Skip to content

Starting a Simulation

PhillP edited this page Sep 15, 2012 · 3 revisions

The steps required to begin a simulation are as follows:

  • create a simulation context
  • add the processes, resources and other elements of the model to the simulation context
  • instantiate a simulator
  • call the Simulate() method of the simulator
// Make a simulation context
using (var context = new SimulationContext(isDefaultContextForProcess: true))
{
     //
     // Instantiate the processes, resources and other elements of the simulation
     // 

     // instantate a new simulator
     var simulator = new Simulator();
     
     // run the simulation
     // the simulation will run until:
     //     there are no processes with work remaining
     //     a terminate instruction has been issued; 
     //     or and SimuationEndTrigger has fired
     simulator.Simulate();
}
Clone this wiki locally