- Timestamp:
- Mar 7, 2007, 3:09:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.