wbzhong Posted May 30, 2019 Share Posted May 30, 2019 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 More sharing options...
wbzhong Posted May 31, 2019 Author Share Posted May 31, 2019 The picture illustration of my question is attached. Link to comment Share on other sites More sharing options...
wbzhong Posted May 31, 2019 Author Share Posted May 31, 2019 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. Link to comment Share on other sites More sharing options...
curtwilson Posted June 3, 2019 Share Posted June 3, 2019 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 More sharing options...
wbzhong Posted June 4, 2019 Author Share Posted June 4, 2019 Many thanks for your reply. It is a big relief to avoid developing my own servo routines. I will try these techniques in my application, and let everyone know how it works. Link to comment Share on other sites More sharing options...
Recommended Posts