# 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. ![Diagram showing the EtherCAT MainDevice cyclically sending frame outputs and the EC-Simulator receiving, simulating, and returning process data inputs](../Media/Process_data_update_and_synchronization_Overview.png) The HiL Application directly accesses the Process Data Image at Simulator: ![Diagram showing the EC-Simulator HiL application directly accessing the Process Data Image](../Media/Process_data_update_and_synchronization_Overview_HiL.png) ## 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. ![Diagram showing the EC-Simulator stack synchronizing outputs, inputs, DPRAM areas, and process data objects individually for forced data and firmware data simulation](../Media/Process_data_update_and_synchronization_Forced_Data.png) ## 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. ![Diagram showing the EC-Simulator stack as the default process data memory provider, internally allocating separate input and output memory areas for the application](../Media/data-memory-provider.png) 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`](api_general.html.md#_CPPv4N25EC_T_SIMULATOR_INIT_PARMS24bDisableProcessDataImageE) at [`esInitSimulator()`](api_general.html.md#_CPPv415esInitSimulator10EC_T_DWORDPK25EC_T_SIMULATOR_INIT_PARMS) (HiL) or [`EC_T_LINK_PARMS_SIMULATOR::bDisableProcessDataImage`](architecture_os-configuration.html.md#_CPPv4N25EC_T_LINK_PARMS_SIMULATOR24bDisableProcessDataImageE) (SiL) for how to disable allocation and usage of the process data image. ### Cyclic frames - Real-time Ethernet Driver in polling mode ![Diagram showing the cyclic frame processing sequence in polling mode with ProcessAllRxFrames and SimulatorTimer jobs in the application job task](../Media/cyclic-frames.png) Application has to perform: ```cpp /* 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”. \\newpage