Home | Store | About | Progress | TNP | Videos | Visit | Links Main Menu TMRC Store About TMRC Progress About the TNP Videos Visit the Clubroom Links
System 3 Server

System 3 Server Software

This page will document the server software. It is written in java, and the source is at /home/tmrc/sys3/server/tmrc/railserver.

TCP Command and Status Interface

The control and status to the server software is via a TCP port. The messages sent across the port are in the form of LISP s-expressions

Status is entirely in the form of "(set ...)" s-expressions, setting the state of some object. The complete status is sent when a TCP connection is created and authenticated.

Incoming requests from SCab2 are parsed in /home/tmrc/sys3/server/tmrc/railserver/TCPControl2.java. These are the commands:

(fullUpdate)
Send a full update of system state, as is sent when first connected and authenticated.
(cxnInfo)
Send state information on all connections. Connections are the connections between blocks and blocks or switches or crossings or turntables.
(quit)
Quit the session, closing the TCP connection.
(info (Obj"object-name"))
Get debug state information on an object.
For a switch:
(debug-info (Obj "S233") "Reversed: false
Swing: 0
Hand: LEFT
Name: S233 DName: null
Owner: (null)
Logical Direction: 
0: Connection to B236 0 sig stop flags 0
1: Connection to B231 1 sig stop flags 2
2: Connection to B232 1 sig stop flags 2
HardaerePresent: false
OutOfService: false
")
For a block:
(debug-info (Obj "B62") "Occupied: CAR Overflow: false
Speed: 0 Feedback: 99
Direction: false
Name: B62 DName: SY21
Owner: (null)
Logical Direction: 
0: Connection to S87 2 sig stop flags 2
1: Connection to B52 0 sig stop flags 2
HardaerePresent: false
OutOfService: false
")
(findpath (Obj "train-name") (Obj "track-name"))
Find the path (a route for local switching) for the given train-name and track-name.
(selectPath area-number path-number)
Select the path in the area (which is really A followed by area-number, and set the switches along the path given by path-number.
(packet args...)
Sends a packet on the picnet. (Specifics needed.)
(throwSwitch (Obj "switch-name") boolean)
Throw the switch identified by switch-name to normal if boolean is #f or to reverse (diverging, crossover) if boolean is #t.
(rotate (Obj "turntable-name") number number)
Rotate the turntable identified by turntable-name to the track setlected by one number and the end of the turntable bridge selected by the other number. This would be used when you have a locomotive on the turntable, and want to align it with a track pointing in a specific direction. (Specfics needed.)
(rotateToClosest (Obj "turnable-name") track-number)
Rotate the turntable identified by turntable-name with the least movement to align with the track specified by track-number. This would be used when the turntable is empty, and you need to move a locomotive onto it.
(setOutOfService (Obj "track-name") boolean)
Set the track idenfied by track-name out of service if boolean is #t or in-service if it is #f. Will generate a response s-expression (set (Obj "track-name") boolean) to update the state of the block.
(speed (Obj "train-name") number)
Sets the speed of the train identified by train-name to a number in the range 0-100.
(addTrain (Obj "train-name") (Obj "block-name"))
Create a "soft" train (not associated with a hardware cab) with the name train-name in the block block-name. The train name must not aready exist. There must be an occupancy in the block, which is not presently associated with an existing train. The direction of the train is always TBD.
(delTrain (Obj "train-name"))
Delete the "soft" train with the given train-name.
(reverseTrain (Obj "train-name"))
Reverse the direction of the train identified by train-name.
(setDirection (Obj "train-name" boolean)
Set the direction of the train identified by train-name. The boolean identifies the desired direction, with some relation betwee true/false and eastbound/westbound. (Details needed.)
(callOn (Obj "train-name"))
For the train idenfied by train-name, do a "call-on", taking control of the occupied block in front of the train, if it is not part of another train.
(stealAhead (Obj "train-name"))
For the train identified by train-name, do a "steal-ahead."
(dropBehind (Obj "train-name"))
FOr the train identified by train-name, drop all occupied block from the rear of the train. (It may only drop blocks with non-engine occupancy.)
(assignCab (Obj "cab-name") (Obj "train-name"))
Assign the train identified by train-name to the hardware cab named cab-name. Since no block is specified, presumably the train must have been created with the (addTrain) command.
(releaseCab (Obj "cab-name"))
Release the hardware cab identified by cab-name.

Tech Model Railroad Club of MIT
MIT Room N52-118
265 Massachusetts Avenue
Cambridge, MA 02139

+1 617 253-3269
Email: tmrc-web@mit.edu