Clear Filters
Clear Filters

Best practices for Using Speedgoat as an EtherCAT Main Device with Simulink Real-Time

42 views (last 30 days)
What are some best practices for using a Speedgoat computer as an EtherCAT Main Device (previously "EtherCAT Master") with Simulink Real-Time, especially when trying to achieve fast sampling and cycle task times over 1kHz?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 26 Feb 2024
Edited: MathWorks Support Team on 26 Feb 2024
1. Use Bus Shift Mode: If your model is currently configured for Main Device Shift Mode (previously called "Master Shift Mode"), configure the EtherCAT network to utilize the Bus Shift Mode as the Distributed Clock (DC) algorithm instead. Achieving Main Device Shift Mode can be challenging when the model is set to rapid sampling times (<1ms) in Simulink Real-Time R2020b and later. To apply Bus Shift, adjust the settings in the TwinCAT tool as shown in the image below:
For a deeper understanding of EtherCAT DC algorithms, visit the MathWorks documentation: EtherCAT Distributed Clock Algorithm - MATLAB & Simulink (mathworks.com)
2. Set DC Tuning to 'Small Model': This will reduce the initial amount of ARMW burst frames sent to the network, reducing the initialization load of a model. The 'DC Tuning' setting can be found in the EtherCAT Init block.
3. Disable DC Synchronization: If ultra-precise synchronization is not a requirement for your application, you might want to turn off DC synchronization in the TwinCAT tool. Even with DC synchronization turned off, the system should still be able to perform adequately for applications where the timing requirements are not as strict or where high precision in synchronization between devices is not necessary.
4. Enable Force Polling Mode: For models with fast sampling rates, enable 'Force Polling Mode' to maintain precision. Although this setting increases CPU usage, it ensures timely data acquisition and control, which is critical for real-time applications. To do this, navigate to your model settings and go to 'Code Generation' > 'Simulink Real-Time Options'.
5. Align the Model Sample Time & Cycle Task Time: Ensure the base rate of the model matches the fastest cycle task as specified in the ENI file, and that the EtherCAT Init block is running at that base rate. Other EtherCAT blocks (such as PDOs and SDOs) can run at slower sample rates.
6. Disable the EtherCAT Log for Debugging: Printing and logging in the status monitor while operating at high task rates, will impact highly in the step. Make sure the option is disabled in the EtherCAT Init block.
7. Task Categorization in TwinCAT: In TwinCAT, tasks can be categorized into fast and standard tasks. If there's leeway in the slower signals, splitting the tasks can lessen the burden on the fast cycle task.
8. Use Speedgoat Performance hardware: Speedgoat Performance hardware is equipped with a powerful multi-core CPU, which is best suited for handling high-performance EtherCAT operations. Contact Speedgoat for more information.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!