Text file that contains user alarms generated by application using the ALARM_SET instruction.
In contrast to the system alarms file, the contents of this file are the responsibility of the user.
From RTE 34.20.3 such a file is also used to configure messages that are not placed in the alarm stack but only in the history. Use the ah_log and ah_log_us functions.
In case the user alarm contains parameters, these can be of two types:
•non-positional: the first parameter in the string is equivalent to parameter 1, the second to parameter 2, and the third to parameter 3
•positional: there is a possibility to define in the text of the alarm the parameter number regardless of the position. It is defined by placing after the % character the parameter number (1, 2, 3) followed by the $ character (from RTE 34.24.6, see example 2)
NOTE: Positional and non-positional parameters cannot be defined in the same alarm.
NOTE: For RTE handling of user and system alarm files, see chapter Alarms: user files in RTE configuration.
File structure
It is an ASCII format file in which texts are defined using the following syntax:
Syntax |
nnnn iAM iB flags "text" p1k p2k p3k |
---|---|
nnnn |
User alarm number: •major: 1000-:-1999 •minor: 3000-:-3999 •warnings: 4000-:-8999 •messages: 10000-:-11999 |
iAM |
Index of AM variable to be used: •-1 -> Axis alarm, the axis number will be used as the index of AM (1÷32). If you do not want the alarm to also be stored in the AMs put index -1 in the next parameter (iB) •0 -> Used necessarily in the case of messages •37-:-40 -> User major alarms (1000÷1999) •45-:-48 -> User minor alarms (3000÷3999) •53-:-63 -> User warnings (4000÷8999) |
iB |
Selection of the bit associated with the alarm: •-1 -> Disable storage of alarm within AM. Also used necessarily in the case of messages •0-:-9 -> if iAM = -1 (i.e. axis alarm) bits reserved for system for major alarms (stored as such in ax_in_alarm parameter). If iAM <> -1 Bits available to user •10-:-15 -> if iAM = -1 (i.e. axis alarm) Bits reserved for user for major alarms (stored as such in ax_in_alarm parameter). If iAM < > -1 Bits available to user •16-:-23 -> if iAM = -1 (i.e. axis alarm) Bits reserved for minor axis alarms. If iAM <> -1 Bits available to user •24-:-31 -> if iAM = -1 (i.e. axis alarm) Bits reserved for warnings. If iAM <> -1 Bits at user disposal |
flags |
Descriptive mask of alarm or message type (for exclusive use of alarm history). Refer to documentation of predefined variable ah_filter for meaning of individual bits |
text |
Text of the alarm or message. The maximum size is 63 bytes; if you exceed the size the alarm will be stored incomplete and you will have a message in the report. Up to three variables can be specified for display (see Instruction R3 alarm_set and alarm_set_us). The codes to identify the variables are as follows: •%d Integer variable signed - Decimal representation •%u Integer variable unsigned - Decimal representation •%x Integer variable - Hexadecimal representation •%f Real variable •%g Real variable •%s String variable. Maximum size is 63 bytes and can be of type: ouser string (TABSTR); in this case the construct must be added to the file: TABSTR_USER n ; maximum number of elements in the table "string 1" ; this is index 0 "string 2" ; this is index 1 "string n" ; this is index n-1 ENDTAB ouser string (USV) NOTE: To enable the use of user strings as parameters of an alarm you must enable the option from project configurator "settings->general->alarms->settings" and the keyword enable_user_string_management_in_ah must be present in rte.cfg. |
p1k,p2k,p3k |
Parameter type 1/2/3 (optional): • 0 -> No parameters •-1 -> I8 • 1 -> U8 •-2 -> I16 • 2 -> U16 •-4 -> I32 • 4 -> U32 • 8 -> Real •10 -> TID (internal use) (%s) •11 -> PowerSet Name (%s) •12 -> PowerSet Axes (%d) •13 -> Axes group name (%s) •15 -> TABSTR String (%s) •16 -> Axis Name (%s) •17 -> String User Variable USV (%s) |
NOTE: Refer to the str_format instruction specification for more information regarding formalism.
Since RTE 34.27.8, the possibility to associate a name with an axis and use it in the description of alarms has been added.
To use the axis name in alarms, the following steps should be taken:
•In the string text use '%s' as the parameter type.
•The parameter code to be set is 16
•When generating the alarm, pass as a parameter the axis number whose name is desired
To associate the name with the axis number you can use the ascii directive AXIS_NAME in the file(GET AXIS_NAME to read it) (see example 3 below):
AXIS_NAME 1 "nameAxis" ; associated name to axis 1
AXIS_NAME 2 "nameAxis" ; associated name to axis 2
Note: Using Siemens drives the name is already associated using the module name.
Example 1
; File alarms_user.txt on /FA/. 1000 37 0 0x02000100 "the value of R 10 is:[%d]" -4 1001 37 1 0x02000100 "the value of R 11 is:[%d]" -4 1002 37 2 0x02000100 "the value of R 12 is:[%d]" -4 10001 0 -1 0x010000 "This is a message!" ;0x02000000 if alarm re-generation is desired in case of par value changes ;0x00000100 because user alarm ;0x010000 because it is a message
; From program R3: alarm_set(1000,0,R(10)) ; R(10) is worth 123 ; From RDE3 shell: command: D AL ;display alarm stack answer: 1000 the value of R 10 is:[123] ; From program R3: ah_log(10001) ; From RDE3 shell: command: alh; display alarm history response: 19/07/17 09:43:30 <10001> '10001 This is a message! |
Example 2
; Example with positional parameters ; With RTE 34.24.6 I define in the alarm_user_us.txt file the alarm: 4001 53 0 0x02000100 "Alarm 4001: par1 %1$d, par2 %2$d, par3 %3$d" -4 -4 -4 ; I then define in the alarm_user_en.txt file the alarm: 4001 53 0 0x02000100 "Alarm 4001: par3 %3$d, par1 %1$d, par2 %2$d" -4 -4 -4
; From program R3: alarm_set(4001,0,10,20,30) ; If I use alarm_user_us for alarms I display: "Alarm 4001: par1 10, par2 20, par3 30" ; If I use alarm_user_en for alarms I display: "Alarm 4001: par3 30, par1 10, par2 20"
; Some incorrect definitions 4004 53 3 0x240000 "Alarm 4004: %1$d, %3$d" -4 0 -4 4005 53 4 0x260000 "Alarm 4005: %1$d, %3$d" -4 -4 4007 53 6 0x260000 "Alarm 4007: %3$d" 0 0 -4 4008 53 7 0x260000 "Alarm 4008: %2$d" -4 |
Example 3
; With RTE 34.27.8 I define in the alarm_user_us.txt file the alarm: 3030 -1 29 0x22001000 "Problem on Ax:%s" 16 7030 62 29 0x22001000 "Problem on Ax:%s" 16 ; Name link: AXIS_NAME 1 "MainRot" AXIS_NAME 2 "Shoulder" AXIS_NAME 3 "Elbow" AXIS_NAME 4 "Yaw" AXIS_NAME 5 "Pitch" AXIS_NAME 6 "Roll" ; Alarm generation: alarm_set (3030, 2, 2) alarm_set (7030, 0, 3) ; The alarm in the stack will be: 3030#2 Problem on Ax:Shoulder 7030 Problem on Ax:Elbow |