Computer Aided Modeling Tool - ModDev Rafiqul Gani CAPEC Department of Chemical Engineering, Technical University of Denmark, DK-2800 Lyngby, Denmark. C A P E C
Dec 21, 2015
Computer Aided Modeling Tool - ModDev
Rafiqul Gani
CAPECDepartment of Chemical Engineering,
Technical University of Denmark,
DK-2800 Lyngby, Denmark.
C A P E C
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
2
Purpose of ModDev
• Derive the model equations• Analyze model equations
• Implement the model equations and integrate them to an existing simulator
MODELS
MATHEMATICALMODELS
PROCESS MODELS
A computer aided system assists the user in performing the above tasks
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
3
Modelling Steps
Mathematicalmodel
Decomposition
AggregationBuilding block
Decomposition, creation, aggregation
* Balance Equations
*Constraint Equations
*Constitutive Equations
4
Model Objects (Building Blocks)
Balance Population
Basic
Moment
Constraints
Closure
Equilibrium
Boundary
Mathematical
Constitutive
Rate
Thermodynamic
Balance correlations
Micro. with efficient coefficients
Microscopic balance equations
Macroscopic balance equations
Microscopic population equation
Macroscopic population equation
Microscopic moment equation
Macroscopic moment equation
Component sum
Volume sum
Phase
Homogeneous
Heterogeneous
Optimization
Control
Generation
Transport
Balance correlations
Capital
Can be transferred intobalance equations for otherextensive quantities bysymbolic manipulation
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
5
Process-Model Relation
Each process building block is represented by a set of control shells (with defined boundaries) and connections
AccumulationIn Out
Control ShellStream
Generic building blocks
Variable type Model
Fundamental building blocks
Shell Connection
Stream Shell-connection(a) (b)
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
6
Model Generation
Each control shell & connection is associated to a set of model (fundamental) building blocks
Each model building block is either represented by a Reference Model or a generic (Created Model)
building block
Model equations available in the knowledge base
Model equations not available in the
knowledge base
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
7
Control shellsTo model the various type of processes, the control shell must be
defined such that the partial gradients (with respect to T, P and fI ) within the boundaries are either:
• Negligible• Incorporated in an interface or overall flux model• Dependent on some product specification (design)
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
9
Integrated Computer Aided System - ICAS
• ICAS is a collection of tools which have been integrated to solve various CAPE problems in an
integrated manner
• ModDev is a toolbox within ICAS
10EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
Balance EquationsBalance Equations
Constraint EquationsConstraint Equations
Constitutive relationsConstitutive relations
LinearizationLinearization
ReductionReduction
IdentificationIdentification
MANAGER
Model Equations Adaptation
AE / ODE / DAEAE / ODE / DAE
PDEPDE
LP / NLPLP / NLP
MILP / MINLPMILP / MINLP
Solvers
Degrees of FreedomDegrees of Freedom
Index / Sparse PatternIndex / Sparse Pattern
Partitioning / OrderingPartitioning / Ordering
Analysis
FlowsheetComponents / ReactionsUnits of MeasureConstitutive ModelsWhat to SolveMethod of SolutionSet/Initialize VariablesOutput (Detail/Form)
PROBLEM DEFINITION
ADD TO THE SYSTEM
TOOL BOXES
ICAS
DATABANKS
New Models(Model Generation)
New Models(Model Generation)
New Components(Property Prediction)New Components(Property Prediction)
New ReactionsNew Reactions
PropertyProperty
Solvent/FluidSolvent/Fluid
EquipmentEquipment
FlowsheetFlowsheet
ControlControl
Phase DiagramsPhase Diagrams
Design / Synthesis
Thermodynamic
EnergyEnergy
EnvironmentalEnvironmental
ControlControl
Analysis
INFORMATIONSTORAGE
RHS for the units that are solved together RHSX
SIMULATOR
Expert SystemExpert System
Parameter Estimation
Thermo-model
Kinetic Model
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
11
Model Generation with ModDev
• Draw Objects
• Describe Objects
• Screen equations
• Analyze/Modify model equations
• Translate model equations into a language that is integrated to the numerical routines
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
12
Tools & options in ModDev (ModGen)
Fundamental shell object
Fundamental stream object
Fundamental shell connection object
Interphase with solver
Select external solver
ModDefDraw modeling objects
Analyze andmanipulate themodel equations
13
Tools & options in ModDev (ModGen)
14
Tools & options in ModDev (ModGen)
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
15
Tools & options in ModDev (ModGen)
16
Tools & options in ModDev (ModGen)
Example - Steady state flash - I
1
2
3
SHELL OBJECTName: flash
Assumed phase condition: Calculate (VL) Equilibrium model: 0= f2i/ ft2- Kflash * f3i/ft3i, @KEQ(Tflash, Pflash,
f2[], f3[], #Kflash)
STREAM CONNECTION OBJECTName: 3
Models for quantities: Energy (enthalpy): H3=@FUNC_E(2,f3[],T3,P3)Models for the “from”-connection: (equilibrium)
Energy connection: T3=Tflash
Momentum connection: P3=Pflash
SHELL CONNECTION OBJECTName: heater
Connection models: Energy connection: Qheater=Qflash
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
18
Example - Steady state flash - II
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
19
Example - Steady state flash - III
Specify feed streamT=200 KP= 1 atm1 kmole/hr Methane1 kmole/hr Ethane1 kmole/hr Propane
Specify feed streamT=200 KP= 1 atm1 kmole/hr Methane1 kmole/hr Ethane1 kmole/hr Propane
Specify unit variablesT=180 KP=1 atm
Specify unit variablesT=180 KP=1 atm
Select ComponentsMethane,Ethane,Propane
Select ComponentsMethane,Ethane,Propane
Run the simulationRun the simulation
View ResultsView Results
Select Thermodynamic modelSRK+QMR+Default
Select Thermodynamic modelSRK+QMR+Default
Initialize stream 31 kmole/hr Ethane1 kmole/hr Propane
Initialize stream 31 kmole/hr Ethane1 kmole/hr Propane
EURECHA Workshop on Computer Aided Modeling, Vezsprem, Hungary, June 3-4, 1999
20
Tutorial Exercises
• Part-I: Model generation (steady state tank mixer, dynamic tank mixer,
CSTR with different kinetics)
• Part-II: Model analysis & translation (for each generated model check degrees of freedom, incidence
matrix, generate code, …..)