To configure the sample time for an EtherCAT® model, set the fixed-step size for the entire model in the model Configuration Parameters Solver pane. You can also specify the sample times for key blocks.
During execution, the fixed-step size determines the cycle tick of the EtherCAT tasks and the sample times of the other source blocks in the model. Subject to the fixed step size value, the block type determines the sample time groups: a comparatively long sample time for the synchronous SDO blocks and another, shorter sample time for the rest of the blocks. As a best practice, set the sample time for the synchronous SDO blocks to a value at least three times that for the PDO blocks.
Using an EtherCAT network configurator, specify the EtherCAT task cycle tick based on the requirements of the EtherCAT network. Specify the fixed-step size so that the GCD of the task cycle tick and the block sample times is an integer multiple of the fixed-step size.
For example, assume that the fastest EtherCAT task rate is 50 Hz, for a corresponding cycle tick of 20 ms. The model block sample times, scaled to ms, are [20, 30, 40 50]. Then the FSS is:
FSS = min(gcd(20, [20, 30, 40, 50]))
FSS = 10
The software sends all PDO data updates at the fastest EtherCAT task cycle tick (20 ms), even if you created multiple EtherCAT tasks running at different cycle ticks. The PDO read and write blocks run at the cycle tick for the tasks containing the given EtherCAT variable.
If you know that the other source blocks have defined sample times, you can set
Fixed-step size to
auto. If one or more
block sample times are incompatible with the fixed sample time, there is an error during
system update. If you do not encounter an error, from the Simulink® Editor, on the Debug tab, from Information
Overlays, click Sample Time Colors to reveal the
block sample times.