Type | Function block |
Description | The function block can be used in an Exception task to read details such as the task type, task name, program name, etc. from the assigned exception. At the EXCEPTION_INFO_ARRAY in-/output a variable of the data type ESM_EXCEPTION_INFO (predefined array) must be connected. This array is filled with the read information when the function block is called.If an error occurs during execution, the ERROR output is set to TRUE. While ERROR = TRUE, the ERROR_ID output provides information on the cause of the error. |
Notes | Function blocks have to be instantiated. The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used. The instance name must be unique within the POU. |
Parameters | Input/Output
EXCEPTION_INFO_ARRAY
Data type: | ESM_EXCEPTION_INFO (predefined array) |
Description: | This array is filled with the details on the exception when the function block is called. The array is predefined as follows (one array element per CPU core):
TYPE ESM_EXCEPTION_INFO_ARRAY : ARRAY [0..1] OF ESM_EXCEPTION_INFO; ESM_EXCEPTION_INFO : STRUCT TYPE_ID : UDINT; SUB_TYPE : STRING(512); SUB_TYPE_ID : UDINT; TASK_NAME : STRING; PROGRAM_NAME : STRING(512); INFORMATION : STRING(512); END_STRUCT END_TYPE
With:
Element | Description |
TYPE_ID | 0 = None 1 = ARP exception (see details in SUB_TYPE and SUB_TYPE_ID) 2 = STD exception (see details in SUB_TYPE) 3 = Unknown exception 4 = Signal 5 = Task WatchDog |
SUB_TYPE | Subtype of the exception (for example, std::exception, Arp::System::Commons::ArgumentException) |
SUB_TYPE_ID | Provides detailed information for ARP exceptions (if TYPE_ID = 1) 0x4000 = PLC exception 0x4001 = PLC division by zero exception 0x4002 = PLC index out of range exception 0x4003 = PLC stack overflow exception 0x4004 = PLC string error exception |
TASK_NAME | Name of the ESM task where the exception occurred |
PROGRAM_NAME | Source of the exception in the form "component-name/program-name" |
INFORMATION | Additional information that was provided along with the exception |
|
Outputs
ERROR
Data type: | BOOL |
Description: | If an error occurred during execution, the output is set to TRUE. As long as ERROR = TRUE, the error code providing information for the cause of the error is output at ERROR_ID. |
ERROR_ID
Data type: | ESM_GET_EXCEPTION_INFO_ERROR (predefined array) |
Description: | If an error occurred during execution of the function block, the output returns the error code providing information on the cause of the error.The value of the output is only valid while ERROR = TRUE.Possible values:
NoError | The array is filled with the expected values. |
InvalidArgument | The array is not a valid ESM_EXCEPTION_INFO array. |
CommunicationError | Internal error |
CommunicationError_CannotReadExceptionInfo | Internal error |
|
|