Skip to content

DigGenDataStrMsg

Dig Gen Data Str Msg

AM Type: 92

Source Code


Field Bits Type Unit Condition Mutator Validator Description
ls_header Struct Always
├── uplink_version 4 UInt Always
├── node_id_high 4 Fragment Always
├── product_code 8 UInt Always
├── node_id 16 UInt Always
├── sequence_number 8 UInt Always
└── am_type 8 UInt Always
readTimestamp 32 TimestampField Always TimestampMutator
msgVersion 3 UInt Always
portNumber 3 UInt Always
totalFragments 5 UInt Always OffsetMutator(-1)
numFragment 5 UInt Always
numRedundancyFragments 2 UInt Always
integrationIdLength 2 Enum Always SHORT_ID (0), LONG_ID (1), RFU (2), SHORT_CUSTOM_ID (3)
error 3 Enum Always NO_ERROR (0), NOT_STARTED (1), FILLING (2), TIMEOUT (3), PAYLOAD_TOO_LARGE (4)
rfu 1 UInt Always
integrationId Switch totalFragments == 1
├── SHORT_ID 8 UInt integrationIdLength == SHORT_ID
└── LONG_ID 16 UInt integrationIdLength == LONG_ID
integrationIdMsgVersion 3 UInt totalFragments == 1
readings Switch totalFragments == 1
├── x 5 UInt integrationId == (65534, 0)
├── x 5 UInt integrationId == (65534, 1)
├── addedField 8 UInt integrationId == (65534, 1)
├── rfu 5 UInt integrationId == (65534, 2)
├── error 8 UInt integrationId == (65534, 2)
├── numSensors 8 UInt integrationId == (65534, 2)
├── Sensors [numSensors] Seq integrationId == (65534, 2)
│   ├── x 32 Int
│   ├── y 32 Int
│   ├── z 32 Int
│   └── tmp 32 Int
├── numSensors 6 UInt count integrationId == (0, 0) RangeValidator[0, 62] Number of sensors read from the SDI-12 port. Limit 62 by protocol.
├── numChannels 6 UInt count integrationId == (0, 0) RangeValidator[0, 31] Number of channels read from each sensor. It is assumed that all sensors have the same number of channels. If numSensors is 0, numChannels is also 0. In current implementation the limit should be 9. If we add a list of reading commands, it can be 9 per command. Limit 31 to be aligned with the 5bits of errorParameter.
├── portError 1 Bool boolean integrationId == (0, 0) Whether there was an error reading the SDI-12 port. If true, no sensor or channel data is included in the message.
└── portData Switch integrationId == (0, 0)
    ├── errorCode 3 Enum portError == 1 Type of error encountered on the SDI-12 port GENERIC (0), HW_FAILURE (1), NUM_CH_MISMATCH (2)
    ├── errorParameter 5 UInt count portError == 1 Number of channels read if errorCode is NUM_CH_MISMATCH, otherwise 0. It is useful to the user to understand how many channels is really reading.
    └── Sensor Data [numSensors] Seq portError == 0 Data for each sensor read from the SDI-12 port
        ├── sensorError 1 Bool boolean Whether there was an error reading the sensor. If true, no channel data is included for this sensor.
        ├── errorCode 3 Enum sensorError == 1 Type of error encountered on the sensor GENERIC (0), NO_RESPONSE (1), PROTOCOL_ERR (2)
        └── Channel Data [numChannels] Seq sensorError == 0 Data for each channel read from the sensor
            ├── channelError 1 Bool boolean Whether there was an error reading the channel. If true, no channel data is included for this channel.
            ├── errorCode 3 Enum channelError == 1 Type of error encountered on the channel GENERIC (0), NAN (1), NEG_INF (2), POS_INF (3)
            ├── decimalPlace 3 UInt count channelError == 0 Number of decimal places for the channel value
            └── scaledInteger 25 Int channelError == 0 DynamicScalingMutator(decimalPlace) Scaled integer value for the channel. The actual value is obtained by applying the scaling factor based on the decimalPlace field.
Payload [totalFragments] Seq totalFragments > 1
    ├── True None Bytes numFragment == 1
    └──  0 numFragment == default

Example

DummyIntegrationIdv0

Source: DigGenDataStrMessages.py

JSON Message

{
  "ls_header": {
    "uplink_version": {
      "value": "4",
      "raw": 4
    },
    "product_code": {
      "value": "89",
      "raw": 89
    },
    "node_id": {
      "value": "5",
      "raw": 5
    },
    "sequence_number": {
      "value": "5",
      "raw": 5
    },
    "am_type": {
      "value": "92",
      "raw": 92
    }
  },
  "readTimestamp": {
    "value": "1970-01-01T00:00:00Z",
    "raw": 0
  },
  "msgVersion": {
    "value": "0",
    "raw": 0
  },
  "portNumber": {
    "value": "0",
    "raw": 0
  },
  "totalFragments": {
    "value": "1",
    "raw": 0
  },
  "numFragment": {
    "value": "0",
    "raw": 0
  },
  "numRedundancyFragments": {
    "value": "0",
    "raw": 0
  },
  "integrationIdLength": {
    "value": "LONG_ID",
    "raw": 1
  },
  "error": {
    "value": "NO_ERROR",
    "raw": 0
  },
  "rfu": {
    "value": "0",
    "raw": 0
  },
  "integrationId": {
    "value": "65534",
    "raw": 65534
  },
  "integrationIdMsgVersion": {
    "value": "0",
    "raw": 0
  },
  "readings": {
    "x": {
      "value": "1",
      "raw": 1
    }
  }
}

Encoded Bytes

Source:

BitArray(
            "hex = 40 59 00 05 05 5c 00 00 00 00,"  # Header + readTimestamp
            # Start DigGen header
            "uint:3 = 0,"  # MsgVersion
            "uint:3 = 0,"  # portNumber
            "uint:5 = 0,"  # totalFragments (+1)
            "uint:5 = 0,"  # numFragment
            "uint:2 = 0,"  # numRedundancyFragments
            "uint:2 = 1,"  # integrationIdLength
            "uint:3 = 0,"  # error
            "uint:1 = 0,"  # rfu
            # End DigGen header
            "hex = FFFE,"  # Payload 1st part (Integration Id = 65534, no padding)
            "uint:3 = 0,"  # IntegrationMsgVersion
            "uint:5 = 1"  # x
        ).hex

Result:

40 59 00 05 05 5c 00 00 00 00 00 00 10 ff fe 01