Upload
vothien
View
221
Download
4
Embed Size (px)
Citation preview
1
The Creation of ASCEND, a Modeling System for Hard Science and
Engineering Problems
byArthur W. Westerberg
Dept. of Chemical Engineering andthe Institute for Complex Engineering Systems (ICES)
Carnegie Mellon UniversityPittsburgh, PA 15213
USA
*** Demo first ***
2
ASCEND• Why we developed ASCEND• Features of the ASCEND system
+ language+ solvers+ interactive user interface+ debugging aids
3
Modeling - general discussion• Modeling is a product design problem
+ Modeling is more than+ writing down some equations+ coding+ solving
• Modeling is hard+ Writing a correct model+ Writing a maintainable model: the issues of elegance
and reuse+ Correctly handling degrees of freedom+ Dealing with different ways models fail to converge+ Thou shalt not divide
4
AcknowledgementsPre ASCEND IIIDean BenjaminLarry Gaydos
ASCEND IIIPeter PielaTom EpperlyKarl WesterbergRoy McKelveyJoseph ZaherOliver SmithNeil Carlberg
ASCEND IVKirk AbbottBen AllanTom EpperlyRobert HussVicente Rico RamirezMark ThomasBoyd SafritKenneth Tyner
5
Why did we develop ASCEND?Because modeling is extremely hard.
+ Graduate students can take several months to over a year to develop what look like simple models
We want this process to take one tenth this time.
6
ASCEND related Ph.D. projects (date started)Approach: ask hard questions about modeling
• 1984: (Piela) Reduce modeling effort by order of magnitude• 1988: (Zaher) Formulate and solve regional models• 1991/2: (Abbott and Allan) Increase size of model we can
solve by order of magnitude (on same workstation)• 1992: (Allan) Give typical end user the possibility to reuse
complex models developed by others• 1993: (Rico-Ramirez) Continue work on regional models• 1993: (Tyner) Significantly improve solver reliability
7
Goals for ASCEND• To provide scientists and engineers with a modeling system
for very hard science and engineering problems• To be a modeling environment that pushes the limits of
what is possible
ASCEND: push on the edges to find out what is
possible
current modeling systems
8
What is the ASCEND system?• A modeling language• An interactive interface• A suite of solvers
Instance data-base
MODEL VLflash( feed WILL_BE stream; vap WILL_BE stream; liq WILL_BE stream; Qin WILL_BE energy_rate; equil WILL_BE boolean;)
Interface
Solvers
load and compile
9
Typical execution of an ASCEND model(Debugging aids at every step)
• Using editor, create text file containing model• Load text file• Compile instance of one of the types in the text file• Browse instance to examine it for correctness• Run methods belonging to model that prepare it for solving
(make it well-posed, establish initial values, establish scal-ing)
• Pass any part of model to solver• Solve• Browse instance to see results
11
Language (based on object-oriented princi-ples)
Elementary types
RealsBooleansIntegersSymbol
Sets
EquationsSparse associa-tive arrays (of any-thing)
WhenSelectLoopsModels/atomsMethods
12
Language conceptsPart/whole modeling to• control complexity
flowsheet
mixer reactor column splitter
feed recycle smr src dist prod bleed
tray1 tray2 trayN
V1 L1 V2 L2 LN-1
13
Sharing of parts to• configure complex models in a natural way• permit solving of isolated parts
mixer reactor column splitter
smr src dist
tray1 tray2
L1 V2
14
Parameterized types to
• allow sharing of parts• aid user to see exactly what must be defined to use this
model
MODEL VLflash( feed WILL_BE stream; vap WILL_BE stream; liq WILL_BE stream; Qin WILL_BE energy_rate; equil WILL_BE boolean;)
15
• allow modeler to supply constraints to the compiler to reduce misuse
WHERE( feed, vap, liq WILL_NOT_BE_THE_SAME; (feed.pd.phase_indicator IN ['V','L','VL','VLL']) == TRUE; (vap.pd.phase_indicator IN ['V']) == TRUE; (liq.pd.phase_indicator IN ['L']) == TRUE;);
16
Methods to• carry out pre- and post-processing of variable values• prepare model for solving (done recursively through all the
model parts): clear, specify (square yourself), values, scale
METHOD specify;RUN feed.specify;RUN vap.specify;RUN liq.specify;Qin.fixed := TRUE;RUN st.specify;
END specify;
17
or in pictures to illustrate recursive nature --
squareyourself
squareyourself
squareyourself
squareyourself
18
Very fast compile times
Approach• Analyze part/whole structure (a Directed Acyclic Graph
(DAG)) to discover unique equation types in model• Compile only each unique equation type• Equation instances become pointers to variables and type
We now compile at the rate of 120,000 equations/minute on 200 megahertz pentium PC
19
The DAG for a seven tray column
4 3 2
428431
4 3 3
416
4 1 9 4 2 2
4 7 0
271
5 0 2
503 515
5 2 0
519
5 2 1
5 0 65 0 9
5 2 7
2 7 8 3 1 0
5 3 4
3 4 1 5 3 05 3 3
5 3 5
5 4 1
3 5 2
3 5 4
3763 9 8353 401 4 0 5 4 0 8 4 3 6 524 537 540
5 5 1
550
554
5 6 1
5 6 0
5 6 7
572
5 7 1
5 7 3
3 7 4
5 8 3
5 5 3557 578 582
5 8 75 9 0 602
6 0 7
6 0 6
608
593 596
6 0 9
3 9 7
6 1 3
6 2 0
616 619
2 1
2 0
231
110 122 1 3 4 1 4 6 1 5 8 1 7 0 1 8 21 9 4 2 0 6 218 230
7 3 9 8256 269
3 1 1
318
317
3 2 4
3 3 0
3 2 93 3 63 4 0
3 4 22 3 314 3 4 7351
3 5 7 3693 7 3
375
3 6 0 3 6 3
3 8 0
3 8 7
3 8 3 3 8 6
3 9 0
3 9 3 3 9 6
767
7 7 3
6 9 9
7 0 3
725 7 3 7
7 6 3
7 0 0 7 3 97 4 2 766 769 7 7 2
7 8 3
782
786
7 9 3
792
799
804
803
805
723
8 1 5
7 8 5 7 8 9 8 1 0 8 1 4
8 1 7 8 1 9 8 3 1
8 3 6
8 3 5
8 3 7
8 2 2825
8 4 0 852
8 5 7
856
858
8 4 3 8 4 6
8 5 9
736
863
870
8 6 6 8 6 9
871
8 8 28 9 4
898
8 9 7
899
8858 8 8
9 0 3
7 2 4
9 0 9
8 1 6 8 7 3 876 9 0 2 9 0 5 9 0 86 2 1
6 3 0642
6 4 6
645
647
6 3 36 3 6
651
6 5 7
584 6 2 3626 650 6 5 3 6 5 6
6 6 7
6 6 6
670
6 7 7
6 7 6
6 8 3
6 8 8
6 8 7
6 8 96696 7 3 6 9 4 6 9 8
7 0 6 7 1 8 7 2 2
7 0 9 7 1 2
729
732 735
7 4 6758
762
761
749752
1 0 4 5
1 0 4 4
1051
1 0 5 6
1 0 5 5
1057
975
1 0 6 7
1 0 3 5
1038
1 0 3 7 1 0 4 1 1 0 6 2 1 0 6 6
1 0 7 1 1 0 7 4 1 0 8 6
1 0 9 1
1 0 9 0
1 0 9 2
1 0 7 7 1 0 8 0
1 0 9 3
9 8 8
1 0 9 7
1104
1 1 0 0 1103
1 1 0 5
1 1 1 4 1 1 2 6
1 1 3 0
1 1 2 9
1131
1117 1 1 2 0
1 1 3 5
9 7 6
1 1 4 1
1 0 6 8 1 1 0 7 1 1 1 0 1 1 3 4 1 1 3 7 1140
1 1 5 1
1150
1154
1 1 6 1
1160
1167
1172
1171
1 1 7 3
1 1 8 3
1 1 5 31 1 5 7 1 1 7 8 1 1 8 29 1 9
918
9 2 2
929
9 2 8
9 3 5
940
9 3 9
9 4 1
9 5 1
921 9 2 5 9 4 6 9 5 0
955 9 5 8 9 7 0 9 7 4
9 6 1 964
977
981
9 8 4987
9 8 9
9 9 8 1010
1014
1013
1 0 1 5
1 0 0 1 1004
1019
1 0 2 5
9 5 2 991 994 1 0 1 8 1 0 2 1 1 0 2 4
1 0 3 4
1 1 8 5
1186
1190
1 1 9 7
1193 1 1 9 6
1 1 9 8
1 2 1 4 1 2 2 6
1230
1229
1231
1217 1220
1268 1300
1 3 0 1 1 3 1 3
1 3 1 8
1 3 1 7
1 3 1 9
1 3 0 4 1 3 0 7
1 3 2 5
1 3 3 2
1 3 2 8 1 3 3 1
1 3 3 3
1341
1 1 8 4 1 2 0 0 1 2 0 3 1206 1 2 3 4 1 3 2 2 1 3 3 6 1 3 4 0
1 3 4 2
1 3 4 3
4 1 0
20
Why so fast?110,000 equations
DAG analysis
71 unique equation
types
Very compact, fast code rapidly
produced
Residual and Jacobian
evaluation
C-compiler(broken)
C-compiler
Compile to data structure
Very large data structure
21
Faster solve timesRequires• very fast residual and Jacobian evaluation
Residual evaluation is at 230,000 equations/second on 200 megahertz pentium PC
22
AND• faster factorization times for solving Newton equations
+ Very simple and fast global preordering algorithm - also based on analyzing DAG
=> Four columns with recycle: 83,000 equations (53,000 equation partition)
Preorder time - 15.5 secL/U factor time - 4 sec
Related to tearing in sequential modular
23
Kinds of solvers• Normal simulation (solve n equations in n unknowns) but
with bounds on variables (for example, to prevent mole fractions from being negative) - our solvers
• Optimization (using CONOPT, working on OPT)• Dynamic simulation (using LSODE)• Conditional models (Vicente Rico-Ramirez) -- is it a sub-
cooled liquid, two phase, three phase or a superheated vapor stream? - our solvers
24
Generation of output files for other solvers• Output for a GAMS model
Had following at one time and need to reimplement • Automatic generation of linearized mixed integer linear pro-
gram - as extended MPS input file
25
More on conditional modelsEquations defining model depend on where solutions occurs
Ex. “laminar vs. turbulent flow”• Language constructs (WHEN and SELECT)
+ Replace/drop model parts (e.g., in superstructure opti-mization) based on value of discrete variable
m1
m2
p1
p2
26
• New regional model solvers (including optimization)+ Based on complementarity formulations
=> formulations by others are incomplete and allow spurious solutions
+ Based on boundary crossing=> Newton/gradient based method to cross bound-
aries mid-iteration -- steps over boundaries without region convergence
35
And many other such tools• Browse to see if configured correctly• Find within any part variables eligible to be fixed• Send any part to solver to be solved• Ask if any part is numerically singular -- answer indicates
which (if any) equations are locally dependent in their lin-earized form
• Find all variables which are close to their bounds• List all variables which are currently fixed within any part• List the equations for any part• List the variables for any part
36
And tools to aid in solving numerically hard problems• Send any sequence of parts to solver to be solved one at a
time• Recompute model scaling (send “rescale yourself” mes-
sage to instance)• Change value for variable that picks which form of model is
active• Change type of a part to be more refined -- causes compiler
to restart and incrementally compile in the refinements