0% found this document useful (0 votes)
31 views23 pages

03a - Initialization

This document discusses initialization of thermofluid models. Initialization is critical for models with dynamics, as the solution depends on the initial conditions. Thermofluid models are often strongly nonlinear, making steady-state initialization challenging due to sensitivity to initial guesses and parameter values. Specifying meaningful initial conditions for thermofluid systems can be difficult. The document reviews various Modelica features for specifying initial conditions like start attributes, fixed attributes, and initial equations. It also discusses tearing of equations, alias variables, troubleshooting initialization failures, and strategies like decomposition, checking logs, fixing initial states, and homotopy-based initialization.

Uploaded by

Hassan Ali
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views23 pages

03a - Initialization

This document discusses initialization of thermofluid models. Initialization is critical for models with dynamics, as the solution depends on the initial conditions. Thermofluid models are often strongly nonlinear, making steady-state initialization challenging due to sensitivity to initial guesses and parameter values. Specifying meaningful initial conditions for thermofluid systems can be difficult. The document reviews various Modelica features for specifying initial conditions like start attributes, fixed attributes, and initial equations. It also discusses tearing of equations, alias variables, troubleshooting initialization failures, and strategies like decomposition, checking logs, fixing initial states, and homotopy-based initialization.

Uploaded by

Hassan Ali
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Initialization of Thermofluid models

Francesco Casella
([email protected])

Dipartimento di Elettronica e Informazione

Politecnico di Milano

Introduction
Initialization is critical for models with dynamics
solution of ODE/D E 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
2

Specifying initial conditions - defaults


Each 'aria!le in Modelica has a start attri!ute
model SimpleSystem parameter Time tau; parameter Real 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; end SimpleSystem

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,

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

model SimpleSystem2 parameter Time tau; parameter Real 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; end SimpleSystem2

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,
model SimpleSystem parameter Time tau; parameter Real 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) = #; end SimpleSystem

model SimpleSystem parameter Time tau; parameter Real 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; end SimpleSystem

Initial e(uations are com!ined with dynamic e(uations 9onlinear sol'ers use start attri!ute for $uess 'alues
5

Specifying initial conditions Unknown parameters


Parameters can !e freed and determined !y further initial e(uations *!eware of initial e(uation count+++,
model SimpleSystem parameter Time tau; parameter Real x_start = 2; parameter Real y_start = 1#; parameter Real 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; end SimpleSystem

Fi3ed attri!utes can !e chan$ed at instantiation *%how Component feature in the Dymola ./I,
System S(u_start(start = 2 fixe! = false) y(start = " fixe! = true));
6

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 +++

!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!er of 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

!uick re"iew of

odelica model transformations #cont$d%

.uess 'alues pro'ided in Modelica !y start attri!utes Defined !y types


type Temperature = Real(unit = $%$ start = "##);

Defined !y modifiers in li!rary models" possi!ly throu$h parameters


S&'(ressure p_start; S&'(ressure p(start = p_start);

Defined !y direct modifiers on the simulation model


model (lant)ithStart*ttri+utes extends (lant( tur+ine(p_in(start = 1'2,e-)) !rum.((p(start = 1'"2e-))); end (lant)ithStart*ttri+utes;

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 C y, A=6> assi$ned in assi$nment section of torn systems %election of alias and iteration 'aria!les in torn systems not uni(uelias '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 oriented10

Understanding initialization failures in (ymola


Interacti'e demo dsmodel+mof7 how to $enerate" how to read dslo$+t3t7 how to $enerate" how to read

11

Strategies for steady-state initialization


Di'ide and con(uer
!reaD plant in smaller modules initialize each model w/ suita!le !oundaries maDe sure each model is correctly parameterized

ChecD 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!acD 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 remarD7 if the parametrization of the model is incorrect" a steady&state solution mi$ht not e3ist12

'n example of model without steady-state solution


9atural circulation steam $enerator 9ominal operatin$ data7
drum pressure 45E !ar feedwater pressure 4=E !ar steam 'al'e outlet pressure F6 !ar power from flue $as7 466 MG steam flow7 H6 D$/s

%team flow rate rou$hly proportional to steam 'al'e C' and drum pressure ssume now C' is :ust 46> smaller than the correct 'alue
in order to e'acuate H6 D$/s drum pressure should !e 4I6 !ar feedwater cannot flow from source at lower pressure-

%olution does not e3ist-

13

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 thanDs 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,

14

)omotopy-based initialization*
%ettin$ start 'alues

oti"ations

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 sDills to trou!leshoot models

more ro!ust method re(uired


$uarantee con'er$ence use only well&Dnown desi$n data reasona!le defaults for iteration 'aria!les no need of directly settin$ start 'alues o!:ect&oriented

Lomotopy&!ased initialization
15

)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 Mactual N *4 ) Msimplified
16

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

11 (ressure l/ss 0/mp/nent pin - p/ut = homotopy(sm//th(1 %f*s2uareRe3(4 4n/m*4nf))1rh/ !pn/m14n/m*4) 56l/4 0hara0teristi0s5; 11 7al8e f/r in0/mpressi+le flui! 4 = homotopy(6l/49har(theta)**8*s2rt(rh/)*s2rtR(!p) theta1thetan/m*4n/m1!pn/m*!p); 11 (ump function !f_!2 = der(fl/49hara0teristi0 2_fl/4); hea! = homotopy( (n1n#)^2*fl/49har(2*n#1(n+n_eps)) !f_!2(2#)*(2-2#) + (21n#*fl/49har(2#) - 2#1n#*!f_!2(2#))*(n-n#) + hea!#); 11 Tur+ine 4 = homotopy(%t*partial*r0*s2rt(p_in*rh/_in))*s2rtRe3(1-(11(R)^2) 4n/m1pn/m*p_in);
17

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
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));

Flow&dependent heat transfer coefficients


assume nominal h+t+c+ 'alue
4all'3amma:;< = h/m/t/py(3amma_n/m*n/=8ent(a+s(infl'm_fl/414n/m)^>4) 3amma_n/m);

#emperature&specific enthalpy relationship


9ot too nonlinear in most cases *sa'e phase chan$es, Do not chan$e *difficult to maDe it consistent across models, %et rou$h start 'alues
li(uid / two&phase / 'apour for water within 466&566 O for ideal $ases
18

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 Deep control 'aria!le fi3ed at nominal 'alue *opened feed!acD loop,

Controllers with saturations and anti&windup


%aturations are stron$ nonlinearities If Dnown to !e in linear re$ime7 remo'e saturations Else7 fi3 at 6> or 466>

Control 'al'es
ssume flow is nominal flow M 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,

19

+erforming the homotopy transformation


%uita!le continuation sol'ers can !e used
can tracD 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

20

)omotopy-based initialization* tool support


%uccessful e3periments at Politecnico and EDF
e3perimental sol'er linDed to Dymola !y M+%ielemann" !ased on 9OP/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 BE6 iteration 'aria!les *-, no need of manual settin$ of start 'alues

Preliminary implementation in Dymola E+F *not $ood enou$h yet, Lopefully a'aila!le soon as standard feature in all Modelica tools
21

DI%C/%%IO9

22

,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 Hth International 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 Hth International Modelica Conference" Dresden" .ermany" 56&55 March 5644+

23

You might also like