11/24/2019
Ali M. Sahlodin
Department of Chemical Engineering
AmirKabir University of Technology
1397 S.H
Elements of hybrid models
Types of events and model switches
Event detection
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 2
1
11/24/2019
Event detection: confirm an event has occurred
in the past or current integration step
Event location: find the time of the event
What if multiple events occur in the same
integration step?
Find the earliest one
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 3
Event time: report the first point the event is detected.
Will not give the exact event time in general
Timing error: depending on step size
timing error
t*
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 4
2
11/24/2019
Multi-transition system
h=0.001
h=0.003
h=0.03
h=0.3
Sequence of modes is different for each step size!
different trajectories
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 5
Recall error estimate Err M || x n1 x (0)
n 1 || 1
Cuts steps until Err is less than the tolerance
time event approximated
x Trajectory after event
Trajectory before event
Corrector failure due to large Predictor polynomial
error estimates, resulting in
repeated step cuts
t* t
Cons
•Repeated corrector failures inefficiency issues
•Possibly total failure of the solver
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 6
3
11/24/2019
1. Lock the current mode until a successful integration
step is taken.
2. Check if the any state transition has occurred during
the previous step.
3. Find exact location of the event.
Trajectory after event
x
Trajectory
before event
Discontinuity locked
simulation
tk t* tk+1 t
Any assumption?
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 7
Zero-crossing of discontinuity function y,u, t ) 0
g (x, x,
x(t)
tk t* tk+1 t
g(t)
g (tk ) g (tk 1 ) 0
tk t* tk+1 t
Can this condition always detect the event(s)?
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 8
4
11/24/2019
Rudimentary Approach x(t)
1. Estimate event time tˆ* from the
values of g(t) at tk and tk+1.
*
2. Integrate from tk to tˆ .
*
3. Evaluate g (tˆ ) . tk t* tk+1 t
* * g(t)
4. If g (tˆ ) 0 , update tˆ . Go to
Step 2. Otherwise stop.
tk t* tk+1 t
Pro
•Useful when g(t) is not available in closed form.
Con
•Inefficient due to repeated integrations.
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 9
Root-finding with interpolating polynomials
Multistep methods (e.g., BDF)
y,u, t) = 0
f(x, x,
Interpolating polynomials x p (t ), x p (t ), y p (t )
Construct interpolating polynomial for discontinuity function
Newton method
p p p
g (x , x , y ,u, t ) 0 t*
Accuracy of the polynomial impacts accuracy of event location found.
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 10
5
11/24/2019
Improveaccuracy of the polynomial
Append discontinuity function to the DAE system
y,u(t ), t ) 0
f (x, x, Now under error control
z (t ) g (x, x,
y,u(t ), t ) mechanisms of solver
Any change in the DAE index?
Any impact on the DAE solution?
Solve z p (t ) 0
t [tk , tk 1 ] t*
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 11