U F Building Dynamic Models R G S – CSTR: modeling – where (5) q = U A t ( T – T w ) q r = (- Δ H r ) V ( -r A ) (6) (7) ( -r A ) = k C A (8) k = k 0 exp(– E / RT ) A = π D 2 /4 (9) (10) V = A h A t = A + π D h (11) F s = x Cv √ h (12) x = f(h) Level control (13) T w = f(T) Temperature control (14) 23
U F Building Dynamic Models R G S – CSTR: consistency analysis – variable units of measurement m 3 s -1 F e , F s m 3 V t, τ s kmol m -3 C A , C Af kmol m -3 s -1 r A ρ kg m -3 kJ kg -1 K -1 Cp T, T f , T w K kJ s -1 q r , q kJ m -2 K -1 s -1 U m 2 A t , A h, D m m 2.5 h -1 Cv x – Δ H r , E kJ kmol -1 kJ kmol -1 K -1 R s -1 k, k 0 24
U F Building Dynamic Models R G S – CSTR: consistency analysis – variables: F e , F s , V, t, C A , C Af , r A , ρ , Cp, T, T f , T w , q r , q, U, A t , A, h, D, Cv, x, Δ Hr, E, R, k, k 0 , τ � 27 constants: ρ , Cp, U, D, Cv, Δ Hr, E, R, k 0 � 9 specifications: t � 1 driving forces: F e , T f , C Af � 3 unknown variables: F s , V, C A , r A , T, T w , q r , q, A, A t , h, x, k, τ � 14 equations: 14 Degree of Freedom = variables – constants – specifications – driving forces – equations = unknown variables – equations = 27 – 9 – 1 – 3 – 14 = 0 Initial condition: h (0), C A (0), T (0) � 3 Dynamic Degree of Freedom (index < 2) = differential equations – initial conditions = 3 – 3 = 0 25
U F Building Dynamic Models R G S – CSTR: EMSO version – � Running EMSO Open MSO file 26
27 Consistency Analysis Results G U F R S
28 G U F R S
29 incompatible units – Checking Units of Measurement – Building Dynamic Models G U F R S
U F 3. EMSO Tutorial R G S – Modeling Structure – EMSO has 3 main entities in the modeling structure FlowSheet – process model, is composed by a set of DEVICES DEVICES – components of a FlowSheet, an unit operation or an equipment Model – mathematical description of a DEVICE 30
U F EMSO Tutorial R G S – Modeling Structure – FlowSheet Model Model: equation-based FlowSheet: component-based streamPH 31
U F EMSO Tutorial R G S – Object-Oriented Modeling Language – The modeling and simulation of complex systems is facilitated by Equipment the use of the Object-Oriented concept Component System The system can be decomposed in The components of the several components, each one system exchange information described separately using its through the connecting ports constitutive equations 32
U F EMSO Tutorial R G S – Object-Oriented Variable Types – Parameters and variables are declared within their valid domains and units using types created based on the built-in types: Real, Integer, Switcher, Plugin 33
U F EMSO Tutorial R G S – Model Components – Including sub- models and types Automatic model documentation Symbol of variable in LaTeX command for documentation Basic sections to create a Port location to draw a math. model flowsheet connection Input and output connections 34
U F EMSO Tutorial R G S – FlowSheet Components – Parameters of DEVICES Degree of Freedom Simulation options Dynamic Degree of Freedom 35
U F EMSO Tutorial R G S – Simulation Results: graphics – double-click Horizontal axis is always the independent variable (usually time) 36
U F EMSO Tutorial R G S – Simulation Results: exporting graphics – Right-click the mouse button and select “Export Image” Choose the file format 37
U F EMSO Tutorial R G S – Simulation Results: exporting data – click Choose the file format RLT: MATLAB/SCILAB XML: EXCEL/OpenOffice 38
U F EMSO Tutorial R G S – Simulation Results: in spreadsheets – Using EXCEL to analyze the results Results separated by devices 39
U F EMSO Tutorial R G S – Simulation Results: in MATLAB/SCILAB – Using MATLAB to analyze the results 40
U F EMSO Tutorial R G S – Building Block Diagrams: create file – Selected components from physical properties package Devices found in the model library 41
U F EMSO Tutorial R G S – Building Block Diagrams: select devices – When making a connection, only compatible ports become available to connect drag & drop ports to create a connection click to create a device 42
U F EMSO Tutorial R G S – Building Block Diagrams: set case study – double-click Variable status: unknown (Evaluate) known (Specify) initial condition (Initial) estimate (Guess) 43
U F EMSO Tutorial R G S – Building Block Diagrams: thermodynamic – Available models right-click In development: PC-SAFT 44
U F EMSO Tutorial R G S – Building Block Diagrams: simulating – 45
46 – Automatic Documentation – EMSO Tutorial Note: LaTeX must be installed. G U F R S
U F 4. Dynamic Degree of Freedom R G S – Consistency Analysis – Degree of Freedom (DoF) = 0 (for simulation) > 0 (for optimization) Dynamic Degree of Freedom (DDoF) = number of given initial conditions Check → Units of measurement → Structural non-singularity → Consistent initial conditions 47
U F Dynamic Degree of Freedom R G S – General Concept – Given a system of DAE: F ( t , y , y ’) = 0 The Dynamic Degree of Freedom (DDoF) is the number of variables in y ( t 0 ) that can be assigned arbitrarily to compute a set of consistent initial conditions { y ( t 0 ), y ’( t 0 )} of the DAE system. Is the true number of states of the system (or the system order of the DAE). Is the number of initial conditions that must be given. For low-index DAE system (index 0 and 1) the DDoF is equal to the number of differential equations. For high-index DAE system (index > 1) the DDoF is equal to the number of differential variables minus the number of hidden constraints. 48
U F Dynamic Degree of Freedom R G S – High-Index DAE System – Example: classical pendulum problem Inconsistent initial condition: (1) (2) (3) (4) (5) OK! Hidden constraints: (6) Differentiating (5) and using (1) and (2): + + ⋅ ≠ ⋅ (7) w (0) 2 z (0) 2 T (0) L 2 g y (0) Differentiating (6) and using (1)–(5): (8) Differentiating (7) and using (2), (3), (4), (6): 49
U F Dynamic Degree of Freedom R G S – High-Index DAE System – Example: classical pendulum problem (1) Index 3 Index 2 (1) (1) (2) (2) (2) (3) (3) (3) (4) (4) (4) (5) (5) (6) (6) (7) Index 0 Index 1 (8) (1) (1) (2) (2) 10 variables ( y, y´ ) (3) (3) (4) (4) 8 equations (8) (7) 2 DDoF Satisfies the inconsistent I.C. 50
U F Dynamic Degree of Freedom R G S – High-Index DAE: solution – Three general approaches: 1) Manually modify the model to obtain a lower index equivalent model 2) Integration by specifically designed high-index solvers (e.g., PSIDE, MEBDFI, DASSLC) 3) Apply automatic index reduction algorithms 51
U F Dynamic Degree of Freedom R G S – High-Index DAE: modeling – 52
U F Dynamic Degree of Freedom R G S – High-Index DAE: consistency analysis – 53
U F Dynamic Degree of Freedom R G S – High-Index DAE: simulation – Error propagation Drift-off effect index-0 solver vs index-3 solver x L = 0.9 m , g = 9.8 m/s 2 ∴ I.C.: x (0) = 0.9 m and w (0) = 0 54
U F R 5. Debugging Techniques G S � Questions to be answered to assist the user of a CAPE tool - debugging: • For an under-constrained model which variables can be fixed or specified? • For an over-constrained model which equations should be removed? • For dynamic simulations, which variables can be supplied as initial conditions? • How to report the inconsistencies making it easy to fix? � In other words, debugging methods need to go beyond degrees of freedom and the currently available index analysis methods 55
U F Debugging Techniques R G S – Current Status – � Static models - Nonlinear Algebraic (NLA) systems: • Several structural analysis methods available on the literature • Most EO tools implement a degrees of freedom (DoF) and structural solvability analysis but user assistance is very limited when ill-posed models are found � Dynamic models - Differential Algebraic Equation (DAE) systems: • Currently available methods are limited to index and dynamic degrees of freedom (DDoF) analysis • The well-known EO commercial tools have a high-index check which can fail even for some simple low-index problems 56
U F Debugging Techniques R G S – Bipartite Graphs – � Bipartite graphs can be used to solve combinatorial problems: • Tasks to machines • Classes to rooms • Equations to variables e ∪ V v , E ) have two • Bipartite graph G ( V = V independent sets of vertices 1 2 3 4 • Vertices in the same partition must not be adjacent • We can have alternating and augmenting paths 6 7 8 5 Matching {{1,5}, {3,7}} w/ alternating path 57
U F Debugging Techniques R G S – Bipartite Graphs: variable-equations – Graph for variable-equation relationship f 1 ( x 1 ) = 0 f 2 ( x 1 , x 2 ) = 0 f 3 ( x 1 , x 2 ) = 0 f 4 ( x 2 , x 3 , x 4 ) = 0 f 5 ( x 4 , x 5 ) = 0 f 6 ( x 3 , x 4 , x 5 ) = 0 f 7 ( x 5 , x 6 , x 7 ) = 0 Maximum Matching variables values Multiple Solutions or equations forms are irrelevant 58
U F Debugging Techniques R G S – Nonlinear Algebraic Equations – Debugging Nonlinear Problems � Discover if there are over or under-constrained partitions � Start from unconnected vertices and walk in alternating paths Dulmage and Mendelsohn (DM) decomposition 59
U F Debugging Techniques R G S – Differential-Algebraic Equations – A Simple Example � Only two differential variables ′ ′ − = x x a t ( ) � Index-1 system 1 2 = x b t ( ) 2 � Requires only one initial condition � Initial condition must be x 1 Solution: � x 1 is the only state of the model ∫ t = + τ τ + x t ( ) x (0) a ( ) d b t ( ) 1 1 0 = x t ( ) b t ( ) 2 60
U F Debugging Techniques R G S – Bipartite Graphs: DAE system – Classic Algorithm f f 1 2 ′ ′ − = x x a t ( ) 1 2 = x b t ( ) 2 x ′ x ′ x x 1 1 2 2 • Who are the states? • Which variables should be specified as initial conditions? 61
U F Debugging Techniques R G S – gPROMS output – ′ ′ − = x x a t ( ) � If only one initial condition is given (which is correct): 1 2 = ( ) x b t 2 62
U F Debugging Techniques R G S – gPROMS output – ′ ′ − = x x a t ( ) � If two initial condition are given (which is wrong): 1 2 = ( ) x b t 2 63
64 – AspenDynamics output – Debugging Techniques ( ) a t ( ) = b t 2 ′ x = − ′ 2 1 x x G U F R S
U F Debugging Techniques R G S – New Algorithm: debugging DAE system – 65
U F Debugging Techniques R G S – New Algorithm: debugging DAE system – 66
U F Debugging Techniques R G S – Applying the New Algorithm – f ′ f ′ f f f f 1 2 2 1 2 2 ′ ′ − = x x a t ( ) 1 2 = x b t ( ) 2 x ′ x ′ x ′ x ′ x x 1 1 2 2 2 1 Classic Algorithm � All equations and all x ´ are connected when it finishes � Free variable nodes are the real states � DM decomposition can be applied to the final matching � Singularities are detected (classic algorithm runs indefinitely) 67
U F Debugging Techniques R G S – EMSO output – ′ ′ − = x x a t ( ) � If only one initial condition is given (which is correct): 1 2 = ( ) x b t 2 68
69 – Applying the New Algorithm: high-index – Debugging Techniques only two states! (1) (2) (3) (4) (5) G U F R S
U F Debugging Techniques R G S – Applying the New Algorithm: performance – � Dynamic model of a distillation column for the separation of isobutane from a mixture of 13 compounds * Pentium M 1.7 GHz PC with 2 MB of cache memory, Ubuntu Linux 6.06 70
U F R What is coming next? G S � Tools � Model updating tool and development of virtual analyzer based on Constrained Extended Kalman Filter (CEKF) � Model generation tool for predictive controllers � Features � Creation of discretization functions for integral-partial differential equations � Implementation of MINLP solver interfaces � Technologies � Hessian evaluation by reverse-mode automatic differentiation � New resources for incremental building of flowsheets in the G.U.I. 71
U F R Challenges G S Robust strategies for on-line updating of dynamic models Dynamic data reconciliation Parameters selection and gross error detection and estimation Related topics: • Hybrid and rigorous modeling • Order reduction of nonlinear models • Fault diagnosis • NMPC tuning strategies 72
U F R Challenges G S DAE solvers Reliable high-index Automatic/guided selection (>3) solvers of feasible set of variables for initial condition Index reduction with trajectory projection onto hidden manifold 73
U F R Challenges G S Simultaneous data Multi-level dynamic reconciliation and parameter simulator estimation tool Specialist Integrated tool for D-RTO system Self-tuned nonlinear model Dynamic optimizer with predictive controller adaptive grid 74
U F R Challenges G S Systems Interoperability Truly CAPE-OPEN Heterogeneity and multi-platform Unified communication Multi-processing protocol and Shared-memory advantages 75
U F R Challenges G S Complex systems Advances in Multi-scale modeling + process simulation simulation tools + CFD Bifurcation + control Hybrid system design modeling 76
U F R References G S • Biegler, L.T., A.M. Cervantes and A. Wächter. Advances in Simultaneous Strategies for Dynamic Process Optimization. Chemical Engineering Science , 57, 575–593 (2002). • Charpentier, J.C. and T.F. McKenna. Managing Complex Systems: Some Trends for the Future of Chemical and Process Engineering. Chemical Engineering Science , 59, 1617–1640 (2004). • Costa Jr., E.F., R.C. Vieira, A.R. Secchi and E.C. Biscaia Jr. Dynamic Simulation of High-Index Models of Batch Distillation Processes. Journal of Latin American Applied Research , 32 (2) 155–160 (2003). • Marquardt, W. and M. Mönnigmann. Constructive Nonlinear Dynamics in Process Systems Engineering. Computers and Chemical Engineering , 29, 1265–1275 (2005). • Martinson, W.S. and P.I. Barton. Distributed Models in Plantwide Dynamic Simulators. AIChE Journal , 47 (6) 1372–1386 (2001). • Rodrigues, R., R.P. SOARES and A.R Secchi. Teaching Chemical Reaction Engineering Using EMSO Simulator. Computer Applications in Engineering Education , Wiley (2008). • Soares, R.P. and A.R. Secchi. EMSO: A New Environment for Modeling, Simulation and Optimization. ESCAPE 13, Lappeenranta, Finlândia, 947 – 952 (2003). • Soares, R.P. and A.R. Secchi. Modifications, Simplifications, and Efficiency Tests for the CAPE-OPEN Numerical Open Interfaces. Computers and Chemical Engineering , 28, 1611–1621 (2004). • Soares, R.P. and A.R. Secchi, Direct Initialisation and Solution of High-Index DAE Systems, ESCAPE 15, Barcelona, Spain, 157– 162 (2005). • Soares, R.P. and A.R. Secchi, Debugging Static and Dynamic Rigorous Models for Equation-oriented CAPE Tools, DYCOPS 2007, Cancún, Mexico, v.2, 291–296 (2007). • Valle, E.C., R.P. Soares, T.F. Finkler, A.R. Secchi. A New Tool Providing an Integrated Framework for Process Optimization, EngOpt 2008 - International Conference on Engineering Optimization, Rio de Janeiro, Brazil (2008). 77
U F R References G S DAE Solvers: DASSL: Petzold, l.R. (1989) http://www.enq.ufrgs.br/enqlib/numeric/numeric.html DASSLC: Secchi, A.R. and F.A. Pereira (1997), http://www.enq.ufrgs.br/enqlib/numeric/numeric.html MEBDFI: Abdulla, T.J. and J.R. Cash (1999), http://www.netlib.org/ode/mebdfi.f PSIDE: Lioen, W.M., J.J.B. de Swart, and W.A. van der Veen (1997), http://www.cwi.nl/cwi/projects/PSIDE/ SUNDIALS: R. Serban et al. (2004), http://www.llnl.gov/CASC/sundials/description/description.html 78
U F R Research Group G S GIMSCOP - 2008 Luciano Forgiarini, Eng. Argimiro Resende Secchi, D.Sc. Luciane da Silveira Ferreira, M.Sc. Marcos Lovato Alencastro, Eng. Evaristo Chalbaud Biscaia Jr, D.Sc. Marcelo Escobar, M.Sc. Rafael Busato Sartor, Eng. Jorge Otávio Trierweiler, D.Sc. Nina Paula Gonçalves Salau, M.Sc. Rodolfo Rodrigues, Eng. Nilo Sérgio Medeiros Cardozo, D.Sc. Paula Betio Staudt, M.Sc. Thais Machado Farias, Eng. Marcelo Farenzena, D.Sc. Ricardo Guilherme Duraiski, M.Sc. Bruno Cardozo Mohler, I.C. Rafael de Pelegrini Soares, D.Sc. Tiago Fiorenzano Finkler, M.Sc. Caio Felippe Curitiba Marcellos, I.C. Adriano Giraldi Fisch, M.Sc. Anderson de Campos Paim, Eng. Ivana Martins, I.C. Débora Jung Luvizetto, M.Sc. Andrea Cabral Farias, Eng. Josias José Junges, I.C. Edson Cordeiro do Valle, M.Sc Antonio José V. Nascimento, Eng. Luiza Gueller Zardin, I.C. Eduardo Moreira de Lemos, M.Sc. Bruna Racoski, Eng. Maria Aparecida Paula Lima, I.C. Euclides Almeida Neto, M.Sc. Cristine Alessandra Kayser, Eng. Sara Scomazzon Masiero, I.C. Gabriela Sporleder Straatmann, M.Sc. Fabio Cesar Diehl, Eng. Igor Rodacovski, Tec. Inf. Gérson Balbueno Bicca, M.Sc. Gustavo Rodrigues Sandri, Eng. Irma Maria Bueno, Sec. Gustavo Alberto Neumann, M.Sc. Jovani Luiz Fávero, Eng. 79
U PASI 2008 F R G S Pan American Advanced Studies Institute Program on Process Systems Engineering ... thank you for your attention! http://www.enq.ufrgs.br/alsoc Process Simulation and Optimization Lab Process Modeling, Simulation and Control Lab • Prof. Dr. Rafael de Pelegrini Soares • Prof. Dr. Argimiro Resende Secchi • Phone: +55-51-3308-4166 • Phone: +55-21-2562-8349 • E-mail: rafael@enq.ufrgs.br • E-mail: arge@peq.coppe.ufrj.br • http://www.enq.ufrgs.br/labs/lasim.html • http://www.peq.coppe.ufrj.br/Areas/Modelagem_e_simulacao.html 80
81 Extra slides G U F R S
82 V, y L, x Building Dynamic Models – Another simple example – Flash multi-component m T, P F, z, P f , T f G U F R S
U F Building Dynamic Models R G S – FLASH: process description – A liquid-phase mixture of C hydrocarbons, at given temperature and pressure, is heated and continuously fed into a vessel drum at lower pressure, occurring partial vaporization. The liquid and vapor phases are continuously removed from the vessel through level and pressure control valves, respectively. Determine the time evolution of liquid and vapor stream composition and the vessel temperature and pressure, due to variations in the feed stream, keeping the heating rate constant. 83
U F Building Dynamic Models R G S – FLASH: model assumptions – • negligible vapor holdup (no dynamics in vapor phase); • thermodynamic equilibrium (ideal stage); • no droplet drag in vapor stream; • negligible heat loss to surroundings; Δ (internal energy) ≈ Δ (liquid-phase enthalpy); • • perfect mixture in both phases. 84
U F Building Dynamic Models R G S – FLASH: modeling – Overall mass balance (molar base): dm dt = − − F V L (1) Component mass balance: d ( ) = − − m x F z V y L x (2) i = 1, 2, ..., C i i i i dt Equilibrium: y = (3) i = 1, 2, ..., C K x i i i K i = f ( T, P, x, y ) (4) i = 1, 2, ..., C Molar fraction: C ∑ = (5) x 1 i = i 1 85
U F R G Exercícios de Modelagem S Energy balance: d = + − − ( m h ) F h q V H L h (6) f dt Enthalpies: h = f(T, P, x) (7) H = f(T, P, y) (8) (9) h f = f(T f , P f , z) Controllers: (10) L = f(m) (11) V = f(P) 86
U F Building Dynamic Models R G S – FLASH: consistency analysis – variable units of measurement m kmol kmol s -1 F, L, V t s kmol kmol -1 x i , y i , z i K i – T, T f K P, P f kPa kJ s -1 q kJ kmol -1 h, H, h f 87
U F Building Dynamic Models R G S – FLASH: consistency analysis – variables: m, F, L, V, t, x i , y i , z i , K i , T, T f , P, P f , q, h, H, h f � 13+4C constants: � 0 specifications: q , t � 2 driving forces: F, z i , T f , P f � 3+C unknown variables: m, L, V, x i , y i , K i , T, P, h, H, h f � 8+3C equations: 8+3C Degree of Freedom = variables – constants – specifications – driving forces – equations = unknown variables – equations = (13+4C) – 0 – 2 – (3 + C) – (8+3C) = 0 Initial condition: m (0), x i (0), T (0) � 2+C Dynamic Degree of Freedom (index < 2) = differential equations – initial conditions = (2+C) – (2+C) = 0 88
U F Building Dynamic Models R G S – FLASH: EMSO version – � Running EMSO Note: file Sample_flash_pid.mso has level and pressure controllers. 89
90 G U F R S
91 G U F R S
92 Standard Interfaces CAPE-OPEN G U F R S
U F R CAPE OPEN G S Example of CAPE-OPEN: DyOS (Dynamic Optimization Software) - Marquardt’s group (2000) gPROMS 93
U F R CAPE OPEN G S Another example of CAPE-OPEN: EMSO (Environment for Modeling, Simulation and Optimization) - Soares and Secchi (2004) EMSO A EMSO B methanol plant ESO ESO CORBA Object Bus EMSO 94 ESO
95 tools and features Other available G U F R S
96 Optimization G U F R S
97 Parameter Estimation G U F R S
98 Data Reconciliation G U F R S
99 Interface EMSO-OPC G U F R S
100 Simulator Interface EMSO-OPC Plant G U F R S
Recommend
More recommend