This shows you the differences between two versions of the page.
— |
timed_event [2020/12/03 16:22] (current) mina created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Timed event ====== | ||
+ | |||
+ | |**Note**|Since release 7.1, there is a [[time event]] block which should be used for events that are time-related.| | ||
+ | |||
+ | Discrete events are used by various blocks in order to trig an action. The [[Snapshot|snapshot]] block uses a discrete event in order to trigger the snapshot, the [[Transfer|transfer]] block can specify a discrete transfer by referencing a discrete event. | ||
+ | |||
+ | The discrete event can also be used to notify the ODE solver that something drastic has happened in the model and that the solver needs to reduce the current time_step. A typical case is for models that contain [[Expression_syntax|conditions]]. In a model with a condition such as (time> | ||
+ | |||
+ | The block has a right hand side expression and a left hand side expression. The event is triggered when these are equal. Whenever a time step is taken by the solver, the solver will see if the difference of the two expressions has changed sign since the last time step. If so, the solver will try to backtrace to the time point when they are equal. After, the solver will restart with a time step given in [[Simulation_Settings|simulation settings]] as the //initial time step//. | ||
+ | |||
+ | ===== Creating a discrete event ===== | ||
+ | |||
+ | From the [[Projects_window|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’, | ||
+ | |||
+ | From the [[Matrix_window|Matrix window]] | ||
+ | |||
+ | * Right click an empty diagonal cell of the matrix and select **Discrete event** from the the pop-up menu. | ||
+ | |||
+ | From the [[Blocks_window|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 {{: | ||
+ | |||
+ | ===== Editing a discrete event ===== | ||
+ | |||
+ | |Note|Most block properties can be edited directly in the [[Blocks_window|blocks window]].| | ||
+ | |||
+ | The block editor is shown by right-clicking the block in a window and selecting **Edit**. In the [[Blocks_window|Blocks window]], you can also show the block editor by selecting the block and clicking the {{: | ||
+ | |||
+ | 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|editing properties]] for more information. | ||
+ | |||
+ | ==== Appearance ==== | ||
+ | |||
+ | This page lets you edit the visual properties of the block in the [[Matrix_window|Matrix window]]. See [[Editing_appearance|Editing appearance]] for more information. | ||
+ | |||
+ | ==== Values ==== | ||
+ | |||
+ | |Note|When entering an expression, you can also enter names of objects that are not yet created and let Ecolego use [[Automatic_object_creation|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. | ||
+ | |||
+ | For the example given in the introduction, | ||
+ | |||
+ | Another example would be when a discrete event is used to assert that the quantity of a [[Compartment|compartment]] does not decrease below a certain limit. In a [[Transfer|transfer]], | ||
+ | |||
+ | **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|editing values]] for more information. | ||
+ | |||
+ | **Data** | ||
+ | |||
+ | * **// | ||
+ | * **First expression** - The left hand side. | ||
+ | * **Direction** - The expected direction of the event. If the left hand side is expected to exceed the right hand side when the event occurs, use **>> | ||
+ | * **Second expression** - The right hand side. | ||
+ | * **Information** - By using the [[Table_control_button|Table control button]] you can display more columns that will help you document your model. | ||
+ | |||
+ | ===== Cyclic events ===== | ||
+ | |||
+ | Cyclic events should be modelled using [[time event|time event blocks]]. | ||
+ | |||
+ | |||
+ | ===== See also ===== | ||
+ | |||
+ | * [[Block|Blocks]] | ||
+ | * The [[Blocks_window|Blocks window]] | ||
+ | * The [[Matrix_window|Matrix window]] | ||
+ | * The [[Recorder|recorder]] block | ||
+ | * [[Expression_syntax|Expression syntax]] | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||