Chapter 4: Examples

A number of example simulations exist to act as a reference for how to apply the concepts covered in this guide, in practice:

Example Concepts
source_sink.rs

Linear chain of a source, process and sink, linked via stocks. This example is covered in Chapter 1.

Pre-built components Vector Resource (Vector3) Sources Sinks
material_blending.rs

Model of a stockyard with Reclaimers to remove material from multiple stockpiles, and a Stacker to add material to multiple stockpiles.

Pre-built components Vector Resource (Vector3) Splitters and Combiners
car_workshop.rs

Model of a Car Workshop using Strings to represent cars, and multiple processes sourcing and depositing into common queues.

Pre-built components Discrete Resource (String) Fixed-N Parallel Processes
discrete_queue.rs

Basic example demonstrating use of a Sequence resource of Strings. Processes and stocks are arranged in infinite loop.

Pre-built components Sequence Resource (String) Distribution Sampling
iron_ore.rs

Processes involving an Iron Ore resource, which tracks elemental mass composition, and composition by mineral types.

Custom vector resource Distribution Sampling
assembly_line.rs

Linear model using a custom discrete ProtoCar resource but pre-built components. Demonstrates use of an Environment component accessible by all processes.

Custom discrete resource Environment component Scheduled events
truck_loading_dumping

Demonstrates creation of custom components (LoadingProcess and DumpingProcess) which interact with multiple resource types (Truck and Ore). Usage of DiscreteParallelProcess to multiple truck movements in parallel. Logic is split between multiple files.

Custom components Multiple resources Discrete Parallel Process