This example shows how to model a non-periodic synchronous sampled data systems
with the Modelica_Synchronous library
. This is demonstrated at hand
of a closed-loop throttle control synchronized to the crankshaft angle of an
internal combustion engine. This system has the following properties:
The complete system is shown in figure below (diagram-layer):
Block speedControl
is the discrete control system. The boundaries
of this controller are defined by sample1
, sample2
and
hold1
. The sampling is done via rotationalClock
, an
event-based clock that ticks every 180° rotation of the crankshaft angle. The
speed controller therefore is automatically executed every half-rotation of the
engine's crankshaft. To produce respective clock ticks,
rotationalClock
bookeeps the angular of the last time a half-rotation of
the crankshaft has been recognized (angular_offset
). Given
angular_offset
, the event-condition for half-rotations is:
abs(angle - angular_offset) >= abs(trigger_interval)
with trigger_interval = 180°
. The model of
rotationalClock
therefore is (diagram-layer):
In the end, rotationalClock
samples it's own input angle to bookeep
an offset used to decide when to tick; the clock's event condition depends on
the state present when the condition changed last time from beeing non-satisfied
to beeing satisfied, i.e., the state when the clock last ticked.