For the procedures used in this project see : Procedures
For the documentation by the team see: Documentation/readme.md
The goal of this project is to create a small train simulator.
The track consist if four stations, two end stations and two in-between, on separate tracks.
The trains on the track is controlled by the control tower where the operator (mr Carlos), makes sure the trains follows the time schedule by starting and stopping the trains at the stations, he also controls the level crossing (the trains can't parse an open crossing thanks to the ETCS system) and the railroad switches.
The track have currently two active trains going back and forward Golden Arrow and Lapplandståget, it has previously been operated by other trains, but these are no longer in service.
Each train have a wagon with passengers, and these gets on and of at different stations.
There can only be one train at each station at the time. If there is currently not room for the train must it wait until the other train has left.
The project is parted into three parts, and the suggestion is to implement the project in the suggested order. Remember to create unit tests, where possible throughout the project.
Produce a fluent API used by mr Carlos to manually plan the trains, it could maybe look something like this:
Train train1 = new Train("Name of train");
Station station1 = new Station("Gothenburg");
Station station2 = new Station("Stockholm");
ITravelPlan travelPlan = new TrainPlaner(train1, station1)
.HeadTowards(station2)
.StartTrainAt("10:23")
.StopTrainAt(station2, "14:53")
.GeneratePlan();
Create your own mini ORM for the data provided.
It should also be possible to save and load a travel plan made using the Fluent API.
travelPlan.Save("Data/travelplan-train1.txt"); //json
travelPlan.Load("Data/travelplan-train1.txt"); //json
It should be possible to start the trains on the track, a bit like this:
// exmaple Solution1
Train train1 = new Train1();
train.Start(travelplan1);
train.Stop(); // maybe not need
// eample Solution2
travelplan1.Train.Start()
travelplan1.Train.Stop(); // maybe not needed
The though is that each train should have it's own thread running without the knowledge of other trains in the track. But aware of signals on the track. The train is automatically stopping at all stations but are signaled by Mr Carlos when to go on (according to the time table).
Some files are given in this repository.
Data
This folder contains six files:
- Passengers (passengers.txt): A list of possible passengers, missing information on where the passengers are going
- columns separated by ';'
- Stations (stations.txt): All trains stations on the track,
- columns separated by '|'
- Timetable (timetable.txt): this is an example of a travel plan, contains information on when each train is leaving and arriving the stations
- you can choose to implement this in the data format you prefer (eg json)
- Trains (trains.txt): contains a list of trains, some trains are not active
- columns separated by ','
- Train track (traintrack.txt): Describes the track, it contains the stations and the tracks in between:
- The stations placement eg:
[1]
- The start station:
*
- Tracks:
-
,/
and\
- Railroad switches:
<
and>
- Level crossing:
=
- The stations placement eg:
- Controllerlog (controllerlog.txt): An empty file which should be populated as time progress with information relevant for the controller, like:
- Which trains are arriving to the stations and when
- When are the level crossing changing state (open or closed)
- When are the railway switches changing position, and to what
Documentation
The folder initially only contains one file called readme.md, this file is more or less empty.
In this folder should you place digital representations of all documentation you do. Screenshots, photos (of CRC cards, mindmaps, diagrams).
Please make a link and descriptive text in the readme.md using the markdown notation:
# Our train project
What we have done can be explained by this mindmap.
![Mindmap of train track](mindmap.jpg)
Bla bla bla bla
Source
The source folder contains a solution with three projects. With a small code outline.
- TrainEngine, .NET Standard 2.1, This project should contain all the logic of you program
- TrainConsole, NET 5, This project is what starts when you start the project, is a console application
- TrainEngine.Tests, .NET 5, This project should contain all of your automated tests