Before the trip…
As the O2DES is using the following techniques, please make sure that you have basic understanding of them.
- Object-Oriented Programming in C#
- Discrete-Event Simulation
- Visual Studio 2019
Let’s roll…
In this paper, you will learn:
- The basic components in O2DES
- How to install O2DES from NuGet
- How to build the first DES model with O2DES
The basic components in O2DES
Below is the simplified class diagram for the O2DES simulator. Only the relevant public and protected parameters and classes are shown.
Scenario
The class Scenario encapsulates the static properties of the system bring simulated. These entities are static as they are simply a description of the entities and do not change in state during the simulation. These static properties include entities such as path, road, rack, SKU, etc. Essentially, this class should describe the entities present in the system.
The template for the Scenario class is as such:
public class Scenario : O2DESNet.Scenario { // encapsulate all static properties here // ... }
Status
The class Status, as the name suggests, tracks the respective status of the entities in the system. These entities are dynamic in nature as their respective states can change as the simulation progresses. Examples of such dynamic entities are load, server, etc. Consequently, the output statistics desired from the simulation should be inferred from this class. Click here to learn about the Status API.
The template for the Status class is as such:
public class Status : O2DESNet.Status<Scenario> { // encapsulate all dynamic properties here // ... public Status(Scenario scenario, int seed = 0) : base(scenario, seed) { // initialize all the dynamic elements // ... } // implement methods that help to update the Status // ... }
Event
The class Event is an abstract class which can be scheduled to change the status of the entities in the simulation, according to the discrete-event simulation paradigm. Each event in the simulation should be encapsulated as a new sub-class derived from this abstract class. Click here to learn about the Event API.
The template for the Event class is as such:
public class MyEvent : O2DESNet.Event<Scenario, Status> { public override void Invoke() { // implementation of this Event // ... } }
The Event class is the only class that has to be created multiple times, one for each event. The template is available in Project > Add New Item… as O2DESNet.Event. Name your new Event class and place the new .cs file into the Event folder in the solution.
Simulator
The class Simulator contains the future event list and the simulation clock. The mechanism to drive the simulation forward is also contained in this class. Click here to learn about the Simulator API.
The template for the Simulator class is as such:
public class Simulator : O2DESNet.Simulator<Scenario, Status> { public Simulator(Status status) : base(status) { // specify initial events here // example of scheduling a new event // Schedule(new MyEvent(), TimeSpan.FromMinutes(DefaultRS.NextDouble())); // example of executing a new event // Execute(new MyEvent()); } }