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
Signal | Description |
---|---|
Time | The relative time. |
Parameters
Parameter | Description |
---|---|
SignalTimeout | Timeout duration before Transmission Error alarm is triggered. (Inherited from IOServer) |
Alarms
Alarm | Description |
---|---|
Transmission Error | Alarm raised if we didn't receive packets in time. (Inherited from IOServer) |
Properties
Property | Description |
---|---|
fs | UDPIOServer run frequency and packet send frequency (also maximum change rate for CDPSignalChannels in incoming packets) |
Priority | Defines the priority the IOServer will run at. Can have a value of "high", "normal", or "low". |
Debug | Debug 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:
Property | Description |
---|---|
RemoteAddress | IP-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. |
RemotePort | The port to which the packet will be sent. |
NetworkInterface | Local ethernet interface to use. Must match an interface listed in applications NetworkInterface table. |
TriggerRouting | Routing 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:
Property | Description |
---|---|
LocalPort | Defines the port listened to. |
NetworkInterface | Local 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 CDP Studio, meaning that it will use the applications deployment network interface selected in CDP Studio.
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 CDP Studio.
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
Note: CDPSignalChannel<string> reserves as many bytes as are specified in the channel BinaryEncodedLength attribute.
CDPSignalChannel<bool> objects must also have Nr property set.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.