User Tools

Site Tools


time_event

Time event

Time event is an event block which lets the user specify time points when actions should be performed by simulation blocks. They have a big performance benefit over discrete events in that the event time can be predetermined before the simulation starts.

In order to allow end-users to be able to input event time data(for instance in Ecolego Player)), the time points used by a time event are taken from parameters, lookup tables, time points and time series'. This means that the user selects one, or more, blocks for the time event. The event block will search the block for time points that in turn will cause the event to be sent.

Depending on the type of block(s) selected, the user can model different kinds of behaviour; working with dates resp. working with simulation time, periodic vs. single instances.

Working with simulation time

Simulation time boundaries are set in the simulation settings window. The start time is typically 0, and end time typically indicates the number of time units to run the simulation.

When you want an event to trigger depending on the value of the time variable, you use either parameter or lookup table blocks.

TypeDescription
SingleIn order to set a single time point for when the event triggers, use a parameter which contains the target value of the time variable. For instance, if the simulation time is set to go from 0 to 100 days, and the parameter has the value 20, simulation will pause after 20 days and all actions related to the event will trigger
MultipleMultiple time points can be specified either by selecting several parameters, or by using a lookup table. In the latter case, the time event block will fire for every time point discovered in the lookup table.
PeriodicFor an event to be fired at certain intervals, use a lookup table which has been marked as cyclic. The period will be determined by the first and the last time point in the lookup table. For instance, a lookup table with the values (10,40,60) gives the period 50 time units. The event will thus fire at t=10, t=40, t=60, t=90, t=110, t=140 etc.

Working with dates

The end user specifies the simulation start date in the simulation settings window. The end date is either derived from the duration of the simulation (the end time-the start time), or given by the user. When working with dates Ecolego converts the simulation time to a calendar date. This means that leap years are taken into account.

For dates there are more options than when working with simulation time. You would use either time point or time series blocks. The mode of the block (date, year, day of year etc.) will influence the behaviour of the event time block.

TypePeriodicDescription
DateNoUse a time point block in date mode
Multiple datesNoUse a time series block in date mode. An event will be sent for every date in the block.
YearNoUse a time point block in year mode
Multiple yearsNoUse a time series block in year mode. An event will be sent for every year in the block.
MonthlyYesUse a time point block in month mode. Events are fired yearly at the 1st of the month specified in the block.
Multiple monthsYesUse a time series block in month mode. Events are fired yearly at the 1st of each month specified in the block.
Day of yearYesUse a time point block in day of year mode. Events are fired yearly at the day and month specified in the block.
Day of yearYesUse a time series block in day of year mode. Events are fired yearly at each day and month specified in the block.
Day of monthYesUse a time point block in day of month mode. Events are fired every month at the day specified in the block. Note: events are only fired if the day is valid for the month. For example, if the day 29 is specified, an event will only fire for months with 29 days or more - non-leap year Februaries are ignored.
Day of monthYesUse a time series block in day of month mode. Events are fired yearly at each day and month specified in the block.
WeeklyYesUse a time point block in day mode. Events are fired weekly at the day specified in the block.
WeeklyYesUse a time series block in day mode. Events are fired weekly at the days specified in the block.
DailyYesUse a time point block in hour mode. Events are fired daily at the hour specified in the block.
DailyYesUse a time series block in hour mode. Events are fired daily at the hours specified in the block.
HourlyYesUse a time point block in minute mode. Events are fired hourly at the minute specified in the block.
HourlyYesUse a time series block in minute mode. Events are fired hourly at the minutes specified in the block.
Once every minuteYesUse a time point block in seconds mode. Events are fired at the seconds specified in the block.
Several times each minuteYesUse a time series block in seconds mode. Events are fired at each second specified in the block.

For examples, check out the Tutorial - Time events.

Linking time event blocks to actions

As with discrete events, several blocks can take advantage of events. Read more here.

Creating a discrete event

From the Projects window

  • Expand the Project to which you wish to add the discrete event by clicking the + symbol next to it. Right-click on ‘Blocks’, or a sub-system in ‘Blocks’, and select Time event from the pop-up menu.

From the Matrix window

  • Right click an empty diagonal cell of the matrix and select Time event from the the pop-up menu.

From the Blocks window

  • Place the mouse cursor over the table and right-click on it. Select New | Time event from the pop-up menu, or
  • In the title bar, select Time event from the Type drop-down list and click on the New button.

Editing a time event

NoteMost block properties can be edited directly in the blocks window.

The block editor is shown by right-clicking the block in a window and selecting Edit. In the Blocks window, you can also show the block editor by selecting the block and clicking the Edit button, or by double-clicking the right-most “validation” column of the block.

The block editor has three tabs:

Properties

This page lets you edit basic properties such as name, sub-system and base unit. See editing properties for more information.

Appearance

This page lets you edit the visual properties of the block in the Matrix window. See Editing appearance for more information.

Values

This page lets you select which objects to read time points from. This page lists all parameter, lookup table, time point and time series blocks of the model. Below the list are controls that allow you to search for blocks and selecting a sub-system. Note by default the list shows only blocks from the same sub-system as the event.

Dimension - You can specify the dimension of the block by using the Type drop down list. Depending on the dimension the index drop down lists are activated. See editing values for more information.

See also

time_event.txt · Last modified: 2020/10/12 16:33 by erik