Example: Alarm Type bit block
This example illustrates the use of the bit block alarm type.
Example scenario:
A facility has three identical sensors. In the PLC program, each sensor is assigned a data word, where each bit represents an error state. The HMI reads the data word as a VT_UI2 variable. It must be assured that each bit could trigger an alarm. Since the three sensors are identical in construction, the definition process can be simplified by defining a bit block alarm type.
-
This is how you proceed:
-
Create a new bit block alarm type definition:
-
In the project explorer, select the Alarms > Alarm types > Bit block node.
-
To create a new alarm type definition, right-click and select New from the context menu or click once on the table editor and press F8.
-
Indicate a name for the new definition in the Property Pages window, e.g. Sensor.
-
-
Create four new assignments in the alarm type definition:
-
In the project explorer, select the node of the bit block alarm type definition you have just created.
-
To create four new assignments, click on the table editor and press F8 four times.
-
For each assignment, type or select the Name, the triggering Bit number, the Text and the Alarm class on the Property Pages or in the table editor. Indicate the error cause in the Text parameter.
Use the following values, for example:
Name
Bit number
Text
Alarm class
SensorFailure
0
No valid sensor input
Alarm
SensorCalibration
1
Recalibration interval
Alarm
VibrationLevel1
4
Vibration level 1 reached
Message
VibrationLevel2 5 Vibration level 2 reached Alarm
-
-
Create an alarm definition for each of the three sensors:
-
First, create an alarm group since alarms always require an alarm group. Indicate a name for the new alarm group in the Name parameter on the Property pages, e.g. Sensors.
-
Create an alarm definition for each of the three sensors. Indicate a Name and select the Event variable for each alarm definition:
Name
Event variable
Sensor1
Ch1.Sensors.1.Error
Sensor2
Ch1.Sensors.2.Error
Sensor3
Ch1.Sensors.3.Error
-
Indicate the alarm source in the Text parameter of the alarm definition (i.e. the sensor name). You have already indicated the error cause in the Text parameter in the assignments (step 2.c). Bind the assignment text (error cause) to the alarm definition text (error source) using the @J@ format string:
Name
Text
Sensor1
Sensor 1: @J@
Sensor2
Sensor 2: @J@
Sensor3
Sensor 3: @J@
Type the @J@ string into the Text parameter or click on the ... button to open the Edit Localizable Text dialog and to insert the string.
Ensure that the Text mode parameter of the bit block alarm type definition is set to Use text of alarm definition (default setting).
At runtime, the format string will be replaced by the text of the respective assignment. This approach allows to combine error cause and error source in a single alarm text. For example, if at runtime Bit 4 is set by Sensor 1, then the alarm list or alarm line will show the following text: Sensor 1: Vibration level 1 reached.
-
- Bind the bit block alarm type to each of the three alarms:
Select an alarm definition, open the drop-down menu in the Type parameter and select Bit block.
Under Bit block types, select the bit block alarm type you created in step 1.
The alarm type definition now contains 4 assignments that bind alarm information to individual bits. An alarm that uses that alarm type has been defined for each of the three sensors. This results in a total of 12 alarms that may be issued at runtime:
|
Event variable |
Bit number |
Alarm text at runtime |
|---|---|---|
|
Ch1.Sensors.1.Error |
0 |
Sensor 1: No valid sensor input |
|
Ch1.Sensors.1.Error |
1 |
Sensor 1: Recalibration interval |
|
Ch1.Sensors.1.Error |
4 |
Sensor 1: Vibration level 1 reached |
|
Ch1.Sensors.1.Error |
5 |
Sensor 1: Vibration level 2 reached |
|
Ch1.Sensors.2.Error |
0 |
Sensor 2: No valid sensor input |
|
Ch1.Sensors.2.Error |
1 |
Sensor 2: Recalibration interval |
|
Ch1.Sensors.2.Error |
4 |
Sensor 2: Vibration level 1 reached |
|
Ch1.Sensors.2.Error |
5 |
Sensor 2: Vibration level 2 reached |
|
Ch1.Sensors.3.Error |
0 |
Sensor 3: No valid sensor input |
| Ch1.Sensors.3.Error | 1 | Sensor 3: Recalibration interval |
| Ch1.Sensors.3.Error | 4 | Sensor 3: Vibration level 1 reached |
| Ch1.Sensors.3.Error | 5 | Sensor 3: Vibration level 2 reached |