jackvoxel8.com Posted February 20, 2018 Share Posted February 20, 2018 I would like to store total distance traveled for the axes in my machine. These numbers should be resettable through deliberate action but otherwise persist across power cycles and resets. Does anyone have any ideas for doing this accurately but without putting undue strain on the system resources? Link to comment Share on other sites More sharing options...
DaveBarnett Posted February 21, 2018 Share Posted February 21, 2018 Why not just write a plc which integrates the actual velocity ? (the absolute value, I suppose...) Link to comment Share on other sites More sharing options...
Clopedandle Posted February 23, 2018 Share Posted February 23, 2018 Yes, like Dave said, use a background PLC to integrate the absolute velocity value, write it to a global variable, and use the Fsave feature to write the value to memory periodically so that it persists across power cycles. See page 1090 for the fsave entry in the PPMAC SRM. Link to comment Share on other sites More sharing options...
jackvoxel8.com Posted February 23, 2018 Author Share Posted February 23, 2018 How often could I poll the velocity without affecting performance? Link to comment Share on other sites More sharing options...
Clopedandle Posted February 23, 2018 Share Posted February 23, 2018 If you poll the velocity in a background script PLC, PMAC will guarantee that the polling will not affect servo/phase/RTI performance. It literally only polls "in the background" (i.e. when the CPU has completed all performance-critical tasks and has time to do other things). This will not be quite as accurate as polling at a set frequency, but for the purposes of tracking lifetime distance traveled (we're talking big numbers probably), it should be OK. Make sense? Link to comment Share on other sites More sharing options...
jackvoxel8.com Posted February 23, 2018 Author Share Posted February 23, 2018 Ok so here is some pseudocode to accomplish what I think you all are telling me: oldTime = currentTime currentTime = GetTime() timeDelta = currentTime - oldTime velocity = GetAxisVelocity() distance = velocity * timeDelta totalDistance += distance I would then run that loop in a PLC as fast as possible and it should have no effect on performance? Let me know if I am missing something. Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted February 24, 2018 Share Posted February 24, 2018 If you are going to use a PLC, you might want to look at Motor[x].FltrVel or Motor[x].FltrVel2 to get something that's averaged over a longer time. Note that scaling is needed, I think a factor of 16 or 16*Sys.ServoPeriod. Link to comment Share on other sites More sharing options...
Recommended Posts