Exception Handling - General Information
Exception Handling - General Information
You can report/trigger exceptions by setting the generated boolean (exception) variable that belongs to an exception definition to TRUE.
You can do this in the logic code of a module or in an operating mode or in a state if an error is detected there.
If there is a reaction on a module, you can react, for instance in the logic code.
Alternatively, you can inquire the reactions (variables) also in an operating mode and define conditions that, for example, cause the operating mode Auto to switch to the state Aborting in case of the reaction ASYNC_STOP.
For every exception created in the editor Definition of exceptions, the following is generated:
oFor every exception, a boolean variable is generated as FB member.
You can use this variable in the logic code to signal an error.
oFor every exception, some code is generated that transfers the exception as individual values of a method to the FB_ExceptionList.
If an error is issued during program runtime (in the logic code the respective boolean error variable is set to TRUE), the respective code position is executed in the method __exception handling and the exception entered in the Global exception list. There is no corresponding data structure that contains the error.
For each List of the reactions of a module, and for each List of the global reactions respectively one enumeration (ENUM) is generated. In every case, there is a uniqueness by using the enumeration name.
Examples:
oTYPE ET_Reaction_Axis1...END_TYPE - (for reactions of the module Axis1)
oTYPE ET_Reaction_MainMachine...END_TYPE - (for reactions of the module MainMachine)
oTYPE ET_Reaction...END_TYPE - (for global reactions)
For each reaction, a module-unique value of the enumeration is specified. The standard reactions of the module and the global reaction list have the same value.
For the display, in IEC a function is generated that returns the name of an enumeration as STRING.