Model 1d - Scripted Time Instant for Start Events

Goals of the lesson

  • Learn how set up a simple scripted time instant to determine a start event’s inter-arrival time

  • This is only used, if timing is very complicated, e.g. it depends on complex computations. This example is very trivial, and could be achieved more easily with Time Instants. But maybe, you want to substitute the '9' with a variable, which is the result on an individual algorithm, you programmed in Python language

How-to

Model 1d accords with Model 1a. The only difference is that we use a Scripted Time Instant to determine the start event’s inter-arrival time.

Sim Tur 1a Model
Figure 1. Model 1d - Scripted Time Instant for Start Events / IYOPRO-Link

Approach

  • Click the start event (make sure you selected simulation from the property set)

  • Open up the Time Editor to set up the inter-arrival time of the start event

  • Now select Time Instant from the drop-down-box in the top-left corner of the time editor

  • From the second drop-down-box (right to the previous one) select Scripted Time Instants

  • The Time Editor now contains an input-box, in which you can write your Python code

  • Put this line into the text area: Result=SimulationContext.Time.GotoHour(9); (see Figure 2)

    • This tells the simulation to advance to 09:00 o’clock when the event is being initialized by the simulation

    If the simulation time is past 09:00 o’clock it will advance to the next day’s 09:00 o’clock
TimeEditor Python Scripted TimeInstant
Figure 2. Assigning the starting time for the start event

Explanation

  • As already said, this process accords to those of Model 1a and Model 1c.

  • The only difference is that we used a Scripted Time Instant to determine that the process starts every day a 9 o’clock.

Its inter-arrival time is 24 hours at the exact same hours each day.

Report

See below for the run configuration, which we set up to receive the report statistics from below.

Please refer to the section Experiment Results for more information on the report specific data.

Run configuration

  • Stochastic Seed: 12345

  • Simulation start date: 1/1/2014 12:00:00 a.m.

  • Simulation stop time: 240

  • Simulation stop time unit: Hours

Report statistics

  • Contrary to the former configurations we defined a simulation time of 240 hours (10 days)

  • Our start event fires only one time per day (always at 9 a. m.)

  • Therefore the process will start ten times (see Figure 3 below) within the simulation time

NewItem723
Figure 3. Process cycle times