...
The basic unit of data change between a client and the D2000 system is the Unival type - clustering basic object attributes in D2000. The following example of the unival value in the JSON format represents a value of a real number type with the Valid state.
Blok kódu | ||||
---|---|---|---|---|
| ||||
{ "type": "real", "value": 123.456, "status": ["Valid"] } |
Every Unival value has a clearly defined type with the use of the type
attribute. In the case of sending Unival values into the D2000 system, the type attribute has to be always defined. The only exception is the possibility when we send instead of an object log of the Unival type the value directly, in our case 123,456. This value is automatically converted to the "real"
, type by the SmartWeb server since it is a value with a decimal point (in the case of sending a string, the type would be automatically set to the "text"
value and in the case of sending an integer to the "int"
value.
Blok kódu | ||||
---|---|---|---|---|
| ||||
123.456 |
The answer from the SmartWeb server never comes in this shortened log but in the "object" log with a defined type (type
attribute) and a value (value attribute) if it is valid.
...
The type
attribute may gain the following values:
Value of the type attribute | Description of the value type |
---|---|
"nan" | none |
"bool" | VBool type |
"int" | integer |
"real" | real number |
"station" | VStation type |
"alarm" | VAlarm type |
"process" | VProcess type |
"time" | integer (number of milliseconds from epoch) |
"timespan" | real number (number of seconds) |
"text" | text |
"array" | field of objects D2ApiValue |
"qval" | VQval type |
"record" | two-dimensional field (row, column) of values |
The list of all attributes of the Unival object is in the following table:
Attribute | Value type | Mandatory | Default value | Note |
---|---|---|---|---|
type | text | yes | ||
value | according to the type | no | unset attributes automatically mean invalid value, set attributes mean valid value (if the attribute is not overloaded in the status attribute) | |
valueTime | integer (number of milliseconds from epoch) | no | current time | time stamp |
valueTimes | two-dimensional field (row, column) of integers (number of milliseconds from epoch) | no | current time | time stamps of values in a structure, only for the "record" type |
alarmTime | integer (number of milliseconds from epoch) | no | time stamp of an alarm | |
alarmTimes | two-dimensional field (row, column) of integers (number of milliseconds from epoch) | no | time stamps of alarms in a structure, only for the "record" type | |
flags | field of texts (listed Flag type) | no | no flags | field of user flags, possible values are from "A" to "P" |
flagsSets | two-dimensional field (row, column) of text fields (listed Flag type) | no | no flags | two-dimensional field of fields of user flags of structure values, only for the "record" type |
limitStatus | text (listed LimitStatus type) | no | "InLimit" | limited state, possible values are: "InLimit", "VeryLow", "Low", "High", "VeryHigh", "LimitsProblem" |
limitStatuses | two-dimensional field (row, column) of text fields (listed LimitStatus type) | no | "InLimit" | two-dimensional field of limited statuses of structure values, only for the "record" type |
processAlarmStatus | text (listed ProcessAlarmStatus type) | no | "NoAlarm" | status of a process alarm, possible values are: "NoAlarm", "ToOn", "ToOff", "On", "Off", "Err", "Oscillate", "ErrCmdOn", "ErrCmdOff", "SwToTrans", "SwToOff", "SwToOn", "SwToErr", "SwTrans", "SwOff", "SwOn", "SwErr", "ErrZalCmdOff", "HL", "VHL", "LL", "VLL", "ToHL", "ToVHL", "ToLL", "ToVLL", "ErrWriteCmd", "Change", "A29", "A30", "A31", "SysPrAl" |
processAlarmStatuses | two-dimensional field (row, column) of text fields (listed ProcessAlarmStatus type) | no | "NoAlarm" | two-dimensional field of statuses of process alarms ina structure, only for the "record" type |
status | text fields (listed Status type) | no | "Valid" | status fields, possible values are: "Valid", "ProcAlarm", "NoAckPAlarm", "PrAlSilent", "Weak", "NoAckValue", "Transient", "Default", "Manual", "AlCrit", "Unknown" |
statusSets | two-dimensional field (row, column) of text fields (listed Status type) | no | "Valid" | two-dimensional field of statuses of structure values, only for the "record" type |
formattedValue | text | no | in the attribute, the formatted value of D2000 object returns in the answer from the server, unnecessary when calling RPC methods | |
structType | text | yes | structure name, only for the "record" type, mandatory on every "record" type sent to D2000 | |
definition | D2RecordDefinition object | - | structure definition, only for the "record" type, set on every value with the "record" type returned from D2000 | |
returnAs | text | no | have sense only when calling RPC methods with output parameters, defines logical name which will have the returned output value | |
returnFields | text fields | no | empty field | a special attribute defines additional returning attributes required by a client from the server |
returnTransformation | ReturnTransformation object | no | null | only for the "record" type with one numerical column and growing time stamps of values, it contains the configuration of processing (downscaling) of a numerical column performed on a server before sending answers to a client, because of the big data range, values are described below |
Kotva | ||||
---|---|---|---|---|
|
To simplify working through the API interface, it is possible to use simple types instead of Unival type objects as input values to the D2000 system. Such values have the validity attribute, the time of origin to the current time automatically set and other attributes gain their default value.
JSON format type | Corresponding Unival type | Note |
---|---|---|
boolean | "bool" | |
number | "bool" | If the target type is in the D2000 BOOL. Numbers are interpreted according to the order in the VBool type. |
number | "int" | If the target type is in the D2000 INT. If the given number was a real number, it will be rounded to an integer number. |
number | "real" | If the target type is in the D2000 REAL. |
number | "time" | If the target type is in the D2000 TIME. Warning: The number is interpreted as a number of seconds from 1972-01-01 00:00:00 UTC, not as a number of milliseconds from the epoch. |
string | "text" |
Kotva | ||||
---|---|---|---|---|
|
...
Because of the minimization of transmitted data, the Unival objects standardly contain on the output from D2000 only type
and value
attribute (if the value is valid). In the case of need of other extended value attributes, which are provided by the D2000 system, it is possible to set the returnFields
attribute when calling and name required attributes in it. The value of the returnFields
attribute has a format of a text field. Allowed values are in the following table.
Value in the returnFields field | Filled in attributes in response form server |
---|---|
"AlarmTime" | alarmTime, alarmTimes |
"Flags" | flags, flagsSets |
"LimitStatus" | limitStatus, limitStatuses |
"ProcessAlarmStatus" | processAlarmStatus, processAlarmStatuses |
"Status" | status, statusSets |
"ValueTime" | valueTime, valueTimes |
"FormattedValue" | formattedValue |
Unival type Structure ("record")
The value of the structure type has its values and attributes stored as a two-dimensional field (row, column). Values gain the type according to the definition of structure in the D2000 system. It does not use extended attributes
alarmTime, flags, limitStatus, processAlarmStatus, status a valueTime
. Instead of them, it uses attributes alarmTimes, flagsSets, limitStatuses, processAlarmStatuses, statusSets, valueTimes
, which are a two-dimensional field and components have the same type as the original attributes. Other attributes used only in structures are definition
and structType
. The definition
attribute (D2RecordDefinition object) is always automatically set on all structural values that come from the D2000 system. This attribute describes columns' names and their types in a structured variable. Columns' types in a structure are a simplified version of Unival types.
Column type | Value type |
---|---|
"bool" | VBool type |
"integer" | integer |
"real" | real number |
"time" | integer (number of milliseconds from epoch) |
"timespan" | real number (number of seconds) |
"text" | text |
"object" | according to the type of referenced D2000 object |
The structType
attribute is a text attribute and defines the name of the D2000 object of the structure definition type. It is mandatory to set it for every structured value that is inputted into the D2000 system.
...