4.8. Error simulation functions

4.8.1. esSetErrorAtSlavePort

EC_T_DWORD esSetErrorAtSlavePort(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress, EC_T_BYTE byPort, EC_T_BOOL bOutgoing)

Trigger physical layer error (“single shot”) destroying frames at slave port.

Remark

See ESC registers RX Error Counter (0x0300:0x0307), Forwarded RX Error Counter (0x0308:0x030B), ECAT Processing Unit Error Counter (0x030C)

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

  • byPort – [in] ESC port. 0, 1, 2, 3: port A, port B, port C, port D

  • bOutgoing – [in] Direction. EC_FALSE: Receive Frame, EC_TRUE: Send Frame

Returns

EC_E_NOERROR or error code

4.8.2. esSetErrorGenerationAtSlavePort

EC_T_DWORD esSetErrorGenerationAtSlavePort(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress, EC_T_BYTE byPort, EC_T_BOOL bOutgoing, EC_T_DWORD dwLikelihoodPpm, EC_T_DWORD dwFixedGoodFramesCnt, EC_T_DWORD dwFixedErroneousFramesCnt)

Generate physical layer errors destroying frames at slave port randomly or at fixed intervals.

Remark

See ESC registers RX Error Counter (0x0300:0x0307), Forwarded RX Error Counter (0x0308:0x030B), ECAT Processing Unit Error Counter (0x030C)

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

  • byPort – [in] ESC port. 0, 1, 2, 3: port A, port B, port C, port D

  • bOutgoing – [in] Direction. EC_FALSE: Receive Frame, EC_TRUE: Send Frame

  • dwLikelihoodPpm – [in] Random simulation: error likelihood (ppm)

  • dwFixedGoodFramesCnt – [in] after error was simulated: fixed amount of frames without errors (at least)

  • dwFixedErroneousFramesCnt – [in] on error simulation: fixed amount of frames with errors (at least)

Returns

EC_E_NOERROR or error code

4.8.3. esResetErrorGenerationAtSlavePorts

EC_T_DWORD esResetErrorGenerationAtSlavePorts(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress)

Reset physical layer error generation destroying frames at slave port.

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

Returns

EC_E_NOERROR or error code

4.8.4. esSetLinkDownAtSlavePort

EC_T_DWORD esSetLinkDownAtSlavePort(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress, EC_T_BYTE byPort, EC_T_BOOL bDown, EC_T_DWORD dwLinkDownTimeMs)

Trigger link lost event.

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

  • byPort – [in] ESC port. 0, 1, 2, 3: port A, port B, port C, port D

  • bDown – [in] Connect or disconnect cable. EC_TRUE: disconnect

  • dwLinkDownTimeMs – [in] Link down duration in ms

Returns

EC_E_NOERROR or error code

4.8.5. esSetLinkDownGenerationAtSlavePort

EC_T_DWORD esSetLinkDownGenerationAtSlavePort(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress, EC_T_BYTE byPort, EC_T_DWORD dwLikelihoodPpm, EC_T_DWORD dwFixedLinkDownTimeMs, EC_T_DWORD dwFixedLinkUpTimeMs)

Generate link lost events randomly or at fixed intervals.

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

  • byPort – [in] ESC port. 0, 1, 2, 3: port A, port B, port C, port D

  • dwLikelihoodPpm – [in] Random simulation: link down likelihood (ppm) within OnTimer

  • dwFixedLinkDownTimeMs – [in] on link down simulation: fixed link down duration in ms (at least)

  • dwFixedLinkUpTimeMs – [in] after link down was simulated: fixed link up duration in ms (at least)

Returns

EC_E_NOERROR or error code

4.8.6. esResetLinkDownGenerationAtSlavePorts

EC_T_DWORD esResetLinkDownGenerationAtSlavePorts(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress)

Reset link lost event generation.

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

Returns

EC_E_NOERROR or error code

4.8.7. esLogFrameEnableAtSlavePort

EC_T_DWORD esLogFrameEnableAtSlavePort(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress, EC_T_BYTE byPort, EC_T_PFLOGFRAME_CB pvLogFrameCallBack, EC_T_VOID *pvContext)

Register EtherCAT network traffic logging function at given slave port.

Note

The simulator introduces frame errors if the callback function modifies the Ethernet frame type at byte offset 12.

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

  • byPort – [in] ESC port. 0, 1, 2, 3: port A, port B, port C, port D

  • pvLogFrameCallBack – [in] Pointer to frame logging callback function

  • pvContext – [in] Pointer to context passed as first parameters to callback function

Returns

EC_E_NOERROR or error code

4.8.8. esLogFrameDisableAtSlavePort

EC_T_DWORD esLogFrameDisableAtSlavePort(EC_T_DWORD dwInstanceId, EC_T_WORD wCfgFixedAddress, EC_T_BYTE byPort)

Unregister EtherCAT network traffic logging function from given slave port.

Parameters
  • dwInstanceId – [in] Simulator Instance ID

  • wCfgFixedAddress – [in] Slave’s station address. 0: all slaves

  • byPort – [in] ESC port. 0, 1, 2, 3: port A, port B, port C, port D

Returns

EC_E_NOERROR or error code