UDP Configuration Manual

Introduction

This document describes how the UDPIOServer component works, and how to set it up and use it within a CDP system.

The UDPIOServer is used for sending and/or receiving UDP (User Datagram Protocol) packets and converting values in packets to/from CDPSignals

UDPIOServer Configuration

About

UDPIOServer can be added to selected application in a Project tree by right-clicking on UDPIOServer and selecting Add in UDPIO subsection in Resource tree. Configuration is done by adding resources like InPacket, OutPacket and CDPSignalChannel and modifying the properties of InPackets, OutPackets and CDPSignalChannels.

Generic UDPIOServer component configuration

The OutPackets send frequency is specified by the component's standard fs Property. OutPacket sending is triggered from the Online state at frequency of fs. This also sets the maximum change rate for CDPSignalChannels in incoming packets.

UDPIOServer component has some notable objects:

Signals

SignalDescription
TimeThe relative time.

Parameters

ParameterDescription
SignalTimeoutTimeout duration before Transmission Error alarm is triggered. (Inherited from IOServer)

Alarms

AlarmDescription
Transmission ErrorAlarm raised if we didn't receive packets in time. (Inherited from IOServer)

Properties

PropertyDescription
fsUDPIOServer run frequency and packet send frequency (also maximum change rate for CDPSignalChannels in incoming packets)
PriorityDefines the priority the IOServer will run at. Can have a value of "high", "normal", or "low".
DebugDebug level for the IOServer.

IOConfig configuration section

The IOConfig section resides inside the UDPIOServer component and lists all the Packets in the IOServer, both for out-going OutPacket and incoming InPacket UDP packets. New packets can be added when UDPIOServer component is selected in the System by right clicking in the UDPIO Resources UDPIOServer.InPacket or UDPIOServer.OutPacket and selecting Add or dragging the Packets to IOConfig section (the drop target will be auto-selected and highlighted even if drop is performed outside of IOConfig section).

UDP Packet Configuration

This chapter describes how to configure the specific UDP packets.

OutPacket and InPacket

The OutPacket defines a UDP packet format to be sent whereas InPacket defines UDP packet format to be received.

OutPacket has the following properties element:

PropertyDescription
RemoteAddressIP-address to which the packet will be sent. A broadcast address may be specified (for instance 10.0.2.255). If empty, it will default to the local IP of the selected interface.
RemotePortThe port to which the packet will be sent.
NetworkInterfaceLocal ethernet interface to use. Must match an interface listed in applications NetworkInterface table.
TriggerRoutingRouting path to CDPProperty. When the properties value evaluated to true/false changes the packet will be sent. When defined the packet is not sent periodically.

InPacket has the following properties element:

PropertyDescription
LocalPortDefines the port listened to.
NetworkInterfaceLocal ethernet interface to use. Must match an interface listed in applications NetworkInterface table.

NetworkInterface property on InPacket and OutPacket

Note that the ETH0 interface is handled specially by CDPStudio, meaning that it will use the applications deployment network interface selected in CDPStudio.

Also note that listening on 127.0.0.1 is not the same as listening on the computer's IP-address. To be able to listen to 127.0.0.1, create an additional NetworkInterface in your application with this IP-address and set it as Packets NetworkInterface.

This may look strange, but is necessary since ETH0 will be changed from 127.0.0.1 to the IP-address chosen for deployment in CDPStudio.

CDPChannel section

One or more CDPSignalChannel objects go inside the OutPacket or InPacket to make up the packet format that is transmitted or received.

Each CDPSignalChannel reserves its data size amount of bytes in the packet format, only exception is CDPSignalChannel<bool> first of which reserves a byte, but sequential boolean channels will reside in the same byte (until the sequence has 8 boolean channels). Property Nr from 0 to 7 will indicate bit location in said byte.

For example packet with:

  • Channels CDPSignalChannel<bool>, CDPSignalChannel<char> will be 2 bytes
  • Channels CDPSignalChannel<bool>, CDPSignalChannel<bool>, CDPSignalChannel<char> will be 2 bytes
  • Channels CDPSignalChannel<bool>, CDPSignalChannel<char>, CDPSignalChannel<bool> will be 3 bytes

CDPSignalChannel<bool> objects must also have Nr property set.