User Tools

Site Tools


discrete_event

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
discrete_event [2020/10/12 16:30]
erik
discrete_event [2020/10/12 16:31] (current)
erik
Line 1: Line 1:
 ====== Discrete event ====== ====== Discrete event ======
  
-**Note:** Since release 7.1, there is a [[time event]] block which should be used for events that are time-related.+|**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. 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.
Line 64: Line 64:
 Cyclic events should be modelled using [[time event|time event blocks]]. Cyclic events should be modelled using [[time event|time event blocks]].
  
-<del>For recurring events, you do not need to create several discrete event blocks. By using a trick, it is possible to make an event trigger several times. A typical case is when an event should be triggered every year, month or day. 
- 
-During the simulation an event is triggered when the //sign// of the //difference// of the left hand side expression and the right hand side expression changes between two time points. In other words; for every time step taken, ''%%sign(leftexpression-rightexpression)%%'' will be checked. As explained in the introduction, when the sign changes the solver will backtrace to a time point when the two sides are equal. 
- 
-In the following example we will create an event that is trigged every month of the year. The simulation time unit is years. We need to construct expressions so that the left hand side is equal to the right hand side 12 times every year. 
- 
-One way to achieve this is to compare the two expressions ''%%time/12%%'' with ''%%round(time/12)%%''. The table below shows the value of the two over two years: 
- 
-^Time^time/12^round(time/12)^time/12-round(time/12)^ 
-|0,0 |0,0    |0,0           |**0,0**               | 
-|1,0 |0,1    |0,0           |0,                  | 
-|2,0 |0,2    |0,0           |0,                  | 
-|6,0 |0,5    |1,0           |-0,                 | 
-|12,0|1,   |1,0           |**0,0**               | 
-|13,0|1,   |1,0           |0,                  | 
-|18,0|1,   |2,0           |-0,                 | 
-|24,0|2,   |2,0           |**0,0**               | 
-|40,0|3,   |3,0           |0,                  | 
-|45,0|3,   |4,0           |-0,                 | 
- 
-{{:CyclicEvent.png|CyclicEvent.png}}</del> 
  
 ===== See also ===== ===== See also =====
discrete_event.1602513056.txt.gz ยท Last modified: 2020/10/12 16:30 by erik