User Tools

Site Tools


users:eporocrail:system_design-en

System design

Overview


The router creates a closed WiFi network. Rocrail and Mosquitto are installed on a Raspi. Rocrail is the model rail road controlling software. It communicates wireless via the “MQTT”(Message Queue Telemetry Transport) protocol with the Eltraco decoders. Mosquitto is the “MQTT – post office”.

Eltraco consists of one single software package. Each decoder has the same software package. After the initial installation, each decoder is configured to perform the desired function. This is done via an “Eltraco configuration” website and the user's webbrowser. Updates of the software can be performed “OTA” (Over The Air). After installation of a servo underneath the baseboard of the layout it needs adjustment of two angles, one for the straight position and one for the thrown position. This adjustment is done via a webbrowser.

Four different Eltraco decoders are available. One turnout decoder controls two turnouts, the other one controls one turnout and has four sensors. The sensor decoder accommodates eight digital and one analogue sensor. With each switch decoder eight individual ports can be switched on and off wireless by Rocrail.

WiFi network

Within the WiFi network the participants need to establish a communication link. This can be done with the “UDP”(User Datagram Protocol) protocol or the “TCP/IP”(Transport Control Protocol / Internet Protocol). The most important difference between UDP and TCP/IP is that UDP is a “fire and forget” protocol where TCP/IP safeguards the delivery of data packets. At the other hand UDP allows for broadcasting. Eltraco uses TCP/IP because of the certainty of delivery of data packets. If necessary broadcasting is done by proper use of the subscription method of Mosquitto.

An IP-address consists of four triplets of numbers. Within the network for Eltraco for the time being only the rightmost triplet is used. This provides an address space for 256 participants. When required this can be broadened by using an extra triplet.

The following IP-addresses are allocated semi permanently: IP-address: Rocrail 192.168.xxx.1 (explained further on)

	Router 192.168.xxx.251
	Configuration website 192.168.xxx.252
	Command Station 192.168.xxx.253
	Mosquitto 192.168.xxx.254

To put it simple 250 addresses are available for Eltraco decoders.

Rocnet protocol

Within Rocrail the “Rocnet protocol” is defined and can be used freely. Eltraco uses the Rocnet protocol. Rocrail exchanges messages with the Eltraco decoders. The exact content of these messages, the use of data packets, is extensively explained in the Rocrail Wiki. Part of those messages is the addressing mechanism used to deliver the Rocnet messages. Each participant in a Rocnet network is allocated a unique node-number. Node-number 1 is reserved for Rocrail.

MQTT

MQTT is an “IOT” (Internet of Things) protocol to transfer messages between network participants. It requires very little overhead and is rather easy to use. Messages from the sender are transferred to a “post office”, being Mosquitto. Those message are put into mailboxes with a certain user defined “topic”. Recipients subscribe to topics which they are interested in. The main reason to apply this message protocol within Eltraco is the disconnection between sending and receiving it provides. It is not necessary to program any “handshaking” or whatsoever.

Process

In different words, Rocrail creates messages to be sent to decoders. Those messages are put into envelopes and transferred to Mosquitto. When a decoder is ready to receive a message it is transferred from the post office to the decoder. The decoder takes the message out of the envelope and reacts on the content of the message. This happens the other way around in the same fashion.

Rocnet messages

Rocnet uses node-numbers for each element in the network. A node-number consists of two bytes, a MSB (Most Significant Byte) and a LSB (Least Significant Byte). For Eltraco the LSB is used. A byte has a maximum value of 256, the same as the rightmost triplet of an IP-address. In the configuration windows of Rocrail this node-number has to be inserted into the field “Bus”. So the node-number is the bus-number. Furthermore a Rocnet participant can have multiple “ports”. In the configuration windows of Rocrail this port-number has to be inserted into the field “Address”. It accepts a number ranging from 1 to 256.

Addressing

With this in mind the following message addressing scheme is used within Eltraco:
For decoders the node-number is the same as the right most triplet of the IP-address of the decoder. Each port of a decoder is addressed with its port-number starting with “1”. (e.g. sensor decoder with IP-address 192.168.xxx.123 has bus-number 123. The sensors have each an address out of the range from 1 .. 9. Switch decoder with IP-address 83 has bus-number 83 with each output having an address out of the range 1 ..8. With a turnout decoder the turnouts are addressed with IP-address as bus-number and 1 and 2 as address. The sensors of the single turnout decoder report with addresses from 1 - 4).

Bus-number 1 is allocated to the Rocrail server. Because of the relation in Eltraco between Rocnet node-number and IP-address, the IP-address “192.168.xxx.1” can not be allocated to any Eltraco decoder.

In total 250 decoders can be used.

users/eporocrail/system_design-en.txt · Last modified: 2018/11/12 08:56 (external edit)