Tutorial Exercise 2
Exercise Information
Five tonnes of material must be transported from one station to another, a locomotive must travel from the empty station to the loaded one, going through a 300 meters rail. The locomotive can carry 500 kilograms on each trip, going at a velocity of 10 m/s.
Creating objects
In order to achieve the solution for the problem, you should create the following objects:
- Create one Source Train.
- Create three Rails, then resize Rail2 xvalue to 300. Connect Source Train to the Rail1 connectpoint and then connect Rail1 to Rail2 and Rail2 to Rail3 via proximity.
- Create two Rail Control Point and put one on Rail1 and the other one on Rail3.
- Create two Stations, then connect its center port to the RailControlPoint on Rail1 and the other station to RailControlPoint on Rail3.
- On the initial Station, set the Max Weight to 5000 (5 tonnes) and, on the other one, set Start Weight and Max Weightto 5000 (5 tonnes).

Your model should be looking like this.
Processflow Configuration
In order to achieve the solution for the problem, you should create the following processflow tasks:
- Create a Source.
- Create a MoveTrain.
- Create a LoadWagon.
- Create a MoveTrain.
- Create a UnloadWagon.
- Create a Decide.
- Create a Sink.
Your processflow should be looking like this.
To configure your processflow tasks follow the steps:
- On CreateTrain points the SourceTrain reference to your SourceTrain, set the Locomotive Speed to the value 10 e and the MaxWeight to 500.
- On first MoveTrain of the block, set train reference to token.train and destiny to the RailControlPoint on Rail3.
- On LoadWagon set train reference to token.train and ControlPoint reference to the RailControlPoint on Rail3.
- On second MoveTrain of the block, set train reference to token.train and destiny to the RailControlPoint on Rail1.
- On UnloadWagon set train reference to token.train and ControlPoint reference to the RailControlPoint1 on Rail1.
- On the decide, set a conditional decide with the value "getvarnode(Model.find("Station2"), "currentWeight").value == 0", where "Station2" is the name of the loaded station. The connector 1 should be the Sink and the connector 2, the block that loads and unloads the train.

With this configuration your model is ready.