Jump to content
OMRON Forums

Override DesPos in user-written servo routine


wbzhong
 Share

Recommended Posts

Hi, I have computed all the servo reference positions offline. I would like to set them as the reference position for each servo update. Can anyone help me with the following questions:

 

1. There are hundreds of thousands of offline generated positions. How can I store it in the PMAC? and How does the servo routine access these data?

 

2. Is this possible to call the already tunned standard servo algorithm to generate the servo output, but use the offline position as the DesPos input?

 

Many thanks,

Wenbin

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Hi, I have computed all the servo reference positions offline. I would like to set them as the reference position for each servo update. Can anyone help me with the following questions:

 

1. There are hundreds of thousands of offline generated positions. How can I store it in the PMAC? and How does the servo routine access these data?

 

2. Is this possible to call the already tunned standard servo algorithm to generate the servo output, but use the offline position as the DesPos input?

 

Many thanks,

Wenbin

 

The picture illustration of my question is attached. Many thanks.

612731866_Annotation2019-05-31074910.jpg.df7593b74e55a54b9a2bf22fa01c9a30.jpg

Link to comment
Share on other sites

Power PMAC's user shared memory buffer is good for applications like this. You can create a giant array of your desired setpoints in the buffer. I would structure the array using "Ddata" (double-precision floating-point) elements, because this is the same format used by the servo algorithms.

 

You can load the buffer with a series of on-line Script commands like:

 

Sys.Ddata[1]=3.14159

 

To save some time, you can load several consecutive elements with a command like:

 

Sys.Ddata[1]=3.14159, 2.71828, 1.61803, 6.28318

 

which loads Ddata[1] to [4].

 

(I would not use Sys.Ddata[0], as it is too easy to have other tasks write to this register.)

 

Each Ddata element occupies 8 bytes. The default buffer size is 1 Mbyte, so 128K values can be stored without changing the size of the buffer. The buffer can easily be made bigger in the "Project Properties" control of the IDE. Set a bigger number in the "User Buffer" field. You must reload your project before the new size takes effect.

 

To use this data, the most flexible way is with a simple looping motion program. For example:

 

open prog 1

local Index;

abs;

spline (MyMoveTime);

Index = StartIndex;

while (Index <= EndIndex)

{

X(Sys.Ddata[index]);

Index++;

}

close

 

If you set MyMoveTime to Sys.ServoPeriod, it will use one new point each servo cycle. But you can vary the time with this technique and it will interpolate smoothly.

 

You could also use a PLC 0 with Sys.RtIntPeriod=0 so it executes every servo cycle:

 

open plc 0

local Index;

Index = StartIndex;

while (Index <= EndIndex)

{

Motor[1].MasterPos = Sys.Ddata[index];

Index++;

}

disable plc 0

close

 

In this approach, you cannot vary the update time from the servo period.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...