Simulation Context Data

Parent Previous Next

We provide some specific data access from the simulation context to allow you to enhance your simulation configuration.


SimulationContext.Time

Represents the simulation time as System.DateTime (Silverlight type). Can be used as getter in all python scripts.


You can use the following methods:

  • SimulationContext.Time.Year
  • SimulationContext.Time.Month
  • SimulationContext.Time.Day
  • SimulationContext.Time.Hour
  • SimulationContext.Time.Minute
  • SimulationContext.Time.Second
  • SimulationContext.Time.Millisecond
  • SimulationContext.Time.DayOfWeek
  • SimulationContext.Time.DayOfYear


Example usage 1 as gateway condition:

SimulationContext.Time.Hour>12

will check, whether current time is 13:00 or later.


Example usage 2 as gateway condition:

SimulationContext.Time.DayOfWeek=='Friday'

will check, whether current day is Friday.


At time-based events with scripted inter-arrival time, you can use operations like:

  • GotoHour(x): jump to hour x (with x being an integer between 0 and 23)
  • GotoMinute(x): jump to minute x (with x being an integer between 0 and 59)


SimulationContext.Resources

Provides access to the current state of resources. Can only be used as getter.


You can use the following methods:

  • SimulationContext.Resources.IsIdle(ROLE_STRING)
  • SimulationContext.Resources.Count(ROLE_STRING)
  • SimulationContext.Resources.CountIdle(ROLE_STRING)
  • SimulationContext.Resources.CountBusy(ROLE_STRING)


Example usage 1 as gateway condition:

SimulationContext.Resources.IsIdle('executive officer')

will check, whether at least one 'executive officer' is free.


Example usage 2 as gateway condition:

SimulationContext.Resources.CountIdle('executive officer')>=3

will check, whether at least three 'executive officer' are free.


SimulationContext.Product

Represents the current product as a string. Can be used as getter or setter.


Example usage as gateway condition:

SimulationContext.Product=='standard product'

will check, whether the current product is called 'standard product'.


Example usage as activity expression:

SimulationContext.Product='standard product'

will set the current product to 'standard product'.