Scripted Event Trigger

Parent Previous Next

Scripted Time Instants

We also provide the possibility to script Time Instants in Python (a common scripting language). This is only used, if timing is very complicated, e.g. it depends on complex computations. The following simple statement "Result=SimulationContext.Time.GotoHour(9);" from the picture below tells the simulation that this event fires every day at 9 o'clock. Of course, 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.

See Model 1d - Scripted Time Instant for Start Events from the Simulation Tutorial for an example.

Also have a look at Simulation Context Data for an overview of the available data from the simulation context.

Figure 1: Time Editor in Python-mode