We are still working on migrating to the new Bosch Connected Industry Online Portal. Stay tuned! Click here for the latest updates.
03-14-2023 09:27 AM
I would like to discuss how to corretly handle object command if peripheral is not ready because of missing EtherCAT connection.
How to handle the state EtherCAT does not work? I have few ideas, but I would like to know what is the best or standard solution. My ideas are:
Solved! Go to Solution.
03-15-2023 05:29 PM
If your peripheral looses it's EtherCAT connection it goes into an error state (HasError = True). You can check if the peripheral has no error at the top of every command method. If the connection probelm is resolved bevor the command method is called there will be no problem.
Example:
// Check if peripheral has an error
IF( HasError )
THEN
SetDeviceError( ObjectID := PeripheralConstants.OOID,
Number := PeripheralEvents.FLT_PERIPHERAL_ERROR,
AddText := '',
NativeErrCode := 0,
EventStdFlags := 0 );
CommandMethod := HAS_ERROR;
RETURN;
END_IF
04-03-2023 03:56 AM - edited 04-03-2023 03:58 AM
In my opinion, you don't need any code to handler EtherCAT error, this is done by OpconBase, if EtherCAT state is not ok, all object will receive Cancel signal from OpconBase or by SafetyAddon, and your object will execute OnExecCancel, normally the unit object would call Reset method of peipheral object, you only need put some code in Reset method of peipheral object to such as reset _step variables.