Examples

Sample Configuration

Data

´D´

´T´

Counter [uint32]

AI1 [sint16]

  • UDP packets with 8 bytes payload are sent to port 1021

  • 2-byte header: ‘DT’

  • 4-byte unsigned counter value

  • 2-byte signed integer analog channel; measurement range is ±10V

<?xml version="1.0"?>
<Receiver xmlns="http://xml.dewetron.com/receiver">
  <DataStream>

    <!-- Receive all packets on UDP port 1021 -->
    <UDPSource port="1021" />

    <!-- All packets are 8-bytes long and the first two bytes are fixed -->
    <PacketDefinition length="8">
      <FixedPacketByte offset="0" value="0x44" />
      <FixedPacketByte offset="1" value="0x54" />
    </PacketDefinition>

    <Channels>

      <!-- First channel is a 32-bit counter -->
      <Channel name="Counter" type="double">
        <Sample>
          <NumericValue byte_offset="2" bit_length="32" type="unsigned" />
        </Sample>
      </Channel>

      <!-- Second channel is the 16-bit raw value of an analog input -->
      <Channel name="AI1" unit="V" type="double">
        <DisplayRange min="-10" max="+10" resolution="3" />
        <Sample>
          <NumericValue byte_offset="6" bit_length="16" type="signed" />
          <LinearScaling scale="0.00030517578125" offset="0" />
        </Sample>
      </Channel>

    </Channels>

  </DataStream>
</Receiver>

Conditonal Decoding

Data

´P´

[1,2,3]

Coordinate[float]

  • UDP packets with 6 bytes payload are sent to port 1021

  • 1 byte header: ‘P’

  • 1 byte describes which coordinate is sent in this packet (1=>X; 2=>Y; 3=>Z)

  • 4-byte float value of the specified coordinate

Configuration

<?xml version="1.0"?>
<Receiver>
  <DataStream>
    <UDPSource port="1021" />
    <PacketDefinition length="6">
      <FixedPacketByte offset="0" value="0x50" />
    </PacketDefinition>

    <Channels>
      <SelectorValue name="which">
        <NumericValue byte_offset="1" bit_length="8" type="unsigned" />
      </SelectorValue>

      <Channel name="X" type="double">
        <Sample valid_if="which=1">
          <NumericValue byte_offset="2" bit_length="32" type="float" />
        </Sample>
      </Channel>

      <Channel name="Y" type="double">
        <Sample valid_if="which=2">
          <NumericValue byte_offset="2" bit_length="32" type="float" />
        </Sample>
      </Channel>

      <Channel name="Z" type="double">
        <Sample valid_if="which=3">
          <NumericValue byte_offset="2" bit_length="32" type="float" />
        </Sample>
      </Channel>
    </Channels>
  </DataStream>

  <ChannelTopology>
    <ChannelGroup name="Location">
      <ChannelRef channel_name="X"/>
      <ChannelRef channel_name="Y"/>
      <ChannelRef channel_name="Z"/>
    </ChannelGroup>
  </ChannelTopology>
</Receiver>

Synchronization

Data

Timestamp information [uint64]

  • UDP packets with 8 bytes payload are sent to port 1021

  • 8-byte timestamp information, as milliseconds relative to midnight, with a 2 hour offset (UTC+2), decoded as timestamp and displayed as channel

Configuration

<?xml version="1.0"?>
<Receiver>
  <DataStream name="Time Stream">
    <UDPSource port="1021" />
    <PacketDefinition length="8" />

    <Synchronization>

      <!-- Timestamping relative to midnight (ms from midnight with 2hrs offset) -->
      <RelativeTimestampChannel base="midnight" unit="ms" offset="7200000">
        <Sample>
          <NumericValue byte_offset="0" bit_offset="0" bit_length="64" type="unsigned" />
        </Sample>
      </RelativeTimestampChannel>

    </Synchronization>

    <Channels>

      <!-- Decode timestamping information as "Time" channel -->
      <Channel name="Time" unit="ms" type="double">
        <Sample>
          <NumericValue byte_offset="0" bit_offset="0" bit_length="64" type="unsigned" />
        </Sample>

        <DisplayRange min="0" max="+86400000" resolution="1" />
      </Channel>

    </Channels>

  </DataStream>
</Receiver>