Skip to content

Developer’s Guide

Benedek Horvath edited this page Feb 18, 2018 · 2 revisions

Development environment setup

To set up the development environment on your machine, follow the Getting Started page.

Creating and integrating a new software component

The following guide aims to summarize the steps you should follow in order to create your own software component in the MoDeS3 project.

Gradle integration

Should you integrate a new software component with gradle, use one of the projects in the src/java folder as a starting point.

If you need a project, that should be deployed and run as a standalone jar, look at the projects in the src/java/components folder. If you need a project and a standalone jar should be generate from that, which assembles all its dependencies, then have a look at the src/java/messaging folder, especially src/java/messaging/communication.

The respective projects build.gradle, settings.gradle files contain every necessary information to integrate a project into a Multi-Project build with gradle. The root project’s build.gradle and settings.gradle files are in the src/java folder.

Sample Component

There is a sample component in the sample project.

How to communicate with other MoDeS3 components

In order to be able to communicate with other components, your component should extend the abstract supertype AbstractRailRoadCommunicationComponent. This allows you to use the high-level API described below in the next section.

Abstract Common Supertype for components

There is an Abstract class which you can extend in package hu.bme.mit.inf.modes3.components.common called AbstractRailRoadCommunicationComponent. Your component extending this can access the inherited locator member which can be used to communicate with the railroad system. The several relevant members of the locator are summarized described in the next section.

Communication classes

Function Message Senders Message Receivers Related enums

Segment occupation

TrackElementStateSender

TrackElementStateRegistry

SegmentOccupancy

Turnout state

TrackElementStateSender

TrackElementStateRegistry

TurnoutState

Enabling segments

TrackElementCommander

TrackElementCommandCallback

SegmentState

Switching turnouts

TrackElementCommander

TrackElementCommandCallback

TurnoutState

Emergency stop

TrackElementCommander

TrackElementCommandCallback

none

Train Speed

C++

TrainReferenceSpeedState

none

Train Direction

C++

TrainReferenceSpeedState

TrainDirection

Network setup

Node SBC type DNS name IP address MAC address Links

root node

Raspberry Pi

root.modes3.intra

192.168.1.2/24

b8:27:eb:22:5a:bc

IPConfig dump

Manager node

Raspberry Pi

manage.modes3.intra

192.168.1.4/24

b8:27:eb:f7:0e:f7

IPConfig dump

Safety controller, T1 turnout

BeagleBone Black

t1.modes3.intra

192.168.1.101/24

04:a3:16:b3:95:00

IPConfig dump

Safety controller, T2 turnout

BeagleBone Black

t2.modes3.intra

192.168.1.102/24

04:a3:16:b3:be:6b

IPConfig dump

Safety controller, T3 turnout

BeagleBone Black

t3.modes3.intra

192.168.1.103/24

54:4a:16:ee:92:b9

IPConfig dump

Safety controller, T4 turnout

BeagleBone Black

t4.modes3.intra

192.168.1.104/24

54:4a:16:bb:d1:db

IPConfig dump

Safety controller, T5 turnout

BeagleBone Black

t5.modes3.intra

192.168.1.105/24

54:4a:16:c5:fe:0d

IPConfig dump

Safety controller, T6 turnout

BeagleBone Black

t6.modes3.intra

192.168.1.106/24

54:4a:16:f9:2f:73

IPConfig dump

Connections with switches

switch1
Figure 1. Switch #1
switch2
Figure 2. Switch #2
node Connected to switch Port number on switch Cable marker

root node

#1

2

Light gray

Manager node

#2

6

Black (with light gray cable)

Safety controller, T1 turnout

#1

7

green

Safety controller, T2 turnout

#2

2
4

Black
Temporary replaced with swinger cable

Safety controller, T3 turnout

#2

1

yellow

Safety controller, T4 turnout

#1

5

Blue

Safety controller, T5 turnout

#1

6

Red

Safety controller, T6 turnout

#2

7

Red

Switch #2

#1

8

Light gray with dark gray cable

Switch #1

#2

8

Light gray with dark gray cable

networking
Figure 3. EMF model of networking
hardware platform
Figure 4. Hardware platform connections

Accessing multiple computers

ClusterSSH is a tool suitable to handle multiple SSH sessions. It’s handy in case the same process shall be started on multiple machines.

Example:

clusterssh -l debian t1.modes3.intra t2.modes3.intra t3.modes3.intra t4.modes3.intra t5.modes3.intra t6.modes3.intra
Clone this wiki locally