Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
cms:units:sensors:param [19/05/2020 21:33]
alse [Expressions]
cms:units:sensors:param [13/07/2020 12:32] (current)
mary mani
Line 2: Line 2:
 ====== Sensor Parameter ====== ====== Sensor Parameter ======
  
-Parameter is a required [[props|sensor property]]. ​Most of the sensors ​are based on a parameter coming ​in messages+Parameter is a required [[props|sensor property]]. ​The sensors ​in the system work mainly ​on the basis of the data received ​in the parameter
  
-Parameters can be of any names. These names are predefined in the [[https://​gurtam.com/​en/​gps-hardware/​auto|device configuration]],​ for example, ​//param199, param240, TEMP, pwr_int, gsm, can6//, and the like. Read device specification to find out which parameters are available and what they measure. ​In the //[[user/​msg/​msg|Messages]]// panel you can also request messages from the unit and view the available parameters in the corresponding column. ​+Parameters can have any names. These names are predefined in the [[https://​gurtam.com/​en/​gps-hardware/​auto|device configuration]],​ for example, ​**param199****param240****TEMP****pwr_int****gsm****can6**, and so on. Read the device specification to find out which parameters are available and what they measure. ​Besides, you can request messages from the unit on the **[[user/​msg/​msg|Messages]]** tab and view the available parameters in the corresponding column. ​
  
-The parameters from the last message appear in the dropdown list of available parameters when creating ​or editing a sensor. Howevereven if the parameter ​you need is not on the list, you can enter its name manually. ​+When [[props|adding ​or editing]] a sensor, ​you can select its parameter in the drop-down list which shows all the parameters that have ever been received in messages from the unit. If the required ​parameter is not on the list, you can enter its name manually.
  
-The same parameter can be used to create any number of sensors. ​The maximum number of sensors ​allowed can be viewed ​in the //[[user/​set/​account|]]// tab of the User Settings dialog+The same parameter can be used to create any number of sensors. ​You can see the maximum ​allowed ​number of sensors in the **[[user/​set/​account|]]** tab of the user settings.
  
 ===== Virtual Parameters ===== ===== Virtual Parameters =====
Line 22: Line 22:
 ^**time**| Unix time of the message| ^**time**| Unix time of the message|
 ^**regtime**| time of registering a message on the server| ^**regtime**| time of registering a message on the server|
-:!: //​Note.//​\\ +:!: Some rare types of devices may not support any of these parameters, e.g., altitude or speed. ​
-Some rare types of devices may not support any of these parameters, e.g., altitude or speed. ​+
  
 ===== Inputs and Outputs ===== ===== Inputs and Outputs =====
Line 33: Line 32:
 ^**adc**N| analog input parameter, ​ N — input number| ^**adc**N| analog input parameter, ​ N — input number|
  
-For example, ​//adc8// is a parameter that registers the values coming from the eighth analog input. ​+For example, ​**adc8** is a parameter that registers the values coming from the eighth analog input. ​
  
 Usually, the data from digital inputs and outputs are presented in messages in the following format: I/O = 0/0, where I refers to inputs, O — outputs. If I/O = 0/0, it means all bits (inputs and outputs) are inactive. If a value in any of them is not zero, it means that one input/​output or several of them are active. To determine which exactly, convert the hexadecimal number to binary and use the latter to define a bit number. Usually, the data from digital inputs and outputs are presented in messages in the following format: I/O = 0/0, where I refers to inputs, O — outputs. If I/O = 0/0, it means all bits (inputs and outputs) are inactive. If a value in any of them is not zero, it means that one input/​output or several of them are active. To determine which exactly, convert the hexadecimal number to binary and use the latter to define a bit number.
Line 39: Line 38:
 For instance, when the ignition was activated, we received the message with the parameter I/O = 10/0. To get the bit number (input) in which the value of the sensor is shown, it is necessary to enter the received value in the calculator in the mode of hexadecimal values (HEX). That is, enter 10 and switch to the binary mode (BIN). We get a new number - 10000. Now we have to calculate in which position 1 has appeared. The calculation is done from right to left. In the given case 1 is in position 5, i.e. the ignition sensor is connected to the fifth port. Since the changed number is before the fraction (I/O), it is the input. Consequently,​ the parameter name is in5 (digital input 5). For instance, when the ignition was activated, we received the message with the parameter I/O = 10/0. To get the bit number (input) in which the value of the sensor is shown, it is necessary to enter the received value in the calculator in the mode of hexadecimal values (HEX). That is, enter 10 and switch to the binary mode (BIN). We get a new number - 10000. Now we have to calculate in which position 1 has appeared. The calculation is done from right to left. In the given case 1 is in position 5, i.e. the ignition sensor is connected to the fifth port. Since the changed number is before the fraction (I/O), it is the input. Consequently,​ the parameter name is in5 (digital input 5).
  
-For a sensor, it is also possible to specify the parameter name as //in// or //out// to indicate the sum of all inputs and outputs, respectively.+For a sensor, it is also possible to specify the parameter name as **in** or **out** to indicate the sum of all inputs and outputs, respectively.
  
 ===== Constant Parameter ===== ===== Constant Parameter =====
Line 51: Line 50:
 Parameter for a sensor can be set in the form of expression where you can use:  Parameter for a sensor can be set in the form of expression where you can use: 
  
-  * parameters in the current message (//adc1////in1// etc.),  +  * parameters in the current message (**adc1****in1** etc.),  
-  * parameters in the previous message (they begin from the hash sign #, for example, ​//#adc1//), +  * parameters in the previous message (they begin from the hash sign #, for example, ​**#adc1**), 
-  * bitwise parameters (like //param199:3//), +  * bitwise parameters (like **param199:3**), 
-  * sensors (sensor name must be in square brackets, for example, ​//[Fuel level]//),  +  * sensors (sensor name must be in square brackets, for example, ​**[Fuel level]**),  
-  * constant numbers (//const10////const-4.54// etc.), ​+  * constant numbers (**const10****const-4.54** etc.), ​
   * mathematical operation signs: ​   * mathematical operation signs: ​
  
Line 69: Line 68:
 ^  ** : **  | [[cms/​units/​sensors/​param#​parameters_conversion|conversion operation]] |  ^  ** : **  | [[cms/​units/​sensors/​param#​parameters_conversion|conversion operation]] | 
  
-For example, ​//^const2// — square, ​//^const0.5// — extract the square root.+For example, ​**^const2** — square, ​**^const0.5** — extract the square root.
  
 :!: If one of the parameters that an expression includes is not valid, its total value is also invalid. ​ :!: If one of the parameters that an expression includes is not valid, its total value is also invalid. ​
Line 75: Line 74:
 ===== ===== ===== =====
  
-:!: The parameters from the previous message are not available for the //Private mode// sensor and its validator, in notifications,​ in tooltips for charts, and during the retransmission of sensors.+:!: The parameters from the previous message are not available for the **Private mode** sensor and its validator, in notifications,​ in tooltips for charts, and during the retransmission of sensors.
  
 Expressions allow to create a great variety of sensors that meet any needs and tasks. ​ Expressions allow to create a great variety of sensors that meet any needs and tasks. ​
Line 87: Line 86:
 </​code>​ </​code>​
  
-//Explanation:​//\\+**Explanation:​**\\
 The traditional formula to calculate the speed of the movement is '​distance divided by time'. To calculate the distance, we apply the Pythagorean theorem: squared difference of latitudes in neighboring messages plus the squared difference of longitudes in neighboring messages, and then the square root is extracted from this sum. So, we get the distance (in degrees). This value is divided by the difference of time in two neighboring messages. As the result, we have the distance in degrees per second. To convert this to the more habitual kilometers per hour (or miles per hour), we apply a special coefficient. It varies depending on geographical position. In the example above it is equal to 200000 and applicable to Moscow. ​ The traditional formula to calculate the speed of the movement is '​distance divided by time'. To calculate the distance, we apply the Pythagorean theorem: squared difference of latitudes in neighboring messages plus the squared difference of longitudes in neighboring messages, and then the square root is extracted from this sum. So, we get the distance (in degrees). This value is divided by the difference of time in two neighboring messages. As the result, we have the distance in degrees per second. To convert this to the more habitual kilometers per hour (or miles per hour), we apply a special coefficient. It varies depending on geographical position. In the example above it is equal to 200000 and applicable to Moscow. ​
  
Line 104: Line 103:
   - engine hours coefficient sensor in accordance with engine revolutions. ​   - engine hours coefficient sensor in accordance with engine revolutions. ​
  
-First, create a sensor of //Relative engine hours// type. The parameter for the sensor is: +First, create a sensor of **Relative engine hours** type. The parameter for the sensor is: 
  
 <​code>​ <​code>​
Line 119: Line 118:
   * 1 minute work with the intensity of 500 rpm corresponds to 20 seconds of engine work  => coefficient 0.33   * 1 minute work with the intensity of 500 rpm corresponds to 20 seconds of engine work  => coefficient 0.33
  
-Suppose, the //param1// sends engine revolutions. Then the coefficient parameter is the following: ​+Suppose, the **param1** sends engine revolutions. Then the coefficient parameter is the following: ​
  
 <​code>​ <​code>​
Line 139: Line 138:
 ==== Example 3: Value Availability Check ==== ==== Example 3: Value Availability Check ====
  
-There is equipment installed on the vehicle, which sends some parameter (for example, param1). Then the equipment gets out of order. A new one is installed. The new equipment sends the same data in another parameter (for example, param2). To exclude data loss during report generation, it is necessary to use value availability check in the //Parameter// field upon creating a sensor. The old equipment worked all December, the new one — all January, and we need a report for these two months. If the value availability check is used during the parameter indication (//param1|param2// entered as sensor parameter), then the system takes a value from the //param1// parameter, and if the //param1// value is invalid (for example, the equipment is broken), then the system takes a value from the //param2// parameter. In other words, when using the value availability check, the system takes into account the first valid value of the parameter received.+There is equipment installed on the vehicle, which sends some parameter (for example, param1). Then the equipment gets out of order. A new one is installed. The new equipment sends the same data in another parameter (for example, param2). To exclude data loss during report generation, it is necessary to use value availability check in the **Parameter** field upon creating a sensor. The old equipment worked all December, the new one — all January, and we need a report for these two months. If the value availability check is used during the parameter indication (**param1|param2** entered as sensor parameter), then the system takes a value from the **param1** parameter, and if the **param1** value is invalid (for example, the equipment is broken), then the system takes a value from the **param2** parameter. In other words, when using the value availability check, the system takes into account the first valid value of the parameter received.
  
 <​code>​param1|param2</​code>​ <​code>​param1|param2</​code>​
Line 155: Line 154:
   * [[user/​tools/​player|track player]],   * [[user/​tools/​player|track player]],
   * [[user/​tools/​hittest|track hittest]],   * [[user/​tools/​hittest|track hittest]],
-  * the //Formatted value// column of the //[[ user/​reports/​tables/​tracing|Sensor tracing]]// table.+  * the **Formatted value** column of the **[[ user/​reports/​tables/​tracing|Sensor tracing]]** table.
  
 ===== Conversion of Parameters ===== ===== Conversion of Parameters =====
Line 163: Line 162:
 ** Bitwise parameter control ** ** Bitwise parameter control **
  
-The bitwise parameter control gives an opportunity to control a specific bit and not the whole parameter. For example, in order to control the third bit of the parameter ​//param199// it is necessary to put a colon and the number of the required bit after its name. +The bitwise parameter control gives an opportunity to control a specific bit and not the whole parameter. For example, in order to control the third bit of the parameter ​**param199** it is necessary to put a colon and the number of the required bit after its name. 
  
 <​code>​ <​code>​
Line 171: Line 170:
 This feature is applicable when a device sends various data in one parameter: for instance, the first bit shows alarm condition (on/off), the second bit indicates the state of the driver'​s door (open/​closed),​ the third — headlights, etc. Thus, using bitwise control it is possible to create several sensors on the basis of one parameter. ​ This feature is applicable when a device sends various data in one parameter: for instance, the first bit shows alarm condition (on/off), the second bit indicates the state of the driver'​s door (open/​closed),​ the third — headlights, etc. Thus, using bitwise control it is possible to create several sensors on the basis of one parameter. ​
  
-:!: //​Note.//​\\ ​The parameters of the //double// type are converted into //int//, and only then the bit is retrieved.+:!: The parameters of the **double** type are converted into **int**, and only then the bit is retrieved.
  
 :!: We advise you not to address directly a bit above the 53rd. If necessary, you can use the following scheme: :!: We advise you not to address directly a bit above the 53rd. If necessary, you can use the following scheme:
-   - Create a sensor in which the required parameter comes. For example, ​//Sensor1//+   - Create a sensor in which the required parameter comes. For example, ​**Sensor1**
-   - Create another sensor. For example, ​//Sensor2//+   - Create another sensor. For example, ​**Sensor2**
-   - For the parameter of the second sensor, specify the formula ​//[Sensor1]/​const4294967296//. In that way, a shift of 4 bytes to the right occurs.+   - For the parameter of the second sensor, specify the formula ​**[Sensor1]/​const4294967296**. In that way, a shift of 4 bytes to the right occurs.
  
 **Conversion of textual parameters** **Conversion of textual parameters**
  
-If there is a textual parameter in the sensor formula, it is converted into 53-bit integer. By default, it is interpreted as decimal, however, positional notation can be specified after colon. For example, there is a parameter called ​//text_param// and it has the value //100//, then:  ​+If there is a textual parameter in the sensor formula, it is converted into 53-bit integer. By default, it is interpreted as decimal, however, positional notation can be specified after colon. For example, there is a parameter called ​**text_param** and it has the value **100**, then:  ​
  
 <​code>​ <​code>​
Line 191: Line 190:
 **Determination of the day number in a year** **Determination of the day number in a year**
  
-To determine the number of the day in the year (relative to January 1), it is necessary to indicate ​//d// after the colon. For example, for March 28, 2017 11:00:00 the Unix time corresponds to the value //1490698800//. Therefore, ​+To determine the number of the day in the year (relative to January 1), it is necessary to indicate ​**d** after the colon. For example, for March 28, 2017 11:00:00 the Unix time corresponds to the value **1490698800**. Therefore, ​
  
 <​code>​ <​code>​
Was this helpful?
Thank you!