03a - initialization
Post on 04-Jun-2018
254 Views
Preview:
TRANSCRIPT
-
8/13/2019 03a - Initialization
1/23
Initialization of Thermofluid modelsInitialization of Thermofluid models
Francesco CasellaFrancesco Casella(francesco.casella@polimi.it)(francesco.casella@polimi.it)
Dipartimento di Elettronica e InformazioneDipartimento di Elettronica e Informazione
Politecnico di MilanoPolitecnico di Milano
-
8/13/2019 03a - Initialization
2/23
2
Introduction
Initialization is critical for models with dynamics
solution of ODE/DE depends on initial conditions
if consistent initial conditions cannot !e found" the model is useless
#hermofluid models often stron$ly nonlinear
%teady&state initialization in'ol'es sol'in$ lar$e" stron$ly nonlinear
systems of e(uations
sensiti'ity to initial $uess 'alues
sensiti'ity to selection of iteration 'aria!les
tracin$ root of pro!lem difficult
$uess 'alues)
errors in the model *e+$+ wron$ parameters,)
#rou!leshootin$ is not user friendly
understandin$ of the sym!olic/numeric methods understandin$ the e(uations of the ori$inal model *not encrypted-,
e(uations are rearran$ed / sym!olically sol'ed
no a'alia!le Modelica tool currently $i'es user friendly .I support
unpredicta!le time&to&$o
-
8/13/2019 03a - Initialization
3/23
3
Specifying initial conditions - defaults
Each 'aria!le in Modelica has a startattri!ute
0y default" Modelica tools use start 'alues to assi$n initial 'alues to state
'aria!les
It is possi!le to lo$ these additional initial e(uations*%imulation 1 %etup 1 #ranslation 1 2o$ selected default initial conditions,
modelSimpleSystem
parameterTime tau;
parameterReal x_start = 2; Real x(start = x_start); Real u;equation
u = if time < 1 then 1 else 2;
tau * der(x) = - x^2 + u;endSimpleSystem
-
8/13/2019 03a - Initialization
4/23
4
Specifying initial conditions fixed attribute
%ettin$ the fi3ed attri!ute to true one indicates e3plicitly that the initial
'alue of the 'aria!le is the initial 'alue
modelSimpleSystem2
parameterTime tau;
parameterReal x_start = 2; Real x(start = x_start fixe! = true); Real y;
Real u;equation
u = if time < 1 then 1 else 2;
tau * der(x) = - x^2 + u; y = "*x^2;endSimpleSystem2
-
8/13/2019 03a - Initialization
5/23
5
Specifying initial conditions initial equations
In Modelica 4+3" initialiation was mainly thou$ht as a tool issue
Dymola had a run&time interface to specify initial conditions a define free
and fi3ed 'aria!les *usin$ data from fi3ed and start attri!utes,
%ince Modelica 5+6 *5665,7 e3plict initial e(uations with ar!itrary structure
*the old fi3ed 8 true mechanism is still a'aila!le,
Initial e(uations are com!ined with dynamic e(uations
9onlinear sol'ers use start attri!ute for $uess 'alues
modelSimpleSystem
parameterTime tau;
parameterReal x_start = 2; Real x(start = x_start); Real y; Real u;equation
u = if time < 1 then 1 else 2;
tau * der(x) = - x^2 + u; y = "*x^2;initial equation
x = x_start;endSimpleSystem
modelSimpleSystem
parameterTime tau;
parameterReal x_start = 2; Real x(start = x_start); Real y; Real u;equation
u = if time < 1 then 1 else 2;
tau * der(x) = - x^2 + u; y = "*x^2;initial equation
der(x) = #;
endSimpleSystem
-
8/13/2019 03a - Initialization
6/23
6
Specifying initial conditions Unknown parameters
Parameters can !e freed and determined !y further initial e(uations
*!eware of initial e(uation count+++,
Fi3ed attri!utes can !e chan$ed at instantiation
*%how Component feature in the Dymola .I,
modelSimpleSystem
parameterTime tau;
parameterReal x_start = 2;
parameterReal y_start = 1#;
parameterReal u_start(fixe! = false start = 2); Real x(start = x_start); Real y;
Real u;equation
u = if time < 1 then u_start else u_start + 1;
tau * der(x) = - x^2 + u; y = "*x^2;initial equation
der(x) = #; y = y_start;endSimpleSystem
System S(u_start(start = 2 fixe! = false) y(start = " fixe! = true));
-
8/13/2019 03a - Initialization
7/237
eaningful initial conditions for thermofluid systems
In some cases" the initial state of a thermofluid system
con'eniently e3pressed !y $i'in$ the 'alues of initial states
E3ample7 direct steam $eneration solar plant :ust !efore dawn temperature distri!ution in the collector pipes 8 am!ient temperature
$i'en temperatures in the stora$e 'olumes"
dependin$ on len$th of shutdown period
zero *or ne$li$i!le, flows *!eware of sin$ular conditions,
In other conte3ts" startin$ from an ;off&state< is pro!lematic/not re(uired
E3ample7 power plant model for load chan$e or primary fre(uency
studies
ran$e of 'alidity =6&466>
pipin$ and instrumentation for startup not included in the model
*tur!ine !ypass systems" steam 'ents" etc+,
In these cases" the typical transient is the response to a distur!ance
startin$ from an e(uili!rium state *steady&state,
Fi3in$ appro3imated initial states can lead to unphysical transients
out&of&ran$e mass ? heat flow 'alues
flow re'ersal
trip conditions +++
-
8/13/2019 03a - Initialization
8/238
!uick re"iew of odelica model transformations
%teps of model transformation
flattenin$
inde3 reduction
elimination of tri'ial e(uations / alias 'aria!les
02# transformation
dynamic pro!lem e(uations *initial 'alues and parameters,
initialization pro!lem *deri'ati'es" al$e!raic 'aria!les,
#earin$ applied to implicit systems of e(uations to reduce the num!erof iteration 'aria!les
E(uations sol'ed as e3plicit assi$nments @ no pro!lem
Implicit linear e(uations @ sol'ed without pro!lem if non&sin$ular
Implicit nonlinear e(uations @ iterati'e methods @ reasona!le $uesses
re(uired for the iteration 'aria!les
.uess 'alues pro'ided in Modelica !y start attri!utes
defined !y types
defined !y modifiers in li!rary models" possi!ly throu$h parameters
defined !y direct modifiers on the simulation model
-
8/13/2019 03a - Initialization
9/239
!uick re"iew of odelica model transformations #cont$d%
.uess 'alues pro'ided in Modelica !y start attri!utes
Defined !y types
Defined !y modifiers in li!rary models" possi!ly throu$h parameters
Defined !y direct modifiers on the simulation model
type Temperature = Real(unit = $%$ start = "##);
S&'ressure p_start;
S&'ressure p(start = p_start);
modellantithStartttriutes
extendslant(
turine(p_in(start = 1'2,e)) !rum.(p(start = 1'"2e)));endlantithStartttriutes;
S&'ressure p_start;
S&'ressure p(start = p_start);
-
8/13/2019 03a - Initialization
10/23
10
Tearing & 'lias "ariables
small fraction of model 'aria!les re(uire a $uess 'alue to ensure sol'er
con'er$ence
AB6> alias 'aria!les *3 8 y,
A=6> assi$ned in assi$nment section of torn systems
%election of alias and iteration 'aria!les in torn systems not uni(ue-
lias 'aria!le selection in Dymola7
hi$hest priority to direct modifiers"
intermediate priority to modifiers in li!raries
lowest priority to type&defined start 'alues
#earin$ 'aria!le selection
optimal selection7 9P&complete pro!lem
proprietary heuristics
chan$es w/ small modifications of model
chan$es w/ tool 'ersion
9ot really o!:ect oriented-
-
8/13/2019 03a - Initialization
11/23
11
Understanding initialization failures in (ymola
Interacti'e demo
dsmodel+mof7 how to $enerate" how to read
dslo$+t3t7 how to $enerate" how to read
-
8/13/2019 03a - Initialization
12/23
12
Strategies for steady-state initialization
Di'ide and con(uer
!rea plant in smaller modules
initialize each model w/ suita!le !oundaries
mae sure each model is correctly parameterized
Chec dsmodel+mof/dslo$+t3t and impro'e start 'alues
Fi3 initial states" run transient until e(uili!rium
re(uires asymptotically sta!le e(uili!rium
*if not" use simple feed!ac controllers to sta!ilize,
transient mi$ht $o wron$ !ecause of a!normal mass and ener$y
flows due to unphisical 'alues of initial states
e3ample7 e'aporator with hi$h heat transfer coefficient
small error in delta fluid&wall @ lar$e error in heat flow @
condensation/e'aporation @ !ad flow rates *possi!ly flow re'ersal,
Important remar7 if the parametrization of the model is incorrect"
a steady&state solution mi$ht not e3ist-
-
8/13/2019 03a - Initialization
13/23
13
'n example of model without steady-state solution
9atural circulation steam $enerator
9ominal operatin$ data7
drum pressure 45 !ar
feedwater pressure 4= !ar
steam 'al'e outlet pressure 6 !ar
power from flue $as7 466 MG
steam flow7 H6 $/s
%team flow rate rou$hly proportional tosteam 'al'e C' and drum pressure
ssume now C' is :ust 46> smaller than
the correct 'alue
in order to e'acuate H6 $/s
drum pressure should !e 46 !ar
feedwater cannot flow from source at lower pressure-
%olution does not e3ist-
-
8/13/2019 03a - Initialization
14/23
14
Troubleshooting
%et initial 'alues of pressures and
enthalpies close enou$h to nominal
operatin$ point #he system has an asymptotically sta!le
e(uili!rium thans to le'el controller
%tart the simulation
Drum pressure increases steadily
%team flow JJ feedwater flow
#oo small steam 'al'e
Increase steam 'al'e C'
#o find the correct C'7
set C'*fi3ed 8 false,
set steamKflow*start 8 H6" fi3ed 8 true,
-
8/13/2019 03a - Initialization
15/23
15
)omotopy-based initialization* oti"ations
%ettin$ start 'alues
tedious
selection of iteration 'aria!les can chan$e
how to determine $ood enou$h 'alues)
not o!:ect oriented
not ro!ust
re(uires hi$h&end sills to trou!leshoot models
more ro!ust method re(uired
$uarantee con'er$ence
use only well&nown desi$n data
reasona!le defaults for iteration 'aria!les
no need of directly settin$ start 'alues o!:ect&oriented
Lomotopy&!ased initialization
-
8/13/2019 03a - Initialization
16/23
16
)omotopy-based initialization* basic ideas
%implified pro!lem sol'ed first
same 'aria!les" sli$htly modified e(uations
close enou$h to the actual one
steady&state *otherwise structure can chan$e too much-,
simpler to sol'e *;less nonlinar< @ less sensisti'e to $uess 'alues,
$uess 'alues possi!ly pro'ided !y default
%ol'e con'e3 com!ination of simplified and actual pro!lem
Ca'eat7 the pro!lem chan$es continuously" the solution mi$ht not turnin$ points *can !e handled !y
specialized sol'ers,
asymptotes *failure,
!ifurcations *re(uires interaction
with e3pert user,
%pecification in Modelica =+57
homotopy operator
h/m/t/py(a0tual simplifie!)
durin$ solution of initialization returns
actual N *4 )simplified
-
8/13/2019 03a - Initialization
17/23
17
Simplified models for thermofluid systems
2inear momentum !alance e(uations with constant coefficients !ased on
nominal operatin$ point
pressure loss components
static head term
steam tur!ine
pump7 linearized characteristic around nominal operatin$ point
ressure l/ss 0/mp/nent
pin - p/ut = homotopy(sm//th(1 %f*suareRe3(44n/m*4nf))rh/ !pn/m4n/m*4) 56l/4 0hara0teristi0s5;
7al8e f/r in0/mpressile flui!4 = homotopy(6l/49har(theta)*8*srt(rh/)*srtR(!p) thetathetan/m*4n/m!pn/m*!p);
ump
function!f_! = der(fl/49hara0teristi0 _fl/4);hea! = homotopy( (nn#)^2*fl/49har(*n#(n+n_eps)) !f_!(#)*(-#) + (2n#*fl/49har(#) - #n#*!f_!(#))*(n-n#) + hea!#);
Turine4 = homotopy(%t*partialr0*srt(p_in*rh/_in))*srtRe3(1-(1R)^2) 4n/mpn/m*p_in);
-
8/13/2019 03a - Initialization
18/23
18
Simplified models for thermofluid systems #cont$d%
Ener$y !alance e(uation7 nonlinear wh terms
use nominal flow rate for ener$y !alance in 4D models for heat
e3chan$ers $ets rid of most wh terms in a typical model
pstream specific enthalpy dependin$ on flow direction
assume desi$n direction of flow
Flow&dependent heat transfer coefficients
assume nominal h+t+c+ 'alue
#emperature&specific enthalpy relationship 9ot too nonlinear in most cases *sa'e phase chan$es,
Do not chan$e *difficult to mae it consistent across models,
%et rou$h start 'alues
li(uid / two&phase / 'apour for water
within 466&566 for ideal $ases
hi = homotopy(if n/t all/46l/4Re8ersal then inStream(inlet'h_/utfl/4) else a0tualStream(inlet'h_/utfl/4) inStream(inlet'h_/utfl/4));
4all'3amma: = h/m/t/py(3amma_n/m*n/8ent(as(infl'm_fl/44n/m)^>4) 3amma_n/m);
-
8/13/2019 03a - Initialization
19/23
19
Simplified models for thermofluid systems #cont$d%
Controllers actin$ on flows and controllin$ ener$y&related (uantities
may introduce stron$ nonlinear couplin$ !etween hydraulic and
thermal e(uations simplified model7 eep control 'aria!le fi3ed at nominal 'alue
*opened feed!ac loop,
Controllers with saturations and anti&windup
%aturations are stron$ nonlinearities
If nown to !e in linear re$ime7 remo'e saturations
Else7 fi3 at 6> or 466>
Control 'al'es
ssume flow is nominal flow openin$
*re$ardless of density and pressure drop,
Initialization not at nominal operatin$ point
%implified model has all setpoints at nominal 'alues
Lomotopy !rin$s the setpoints to the desired 'alue
Different from rela3ation transient7 (uasi&static transformation
*less pro!lems if initial $uess not accurate no weird transients,
-
8/13/2019 03a - Initialization
20/23
20
+erforming the homotopy transformation
%uita!le continuation sol'ers can !e used
can trac turnin$ points
efficient interpolation&e3trapolation
Ideally
no turnin$ points
no other sin$ularities
%in$ularities mi$ht arise if wron$ parametrization
split system into su!systems
di'ide and con(uer
-
8/13/2019 03a - Initialization
21/23
21
)omotopy-based initialization* tool support
%uccessful e3periments at Politecnico and EDF
e3perimental sol'er lined to Dymola
!y M+%ielemann" !ased on 9O/2OC sol'er
definitely not user&friendly
%mall&size use cases
multi!ody systems with multiple steady&state confi$urations analo$ electronic circuits
hydrauliccircuits
air conditionin$ systems
2ar$e&sized use cases
complete com!ined&cycle power plant models
up to B6 iteration 'aria!les *-,
no need of manual settin$ of start 'alues
Preliminary implementation in Dymola + *not $ood enou$h yet,
Lopefully a'aila!le soon as standard feature in all Modelica tools
-
8/13/2019 03a - Initialization
22/23
22
DI%C%%IO9
-
8/13/2019 03a - Initialization
23/23
23
,eferences
M+ %ielemann" F+ Casella" M+ Otter" C+ Clauss" Q+ E!orn" %+E+ Mattsson"
L+ Olsson7 Ro!ust Initialization of Differential&l$e!raic E(uations sin$
Lomotopy+ Proceedin$s of HthInternational Modelica Conference"Dresden" .ermany" 56&55 March 5644+
F+ Casella" M+ %ielemann" 2+ %a'oldelli7 %teady&state Initialization of
O!:ect&Oriented #hermo&Fluid Models !y Lomotopy Methods"
Proceedin$s of HthInternational Modelica Conference" Dresden"
.ermany" 56&55 March 5644+
top related