tutorials:ode-framework
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tutorials:ode-framework [2025/07/25 12:57] – Tim | tutorials:ode-framework [2025/07/25 14:13] (current) – Tim | ||
---|---|---|---|
Line 107: | Line 107: | ||
] | ] | ||
</ | </ | ||
+ | |||
+ | ===== monitorPeriodic ===== | ||
+ | |||
+ | Trigger an event in regular intervals and call the event handler. The event handler must not modify the graph. | ||
+ | |||
+ | This allows to keep track of the changes for example: | ||
+ | < | ||
+ | import static java.lang.Math.*; | ||
+ | DatasetRef data = new DatasetRef(" | ||
+ | const double PERIOD = 1.0; | ||
+ | double t; | ||
+ | double x; | ||
+ | protected void init () | ||
+ | { | ||
+ | data.clear().setColumnKey(0, | ||
+ | chart(data, XY_PLOT); | ||
+ | t = 0; | ||
+ | x = 1; | ||
+ | data.addRow().setX(0, | ||
+ | } | ||
+ | public void run () | ||
+ | { | ||
+ | monitorPeriodic(1, | ||
+ | public void run() { data.addRow().setX(0, | ||
+ | }); | ||
+ | |||
+ | integrate(10); | ||
+ | } | ||
+ | protected void getRate() | ||
+ | { | ||
+ | t :'= 1; | ||
+ | x :'= 0.1 * x; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ |
tutorials/ode-framework.txt · Last modified: 2025/07/25 14:13 by Tim