Beginnings of the Simulation



Back to home page 

To get a quick start on the project I decided to use a simulation to represent the train system. When I inherited the project the trains were still in boxes from transporting them to a new building. Thus in order to start the project as soon as possible I started to write a simulation in visual basic. This simulation allows the user to add an active train to the track, change its direction, toggle the tournouts, and simulate a covered photocell. Thus, with this type of simulation I could avoid the confusion with the actual model railroad and concentrate more on the alorithms to keep track of the trains.

Explanation of algorithms


The algortims work by taking all possible routes of the train and creating a hash table in the form of arrays that give information about the train's location and needed resources. One array gives the current location of the train given the photocell that was covered. Other arrays give the next track and turnout needed given the current track and the position of the turnout. Also there are arrays that keep track of which resources are locked and what trains have those resources allocated.