-
Notifications
You must be signed in to change notification settings - Fork 34
Event handling
This concerns the integration of system dynamics when the input is discontinuous. The integrators from SciPy (default RK45) is a variable step integrator, and it is possible that it can take a step over a change in input, say from a step generator, which will lead to an inaccurate solution.
More sophisticated integrators support the notion of events, specific times when there is a change in the input or the system, and the integrator pays attention to the solution around those points. For example:
- a survey of what's out there
- DifferentialEquation.jl, in Julia but callable from Python, see diffeqpy and details of event callbacks
- CVODE from the Sundials package via the FMPy
- port
odedc
from SciLab.
For bdsim
we use a simple workaround where the integration is performed in segments. From t=0 to t_1, then t_1 to t_2, t_2 to t_3, ... t_N-1 to t_N. Where t_i are event times. The blocks that currently support events are:
STEP
RAMP
PIECEWISE
-
WAVEFORM
for square and triangular waveforms
At simulation start the start
method of these blocks computes all the event times, times of discontinuities in their outputs, upto the maximum integration time and pushes them into a priority queue which is part of the simstate
object
sim state.declare_event(block, time)
The block
declaring the event is provided for debugging and possible future use.
The same mechanism is used to support integration of hybrid discrete-time systems.
Events can also be a function of state, but this is beyond the current simplistic implementation.
Copyright (c) Peter Corke 2020-23
- Home
- FAQ
- Changes
- Adding blocks
- Block path
- Connecting blocks
- Subsystems
- Compiling
- Running
- Runtime options
- Discrete-time blocks
- Figures
- Real time control
- PID control
- Coding patterns