Changeset 190 for branches/newlanguage/sample
- Timestamp:
- Mar 7, 2007, 3:09:13 PM (16 years ago)
- Location:
- branches/newlanguage/sample/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/newlanguage/sample/controllers/CSTR_noniso_pid.mso
r84 r190 22 22 using "controllers/PIDs"; 23 23 24 const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit= "m^2.5/h");24 const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit='m^2.5/h'); 25 25 26 26 Model corrente … … 34 34 35 35 PARAMETERS 36 ko as frequency ( Unit="1/h");36 ko as frequency (DisplayUnit='1/h'); 37 37 A as area; 38 38 At as area; 39 Ea as energy_mol ( Unit="kJ/kmol");40 R as Real (Unit= "kJ/mol/K");41 ro as dens_mol ( Unit="kmol/m^3");42 Cp as cp_mol ( Unit="kJ/kmol/K");43 U as heat_trans_coeff ( Unit="kW/m^2/K");44 Hr as heat_reaction ( Unit="kJ/kmol");39 Ea as energy_mol (DisplayUnit='kJ/kmol'); 40 R as Real (Unit='kJ/mol/K'); 41 ro as dens_mol (DisplayUnit='kmol/m^3'); 42 Cp as cp_mol (DisplayUnit='kJ/kmol/K'); 43 U as heat_trans_coeff (DisplayUnit='kW/m^2/K'); 44 Hr as heat_reaction (DisplayUnit='kJ/kmol'); 45 45 46 46 VARIABLES … … 53 53 tau as time_h; 54 54 rA as reaction_mol; 55 k as frequency ( Unit="1/h");55 k as frequency (DisplayUnit='1/h'); 56 56 in Inlet as corrente; 57 57 out Outlet as corrente; … … 94 94 DEVICES 95 95 FEED as corrente; 96 CSTR as CSTR;96 CSTR1 as CSTR; 97 97 PIDL as PID_Ideal_AWBT; 98 98 PIDT as PID_Ideal_AWBT; … … 107 107 108 108 CONNECTIONS 109 FEED to CSTR .Inlet;109 FEED to CSTR1.Inlet; 110 110 111 111 SET 112 112 # Parâmetros do CSTR" 113 CSTR .R = 8.3144 * "kJ/kmol/K";114 CSTR .U = 300 * "kJ/h/m^2/K";115 CSTR .ro = 55.56 * "kmol/m^3";116 CSTR .Cp = 70*"kJ/kmol/K";117 CSTR .Hr = -7000 * "kJ/kmol";118 CSTR .Ea = 6e4 * "kJ/kmol";119 CSTR .ko = 89 * "1/s";120 CSTR .A = 8 * "m^2";121 CSTR .At = 25 * "m^2";113 CSTR1.R = 8.3144 * 'kJ/kmol/K'; 114 CSTR1.U = 300 * 'kJ/h/m^2/K'; 115 CSTR1.ro = 55.56 * 'kmol/m^3'; 116 CSTR1.Cp = 70*'kJ/kmol/K'; 117 CSTR1.Hr = -7000 * 'kJ/kmol'; 118 CSTR1.Ea = 6e4 * 'kJ/kmol'; 119 CSTR1.ko = 89 * '1/s'; 120 CSTR1.A = 8 * 'm^2'; 121 CSTR1.At = 25 * 'm^2'; 122 122 123 123 EQUATIONS 124 124 125 125 "Equações do PID para controle de nível" 126 L_ad*(Lmax-Lmin)=CSTR .h-Lmin;126 L_ad*(Lmax-Lmin)=CSTR1.h-Lmin; 127 127 PIDL.Ports.input=L_ad; 128 128 129 129 "Equações do PID para controle de temperatura" 130 T_ad*(Tmax-Tmin)=CSTR .T-Tmin;130 T_ad*(Tmax-Tmin)=CSTR1.T-Tmin; 131 131 PIDT.Ports.input=T_ad; 132 132 133 133 "Variáveis manipulada" 134 CSTR .Cv = 2.2136 * "m^2.5/h"* (1 - PIDL.Ports.output);135 CSTR .Tw = PIDT.Ports.output*(Tmax-Tmin)+Tmin;134 CSTR1.Cv = 2.2136 * 'm^2.5/h' * (1 - PIDL.Ports.output); 135 CSTR1.Tw = PIDT.Ports.output*(Tmax-Tmin)+Tmin; 136 136 137 137 #distúrbio regulatório 138 138 if time<1.6e5 then 139 FEED.T = 300 * "K";139 FEED.T = 300 * 'K'; 140 140 else 141 FEED.T = 285 * "K";141 FEED.T = 285 * 'K'; 142 142 end 143 143 … … 152 152 PIDL.Options.autoMan=0; 153 153 PIDL.Parameters.gain=20; 154 PIDL.Parameters.intTime=5* "h";155 PIDL.Parameters.derivTime=0* "s";154 PIDL.Parameters.intTime=5*'h'; 155 PIDL.Parameters.derivTime=0*'s'; 156 156 PIDL.Ports.setPoint=0.55; 157 PIDL.Parameters.tau=1* "s";158 PIDL.Parameters.tauSet=1* "s";157 PIDL.Parameters.tau=1*'s'; 158 PIDL.Parameters.tauSet=1*'s'; 159 159 160 160 PIDT.Parameters.bias = 0; … … 166 166 PIDT.Options.autoMan=0; 167 167 PIDT.Parameters.gain=40; 168 PIDT.Parameters.intTime=5* "h";169 PIDT.Parameters.derivTime=1* "h";168 PIDT.Parameters.intTime=5*'h'; 169 PIDT.Parameters.derivTime=1*'h'; 170 170 PIDT.Ports.setPoint=0.85; 171 PIDT.Parameters.tau=1* "s";172 PIDT.Parameters.tauSet=1* "s";171 PIDT.Parameters.tau=1*'s'; 172 PIDT.Parameters.tauSet=1*'s'; 173 173 174 174 "Valores limites para normalizações" 175 Lmax=5* "m";176 Lmin=0* "m";177 Tmax=700* "K";178 Tmin=230* "K";175 Lmax=5*'m'; 176 Lmin=0*'m'; 177 Tmax=700*'K'; 178 Tmin=230*'K'; 179 179 180 180 "Variáveís da corrente de alimentação" 181 FEED.Ca = 300 * "kmol/m^3";182 FEED.F = 3.5 * "m^3/h";181 FEED.Ca = 300 * 'kmol/m^3'; 182 FEED.F = 3.5 * 'm^3/h'; 183 183 184 184 INITIAL 185 CSTR .Ca = 50 * "kmol/m^3";186 CSTR .h = 2.5 * "m";187 CSTR .T = 650 * "K";185 CSTR1.Ca = 50 * 'kmol/m^3'; 186 CSTR1.h = 2.5 * 'm'; 187 CSTR1.T = 650 * 'K'; 188 188 189 189 OPTIONS 190 time = [0:0.1:1 1:1:100] * "h"; 190 TimeStep = 0.1; 191 TimeEnd = 100; 192 TimeUnit = 'h'; 191 193 end -
branches/newlanguage/sample/controllers/Sample_flash_pid.mso
r84 r190 30 30 31 31 PARAMETERS 32 PP as CalcObject(Brief="Physical Properties",File="vrpp");32 PP as Plugin(Brief="Physical Properties",File="vrpp"); 33 33 NComp as Integer; 34 34 #Valores utilizados na normalização do nível e da pressão do flash … … 57 57 pidP as PIDIncr_Parallel_AWBT; 58 58 fl as flash; 59 s1 as s treamTP;59 s1 as source; 60 60 61 61 SET … … 66 66 67 67 #Parâmetros do modelo de flash 68 fl.V = 1 * "m^3";69 fl.Across = 0.5* "m^2";68 fl.V = 1 * 'm^3'; 69 fl.Across = 0.5* 'm^2'; 70 70 71 71 #Valores máximos e mínimos para as normalizações 72 PMax=2.36 * "atm";73 PMin=0 * "atm";74 LMax=2 * "m";75 LMin=0 * "m";76 FVMax=300* "kmol/h";77 FVMin=0* "kmol/h";78 FLMax=692.7* "kmol/h";79 FLMin=0* "kmol/h";72 PMax=2.36 *'atm'; 73 PMin=0 *'atm'; 74 LMax=2 *'m'; 75 LMin=0 *'m'; 76 FVMax=300*'kmol/h'; 77 FVMin=0*'kmol/h'; 78 FLMax=692.7*'kmol/h'; 79 FLMin=0*'kmol/h'; 80 80 81 81 CONNECTIONS 82 s1 to fl.Inlet;82 s1.Outlet to fl.Inlet; 83 83 Q to fl.Q; 84 84 85 85 SPECIFY 86 86 87 Q = 1026.32 * "kJ/s";87 Q = 1026.32 * 'kJ/s'; 88 88 89 89 #Parâmetros do controlador de nível 90 90 pidL.Parameters.bias=0.5; 91 91 pidL.Parameters.gain=1.1776; 92 pidL.Parameters.derivTime=19* "s";93 pidL.Parameters.intTime=76* "s";94 pidL.Parameters.tau=1* "s";95 pidL.Parameters.tauSet=1* "s";92 pidL.Parameters.derivTime=19*'s'; 93 pidL.Parameters.intTime=76*'s'; 94 pidL.Parameters.tau=1*'s'; 95 pidL.Parameters.tauSet=1*'s'; 96 96 pidL.Parameters.alpha =1; 97 97 pidL.Parameters.beta =1; … … 106 106 pidP.Parameters.bias=0.5; 107 107 pidP.Parameters.gain=0.9275; 108 pidP.Parameters.derivTime=18* "s";109 pidP.Parameters.intTime=72* "s";110 pidP.Parameters.tau=1* "s";111 pidP.Parameters.tauSet=1* "s";108 pidP.Parameters.derivTime=18*'s'; 109 pidP.Parameters.intTime=72*'s'; 110 pidP.Parameters.tau=1*'s'; 111 pidP.Parameters.tauSet=1*'s'; 112 112 pidP.Parameters.alpha =1; 113 113 pidP.Parameters.beta =1; … … 120 120 EQUATIONS 121 121 #Corrente de entrada do flash 122 s1. z = [0.3, 0.3, 0.4];123 s1. P = 5 * "atm";122 s1.Outlet.z = [0.3, 0.3, 0.4]; 123 s1.Outlet.P = 5 * 'atm'; 124 124 125 125 #Distúrbio regulatório 126 126 if time<2000 then 127 s1. T = 338 * "K";128 s1. F = 496.3 * "kmol/h";127 s1.Outlet.T = 338 * 'K'; 128 s1.Outlet.F = 496.3 * 'kmol/h'; 129 129 else 130 s1. T = 360 * "K";131 s1. F = 450 * "kmol/h";130 s1.Outlet.T = 360 * 'K'; 131 s1.Outlet.F = 450 * 'kmol/h'; 132 132 end 133 133 … … 154 154 155 155 INITIAL 156 fl.OutletL.T = 340 * "K";157 fl.Level = 1* "m";156 fl.OutletL.T = 340 *'K'; 157 fl.Level = 1* 'm'; 158 158 fl.OutletL.z(1) = 0.1; 159 159 fl.OutletL.z(2) = 0.1; 160 160 161 161 OPTIONS 162 relativeAccuracy = 1e-6;162 RelativeAccuracy = 1e-6; 163 163 #time = [0:100:7000 7000:0.10:8150 8150:100:10000]; 164 time = [0:100:10000]; 164 TimeStep = 100; 165 TimeEnd = 10000; 165 166 end 166 167 -
branches/newlanguage/sample/controllers/sample_tanks_pid.mso
r84 r190 33 33 34 34 PARAMETERS 35 h_max as Real (Brief="Altura máxima do nível do tanque", Unit= "m");36 h_min as Real (Brief="Altura mínima do nível do tanque", Unit= "m");35 h_max as Real (Brief="Altura máxima do nível do tanque", Unit='m'); 36 h_min as Real (Brief="Altura mínima do nível do tanque", Unit='m'); 37 37 38 38 VARIABLES … … 42 42 43 43 SET 44 Tanque1.A = 8 * "m^2";45 h_max = 2 * "m";46 h_min = 0 * "m";44 Tanque1.A = 8 * 'm^2'; 45 h_max = 2 * 'm'; 46 h_min = 0 * 'm'; 47 47 48 48 EQUATIONS 49 PID.Parameters.tau = 1* "s";50 PID.Parameters.tauSet = 1* "s";49 PID.Parameters.tau = 1*'s'; 50 PID.Parameters.tauSet = 1*'s'; 51 51 PID.Parameters.alpha = 0.3; 52 52 PID.Parameters.bias = 0; … … 56 56 PID.Options.clip=1; 57 57 PID.Options.autoMan = 0; 58 PID.Parameters.intTime=5000* "s";58 PID.Parameters.intTime=5000*'s'; 59 59 PID.Parameters.gain = 3.5; 60 PID.Parameters.derivTime=1* "s";60 PID.Parameters.derivTime=1*'s'; 61 61 PID.Ports.input = h_ad; 62 62 h_ad = (Tanque1.h-h_min)/(h_max-h_min); 63 Tanque1.k = 8* "m^2.5/h"*PID.Ports.output;63 Tanque1.k = 8*'m^2.5/h'*PID.Ports.output; 64 64 65 65 #Perturbação servo 66 #Nível desejado=1* "m"66 #Nível desejado=1*'m' 67 67 PID.Ports.setPoint=0.5; 68 68 69 69 #Perturbação regulatória 70 70 if time<10*"h" then 71 Tanque1.Fin= 3* "m^3/h";71 Tanque1.Fin= 3*'m^3/h'; 72 72 else 73 Tanque1.Fin= 1.5* "m^3/h";73 Tanque1.Fin= 1.5*'m^3/h'; 74 74 end 75 75 76 76 INITIAL 77 77 "altura inicial" 78 Tanque1.h = 0.2 * "m";78 Tanque1.h = 0.2 * 'm'; 79 79 80 80 OPTIONS 81 81 DAESolver = "dassl"; 82 time = [0:0.1:30] * "h" ; 82 TimeStep = 0.1; 83 TimeEnd = 30; 84 TimeUnit = 'h'; 83 85 end 84 86 … … 89 91 90 92 PARAMETERS 91 h_max as Real (Brief="Altura máxima do nível do tanque", Unit= "m");92 h_min as Real (Brief="Altura mínima do nível do tanque", Unit= "m");93 h_max as Real (Brief="Altura máxima do nível do tanque", Unit='m'); 94 h_min as Real (Brief="Altura mínima do nível do tanque", Unit='m'); 93 95 94 96 VARIABLES … … 98 100 99 101 SET 100 Tanque1.A = 8 * "m^2";101 h_max = 2 * "m";102 h_min = 0 * "m";102 Tanque1.A = 8 * 'm^2'; 103 h_max = 2 * 'm'; 104 h_min = 0 * 'm'; 103 105 104 106 EQUATIONS 105 PID.Parameters.tau = 1* "s";106 PID.Parameters.tauSet = 1* "s";107 PID.Parameters.tau = 1*'s'; 108 PID.Parameters.tauSet = 1*'s'; 107 109 PID.Parameters.alpha = 0.3; 108 110 PID.Parameters.bias = 0; 109 111 PID.Parameters.gamma = 1; 110 112 PID.Parameters.beta = 1; 111 PID.Parameters.intTime=5000* "s";113 PID.Parameters.intTime=5000*'s'; 112 114 PID.Parameters.gain =3.5; 113 PID.Parameters.derivTime=1* "s";115 PID.Parameters.derivTime=1*'s'; 114 116 PID.Options.action = -1; 115 117 PID.Options.clip=1; … … 117 119 PID.Ports.input = h_ad; 118 120 h_ad = (Tanque1.h-h_min)/(h_max-h_min); 119 Tanque1.k = 8* "m^2.5/h"*PID.Ports.output;121 Tanque1.k = 8*'m^2.5/h'*PID.Ports.output; 120 122 121 123 #Perturbação servo 122 #Nível desejado=1* "m"124 #Nível desejado=1*'m' 123 125 PID.Ports.setPoint=0.5; 124 126 125 127 #Perturbação regulatória 126 128 if time<10*"h" then 127 Tanque1.Fin= 3* "m^3/h";129 Tanque1.Fin= 3*'m^3/h'; 128 130 else 129 Tanque1.Fin= 1.5* "m^3/h";131 Tanque1.Fin= 1.5*'m^3/h'; 130 132 end 131 133 132 134 INITIAL 133 135 "altura inicial" 134 Tanque1.h = 0.2 * "m";136 Tanque1.h = 0.2 * 'm'; 135 137 136 138 OPTIONS 137 139 NLASolver = "sundials"; 138 time = [0:0.1:30] * "h" ; 140 TimeStep = 0.1; 141 TimeEnd = 30; 142 TimeUnit = 'h'; 139 143 end 140 144 -
branches/newlanguage/sample/controllers/tanksmodel.mso
r84 r190 25 25 26 26 VARIABLES 27 k as Real (Brief="Valve Constant", Unit = "m^2.5/h", Default=4);27 k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4); 28 28 h as length(Brief="Tank level"); 29 29 Fin as flow_vol(Brief="Input flow");
Note: See TracChangeset
for help on using the changeset viewer.