3.2. Process data update and synchronization
The EtherCAT® MainDevice cyclically sends frames containing the outputs of the Process Data Image to the EtherCAT® network and the Simulator synchronizes the Process Data Image with the frames from the MainDevice and sends the response back to the MainDevice. The MainDevice cyclically receives the inputs of the Process Data Image from the Simulator.
The SiL Application directly accesses the Process Data Image at MainDevice and Simulator:
3.2.1. Forced Data, Firmware Data, DPRAM
The EC-Simulator stack synchronizes the outputs and inputs from the Process Data Image and the SubDevice DPRAM areas containing process data objects individually.
3.2.2. EC-Simulator stack as process data memory provider
By default the EC-Simulator stack internally allocates the memory needed to store input and output process data values.
In order to update process data, the application’s JobTask has to call:
- eUsrJob_ProcessAllRxFrames (polling mode only)
Process all received frames from Real-time Ethernet Driver
- eUsrJob_SimulatorTimer
Trigger state machines
Important
In polling mode, the MainDevice cycle time must be at least two times higher than the simulator cycle time. E.g. if the simulator runs with 1 ms, the MainDevice cycle time must be at least 2 ms. If the Real-time Ethernet Driver is running in interrupt mode (non-standard), processing of received frames is done immediately after the frame is received.
See also
EC_T_SIMULATOR_INIT_PARMS::bDisableProcessDataImage at esInitSimulator() (HiL) or EC_T_LINK_PARMS_SIMULATOR::bDisableProcessDataImage (SiL) for how to disable allocation and usage of the process data image.
3.2.2.1. Cyclic frames - Real-time Ethernet Driver in polling mode
Application has to perform:
/* Job 1: incoming process data is stored to Process data image (polling mode only) */
esExecJob(dwSimulatorInstanceId, eUsrJob_ProcessAllRxFrames, &bPrevCycProcessed);
...
...
/* do process data cycle */
...
...
/* Job 2: trigger state machines, which are necessary to perform any status change or internal administration tasks */
esExecJob(dwSimulatorInstanceId, eUsrJob_SimulatorTimer, EC_NULL);
For closer details find an example project “EcSimulatorHilDemo” in the folder “Examples”.