tellurianinteractive / Tellurian.Trains.LocoNetMonitor

Data exchange with the LocoNet™ bus.
0 stars 0 forks source link

LocoNet Monitor

This application makes it possible to read and write LocoNet messages over UDP. It has a number of advantages:

The basic application does :

These two functions uses two different IP ports.

Additional Services

The application bundle also contain a service for maintaning a slot table.

Slot Table Updater

The slot table updater service monitors the LocoNet message flow for things related to loco control and updates the corresponding slot accordingly.

The slot table updater also has a feature where loco addresses can be assigned to a named person. Optionally, it can be configured to block driving of loco addresses not assigned to any person.

The slot table updater monitors the LocoNet bus and updates its own cache of slots.

The slot table updater requires some loco address white list service. The simple way of doing address reservation is a local CSV-file on the computer where the application is running. Anyone can reserve addresses by mailing a CSV-file that the meeting administrator can incorporate with the master file. Any tool that can produce CSV can be used.

However, the application design permits implementing services that can get the white list from any source, also over the Internet.

Background

At module meetings, managing address reservation for the participants locos is essential to avoid use of same loco address twice. When driving a loco, it is important that no other loco is accidential running aswell.

There exists two models for address reservation:

Both these methods does not guarantee that the meeting participants actually comforms to the form of address reservation in use.

Although not bulletproof, a way to check what loco addresses that are actually used. If the address is not reserved by a meeting particpant, the adress use will be noted as unassigned and optionally restricted that the loco will not drive, until an address reservation is made.

Settings

The appsettings.json contains all settings for the application. You might have to change the following values:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AppSettings": {
    "LocoNet": {
      "Port": "COM4",
      "BaudRate": 57600,
      "ReadTimeout": 100,
      "MinWriteInterval": 100
    },
    "Udp": {
      "BroadcastIPAddress": "192.168.1.255",
      "BroadcastPort": 34122,
      "SendPort": 34121
    },
    "SlotTable": {
      "BlockDrivingForUnassignedAdresses": false
    },
    "CsvFileLocoAddressOwnerService": {
      "LocoOwnersListCsvFilePath": "./LocoListOwnerExample.txt"
    }
  }
}

Further Improvements

In the Module Registry it is now possible to enter the FREMO-reserved loco addresses for each person and this has to be made by an administrator. When that person register for a meeting and specific layout, the person's FREMO-reserved adresses will be booket for that person. This means that the application cant fetch the person's reserved addresses. This saves administration work of registering address reservaltions for FREMO members. It also reserves only registered persons reserved addresses, leaving all other reserved FREMO-addresses open to anyone else.

A few weeks before the meeting opens, other participants will have the option to reserve loco adresses. Of course, the application will guarantee that an adress can only be reserved by one person.

This solution combines both address reservation schemes and makes it possible to use them a safe way.