TB_StateMonitor_IAX

General information

This block can be used to monitor and log the states of a state machine (CASE) in a POU

Darstellung in FBD

General description

This block can be used for the detailed diagnosis of a state machine. Each state is logged in a status trace in the form of its value, its name. The respective time in the state is also recorded in milliseconds. In addition, user logging can be activated on the PCC via the "x_EnableUsrLog" input, with the recorded values ​​also appearing in the command line window of the PCC. You can also see the output under D:\bm\log\PLC.log.
This FB is simply hung on the end of a state machine and instantiated there. It works as soon as it is called.

So that user logging on the PCC is also active, this must be activated in a configuration file.
This configuration file is located under "D: \ bm \ boot" and is called "PCC_PLC_001.INI". There the entry "x_EnableUsrLog" must be set to 1


Resource dependency: IAX_40/BMI_S_PCC03
Recommended Task: CYCLIC/EVENT
Libraries used: BM_ReportUSR_40bd00
TECH_TYPES_40bd10
TECH_FB_STRUCTS_40bd01t1

In-/Outputs

Marking: Datatype: Description:
_StatusTrace STATE_TRACE_DATA_ARRAY (in TECH_TYPES) This array has a size of 128 fields and the following logging entries of the individual states are recorded here:
» i_State: The state in which was logged
» s_State: The name of the state as STIRNG
» ud_TimeInState: The milliseconds spent in this state

Inputs

Marking: Datatype: Description:
ud_TimeInState UDINT This input receives the timeout time value in ms, which a state can stay in until the output x_Timeout is set. If the value is 0, no timeout monitoring is carried out.
i_State INT The state of the state machine is linked here.
s_State STRING The state name can be specified here.
s_POU_Name STRING This input is relevant for user logging. So that you can differentiate in the logging entries when using multiple FB instances, where the logging entry comes from, it can be assigned to a POU.
x_EnableUsrLog BOOL This activates the user logging described above on the PCC. (see general description)

Outputs

Marking: Datatype: Description:
x_Timeout BOOL Is set as soon as the state has exceeded the limit that can be parameterized with the "ud_TimeInState" input in milliseconds
ud_TimeInState UDINT Displays the time currently spent in the state in ms
i_CurrentIndex INT The currently used index of the _StatusTrace array is specified here.