Robust Initialization of Differential Algebraic Equations EOOLT'07 Berlin Peter Aronsson Peter Fritzson Bernhard Bachmann MathCore Engineering AB Linköping University Fachhochschule Bielefeld Linköping Linköping Bielefeld
Outline � Mathematical Formulation of Hybrid DAEs � Symbolic Transformation Steps � Initialization in Modelica (Conventional) � Higher-Index DAEs � System versus Component initialization � Example (3-Phase System) 2007-07-30 Robust Initialization of 2 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Mathematical Formalism General representation of hybrid DAEs: ( ) � = 0 f t x t , ( ), ( ), ( ), ( ), ( ), x t y t u t q t q ( ), ( ), t c t p e pre e e t time � x t ( ) vector of differentiated state variables x t ( ) vector of state variables y t ( ) vector of algebraic variables ( ) vector of input variables u t ( ), ( ) vectors of discrete variables q t q t e pre e c t ( ) vector of condition expressions e p vector of parameters and/or constants 2007-07-30 Robust Initialization of 3 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Numerical Aspects for Simulation (Explicit Euler Method) Integration of explicit ordinary differential equations (ODEs): ( ) � = = ( ) , ( ), ( ), , ( ) x t f t x t u t p x t x 0 0 Numerical approximation of the derivative Calculating an and/or right-hand-side: approximation of − x t ( ) x t ( ) ( ) x ( t n+ 1 ) based on the � + n 1 n ≈ ≈ ( ) , ( ), ( ), x t f t x t u t p n n n n − t t values of x ( t n ) + n 1 n Iteration scheme: Here: Explicit Euler ( ) ( ) ≈ + − ⋅ ( ) ( ) , ( ), ( ), x t x t t t f t x t u t p integration method + + n 1 n n 1 n n n n Convergence? 2007-07-30 Robust Initialization of 4 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Basic Transformation Steps Mathematical View Transformation to explicit state-space representation: ⎛ � ⎞ x t ( ) ( ) ( ) ⎜ ⎟ = = � z t ( ) g t x t u t , ( ), ( ), p = 0 f t x t , ( ), ( ), ( ), ( ), x t y t u t p y t ( ) ⎝ ⎠ ⎛ � ⎞ x t ( ) ( ) ( ) � = ⎜ = ⎟ = x t ( ) h t x t u t , ( ), ( ), p 0 f t z t , ( ), ( ), ( ), x t u t p , ( ) z t y t ( ) ⎝ ⎠ ( ) = y t ( ) k t x t u t , ( ), ( ), p Implicit function theorem: Necessary condition for the existence of the transformation is that the following matrix is regular at the point of interest: ⎛ ∂ ⎞ ≠ ( ) det ⎜ , ( ), ( ), ( ), ⎟ 0 f t z t x t u t p ⎝ ⎠ ∂ z 2007-07-30 Robust Initialization of 5 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Symbolic Transformation Algorithmic Steps ( ) � = 0 f t x t , ( ), ( ), ( ), ( ), x t y t u t p � Construct bipartite graph representation – Structural representation of the equation system ⎛ � ⎞ x t ( ) ( ) = ⎜ ⎟ � Solve the matching problem = 0 f t z t , ( ), ( ), ( ), x t u t p , ( ) z t y t ( ) ⎝ ⎠ – Assign to each variable exact one equation – Same number of equations and unknowns ⎛ � ⎞ x t ( ) ( ) ⎜ ⎟ = = z t ( ) g t x t u t , ( ), ( ), p � Construct a directed graph y t ( ) ⎝ ⎠ – Find sinks, sources and strong components – Sorting the equation system ( ) � = x t ( ) h t x t u t , ( ), ( ), p ( ) = y t ( ) k t x t u t , ( ), ( ), p 2007-07-30 Robust Initialization of 6 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Initialization of Dynamic Models Conventional � ( ) Initialization of “free” state variables � = 0 f t x t , ( ), ( ), ( ), ( ), x t y t u t p – Transformed DAE after index-reduction – States can be chosen at start time • same number of additional equations ⎛ � ⎞ x t ( ) and “free” states ( ) = ⎜ ⎟ = 0 f t z t , ( ), ( ), ( ), x t u t p , ( ) z t � y t ( ) Initialization of parameters ⎝ ⎠ – Determine parameter settings – Parameters can be calculated at start time ⎛ � ⎞ x t ( ) ( ) ⎜ ⎟ • same number of additional equations = = z t ( ) g t x t u t , ( ), ( ), p y t ( ) ⎝ ⎠ and “free” parameters � Initialization mechanism in Modelica – attribute start – initial equation section ( ) � = x t ( ) h t x t u t , ( ), ( ), p • attribute fixed for parameters ( ) = y t ( ) k t x t u t , ( ), ( ), p 2007-07-30 Robust Initialization of 7 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Example: 3-Phase Electrical System Steady-state initialization? - States I1.i, I2.i, I3.i are not constant! - Here: Initial values set to 0 (standard settings, attribute start ) - Transformation to rotating reference system necessary 2007-07-30 Robust Initialization of 8 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Example: 3-Phase Electrical System Park-Transformation to rotating reference system: - Write states as vector i_abc[3] = {I1.i, I2.i, I3.i} - Park-transformation to dq0-reference frame ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ π π 2 4 ( ) ω ω + ω + ⎜ ⎜ ⎟ ⎜ ⎟ ⎟ sin t sin t sin t ⎝ ⎠ ⎝ ⎠ 3 3 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎛ ⎞ ⎛ ⎞ π π 2 2 4 ( ) ⎜ ⎟ = ω ω + ω + ⎜ ⎟ ⎜ ⎟ P cos t cos t cos t ⎝ ⎠ ⎝ ⎠ ⎜ 3 3 ⎟ 3 ⎜ ⎟ ⎜ ⎟ 1 1 1 ⎜ ⎟ ⎜ 2 2 2 ⎟ ⎝ ⎠ = ⋅ i _ dq 0 P i _ abc 2007-07-30 Robust Initialization of 9 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Example: 3-Phase Electrical System Initialize States model Test3PhaseSystem parameter Real shift=0.4; Real i_abc[3]={I1.i,I2.i,I3.i}; Real i_dq0[3]; … initial equation der (i_dq0)={0,0,0}; equation … i_dq0 = P*i_abc; end Test3PhaseSystem Steady-state initialization: - Derivatives of i_dq0 are only introduced during initialization - Differentiation of i_dq0 = P*i_abc necessary - No higher-index problem 2007-07-30 Robust Initialization of 10 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Example: 3-Phase Electrical System Initialize Parameters model Test3PhaseSystem parameter Real shift(fixed=false,start=0.1); Real i_abc[3]={I1.i,I2.i,I3.i}, u_abc[3]={S1.v,S2.v,S3.v}; … initial equation der (i_dq0)={0,0,0}; power = -0.12865; equation … u_dq0 = P*u_abc; i_dq0 = P*i_abc; power = u_dq0*i_dq0; end Test3PhaseSystem Parameter initialization: - Non-linear equation, no unique solution power=u_dq0*i_dq0=-0.12865 - Attribute fixed (default true) - Attribute start ( default 0) 2007-07-30 Robust Initialization of 11 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Example: 3-Phase Electrical System Hierarchical Definition model LR … Real i_abc[3]={I1.i,I2.i,I3.i} Real i_dq0[3]=P*i_abc; initial equation der (i_dq0)={0,0,0}; equation … end LR Define new LR – Component: - States are LR1.I1.i, LR1.I2.i, LR1.I3.i - Connectors based on rotating reference system - Initial equations defined locally - no higher-index problem 2007-07-30 Robust Initialization of 12 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Higher-Index-DAEs General representation of DAEs: ( ) � = 0 f t , ( ), ( ), ( ), ( ), x t x t y t u t p t time � x t ( ) vector of differentiated state variables x t ( ) vector of state variables y t ( ) vector of algebraic variables u t ( ) vector of input variables v ector of parameters and/or constants p Differential index of a DAE: The minimal number of analytical differentiations of the equation system necessary to extract by algebraic manipulations an explicit ODE for all unknowns. 2007-07-30 Robust Initialization of 13 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Higher-Index-DAEs DAE with differential index 0: ( ) ( ) � � = 0 , ( ), ( ), ( ), = f t x t x t u t p x t ( ) g t x t u t , ( ), ( ), p DAE with differential index 1: ( ) � = 0 , ( ), ( ), ( ), ( ), f t x t x t y t u t p ( ) � = ( ) x t ( ) h t x t u t , ( ), ( ), p � = x t ( ) h t x t u t , ( ), ( ), p d ( ) ( ) � = = y t ( ) k t x t u t , ( ), ( ), p y t ( ) k t x t u t , ( ), ( ), p dt 2007-07-30 Robust Initialization of 14 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Higher Index Problems Structurally Singular Systems � Higher-index DAEs ( ) � = 0 f t x t , ( ), ( ), ( ), ( ), x t y t u t p – Differential index of a DAE – Structural singularity of the adjacence matrix – Index reduction method using symbolic ⎛ � ⎞ x t ( ) ( ) = ⎜ ⎟ differentiation of equations = 0 f t z t , ( ), ( ), ( ), x t u t p , ( ) z t y t ( ) ⎝ ⎠ � Numerical issues ⎛ � ⎞ x t ( ) – Consistent initialization ( ) ⎜ ⎟ = = z t ( ) g t x t u t , ( ), ( ), p y t ( ) ⎝ ⎠ – Drift phenomenon – Dummy derivative method � State selection mechanism in Modelica ( ) � = x t ( ) h t x t u t , ( ), ( ), p – Attribute StateSelect: ( ) = never, avoid, default, prefer, always y t ( ) k t x t u t , ( ), ( ), p 2007-07-30 Robust Initialization of 15 Differential Algebraic Equations B. Bachmann, P. Aronsson, P. Fritzson
Recommend
More recommend