Jump to content
OMRON Forums

accessing Gather data within program


jtaseff

Recommended Posts

Hi all,

I'm tackling the implementation of a new metrology method - it involves measuring an analog voltage over the course of a motor move. So far, I've gotten it to work well by using the gather function to log the voltage and motor position, then using gather in the linux terminal and analyzing data offline.

 

However, now I need to implement this live on the controller. I'm having a difficult time just accessing the data stored in Gather.Ddata[...] in a nice way since it isn't in the same space as P variables. Normal syntax for using P variable arrays doesn't work on the gather data the way I imagine it would.

 

Can anyone help out with a correct method to somehow copy or manipulate the data in Gather.Ddata into a P variable array/matrix? The only thing I've gotten to work is looping through and copying each individual value, which takes decades for just a few thousand values. I've tried using ptrs or using the array/matrix functions but nothing seems to work.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

If you use a background Capp or RTI/Servo/Phase interrupt, you can use the memcpy() function to copy directly from the gather buffer into Pvars. Something like:

 

memcpy((char *)&pshm->P[0], (char *)&pshm->Gather.Buffer[0], <# of bytes to copy>);

 

I don't think you can use memcpy within script PLCs. Also note that memcpy takes the # of bytes to copy as the last argument, and each double is 8 bytes (so # of bytes = # of doubles to copy * 8).

 

I'm not sure why you weren't able to use the Pvars like a normal array. If you share your code we can better see what the problem is.

Link to comment
Share on other sites

Since you are putting your analysis program into Power PMAC for "live" analysis anyway, why not just manually grab the data points you need in the same program (e.g. through a user servo or RTICPLC)? This would completely eliminate the need for copying data arrays.

 

Note that here, you would not be using the gather function at all.

Link to comment
Share on other sites

Thanks for the replies, guys.

I ended up finding 2 ways around my problems. The first is just gathering the data myself - I was just already using the gather function so it didn't occur to me to change.

The other problem was my data copying speed if I was using a while loop to loop through the gather data index, which came up again with my calculation algorithm afterward. I was running up against the GoBack setting, which keeps programs from executing a while loop more than necessary per cycle. Happens for coordinate system sub/programs, motion programs, and PLCs, all of which have their own setting. Bumping up the PLC[x].Ldata.GoBack from 0 to 10 dropped my execution time by 200x, though it didn't help nearly as much when I tried changing Coord[x].GoBack or Coord[x].Ldata.GoBack and running it as a subprog. Just thought I might post this if anyone else sees the same problem with large loops that need to get executed immediately.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...