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.
|
Figure 1: Model 1c - Time Instants 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
- Note: If the simulation time is past 09:00 o'clock it will advance to the next day's 09:00 o'clock
|
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.
- Note that its inter-arrival time is 24 hours at the exact same hours each day.