Chapter 4
Implementation details
Additional information about the use and implementation of the DbDrv driver in the REX Control System is gathered in this chapter.
- The Items parameter in the Archive section is a list of numbers, where the odd entries mean from and the even ones to. E.g. Items "2, 5, 10, 15" exports items with IDs 2 to 5 and 10 to 15. There must be even number of entries even if exporting items with only one ID. The entries in the Items parameter must be sorted in ascending order.
- Hovever the majority of database systems is case-insensitive, the control system REX is case-sensitive. Therefore the DbDrv driver is also case-nsensitive in the I/O flags (the flags correspond with column names in the database).
- All values written or read to/from the database are decimal numbers (type double). The database columns can be of other type because SQL queries are textual. The optional parametr Type can be used, where i means the value is processed as long type, b denotes a bool type, s denotes a string type and r denotes a real. For example Type "rrisb" means 1st and 2nd values are real number, 3th value is integer, 4th value is string and 5th value is boolean.
- The flags must be unique in the whole project because they contain no Group identifier. Only the first occurrence is processed in the case of duplicities.
- It is possible to define (optional) parameter Name in the Group section. The flags must be in form <group name>_<item name>" in this case.
- The driver need username and pasword for login into database. Both is stored in *.rio file in plain text as all other parameters. Therefore it is strongly recommended using dedicated login name with very restricted permisions.
- All timestamps (e.g. substitute for ?T in SQL queries) are expanded into string in form <year>-<month>-<day> <hour>:<minute>:<second>.<mikrosecond>. The UTC timezone is used.
- Using SQL data type with at least microsecond resolution is recommended for timestamps.
- Current implementation limits SQL string to 1023 characters (after expansion question marks). The parameter Items (in both Archive section and Group section) is limited to 64 values.
- The column Code in alarm export is integer number where lowest 5bit is alarm class and
higer 3 bits is alarm subtype. The classes are:
0 System alarm
1 Bool alarm
2 Byte value alarm
3 Short value alarm (signed 16 bits integer number)
4 Long value alarm (signed 32 bits integer number)
5 Word value alarm (unsigned 16 bits integer number)
6 DWord value alarm (unsigned 32 bits integer number)
7 Float value alarm
8 Double value alarm
10 Large value alarm (signed 64 bits integer number)
12 String value alarm
13 .. 16 Not used
17 Bool value group event
18 Byte value group event
19 Short value group event
20 Long value group event
21 Word value group event
22 Dword value group event
23 Float value group event
24 Double value group event
26 Large value group event
31 Alarm acknowledge
The subtypes for system alarms are:
0 Date mark (is not exported)
1 Executive event
2 Archive event
The level indicate event in this case. The executive events are:
0 System reset
1 Download begin
2 Download end
3 Download failed
4 Executive stop
5 Executive start
6 Executive swap
7 Time set
and the archive event:
0 Archive cleared (not used now)
1 Archive rekonstruction saved (not used now)
2 Archive rekonstruction normal (not used now)
3 Checksum error (not used now)
4 Integrity error (not used now)
5 Sizes changed (not used now)
6 Limit exceed (disk archives only)
7 Buffer overflow
The subtypes for boolean alarms are:
0 High to Low (e.g. the attached boolean variable have been changed from the high/true/1 value to the low/false/0 value)
1 Low to High (e.g. the attached boolean variable have been changed from the low/false/0 value to the high/true/1 value)
The subtypes for numeric alarms are:
0 low alarm
1 high alarm
2 2nd low alarm
3 2nd high alarm
The level 0 indicate end of alarm conditions. The alarms with level from 128 to 255 not indicate end of alarm conditions by this special alarm event. The alarm acknowledge should has same subtype and level as acknowledged alarm. However not active alarms are regarded as acknowledged by the acknowledge of any subtype. The 1st level alarm is also regarded as acknowledge by the acknowlwdge of the 2nd level.
[Previous] [Back to top] [Up]