Modelling Hybrid systems - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

Modelling Hybrid systems

Description:

Standard/hysteresis Q overlap (Hys Q differ only if direction changes; only one ... Hysteresis provided more stable behavior (affect results in cells closer/farther ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 44
Provided by: gabriel65
Category:

less

Transcript and Presenter's Notes

Title: Modelling Hybrid systems


1
Modelling Hybrid systems
2
Hybrid Systems
  • Hybrid (combined) Modeling Framework
  • Use more than one formalism
  • Different formalisms to specify different levels
    of abstraction
  • Top-down design
  • step-wise refinement
  • Ex FSM Difference equationDesign and
    Implement the following waveform generator
  • ObservationPeriodic, say-tooth waveformTc
    Charging timeTd Discharging time
  • Top-Level Spec in FSMMltX, Y, S, ??, ?gtS
    Ch, DisX charge, dischargeY 0_to_V,
    V_to_0

V
Tc
Td
3
Example hierarchical control
  • Ex. Hierarchical control

Operator
Planning/scheduling
Event-based control
Discrete Event Controller
Supervisory control
Command
Discrete state
PID controller analog/digital
Time-based control
actuation
Sensor
Plant
4
Motivation
  • Continuous systems analysis
  • Different mathematical formalisms
  • Simulation solutions to particular problems
    under certain experimental conditions of
    interest
  • Classical methods for continuous systems
    simulation
  • Based on numerical approximation
  • Require time discretization gt of time
  • Inefficient in terms of execution times
  • Complex composition difficulties in integration,
    multiresolution models
  • Benefits of DEVS for continuous system MS
  • Discrete event models specification continuous
    time base
  • Execution time reduction
  • Complex system definition using hierarchical
    modular models
  • Easier integration with discrete-event models

5
GDEVS
  • Generalization of DEVS formalism
  • Polynomial of any degree to represent piecewise
    input-output trajectories
  • Introduction of a new event concept
    coefficient-events
  • Advantages of GDEVS
  • Greater accuracy for continuous systems
  • modeling
  • Piecewise linear trajectory specification
  • wltt0tngt ? A a trajectory on a continuous time
    base
  • finite set of instants ?t0, t1,,tn?
    associated with
  • constant pairs (ai bi) such that ?t ?
    ltti tjgt,
  • w(t) ai t bi, and
  • wltt0 tngt wltt0t1gtwltt1t2gtwlttn-1tngt

6
Quantized DEVS
  • Continuous signal represented by crossing of an
    equal spaced set of boundaries, separated by a
    quantum size
  • Check for boundary crossing for every change in
    the model
  • Outputs generated only when a crossing occurs
  • Substantial reduction of the message updates
    frequency

Signal Quantization
7
DEVS Quantized models
  • Crossings of an equal spaced set of boundaries
    quantum
  • Quantizer checks for boundary crossings.
  • The sender computes a value, and generates
    outputs.
  • The number of messages involved is reduced.
  • The quantizer consumes CPU time.
  • The receiver will have some error, depending on
    q.

8
Theoretical results on quantization
9
Q-DEVS with hysteresis
  • strong stability, convergence and error bound
    properties.
  • If signal changes direction use nQ size (proof
    n2 provides best results)
  • If signal keeps current direction use Q size

10
Bond Graphs Formalism
  • Exchange of energy and information between
    elements of a system can be represented in a
    graphical form
  • Energy is the fundamental feature that is
    exchanged between elements of a system during
    interaction
  • Constrained interactions in Bond Graphs are
    represented by junctions
  • constraint equalizes the flow in the elements
    1-junction
  • constraint equalizes the effort in the elements
    0-junction

11
Bond Graphs
  • Suitable for multiple domains electrical,
    mechanical, hydraulic, etc.
  • Physical processes vertices in a directed graph.
    Edges
  • represent ideal exchange of energy between
    components.
  • Interactions 0-junction (connectors), 1-junction
    (interactions between serial components).
  • Causality given a pair of elements connected
    through a bond, causality determine which
    component causes flow, which effort.

12
A library for Bond Graph development on DEVS
  • Model library modular approach to build systems
    code reuse
  • Bond Graph library built to model and simulate
    continuous systems on different domains
  • Library designed using GDEVS formalism concepts
  • BG components developed as atomic GDEVS models of
    degree one
  • Multicomponent systems can be built as coupled
    DEVS components
  • Models implemented using the CD tool

13
GDEVS Capacitor model
  • Equations
  • Flow arrives at component dext.
  • - Calculates effort integrate input flow data
    (generate Capacitors load).
  • - Value computed according to the elapsed time
    since last transition.
  • - Output function transmits the previously
    computed value yout.
  • - Internal transition computes next state





    using a polynomial
  • approximation.

External transition . . . // time since last
transition elapsedTimemsg.time().asMsecs()-
time // calculates load value c
ca1/2pow(elapsedTime,2)a0elapsedTime . .
. yout-gtupdElementAtPos(1, c)
yout-gtupdElementAtPos(2, a1/2dt
a0) holdIn( active, TimeZero ) Internal
transition // approximates load using order 1
polynomial. if ( a1 ! 0 ) // next state
calculated using coefficients c c
a1/2 pow(dt,2) a0dt a0 a1dt
a0 // coefficient values to send when dt
elapsed yout-gtupdElementAtPos
(1,c) yout-gtupdElementAtPos(2,a1/2dt
a0) holdIn(active, Time(dt)) else
passivate() // slope is null
14
BG library class hierarchy
15
Model execution examples
  • Electrical Circuit Simulation
  • Bond Graph model construction of the electrical
    circuit
  • Electrical circuit Bond Graph
    representation

16
Electrical circuit simulation
GDEVS Bond Graph model representation
17
Bond-Graph model simulation in CD
  • Resistance (R1)1
  • Inductors L1 48 L2 48.
  • Capacitance C 65.
  • Conductance R2 0.001
  • EffortSource emits pulses period 2500 ms
    duration 2 ms. Pulse amplitude 220 V

Circuit current
18
QDEVS based models
Uniform quantizer with hysteresis
Uniform quantizer
  • Hysteresis assures legitimate DEVS models
    simulation
  • Avoids infinite iterations on finite time interval

19
Model execution Comparing Quantizers
  • Uniform quantizer vs. HQ (Quantizer with
    hysteresis)
  • Test cases - Evaluation functions

20
Modelica
  • object-oriented language for modeling physical
    systems
  • designed to support library development and model
    exchange
  • Modelica supports different formalisms such as
  • ODEs
  • finite state automata
  • Petri nets
  • discrete events
  • bond graphs

21
Creating Models in Modelica/CD
Model circuit Modelica.Electrical.Analog.Sources.
SineVoltage V(V15,freqHz60) Modelica
.Electrical.Analog.Basic.Resistor
R1(R10) Modelica.Electrical.Analog.Basic.Ground
Gnd equation connect(V.p, R1.p)
connect(R1.n, V.n) connect(R1.n, Gnd.p) end
circuit1
22
M/CD Execution Example Modelica model
model circuit Modelica.Electrical.Analog.Sources.
PulseVoltage V(V10,width50,
period2.5) Modelica.Electrical.Analog.Basic.Resi
stor R1(R0.001) Modelica.Electrical.Analog.
Basic.Inductor I1(L500) Modelica.Electrical
.Analog.Basic.Inductor I2(L2000) Modelica.E
lectrical.Analog.Basic.Capacitor
C(C10) Modelica.Electrical.Analog.Basic.Resistor
R2(R1000) Modelica.Electrical.Analog.Basic
.Ground Gnd   equation connect(V.p, R1.p)
connect(R1.n, I1.p) connect(R1.n, I2.p)
connect(I2.n, C.p) connect(I2.n, R2.p)
connect(C.n, I1.n) connect(R2.n, C.n)
connect(I1.n, V.n) connect(V.n, Gnd.p) end
circuit
23
M/CD Execution Example The results
24
M/CD Execution Example The results
25
Cell-DEVS quantization
26
Quantized Cell-DEVS
  • Every cell includes a quantizer.
  • The value produced by the local computing
    function is quantized.
  • The quantized value is compared with the quantum
    threshold.
  • If the threshold bound was reached, an output is
    provided. The output is delayed using transport
    or inertial delays.
  • If the threshold was not reached, the change is
    not sent to other models.

27
Experimental results
(a) Heat diffusion two-dimensional model (10x10
cells). One "hot" cell. (b) Heat model with 87
of active cells. (c) Three-dimensional extension
of the previous model. (d) Three-dimensional
modification of the Life game (e) Four
dimensional extension of the previous model. (f)
Dynamic heat seeker a three dimensional model
consisting of two adjacent planes.
28
Number of messages involved
29
Number of messages involved
30
Execution times
31
Error behavior
  • e(Cc, i) accumulated error up to the i-th
    simulation step in cell Cc
  • Nc are the inputs of the cell c
  • tcj is the execution result of j-th step of the
    local computing function of cell c
  • q represents the quantized value of the last
    change.
  • Erros behavior f(x) axb

32
Error behavior
33
Cell-DEVS w/Dynamic Quantization
  • Reduce error (improving precision) in each cell.
  • Rationale active cell can appear as
    quiescent (Q size covering activity area). Q
    dynamically adjusted -gt smaller error.
  • Dynamic increase Q in cells with steep update
    functions execution improved at a low cost.
  • Strategy 1 reduce Q if cell's update does not
    cross threshold (increase precision).
  • Strategy 2 reduce Q if threshold is crossed
    (2nd chance in case of oscillations higher
    precision).

34
Test cases a heart tissue model
  • Heart muscle excitable responds to external
    stimuli by contracting muscular cells.
  • Equations defined by Hodgkin and Huxley

35
A Watershed model
36
Flow Injection Analysis Model
37
Performance analysis
  • Two metrics error, execution time
  • Non-quantized.
  • Standard quantization.
  • Quantization with hysteresis.
  • Dynamic quantization, strategy 1.
  • Dynamic quantization, strategy 2.

38
Heart Tissue model execution time
Str2 0.9
Str2 0.5
H, QDEVS
Str 2 0.05
Str 1 0.05
Str 1 0.5
Str 1 0.9
DEVS
Str1 reduce Q if not crossed Str2 reduce Q if
threshold crossed .
39
Heart tissue model error
DEVS
Str 1 .9
Str 2 .9
40
Discussion
  • Standard/hysteresis Q overlap (Hys Q differ only
    if direction changes only one during
    execution).
  • Str1 execution results better than Str2 and
    standard Q-DEVS (the larger the ratio, the
    better the result).
  • High adjust ratio, Q size adjusted very quickly.
  • Dynamic Q reduces amount of error obtained.
  • Str2 error not much improvement.
  • Number of messages is reduced up to a 99.95.

41
Watershed execution time
H, QDEVS
Str2 0.9
Str 2 0.05
Str 1 0.05
Str 1 0.9
DEVS
Str1 reduce Q if not crossed Str2 reduce Q if
threshold crossed .
42
Watershed error
Str 1 0.9/0.05
Str 2 0.9
Str 2 0.05
H, QDEVS
Str 1 0.9
43
Discussion
  • Pattern similar to Heart Tissue. Order of
    different strategies maintained, total error
    smaller.
  • q0.05, Q-DEVS better results (???). Dynamic
    versions -gt Cell increases 0.07 units in each
    update (oscillations around the function
    value).
  • Dynamic Q small cost in the extra execution
    overhead, reduce error (up to 75).
  • Str2 higher rate of reduction when compared to
    Str1. Much higher execution time.

44
FIA execution time
H Str 2 .5
Str 2 .5
QDEVS
H Str 1 .5
Str 1 .05
45
FIA cumulative error
Str 1 .05
H Str 1 .5
Str 2 .5
QDEVS
H Str 2 .5
Str1 reduce Q if not crossed Str2 reduce Q if
threshold crossed .
46
Discussion
  • Hysteresis provided more stable behavior (affect
    results in cells closer/farther from sample).
  • Execution time of Str2 with larger update ratio
    diverges. Str1 w/small update ratio improves
    overall execution time (it adjusts better
    to different values).
  • Simulations with the highest error rate best
    execution times, as expected. Nevertheless,
    amount of error obtained highly reduced at
    the cost of little overhead.
Write a Comment
User Comments (0)
About PowerShow.com