Discord
@hash/unload-train-shipment
Simulation
1
0
Public

Unload Train Shipment

This empty simulation has no behavior.

This is a simulation of a small unloading rail yard. Trains enter the yard to unload cargo, a crane unloads the cargo onto trucks, and the trucks carry the cargo out of the yard. It demonstrates useful rail behaviors such as trains following tracks, and rail switches.

Rail and Train Behaviors

Trains are initialized as a locomotive follwed by 9 railcars. They use the follow_track.js behavior to follow the black track agents around the simulation. Railcars are randomly generated with or without cargo. If train is not carrying any cargo it will bypass the railyard entirely and exit the simulation.

If a train is carrying any cargo, the track switch controller will detect it and cause the switches to direct the train into the yard, until it reaches the "stop" track. Each railcar carrying cargo will then send messages to call for the crane and a truck.

Crane Behaviors

The crane receives its instructions from the railcars carrying cargo once the train has stopped. The crane.js behavior receives and stores instructions as an array of jobs to complete, and then executes them by moving to the position specied and transferring the cargo to a truck.

Truck Behaviors

Trucks also use the follow_track.js behavior to navigate through the simulation. They are generated based on the number of cargo railcars on the current train, and navigate to their respective location in the unloading dock. When the crane sends them a message that they have been loaded, they leave the station.