I'm using NI SoftMotion to control motors from Yaskawa based on EtherCAT.
I want to figure out what the maximum communication speed between EtherCAT slave and compactRIO is.
In examples, I found that for reading command the iteration time is about 100ms and for writing command it seems a little faster but no more than 25ms.
Is it possible for me to increase the communication speed, especially for writing commands like writing torque setpoint? Because the compactRIO has a 1Mhz clock source, I want to take advantage of it.
Solved! Go to Solution.
EtherCAT set-points (torque set-points in your case) can be written at the scan rate of the cRIO but not any faster. This is because the EtherCAT driver is running at the Scan Engine Rate. NI recommends not running the scan engine faster than 1ms, but it is possible to run it faster depending on your application. If you would like to try faster, feel free to increase the scan engine rate and benchmark your CPU usage to make sure you're leaving about 25% utilization free for the processor to rest and account for any spikes.
Don't forget though, that the drive will be interpolating between torque set-points much faster than the RIO will be providing them. This means that the control loop rate isn't being limited by the rate that EtherCAT set-points are being provided. The smart drive is controlling the torque output while the RIO is just continually feeding the drive set-points.
Hope that helps!
This really helps.
And what about the read commands? Is it possible to increase the reading speed?
All EtherCAT traffic is sent and then read at the Scan Rate. This means reading Torque feedback as well as limit switches positions etc. will also be updated once per scan cycle.
Increasing the reading speed would be accomplished as previously mentioned by changing the scan engine rate.
Hope that clears things up for you!
I have set the scan rate to 1 ms as shown in the attached figure.
The loop time for read speed is 1 ms also.
From the attached figure, we could see that the speed profile is updating but the updating speed is less than 1 ms.
Does it mean than the speed reading is much lower than torque reading?
What about speed write and torque write? Is there any speed difference between the readings?
First of all for logging EtherCAT traffic I recommend a Timed Loop Synchronized to the Scan Engine, and in the name of good RT code, go ahead and pre-allocate any logging / UI you are doing to avoid breaking the determinism of the logging.
Second, if I understand your post correctly, you are saying that the actual position isn't matching the set-point. This makes sense because, for one thing there is nothing to enforce the reading of your set-points to match the actual position, so they won't necessarily be synchronized. Also, the motor could be taking time to physically match the new set-point.
Third, there is no difference in how quickly EtherCAT writes (or reads) position set-points compared to torque set-points. However, I am curious if there some problem that you are dealing with that is bringing up these questions about the read/write speeds.
Thanks for your reply. I have found the problem. Like you said, I need to set the scan engine period of the compactrio to the communication speed I want.