Changeset 257 for trunk/sample/controllers/CSTR_noniso_pid.mso
- Timestamp:
- Jun 12, 2007, 1:19:07 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sample/controllers/CSTR_noniso_pid.mso
r190 r257 39 39 Ea as energy_mol (DisplayUnit='kJ/kmol'); 40 40 R as Real (Unit='kJ/mol/K'); 41 ro as dens_m ol (DisplayUnit='kmol/m^3');42 Cp as cp_m ol (DisplayUnit='kJ/kmol/K');41 ro as dens_mass (DisplayUnit='kg/m^3'); 42 Cp as cp_mass (DisplayUnit='kJ/kg/K'); 43 43 U as heat_trans_coeff (DisplayUnit='kW/m^2/K'); 44 44 Hr as heat_reaction (DisplayUnit='kJ/kmol'); … … 54 54 rA as reaction_mol; 55 55 k as frequency (DisplayUnit='1/h'); 56 q as heat_rate (DisplayUnit='kJ/h'); 57 qr as heat_rate (DisplayUnit='kJ/h'); 56 58 in Inlet as corrente; 57 59 out Outlet as corrente; … … 63 65 64 66 "Balanço de Massa por Componente" 65 tau * diff(Ca) = (Inlet.Ca - Ca) - (-rA) * tau; 66 67 V * diff(Ca) = Inlet.F * (Inlet.Ca - Ca) - (-rA) * V; 68 69 "Tempo de residência médio" 70 tau * Inlet.F = V; 71 72 "Balanço de energia" 73 ro * V * Cp * diff(T) = Inlet.F * ro * Cp * (Inlet.T - T) + qr - q; 74 75 "Taxa de calor transferido" 76 q = U * At * (T - Tw); 77 78 "Taxa de calor gerado" 79 qr = (-Hr) * (-rA) * V; 80 81 "Taxa de reação" 82 -rA = k * Ca; 83 84 "Equação de Arrhenius" 85 k = ko * exp(-Ea/(R*T)); 86 87 "Geometria" 88 A * h = V; 89 90 "Equação da válvula" 91 Outlet.F = Cv * sqrt(h); 92 67 93 "Mistura perfeita" 68 94 Outlet.Ca = Ca; 69 95 Outlet.T = T; 70 71 "Taxa de reação"72 -rA = k * Ca;73 74 "Equação de Arrhenius"75 k = ko * exp(-Ea/(R*T));76 77 "Tempo de residência médio"78 tau * Inlet.F = V;79 80 "Geometria"81 A * h = V;82 83 "Equação da válvula"84 Outlet.F = Cv * sqrt(h);85 86 "Balanço de energia"87 tau * diff(T) = (Inlet.T - T) - U*At*(T-Tw)/(ro*V*Cp)*tau + (-Hr)*(-rA)*tau/(ro*Cp);88 89 96 end 90 97 … … 105 112 Tmin as temperature; 106 113 Tmax as temperature; 114 Lsp as length; 115 Tsp as temperature; 107 116 108 117 CONNECTIONS … … 113 122 CSTR1.R = 8.3144 * 'kJ/kmol/K'; 114 123 CSTR1.U = 300 * 'kJ/h/m^2/K'; 115 CSTR1.ro = 55.56 * 'kmol/m^3';116 CSTR1.Cp = 70*'kJ/kmol/K';124 CSTR1.ro = 1000 * 'kg/m^3'; 125 CSTR1.Cp = 4*'kJ/kg/K'; 117 126 CSTR1.Hr = -7000 * 'kJ/kmol'; 118 127 CSTR1.Ea = 6e4 * 'kJ/kmol'; … … 132 141 133 142 "Variáveis manipulada" 134 CSTR1.Cv = 2.2136 * 'm^2.5/h' * (1 - PIDL.Ports.output);143 CSTR1.Cv = 2.2136 * 'm^2.5/h' * PIDL.Ports.output; 135 144 CSTR1.Tw = PIDT.Ports.output*(Tmax-Tmin)+Tmin; 136 145 137 #distúrbio regulatório138 if time<1.6e5 then139 FEED.T = 300 * 'K';140 else141 FEED.T = 285 * 'K';142 end143 144 145 146 #Parâmetros do PID de nível 146 147 PIDL.Parameters.bias=0; 147 148 PIDL.Parameters.alpha=0.1; 148 PIDL.Options.action= 1;149 PIDL.Options.action=-1; 149 150 PIDL.Parameters.gamma=1; 150 151 PIDL.Parameters.beta=1; 151 152 PIDL.Options.clip=1; 152 153 PIDL.Options.autoMan=0; 153 PIDL.Parameters.gain= 20;154 PIDL.Parameters.intTime= 5*'h';154 PIDL.Parameters.gain=1; 155 PIDL.Parameters.intTime=2.5*'h'; 155 156 PIDL.Parameters.derivTime=0*'s'; 156 PIDL.Ports.setPoint= 0.55;157 PIDL.Ports.setPoint=(Lsp - Lmin)/(Lmax - Lmin); 157 158 PIDL.Parameters.tau=1*'s'; 158 159 PIDL.Parameters.tauSet=1*'s'; … … 165 166 PIDT.Options.clip=1; 166 167 PIDT.Options.autoMan=0; 167 PIDT.Parameters.gain= 40;168 PIDT.Parameters.intTime= 5*'h';168 PIDT.Parameters.gain=1; 169 PIDT.Parameters.intTime=2.5*'h'; 169 170 PIDT.Parameters.derivTime=1*'h'; 170 PIDT.Ports.setPoint= 0.85;171 PIDT.Ports.setPoint=(Tsp - Tmin)/(Tmax - Tmin); 171 172 PIDT.Parameters.tau=1*'s'; 172 173 PIDT.Parameters.tauSet=1*'s'; … … 182 183 FEED.F = 3.5 * 'm^3/h'; 183 184 185 #distúrbio regulatório 186 if time < 50 * 'h' then 187 FEED.T = 300 * 'K'; 188 else 189 FEED.T = 285 * 'K'; 190 end 191 192 #mudança de set-point 193 if time < 100 * 'h' then 194 Tsp = 630 * 'K'; 195 else 196 Tsp = 400 * 'K'; 197 end 198 199 if time < 150 * 'h' then 200 Lsp = 2.5 * 'm'; 201 else 202 Lsp = 4 * 'm'; 203 end 204 184 205 INITIAL 185 206 CSTR1.Ca = 50 * 'kmol/m^3'; 186 207 CSTR1.h = 2.5 * 'm'; 187 CSTR1.T = 650 * 'K';208 CSTR1.T = 550 * 'K'; 188 209 189 210 OPTIONS 190 TimeStep = 0.1;191 TimeEnd = 100;211 TimeStep = 1; 212 TimeEnd = 250; 192 213 TimeUnit = 'h'; 214 DAESolver(File = "dasslc"); 193 215 end
Note: See TracChangeset
for help on using the changeset viewer.