- Timestamp:
- Jun 15, 2008, 8:18:35 PM (15 years ago)
- Location:
- trunk/sample/controllers
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sample/controllers/CSTR_noniso_pid.mso
r295 r536 1 1 #*------------------------------------------------------------------- 2 * EMSO Model Library (EML) Copyright (C) 2004 - 200 7ALSOC.2 * EMSO Model Library (EML) Copyright (C) 2004 - 2008 ALSOC. 3 3 * 4 4 * This LIBRARY is free software; you can distribute it and/or modify … … 6 6 * http://www.enq.ufrgs.br/alsoc. 7 7 * 8 * EMSO Copyright (C) 2004 - 200 7ALSOC, original code8 * EMSO Copyright (C) 2004 - 2008 ALSOC, original code 9 9 * from http://www.rps.eng.br Copyright (C) 2002-2004. 10 10 * All rights reserved. … … 16 16 * Sample file for controllers 17 17 *---------------------------------------------------------------------- 18 * Author: 18 * Author: Argimiro R. Secchi 19 19 * $Id$ 20 20 *--------------------------------------------------------------------*# … … 24 24 const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit='m^2.5/h'); 25 25 26 Model corrente26 Model stream_cstr 27 27 VARIABLES 28 28 Ca as conc_mol; … … 35 35 PARAMETERS 36 36 ko as frequency (DisplayUnit='1/h'); 37 D as length; 37 38 A as area; 38 At as area;39 39 Ea as energy_mol (DisplayUnit='kJ/kmol'); 40 40 R as Real (Unit='kJ/mol/K'); … … 43 43 U as heat_trans_coeff (DisplayUnit='kW/m^2/K'); 44 44 Hr as heat_reaction (DisplayUnit='kJ/kmol'); 45 45 pi as Real (Default = 3.141593); 46 Cv as const_valv; 47 46 48 VARIABLES 47 Cv as const_valv;49 At as area; 48 50 T as temperature; 49 51 Tw as temperature; 52 x as fraction; 50 53 V as volume; 51 54 Ca as conc_mol; … … 56 59 q as heat_rate (DisplayUnit='kJ/h'); 57 60 qr as heat_rate (DisplayUnit='kJ/h'); 58 in Inlet as corrente; 59 out Outlet as corrente; 60 61 in Inlet as stream_cstr; 62 out Outlet as stream_cstr; 63 64 SET 65 A = pi * D^2 / 4; 66 61 67 EQUATIONS 62 68 63 " Balanço de Massa Global"69 "Overall Mass Balance" 64 70 diff(V) = Inlet.F - Outlet.F; 65 71 66 " Balanço de Massa por Componente"72 "Component Mass Balance" 67 73 V * diff(Ca) = Inlet.F * (Inlet.Ca - Ca) - (-rA) * V; 68 74 69 " Tempo de residência médio"75 "Average Residence Time" 70 76 tau * Inlet.F = V; 71 77 72 " Balanço de energia"78 "Energy Balance" 73 79 ro * V * Cp * diff(T) = Inlet.F * ro * Cp * (Inlet.T - T) + qr - q; 74 80 75 " Taxa de calor transferido"81 "Heat Transfer Rate" 76 82 q = U * At * (T - Tw); 77 83 78 " Taxa de calor gerado"84 "Reaction Heat Rate" 79 85 qr = (-Hr) * (-rA) * V; 80 86 81 " Taxa de reação"87 "Reaction Rate" 82 88 -rA = k * Ca; 83 89 84 " Equação de Arrhenius"90 "Arrhenius Equation" 85 91 k = ko * exp(-Ea/(R*T)); 86 92 87 "Geometr ia"93 "Geometry" 88 94 A * h = V; 89 90 "Equação da válvula" 91 Outlet.F = Cv * sqrt(h); 92 93 "Mistura perfeita" 95 At = A + pi*D*h; 96 97 "Valve Equation" 98 Outlet.F = x * Cv * sqrt(h); 99 100 "Perfect Mixture" 94 101 Outlet.Ca = Ca; 95 102 Outlet.T = T; 96 end 97 98 # processo com 1 CSTR controlado103 end 104 105 # Process with controlled CSTR and multiple steady-states 99 106 FlowSheet CSTR_controller 100 107 101 108 DEVICES 102 FEED as corrente;109 FEED as stream_cstr; 103 110 CSTR1 as CSTR; 104 111 PIDL as PID; … … 119 126 120 127 SET 121 # Parâmetros do CSTR"128 # CSTR Parameters 122 129 CSTR1.R = 8.3144 * 'kJ/kmol/K'; 123 130 CSTR1.U = 300 * 'kJ/h/m^2/K'; … … 127 134 CSTR1.Ea = 6e4 * 'kJ/kmol'; 128 135 CSTR1.ko = 89 * '1/s'; 129 CSTR1. A = 8 * 'm^2';130 CSTR1. At = 25 * 'm^2';136 CSTR1.D = 3.2 * 'm'; 137 CSTR1.Cv = 2.7 * 'm^2.5/h'; 131 138 132 139 PIDL.PID_Select = "Ideal_AWBT"; … … 135 142 EQUATIONS 136 143 137 " Equações do PID para controle de nível"144 "Dimensionless level to connect PID" 138 145 L_ad*(Lmax-Lmin)=CSTR1.h-Lmin; 139 146 PIDL.Ports.input=L_ad; 140 147 141 " Equações do PID para controle de temperatura"148 "Dimensionless temperature to connect PID" 142 149 T_ad*(Tmax-Tmin)=CSTR1.T-Tmin; 143 150 PIDT.Ports.input=T_ad; 144 151 145 " Variáveis manipulada"146 CSTR1. Cv = 2.2136 * 'm^2.5/h' *PIDL.Ports.output;152 "Manipulated Variables" 153 CSTR1.x = PIDL.Ports.output; 147 154 CSTR1.Tw = PIDT.Ports.output*(Tmax-Tmin)+Tmin; 148 155 149 #Parâmetros do PID de nível 156 # Level control: PID parameters 150 157 PIDL.Parameters.bias=0; 151 158 PIDL.Parameters.alpha=0.1; … … 161 168 PIDL.Parameters.tau=1*'s'; 162 169 PIDL.Parameters.tauSet=1*'s'; 163 170 171 # Temperature control: PID parameters 164 172 PIDT.Parameters.bias = 0; 165 173 PIDT.Parameters.alpha=0.1; … … 176 184 PIDT.Parameters.tauSet=1*'s'; 177 185 178 " Valores limites para normalizações"186 "Operating range for control variables" 179 187 Lmax=5*'m'; 180 188 Lmin=0*'m'; 181 189 Tmax=700*'K'; 182 190 Tmin=230*'K'; 183 184 " Variáveís da corrente de alimentação"191 192 "Feed Stream" 185 193 FEED.Ca = 300 * 'kmol/m^3'; 186 194 FEED.F = 3.5 * 'm^3/h'; 187 195 188 #distúrbio regulatório 196 # Disturbance 189 197 if time < 50 * 'h' then 190 198 FEED.T = 300 * 'K'; 191 199 else 192 FEED.T = 285 * 'K'; 200 FEED.T = 285 * 'K'; # change to 350 K to saturate controller 193 201 end 194 202 195 #mudança de set-point 203 # Set-point changes 196 204 if time < 100 * 'h' then 197 205 Tsp = 630 * 'K'; … … 201 209 202 210 if time < 150 * 'h' then 203 Lsp = 2.5* 'm';211 Lsp = 1.7 * 'm'; 204 212 else 205 213 Lsp = 4 * 'm'; … … 208 216 INITIAL 209 217 CSTR1.Ca = 50 * 'kmol/m^3'; 210 CSTR1.h = 2.5* 'm';211 CSTR1.T = 5 50 * 'K';218 CSTR1.h = 1.7 * 'm'; 219 CSTR1.T = 570 * 'K'; 212 220 213 221 OPTIONS … … 215 223 TimeEnd = 250; 216 224 TimeUnit = 'h'; 217 DAESolver(File = "dassl c");225 DAESolver(File = "dassl"); 218 226 end
Note: See TracChangeset
for help on using the changeset viewer.