The discrete event block should be used when using variable step solvers, to notify the solver of when important events occur in the model.
The typical application is for models that contains conditions. In a model with a condition such as (time>t_leakage), where t_leakage is a parameter indicating when a container starts to leak, it is important that the solver includes this time point when the simulation is run.
From the Projects window
From the Model window
From the Blocks window
Place the mouse cursor over the table and right-click on it. Select New | Discrete event from the pop-up menu, or
In the title bar, select Discrete event from the Type drop-down list and click on the
button.
| Note | Most 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
button, or by double-clicking the right-most “validation” column of the block.
The block editor has three tabs:
This page lets you edit basic properties such as name, sub-system and base unit. See editing properties for more information.
This page lets you edit the visual properties of the block in the Model window. See Editing matrix properties for more information.
| Note | When entering an expression, you can also enter names of objects that are not yet created and let Ecolego use automatic object creation to define them. |
This page lets you specify the condition for the event. It is important that the terms are put on the correct sides. The left hand side should approach the right hand side from below.
For the example given in the introduction, the left hand side would be “time” and the right hand side would be “t_leakage” because time will approach t_leakage from below.
Another example would be when a discrete event is used to assert that the quantity of a compartment does not decrease below a certain limit. In a transfer coefficient, the following expression is written: (Comp1>limit) · TC, where limit is the lower boundary for the compartment. In this case, Comp1 will approach limit from above, so the terms should be shifted in the discrete event: the left hand term is limit and the right hand side is Comp1.
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.
Data
Indices - For blocks that are non-scalar, the first columns will specify indices from the index lists. This allows you to specify different expressions for different indices. The top row is named “default” and can be used when the same value should be set for all indices.
First expression - The left hand side. The expression written on the left hand side should approach the right hand side from below.
Second expression - The right hand side. The expression written on the right hand side should approach the right hand side from above.
Information - By using the Table control button you can display more columns that will help you document your model.