1 | model asmaFlow
|
---|
2 | parameter Modelica.SIunits.AngularVelocity DeltaOmEl = 25;
|
---|
3 | Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox;
|
---|
4 | Modelica.Electrical.Machines.BasicMachines.AsynchronousInductionMachines.AIM_SquirrelCage aimc(p = 2, fsNominal = 50, Rs = 0.435, Lssigma = 0.004, Lrsigma = 0.002, Rr = 0.4, Jr = 2, Lm = 0.06931);
|
---|
5 | Modelica.Electrical.Analog.Basic.Ground ground;
|
---|
6 | Modelica.Electrical.MultiPhase.Basic.Star star;
|
---|
7 | Modelica.Mechanics.Rotational.Sources.Torque torque;
|
---|
8 | Modelica.Blocks.Sources.Constant const(k = -15);
|
---|
9 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor;
|
---|
10 | Modelica.Electrical.MultiPhase.Sources.SineVoltage sinevoltage1(V = 230 * sqrt(2) / sqrt(3) * ones(3), freqHz = 50 * ones(3));
|
---|
11 | equation
|
---|
12 | connect(sinevoltage1.plug_n, terminalBox.plugSupply);
|
---|
13 | connect(sinevoltage1.plug_p, star.plug_p);
|
---|
14 | connect(terminalBox.plug_sn, aimc.plug_sn);
|
---|
15 | connect(terminalBox.plug_sp, aimc.plug_sp);
|
---|
16 | connect(ground.p, star.pin_n);
|
---|
17 | connect(torque.flange, aimc.flange);
|
---|
18 | connect(const.y, torque.tau);
|
---|
19 | connect(speedSensor.flange, torque.flange);
|
---|
20 | end asmaFlow;
|
---|
21 |
|
---|
22 | package ModelicaServices
|
---|
23 | extends Modelica.Icons.Package;
|
---|
24 |
|
---|
25 | package Machine
|
---|
26 | extends Modelica.Icons.Package;
|
---|
27 | final constant Real eps = 0.000000000000001;
|
---|
28 | final constant Real small = 1e-60;
|
---|
29 | final constant Real inf = 1e+60;
|
---|
30 | final constant Integer Integer_inf = OpenModelica.Internal.Architecture.integerMax();
|
---|
31 | end Machine;
|
---|
32 | end ModelicaServices;
|
---|
33 |
|
---|
34 | package Modelica
|
---|
35 | extends Modelica.Icons.Package;
|
---|
36 |
|
---|
37 | package Blocks
|
---|
38 | extends Modelica.Icons.Package;
|
---|
39 |
|
---|
40 | package Interfaces
|
---|
41 | extends Modelica.Icons.InterfacesPackage;
|
---|
42 | connector RealInput = input Real;
|
---|
43 | connector RealOutput = output Real;
|
---|
44 |
|
---|
45 | partial block SO
|
---|
46 | extends Modelica.Blocks.Icons.Block;
|
---|
47 | RealOutput y;
|
---|
48 | end SO;
|
---|
49 |
|
---|
50 | partial block SignalSource
|
---|
51 | extends SO;
|
---|
52 | parameter Real offset = 0;
|
---|
53 | parameter .Modelica.SIunits.Time startTime = 0;
|
---|
54 | end SignalSource;
|
---|
55 | end Interfaces;
|
---|
56 |
|
---|
57 | package Sources
|
---|
58 | extends Modelica.Icons.SourcesPackage;
|
---|
59 |
|
---|
60 | block Constant
|
---|
61 | parameter Real k(start = 1);
|
---|
62 | extends .Modelica.Blocks.Interfaces.SO;
|
---|
63 | equation
|
---|
64 | y = k;
|
---|
65 | end Constant;
|
---|
66 |
|
---|
67 | block Sine
|
---|
68 | parameter Real amplitude = 1;
|
---|
69 | parameter .Modelica.SIunits.Frequency freqHz(start = 1);
|
---|
70 | parameter .Modelica.SIunits.Angle phase = 0;
|
---|
71 | parameter Real offset = 0;
|
---|
72 | parameter .Modelica.SIunits.Time startTime = 0;
|
---|
73 | extends .Modelica.Blocks.Interfaces.SO;
|
---|
74 | protected
|
---|
75 | constant Real pi = Modelica.Constants.pi;
|
---|
76 | equation
|
---|
77 | y = offset + (if time < startTime then 0 else amplitude * Modelica.Math.sin(2 * pi * freqHz * (time - startTime) + phase));
|
---|
78 | end Sine;
|
---|
79 | end Sources;
|
---|
80 |
|
---|
81 | package Icons
|
---|
82 | extends Modelica.Icons.IconsPackage;
|
---|
83 |
|
---|
84 | partial block Block end Block;
|
---|
85 | end Icons;
|
---|
86 | end Blocks;
|
---|
87 |
|
---|
88 | package Electrical
|
---|
89 | extends Modelica.Icons.Package;
|
---|
90 |
|
---|
91 | package Analog
|
---|
92 | extends Modelica.Icons.Package;
|
---|
93 |
|
---|
94 | package Basic
|
---|
95 | extends Modelica.Icons.Package;
|
---|
96 |
|
---|
97 | model Ground
|
---|
98 | Interfaces.Pin p;
|
---|
99 | equation
|
---|
100 | p.v = 0;
|
---|
101 | end Ground;
|
---|
102 |
|
---|
103 | model Resistor
|
---|
104 | parameter Modelica.SIunits.Resistance R(start = 1);
|
---|
105 | parameter Modelica.SIunits.Temperature T_ref = 300.15;
|
---|
106 | parameter Modelica.SIunits.LinearTemperatureCoefficient alpha = 0;
|
---|
107 | extends Modelica.Electrical.Analog.Interfaces.OnePort;
|
---|
108 | extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T = T_ref);
|
---|
109 | Modelica.SIunits.Resistance R_actual;
|
---|
110 | equation
|
---|
111 | assert(1 + alpha * (T_heatPort - T_ref) >= Modelica.Constants.eps, "Temperature outside scope of model!");
|
---|
112 | R_actual = R * (1 + alpha * (T_heatPort - T_ref));
|
---|
113 | v = R_actual * i;
|
---|
114 | LossPower = v * i;
|
---|
115 | end Resistor;
|
---|
116 |
|
---|
117 | model Inductor
|
---|
118 | extends Interfaces.OnePort(i(start = 0));
|
---|
119 | parameter .Modelica.SIunits.Inductance L(start = 1);
|
---|
120 | equation
|
---|
121 | L * der(i) = v;
|
---|
122 | end Inductor;
|
---|
123 | end Basic;
|
---|
124 |
|
---|
125 | package Interfaces
|
---|
126 | extends Modelica.Icons.InterfacesPackage;
|
---|
127 |
|
---|
128 | connector Pin
|
---|
129 | Modelica.SIunits.Voltage v;
|
---|
130 | flow Modelica.SIunits.Current i;
|
---|
131 | end Pin;
|
---|
132 |
|
---|
133 | connector PositivePin
|
---|
134 | Modelica.SIunits.Voltage v;
|
---|
135 | flow Modelica.SIunits.Current i;
|
---|
136 | end PositivePin;
|
---|
137 |
|
---|
138 | connector NegativePin
|
---|
139 | Modelica.SIunits.Voltage v;
|
---|
140 | flow Modelica.SIunits.Current i;
|
---|
141 | end NegativePin;
|
---|
142 |
|
---|
143 | partial model OnePort
|
---|
144 | .Modelica.SIunits.Voltage v;
|
---|
145 | .Modelica.SIunits.Current i;
|
---|
146 | PositivePin p;
|
---|
147 | NegativePin n;
|
---|
148 | equation
|
---|
149 | v = p.v - n.v;
|
---|
150 | 0 = p.i + n.i;
|
---|
151 | i = p.i;
|
---|
152 | end OnePort;
|
---|
153 |
|
---|
154 | partial model ConditionalHeatPort
|
---|
155 | parameter Boolean useHeatPort = false;
|
---|
156 | parameter Modelica.SIunits.Temperature T = 293.15;
|
---|
157 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort(T(start = T) = T_heatPort, Q_flow = -LossPower) if useHeatPort;
|
---|
158 | Modelica.SIunits.Power LossPower;
|
---|
159 | Modelica.SIunits.Temperature T_heatPort;
|
---|
160 | equation
|
---|
161 | if not useHeatPort then
|
---|
162 | T_heatPort = T;
|
---|
163 | end if;
|
---|
164 | end ConditionalHeatPort;
|
---|
165 |
|
---|
166 | partial model VoltageSource
|
---|
167 | extends OnePort;
|
---|
168 | parameter .Modelica.SIunits.Voltage offset = 0;
|
---|
169 | parameter .Modelica.SIunits.Time startTime = 0;
|
---|
170 | replaceable Modelica.Blocks.Interfaces.SignalSource signalSource(final offset = offset, final startTime = startTime);
|
---|
171 | equation
|
---|
172 | v = signalSource.y;
|
---|
173 | end VoltageSource;
|
---|
174 | end Interfaces;
|
---|
175 |
|
---|
176 | package Sources
|
---|
177 | extends Modelica.Icons.SourcesPackage;
|
---|
178 |
|
---|
179 | model SineVoltage
|
---|
180 | parameter .Modelica.SIunits.Voltage V(start = 1);
|
---|
181 | parameter .Modelica.SIunits.Angle phase = 0;
|
---|
182 | parameter .Modelica.SIunits.Frequency freqHz(start = 1);
|
---|
183 | extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Sine signalSource(amplitude = V, freqHz = freqHz, phase = phase));
|
---|
184 | end SineVoltage;
|
---|
185 | end Sources;
|
---|
186 | end Analog;
|
---|
187 |
|
---|
188 | package Machines
|
---|
189 | extends Modelica.Icons.Package;
|
---|
190 |
|
---|
191 | package BasicMachines
|
---|
192 | extends Modelica.Icons.Package;
|
---|
193 |
|
---|
194 | package AsynchronousInductionMachines
|
---|
195 | extends Modelica.Icons.VariantsPackage;
|
---|
196 |
|
---|
197 | model AIM_SquirrelCage
|
---|
198 | extends Machines.Interfaces.PartialBasicInductionMachine(final idq_ss = airGapS.i_ss, final idq_sr = airGapS.i_sr, final idq_rs = airGapS.i_rs, final idq_rr = airGapS.i_rr, redeclare final Machines.Thermal.AsynchronousInductionMachines.ThermalAmbientAIMC thermalAmbient(final Tr = TrOperational), redeclare final Machines.Interfaces.InductionMachines.ThermalPortAIMC thermalPort, redeclare final Machines.Interfaces.InductionMachines.ThermalPortAIMC internalThermalPort, redeclare final Machines.Interfaces.InductionMachines.PowerBalanceAIMC powerBalance(final lossPowerRotorWinding = squirrelCageR.LossPower, final lossPowerRotorCore = 0), statorCore(final w = statorCoreParameters.wRef));
|
---|
199 | output Modelica.SIunits.Current[2] ir = -squirrelCageR.spacePhasor_r.i_;
|
---|
200 | Machines.BasicMachines.Components.AirGapS airGapS(final p = p, final Lm = Lm, final m = m);
|
---|
201 | parameter Modelica.SIunits.Inductance Lm(start = 3 * sqrt(1 - 0.0667) / (2 * pi * fsNominal));
|
---|
202 | parameter Modelica.SIunits.Inductance Lrsigma(start = 3 * (1 - sqrt(1 - 0.0667)) / (2 * pi * fsNominal));
|
---|
203 | parameter Modelica.SIunits.Resistance Rr(start = 0.04);
|
---|
204 | parameter Modelica.SIunits.Temperature TrRef(start = 293.15);
|
---|
205 | parameter Machines.Thermal.LinearTemperatureCoefficient20 alpha20r(start = 0);
|
---|
206 | parameter Modelica.SIunits.Temperature TrOperational(start = 293.15);
|
---|
207 | Machines.BasicMachines.Components.SquirrelCage squirrelCageR(final Lrsigma = Lrsigma, final Rr = Rr, final useHeatPort = true, final T_ref = TrRef, final T = TrRef, final alpha = Machines.Thermal.convertAlpha(alpha20r, TrRef));
|
---|
208 | equation
|
---|
209 | connect(airGapS.spacePhasor_r, squirrelCageR.spacePhasor_r);
|
---|
210 | connect(airGapS.flange, inertiaRotor.flange_a);
|
---|
211 | connect(lssigma.spacePhasor_b, airGapS.spacePhasor_s);
|
---|
212 | connect(squirrelCageR.heatPort, internalThermalPort.heatPortRotorWinding);
|
---|
213 | connect(airGapS.support, internalSupport);
|
---|
214 | end AIM_SquirrelCage;
|
---|
215 | end AsynchronousInductionMachines;
|
---|
216 |
|
---|
217 | package Components
|
---|
218 | extends Modelica.Icons.Package;
|
---|
219 |
|
---|
220 | partial model PartialAirGap
|
---|
221 | parameter Integer m = 3;
|
---|
222 | parameter Integer p(min = 1);
|
---|
223 | output Modelica.SIunits.Torque tauElectrical;
|
---|
224 | Modelica.SIunits.Angle gamma;
|
---|
225 | Modelica.SIunits.Current[2] i_ss;
|
---|
226 | Modelica.SIunits.Current[2] i_sr;
|
---|
227 | Modelica.SIunits.Current[2] i_rs;
|
---|
228 | Modelica.SIunits.Current[2] i_rr;
|
---|
229 | Modelica.SIunits.MagneticFlux[2] psi_ms;
|
---|
230 | Modelica.SIunits.MagneticFlux[2] psi_mr;
|
---|
231 | Real[2, 2] RotationMatrix;
|
---|
232 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange;
|
---|
233 | Modelica.Mechanics.Rotational.Interfaces.Flange_a support;
|
---|
234 | Machines.Interfaces.SpacePhasor spacePhasor_s;
|
---|
235 | Machines.Interfaces.SpacePhasor spacePhasor_r;
|
---|
236 | equation
|
---|
237 | gamma = p * (flange.phi - support.phi);
|
---|
238 | RotationMatrix = {{+cos(gamma), -sin(gamma)}, {+sin(gamma), +cos(gamma)}};
|
---|
239 | i_ss = spacePhasor_s.i_;
|
---|
240 | i_ss = RotationMatrix * i_sr;
|
---|
241 | i_rr = spacePhasor_r.i_;
|
---|
242 | i_rs = RotationMatrix * i_rr;
|
---|
243 | spacePhasor_s.v_ = der(psi_ms);
|
---|
244 | spacePhasor_r.v_ = der(psi_mr);
|
---|
245 | tauElectrical = m / 2 * p * (spacePhasor_s.i_[2] * psi_ms[1] - spacePhasor_s.i_[1] * psi_ms[2]);
|
---|
246 | flange.tau = -tauElectrical;
|
---|
247 | support.tau = tauElectrical;
|
---|
248 | end PartialAirGap;
|
---|
249 |
|
---|
250 | model AirGapS
|
---|
251 | parameter Modelica.SIunits.Inductance Lm;
|
---|
252 | extends PartialAirGap;
|
---|
253 | Modelica.SIunits.Current[2] i_ms;
|
---|
254 | protected
|
---|
255 | parameter Modelica.SIunits.Inductance[2, 2] L = {{Lm, 0}, {0, Lm}};
|
---|
256 | equation
|
---|
257 | i_ms = i_ss + i_rs;
|
---|
258 | psi_ms = L * i_ms;
|
---|
259 | psi_mr = transpose(RotationMatrix) * psi_ms;
|
---|
260 | end AirGapS;
|
---|
261 |
|
---|
262 | model Inductor
|
---|
263 | parameter Modelica.SIunits.Inductance[2] L;
|
---|
264 | Modelica.SIunits.Voltage[2] v_;
|
---|
265 | Modelica.SIunits.Current[2] i_;
|
---|
266 | Machines.Interfaces.SpacePhasor spacePhasor_a;
|
---|
267 | Machines.Interfaces.SpacePhasor spacePhasor_b;
|
---|
268 | equation
|
---|
269 | spacePhasor_a.i_ + spacePhasor_b.i_ = zeros(2);
|
---|
270 | v_ = spacePhasor_a.v_ - spacePhasor_b.v_;
|
---|
271 | i_ = spacePhasor_a.i_;
|
---|
272 | v_[1] = L[1] * der(i_[1]);
|
---|
273 | v_[2] = L[2] * der(i_[2]);
|
---|
274 | end Inductor;
|
---|
275 |
|
---|
276 | model SquirrelCage
|
---|
277 | parameter Modelica.SIunits.Inductance Lrsigma;
|
---|
278 | parameter Modelica.SIunits.Resistance Rr;
|
---|
279 | parameter Modelica.SIunits.Temperature T_ref = 293.15;
|
---|
280 | parameter Modelica.SIunits.LinearTemperatureCoefficient alpha = 0;
|
---|
281 | extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T = T_ref);
|
---|
282 | Modelica.SIunits.Resistance Rr_actual;
|
---|
283 | Machines.Interfaces.SpacePhasor spacePhasor_r;
|
---|
284 | equation
|
---|
285 | assert(1 + alpha * (T_heatPort - T_ref) >= Modelica.Constants.eps, "Temperature outside scope of model!");
|
---|
286 | Rr_actual = Rr * (1 + alpha * (T_heatPort - T_ref));
|
---|
287 | spacePhasor_r.v_ = Rr_actual * spacePhasor_r.i_ + Lrsigma * der(spacePhasor_r.i_);
|
---|
288 | 2 / 3 * LossPower = Rr_actual * (spacePhasor_r.i_[1] * spacePhasor_r.i_[1] + spacePhasor_r.i_[2] * spacePhasor_r.i_[2]);
|
---|
289 | end SquirrelCage;
|
---|
290 | end Components;
|
---|
291 | end BasicMachines;
|
---|
292 |
|
---|
293 | package SpacePhasors
|
---|
294 | extends Modelica.Icons.Package;
|
---|
295 |
|
---|
296 | package Components
|
---|
297 | extends Modelica.Icons.Package;
|
---|
298 |
|
---|
299 | model SpacePhasor
|
---|
300 | constant Integer m = 3;
|
---|
301 | constant Real pi = Modelica.Constants.pi;
|
---|
302 | parameter Real turnsRatio = 1;
|
---|
303 | Modelica.SIunits.Voltage[m] v;
|
---|
304 | Modelica.SIunits.Current[m] i;
|
---|
305 | protected
|
---|
306 | parameter Real[2, m] TransformationMatrix = 2 / m * {array(cos(+(k - 1) / m * 2 * pi) for k in 1:m), array(+sin(+(k - 1) / m * 2 * pi) for k in 1:m)};
|
---|
307 | parameter Real[m, 2] InverseTransformation = array({cos(-(k - 1) / m * 2 * pi), -sin(-(k - 1) / m * 2 * pi)} for k in 1:m);
|
---|
308 | public
|
---|
309 | Modelica.Electrical.MultiPhase.Interfaces.PositivePlug plug_p(final m = m);
|
---|
310 | Modelica.Electrical.MultiPhase.Interfaces.NegativePlug plug_n(final m = m);
|
---|
311 | Modelica.Electrical.Analog.Interfaces.PositivePin zero;
|
---|
312 | Modelica.Electrical.Analog.Interfaces.NegativePin ground;
|
---|
313 | Machines.Interfaces.SpacePhasor spacePhasor;
|
---|
314 | equation
|
---|
315 | v / turnsRatio = plug_p.pin.v - plug_n.pin.v;
|
---|
316 | i * turnsRatio = +plug_p.pin.i;
|
---|
317 | i * turnsRatio = -plug_n.pin.i;
|
---|
318 | m * zero.v = sum(v);
|
---|
319 | spacePhasor.v_ = TransformationMatrix * v;
|
---|
320 | -m * zero.i = sum(i);
|
---|
321 | -spacePhasor.i_ = TransformationMatrix * i;
|
---|
322 | ground.v = 0;
|
---|
323 | end SpacePhasor;
|
---|
324 | end Components;
|
---|
325 |
|
---|
326 | package Functions
|
---|
327 | extends Modelica.Icons.Package;
|
---|
328 |
|
---|
329 | function activePower
|
---|
330 | extends Modelica.Icons.Function;
|
---|
331 | input Modelica.SIunits.Voltage[m] v;
|
---|
332 | input Modelica.SIunits.Current[m] i;
|
---|
333 | output Modelica.SIunits.Power p;
|
---|
334 | protected
|
---|
335 | constant Integer m = 3;
|
---|
336 | constant Modelica.SIunits.Angle pi = Modelica.Constants.pi;
|
---|
337 | Modelica.SIunits.Voltage[2] v_;
|
---|
338 | Modelica.SIunits.Current[2] i_;
|
---|
339 | algorithm
|
---|
340 | v_ := zeros(2);
|
---|
341 | i_ := zeros(2);
|
---|
342 | for k in 1:m loop
|
---|
343 | v_ := v_ + 2 / m * {+cos((k - 1) / m * 2 * pi), +sin(+(k - 1) / m * 2 * pi)} * v[k];
|
---|
344 | i_ := i_ + 2 / m * {+cos((k - 1) / m * 2 * pi), +sin(+(k - 1) / m * 2 * pi)} * i[k];
|
---|
345 | end for;
|
---|
346 | p := m / 2 * (+v_[1] * i_[1] + v_[2] * i_[2]);
|
---|
347 | end activePower;
|
---|
348 | end Functions;
|
---|
349 | end SpacePhasors;
|
---|
350 |
|
---|
351 | package Losses
|
---|
352 | extends Modelica.Icons.Package;
|
---|
353 |
|
---|
354 | record FrictionParameters
|
---|
355 | extends Modelica.Icons.Record;
|
---|
356 | parameter Modelica.SIunits.Power PRef(min = 0) = 0;
|
---|
357 | parameter Modelica.SIunits.AngularVelocity wRef(displayUnit = "1/min", min = Modelica.Constants.small);
|
---|
358 | parameter Real power_w(min = Modelica.Constants.small) = 2;
|
---|
359 | final parameter Modelica.SIunits.Torque tauRef = if PRef <= 0 then 0 else PRef / wRef;
|
---|
360 | final parameter Real linear = 0.001;
|
---|
361 | final parameter Modelica.SIunits.AngularVelocity wLinear = linear * wRef;
|
---|
362 | final parameter Modelica.SIunits.Torque tauLinear = if PRef <= 0 then 0 else tauRef * (wLinear / wRef) ^ power_w;
|
---|
363 | end FrictionParameters;
|
---|
364 |
|
---|
365 | record StrayLoadParameters
|
---|
366 | extends Modelica.Icons.Record;
|
---|
367 | parameter Modelica.SIunits.Power PRef(min = 0) = 0;
|
---|
368 | parameter Modelica.SIunits.Current IRef(min = Modelica.Constants.small);
|
---|
369 | parameter Modelica.SIunits.AngularVelocity wRef(displayUnit = "1/min", min = Modelica.Constants.small);
|
---|
370 | parameter Real power_w(min = Modelica.Constants.small) = 1;
|
---|
371 | final parameter Modelica.SIunits.Torque tauRef = if PRef <= 0 then 0 else PRef / wRef;
|
---|
372 | end StrayLoadParameters;
|
---|
373 |
|
---|
374 | record CoreParameters
|
---|
375 | extends Modelica.Icons.Record;
|
---|
376 | parameter Integer m;
|
---|
377 | parameter Modelica.SIunits.Power PRef(min = 0) = 0;
|
---|
378 | parameter Modelica.SIunits.Voltage VRef(min = Modelica.Constants.small);
|
---|
379 | parameter Modelica.SIunits.AngularVelocity wRef(min = Modelica.Constants.small);
|
---|
380 | final parameter Real ratioHysteresis(min = 0, max = 1, start = 0.775) = 0;
|
---|
381 | final parameter Modelica.SIunits.Conductance GcRef = if PRef <= 0 then 0 else PRef / VRef ^ 2 / m;
|
---|
382 | final parameter Modelica.SIunits.AngularVelocity wMin = 0.000001 * wRef;
|
---|
383 | end CoreParameters;
|
---|
384 |
|
---|
385 | model Friction
|
---|
386 | extends Machines.Interfaces.FlangeSupport;
|
---|
387 | parameter FrictionParameters frictionParameters;
|
---|
388 | extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT(useHeatPort = false);
|
---|
389 | equation
|
---|
390 | if frictionParameters.PRef <= 0 then
|
---|
391 | tau = 0;
|
---|
392 | else
|
---|
393 | tau = -smooth(1, if w >= +frictionParameters.wLinear then +frictionParameters.tauRef * (+w / frictionParameters.wRef) ^ frictionParameters.power_w else if w <= -frictionParameters.wLinear then -frictionParameters.tauRef * (-w / frictionParameters.wRef) ^ frictionParameters.power_w else frictionParameters.tauLinear * w / frictionParameters.wLinear);
|
---|
394 | end if;
|
---|
395 | lossPower = -tau * w;
|
---|
396 | end Friction;
|
---|
397 |
|
---|
398 | package InductionMachines
|
---|
399 | extends Modelica.Icons.VariantsPackage;
|
---|
400 |
|
---|
401 | model StrayLoad
|
---|
402 | extends Modelica.Electrical.MultiPhase.Interfaces.OnePort;
|
---|
403 | extends Machines.Interfaces.FlangeSupport;
|
---|
404 | parameter Machines.Losses.StrayLoadParameters strayLoadParameters;
|
---|
405 | extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT(useHeatPort = false);
|
---|
406 | Modelica.SIunits.Current iRMS = .Modelica.Electrical.MultiPhase.Functions.quasiRMS(i);
|
---|
407 | equation
|
---|
408 | v = zeros(m);
|
---|
409 | if strayLoadParameters.PRef <= 0 then
|
---|
410 | tau = 0;
|
---|
411 | else
|
---|
412 | tau = -strayLoadParameters.tauRef * (iRMS / strayLoadParameters.IRef) ^ 2 * smooth(1, if w >= 0 then +(+w / strayLoadParameters.wRef) ^ strayLoadParameters.power_w else -(-w / strayLoadParameters.wRef) ^ strayLoadParameters.power_w);
|
---|
413 | end if;
|
---|
414 | lossPower = -tau * w;
|
---|
415 | end StrayLoad;
|
---|
416 |
|
---|
417 | model Core
|
---|
418 | parameter Machines.Losses.CoreParameters coreParameters(final m = m);
|
---|
419 | final parameter Integer m = 3;
|
---|
420 | parameter Real turnsRatio(final min = Modelica.Constants.small);
|
---|
421 | extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT(useHeatPort = false);
|
---|
422 | Machines.Interfaces.SpacePhasor spacePhasor;
|
---|
423 | input Modelica.SIunits.AngularVelocity w;
|
---|
424 | Modelica.SIunits.Conductance Gc;
|
---|
425 | protected
|
---|
426 | Modelica.SIunits.AngularVelocity wLimit = noEvent(max(noEvent(abs(w)), coreParameters.wMin));
|
---|
427 | equation
|
---|
428 | if coreParameters.PRef <= 0 then
|
---|
429 | Gc = 0;
|
---|
430 | spacePhasor.i_ = zeros(2);
|
---|
431 | else
|
---|
432 | Gc = coreParameters.GcRef;
|
---|
433 | spacePhasor.i_ = Gc * spacePhasor.v_;
|
---|
434 | end if;
|
---|
435 | lossPower = 3 / 2 * (+spacePhasor.v_[1] * spacePhasor.i_[1] + spacePhasor.v_[2] * spacePhasor.i_[2]);
|
---|
436 | end Core;
|
---|
437 | end InductionMachines;
|
---|
438 | end Losses;
|
---|
439 |
|
---|
440 | package Thermal
|
---|
441 | extends Modelica.Icons.Package;
|
---|
442 | type LinearTemperatureCoefficient20 = Modelica.SIunits.LinearTemperatureCoefficient;
|
---|
443 |
|
---|
444 | function convertAlpha
|
---|
445 | extends Modelica.Icons.Function;
|
---|
446 | input Modelica.SIunits.LinearTemperatureCoefficient alpha1;
|
---|
447 | input Modelica.SIunits.Temperature T2;
|
---|
448 | input Modelica.SIunits.Temperature T1 = 293.15;
|
---|
449 | output Modelica.SIunits.LinearTemperatureCoefficient alpha2;
|
---|
450 | algorithm
|
---|
451 | alpha2 := alpha1 / (1 + alpha1 * (T2 - T1));
|
---|
452 | end convertAlpha;
|
---|
453 |
|
---|
454 | package AsynchronousInductionMachines
|
---|
455 | extends Modelica.Icons.VariantsPackage;
|
---|
456 |
|
---|
457 | model ThermalAmbientAIMC
|
---|
458 | extends Machines.Interfaces.InductionMachines.PartialThermalAmbientInductionMachines(redeclare final Machines.Interfaces.InductionMachines.ThermalPortAIMC thermalPort);
|
---|
459 | parameter Modelica.SIunits.Temperature Tr(start = TDefault);
|
---|
460 | output Modelica.SIunits.HeatFlowRate Q_flowRotorWinding = temperatureRotorWinding.port.Q_flow;
|
---|
461 | output Modelica.SIunits.HeatFlowRate Q_flowTotal = Q_flowStatorWinding + Q_flowRotorWinding + Q_flowStatorCore + Q_flowRotorCore + Q_flowStrayLoad + Q_flowFriction;
|
---|
462 | Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature temperatureRotorWinding;
|
---|
463 | Modelica.Blocks.Interfaces.RealInput TRotorWinding if useTemperatureInputs;
|
---|
464 | Modelica.Blocks.Sources.Constant constTr(final k = Tr) if not useTemperatureInputs;
|
---|
465 | equation
|
---|
466 | connect(constTr.y, temperatureRotorWinding.T);
|
---|
467 | connect(temperatureRotorWinding.port, thermalPort.heatPortRotorWinding);
|
---|
468 | connect(TRotorWinding, temperatureRotorWinding.T);
|
---|
469 | end ThermalAmbientAIMC;
|
---|
470 | end AsynchronousInductionMachines;
|
---|
471 | end Thermal;
|
---|
472 |
|
---|
473 | package Interfaces
|
---|
474 | extends Modelica.Icons.InterfacesPackage;
|
---|
475 |
|
---|
476 | connector SpacePhasor
|
---|
477 | Modelica.SIunits.Voltage[2] v_;
|
---|
478 | flow Modelica.SIunits.Current[2] i_;
|
---|
479 | end SpacePhasor;
|
---|
480 |
|
---|
481 | partial model PartialBasicMachine
|
---|
482 | extends Machines.Icons.TransientMachine;
|
---|
483 | constant Modelica.SIunits.Angle pi = Modelica.Constants.pi;
|
---|
484 | parameter Modelica.SIunits.Inertia Jr;
|
---|
485 | parameter Boolean useSupport = false;
|
---|
486 | parameter Modelica.SIunits.Inertia Js(start = Jr);
|
---|
487 | parameter Boolean useThermalPort = false;
|
---|
488 | parameter Machines.Losses.FrictionParameters frictionParameters;
|
---|
489 | output Modelica.SIunits.Angle phiMechanical(start = 0) = flange.phi - internalSupport.phi;
|
---|
490 | output Modelica.SIunits.AngularVelocity wMechanical(displayUnit = "1/min", start = 0) = der(phiMechanical);
|
---|
491 | output Modelica.SIunits.Torque tauElectrical = inertiaRotor.flange_a.tau;
|
---|
492 | output Modelica.SIunits.Torque tauShaft = -flange.tau;
|
---|
493 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange;
|
---|
494 | Modelica.Mechanics.Rotational.Components.Inertia inertiaRotor(final J = Jr);
|
---|
495 | Modelica.Mechanics.Rotational.Interfaces.Flange_a support if useSupport;
|
---|
496 | Modelica.Mechanics.Rotational.Components.Inertia inertiaStator(final J = Js);
|
---|
497 | Modelica.Mechanics.Rotational.Components.Fixed fixed if not useSupport;
|
---|
498 | Machines.Losses.Friction friction(final frictionParameters = frictionParameters);
|
---|
499 | protected
|
---|
500 | Modelica.Mechanics.Rotational.Interfaces.Support internalSupport;
|
---|
501 | equation
|
---|
502 | connect(inertiaRotor.flange_b, flange);
|
---|
503 | connect(inertiaStator.flange_b, support);
|
---|
504 | connect(internalSupport, fixed.flange);
|
---|
505 | connect(internalSupport, inertiaStator.flange_a);
|
---|
506 | connect(inertiaRotor.flange_b, friction.flange);
|
---|
507 | connect(friction.support, internalSupport);
|
---|
508 | end PartialBasicMachine;
|
---|
509 |
|
---|
510 | partial model PartialBasicInductionMachine
|
---|
511 | final parameter Integer m = 3;
|
---|
512 | parameter Integer p(min = 1, start = 2);
|
---|
513 | parameter Modelica.SIunits.Frequency fsNominal(start = 50);
|
---|
514 | parameter Modelica.SIunits.Temperature TsOperational(start = 293.15);
|
---|
515 | parameter Modelica.SIunits.Resistance Rs(start = 0.03);
|
---|
516 | parameter Modelica.SIunits.Temperature TsRef(start = 293.15);
|
---|
517 | parameter Machines.Thermal.LinearTemperatureCoefficient20 alpha20s(start = 0);
|
---|
518 | parameter Modelica.SIunits.Inductance Lszero = Lssigma;
|
---|
519 | parameter Modelica.SIunits.Inductance Lssigma(start = 3 * (1 - sqrt(1 - 0.0667)) / (2 * pi * fsNominal));
|
---|
520 | extends PartialBasicMachine(Jr(start = 0.29), frictionParameters(wRef = 2 * pi * fsNominal / p), friction(final useHeatPort = true));
|
---|
521 | parameter Machines.Losses.CoreParameters statorCoreParameters(final m = 3, VRef(start = 100), wRef = 2 * pi * fsNominal);
|
---|
522 | parameter Machines.Losses.StrayLoadParameters strayLoadParameters(IRef(start = 100), wRef = 2 * pi * fsNominal / p);
|
---|
523 | replaceable output Machines.Interfaces.InductionMachines.PartialPowerBalanceInductionMachines powerBalance(final powerStator = Machines.SpacePhasors.Functions.activePower(vs, is), final powerMechanical = wMechanical * tauShaft, final powerInertiaStator = inertiaStator.J * inertiaStator.a * inertiaStator.w, final powerInertiaRotor = inertiaRotor.J * inertiaRotor.a * inertiaRotor.w, final lossPowerStatorWinding = sum(rs.resistor.LossPower), final lossPowerStatorCore = statorCore.lossPower, final lossPowerStrayLoad = strayLoad.lossPower, final lossPowerFriction = friction.lossPower);
|
---|
524 | output Modelica.SIunits.Voltage[m] vs = plug_sp.pin.v - plug_sn.pin.v;
|
---|
525 | output Modelica.SIunits.Current[m] is = plug_sp.pin.i;
|
---|
526 | output Modelica.SIunits.Current i_0_s(stateSelect = StateSelect.prefer) = spacePhasorS.zero.i;
|
---|
527 | input Modelica.SIunits.Current[2] idq_ss;
|
---|
528 | input Modelica.SIunits.Current[2] idq_sr(each stateSelect = StateSelect.prefer);
|
---|
529 | input Modelica.SIunits.Current[2] idq_rs;
|
---|
530 | input Modelica.SIunits.Current[2] idq_rr(each stateSelect = StateSelect.prefer);
|
---|
531 | Modelica.Electrical.MultiPhase.Interfaces.PositivePlug plug_sp(final m = m);
|
---|
532 | Modelica.Electrical.MultiPhase.Interfaces.NegativePlug plug_sn(final m = m);
|
---|
533 | Modelica.Electrical.MultiPhase.Basic.Resistor rs(final m = m, final R = fill(Rs, m), final T_ref = fill(TsRef, m), final alpha = fill(Machines.Thermal.convertAlpha(alpha20s, TsRef), m), final useHeatPort = true, final T = fill(TsRef, m));
|
---|
534 | Machines.BasicMachines.Components.Inductor lssigma(final L = fill(Lssigma, 2));
|
---|
535 | Modelica.Electrical.Analog.Basic.Inductor lszero(final L = Lszero);
|
---|
536 | Machines.Losses.InductionMachines.Core statorCore(final coreParameters = statorCoreParameters, final useHeatPort = true, final turnsRatio = 1);
|
---|
537 | Machines.SpacePhasors.Components.SpacePhasor spacePhasorS(final turnsRatio = 1);
|
---|
538 | Machines.Losses.InductionMachines.StrayLoad strayLoad(final strayLoadParameters = strayLoadParameters, final useHeatPort = true, final m = m);
|
---|
539 | replaceable Machines.Interfaces.InductionMachines.PartialThermalPortInductionMachines thermalPort(final m = m) if useThermalPort;
|
---|
540 | replaceable Machines.Interfaces.InductionMachines.PartialThermalAmbientInductionMachines thermalAmbient(final useTemperatureInputs = false, final Ts = TsOperational, final m = m) if not useThermalPort;
|
---|
541 | protected
|
---|
542 | replaceable Machines.Interfaces.InductionMachines.PartialThermalPortInductionMachines internalThermalPort(final m = m);
|
---|
543 | equation
|
---|
544 | connect(spacePhasorS.plug_n, plug_sn);
|
---|
545 | connect(thermalPort, internalThermalPort);
|
---|
546 | connect(thermalAmbient.thermalPort, internalThermalPort);
|
---|
547 | connect(strayLoad.plug_n, rs.plug_p);
|
---|
548 | connect(strayLoad.plug_p, plug_sp);
|
---|
549 | connect(strayLoad.support, internalSupport);
|
---|
550 | connect(spacePhasorS.plug_p, rs.plug_n);
|
---|
551 | connect(spacePhasorS.zero, lszero.p);
|
---|
552 | connect(lszero.n, spacePhasorS.ground);
|
---|
553 | connect(spacePhasorS.spacePhasor, lssigma.spacePhasor_a);
|
---|
554 | connect(statorCore.spacePhasor, lssigma.spacePhasor_a);
|
---|
555 | connect(statorCore.heatPort, internalThermalPort.heatPortStatorCore);
|
---|
556 | connect(strayLoad.heatPort, internalThermalPort.heatPortStrayLoad);
|
---|
557 | connect(rs.heatPort, internalThermalPort.heatPortStatorWinding);
|
---|
558 | connect(friction.heatPort, internalThermalPort.heatPortFriction);
|
---|
559 | connect(strayLoad.flange, inertiaRotor.flange_b);
|
---|
560 | end PartialBasicInductionMachine;
|
---|
561 |
|
---|
562 | package InductionMachines
|
---|
563 | extends Modelica.Icons.VariantsPackage;
|
---|
564 |
|
---|
565 | connector PartialThermalPortInductionMachines
|
---|
566 | parameter Integer m = 3;
|
---|
567 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a[m] heatPortStatorWinding;
|
---|
568 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortStatorCore;
|
---|
569 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortRotorCore;
|
---|
570 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortStrayLoad;
|
---|
571 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortFriction;
|
---|
572 | end PartialThermalPortInductionMachines;
|
---|
573 |
|
---|
574 | model PartialThermalAmbientInductionMachines
|
---|
575 | parameter Integer m = 3;
|
---|
576 | parameter Boolean useTemperatureInputs = false;
|
---|
577 | constant Modelica.SIunits.Temperature TDefault = 293.15;
|
---|
578 | parameter Modelica.SIunits.Temperature Ts(start = TDefault);
|
---|
579 | output Modelica.SIunits.HeatFlowRate Q_flowStatorWinding = temperatureStatorWinding.port.Q_flow;
|
---|
580 | output Modelica.SIunits.HeatFlowRate Q_flowStatorCore = temperatureStatorCore.port.Q_flow;
|
---|
581 | output Modelica.SIunits.HeatFlowRate Q_flowRotorCore = temperatureRotorCore.port.Q_flow;
|
---|
582 | output Modelica.SIunits.HeatFlowRate Q_flowStrayLoad = temperatureStrayLoad.port.Q_flow;
|
---|
583 | output Modelica.SIunits.HeatFlowRate Q_flowFriction = temperatureFriction.port.Q_flow;
|
---|
584 | replaceable Machines.Interfaces.InductionMachines.PartialThermalPortInductionMachines thermalPort(final m = m);
|
---|
585 | Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature temperatureStatorWinding;
|
---|
586 | Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temperatureStatorCore(final T = TDefault);
|
---|
587 | Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temperatureRotorCore(final T = TDefault);
|
---|
588 | Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temperatureStrayLoad(final T = TDefault);
|
---|
589 | Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temperatureFriction(final T = TDefault);
|
---|
590 | Modelica.Blocks.Interfaces.RealInput TStatorWinding if useTemperatureInputs;
|
---|
591 | Modelica.Blocks.Sources.Constant constTs(final k = Ts) if not useTemperatureInputs;
|
---|
592 | Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollectorStator(final m = m);
|
---|
593 | equation
|
---|
594 | connect(constTs.y, temperatureStatorWinding.T);
|
---|
595 | connect(TStatorWinding, temperatureStatorWinding.T);
|
---|
596 | connect(temperatureStrayLoad.port, thermalPort.heatPortStrayLoad);
|
---|
597 | connect(temperatureFriction.port, thermalPort.heatPortFriction);
|
---|
598 | connect(thermalCollectorStator.port_b, temperatureStatorWinding.port);
|
---|
599 | connect(thermalCollectorStator.port_a, thermalPort.heatPortStatorWinding);
|
---|
600 | connect(temperatureStatorCore.port, thermalPort.heatPortStatorCore);
|
---|
601 | connect(temperatureRotorCore.port, thermalPort.heatPortRotorCore);
|
---|
602 | end PartialThermalAmbientInductionMachines;
|
---|
603 |
|
---|
604 | record PartialPowerBalanceInductionMachines
|
---|
605 | extends Modelica.Icons.Record;
|
---|
606 | Modelica.SIunits.Power powerStator = 0;
|
---|
607 | Modelica.SIunits.Power powerMechanical = 0;
|
---|
608 | Modelica.SIunits.Power powerInertiaStator = 0;
|
---|
609 | Modelica.SIunits.Power powerInertiaRotor = 0;
|
---|
610 | Modelica.SIunits.Power lossPowerTotal = 0;
|
---|
611 | Modelica.SIunits.Power lossPowerStatorWinding = 0;
|
---|
612 | Modelica.SIunits.Power lossPowerStatorCore = 0;
|
---|
613 | Modelica.SIunits.Power lossPowerRotorCore = 0;
|
---|
614 | Modelica.SIunits.Power lossPowerStrayLoad = 0;
|
---|
615 | Modelica.SIunits.Power lossPowerFriction = 0;
|
---|
616 | end PartialPowerBalanceInductionMachines;
|
---|
617 |
|
---|
618 | connector ThermalPortAIMC
|
---|
619 | extends Machines.Interfaces.InductionMachines.PartialThermalPortInductionMachines;
|
---|
620 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortRotorWinding;
|
---|
621 | end ThermalPortAIMC;
|
---|
622 |
|
---|
623 | record PowerBalanceAIMC
|
---|
624 | extends Machines.Interfaces.InductionMachines.PartialPowerBalanceInductionMachines(final lossPowerTotal = lossPowerStatorWinding + lossPowerStatorCore + lossPowerRotorCore + lossPowerStrayLoad + lossPowerFriction + lossPowerRotorWinding);
|
---|
625 | Modelica.SIunits.Power lossPowerRotorWinding;
|
---|
626 | end PowerBalanceAIMC;
|
---|
627 | end InductionMachines;
|
---|
628 |
|
---|
629 | partial model FlangeSupport
|
---|
630 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange;
|
---|
631 | Modelica.Mechanics.Rotational.Interfaces.Flange_a support;
|
---|
632 | Modelica.SIunits.Angle phi;
|
---|
633 | Modelica.SIunits.Torque tau;
|
---|
634 | Modelica.SIunits.AngularVelocity w;
|
---|
635 | equation
|
---|
636 | phi = flange.phi - support.phi;
|
---|
637 | w = der(phi);
|
---|
638 | tau = -flange.tau;
|
---|
639 | tau = support.tau;
|
---|
640 | end FlangeSupport;
|
---|
641 | end Interfaces;
|
---|
642 |
|
---|
643 | package Icons
|
---|
644 | extends Modelica.Icons.IconsPackage;
|
---|
645 |
|
---|
646 | partial model TransientMachine end TransientMachine;
|
---|
647 | end Icons;
|
---|
648 |
|
---|
649 | package Utilities
|
---|
650 | extends Modelica.Icons.UtilitiesPackage;
|
---|
651 |
|
---|
652 | model TerminalBox
|
---|
653 | parameter Integer m = 3;
|
---|
654 | parameter String terminalConnection(start = "Y");
|
---|
655 | Modelica.Electrical.MultiPhase.Interfaces.PositivePlug plug_sp(final m = m);
|
---|
656 | Modelica.Electrical.MultiPhase.Interfaces.NegativePlug plug_sn(final m = m);
|
---|
657 | Modelica.Electrical.MultiPhase.Basic.Star star(final m = m) if terminalConnection <> "D";
|
---|
658 | Modelica.Electrical.MultiPhase.Basic.Delta delta(final m = m) if terminalConnection == "D";
|
---|
659 | Modelica.Electrical.MultiPhase.Interfaces.PositivePlug plugSupply(final m = m);
|
---|
660 | Modelica.Electrical.Analog.Interfaces.NegativePin starpoint if terminalConnection <> "D";
|
---|
661 | equation
|
---|
662 | connect(plug_sn, star.plug_p);
|
---|
663 | connect(plug_sn, delta.plug_n);
|
---|
664 | connect(delta.plug_p, plug_sp);
|
---|
665 | connect(plug_sp, plugSupply);
|
---|
666 | connect(star.pin_n, starpoint);
|
---|
667 | end TerminalBox;
|
---|
668 | end Utilities;
|
---|
669 | end Machines;
|
---|
670 |
|
---|
671 | package MultiPhase
|
---|
672 | extends Modelica.Icons.Package;
|
---|
673 |
|
---|
674 | package Basic
|
---|
675 | extends Modelica.Icons.Package;
|
---|
676 |
|
---|
677 | model Star
|
---|
678 | parameter Integer m(final min = 1) = 3;
|
---|
679 | Interfaces.PositivePlug plug_p(final m = m);
|
---|
680 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n;
|
---|
681 | equation
|
---|
682 | for j in 1:m loop
|
---|
683 | plug_p.pin[j].v = pin_n.v;
|
---|
684 | end for;
|
---|
685 | sum(plug_p.pin.i) + pin_n.i = 0;
|
---|
686 | end Star;
|
---|
687 |
|
---|
688 | model Delta
|
---|
689 | parameter Integer m(final min = 2) = 3;
|
---|
690 | Interfaces.PositivePlug plug_p(final m = m);
|
---|
691 | Interfaces.NegativePlug plug_n(final m = m);
|
---|
692 | equation
|
---|
693 | for j in 1:m loop
|
---|
694 | if j < m then
|
---|
695 | plug_n.pin[j].v = plug_p.pin[j + 1].v;
|
---|
696 | plug_n.pin[j].i + plug_p.pin[j + 1].i = 0;
|
---|
697 | else
|
---|
698 | plug_n.pin[j].v = plug_p.pin[1].v;
|
---|
699 | plug_n.pin[j].i + plug_p.pin[1].i = 0;
|
---|
700 | end if;
|
---|
701 | end for;
|
---|
702 | end Delta;
|
---|
703 |
|
---|
704 | model Resistor
|
---|
705 | extends Interfaces.TwoPlug;
|
---|
706 | parameter Modelica.SIunits.Resistance[m] R(start = fill(1, m));
|
---|
707 | parameter Modelica.SIunits.Temperature[m] T_ref = fill(300.15, m);
|
---|
708 | parameter Modelica.SIunits.LinearTemperatureCoefficient[m] alpha = zeros(m);
|
---|
709 | extends Modelica.Electrical.MultiPhase.Interfaces.ConditionalHeatPort(final mh = m, T = T_ref);
|
---|
710 | Modelica.Electrical.Analog.Basic.Resistor[m] resistor(final R = R, final T_ref = T_ref, final alpha = alpha, each final useHeatPort = useHeatPort, final T = T);
|
---|
711 | equation
|
---|
712 | connect(resistor.p, plug_p.pin);
|
---|
713 | connect(resistor.n, plug_n.pin);
|
---|
714 | connect(resistor.heatPort, heatPort);
|
---|
715 | end Resistor;
|
---|
716 | end Basic;
|
---|
717 |
|
---|
718 | package Functions
|
---|
719 | extends Modelica.Icons.Package;
|
---|
720 |
|
---|
721 | function quasiRMS
|
---|
722 | extends Modelica.Icons.Function;
|
---|
723 | input Real[:] x;
|
---|
724 | output Real y;
|
---|
725 | algorithm
|
---|
726 | y := sqrt(sum(x .^ 2 / size(x, 1)));
|
---|
727 | end quasiRMS;
|
---|
728 |
|
---|
729 | function symmetricOrientation
|
---|
730 | extends Modelica.Icons.Function;
|
---|
731 | input Integer m;
|
---|
732 | output Modelica.SIunits.Angle[m] orientation;
|
---|
733 | algorithm
|
---|
734 | if mod(m, 2) == 0 then
|
---|
735 | if m == 2 then
|
---|
736 | orientation[1] := 0;
|
---|
737 | orientation[2] := +.Modelica.Constants.pi / 2;
|
---|
738 | else
|
---|
739 | orientation[1:integer(m / 2)] := symmetricOrientation(integer(m / 2));
|
---|
740 | orientation[integer(m / 2) + 1:m] := symmetricOrientation(integer(m / 2)) - fill(.Modelica.Constants.pi / m, integer(m / 2));
|
---|
741 | end if;
|
---|
742 | else
|
---|
743 | orientation := array((k - 1) * 2 * .Modelica.Constants.pi / m for k in 1:m);
|
---|
744 | end if;
|
---|
745 | end symmetricOrientation;
|
---|
746 | end Functions;
|
---|
747 |
|
---|
748 | package Sources
|
---|
749 | extends Modelica.Icons.SourcesPackage;
|
---|
750 |
|
---|
751 | model SineVoltage
|
---|
752 | extends Interfaces.TwoPlug;
|
---|
753 | parameter Modelica.SIunits.Voltage[m] V(start = fill(1, m));
|
---|
754 | parameter Modelica.SIunits.Angle[m] phase = -Modelica.Electrical.MultiPhase.Functions.symmetricOrientation(m);
|
---|
755 | parameter Modelica.SIunits.Frequency[m] freqHz(start = fill(1, m));
|
---|
756 | parameter Modelica.SIunits.Voltage[m] offset = zeros(m);
|
---|
757 | parameter Modelica.SIunits.Time[m] startTime = zeros(m);
|
---|
758 | Modelica.Electrical.Analog.Sources.SineVoltage[m] sineVoltage(final V = V, final phase = phase, final freqHz = freqHz, final offset = offset, final startTime = startTime);
|
---|
759 | equation
|
---|
760 | connect(sineVoltage.p, plug_p.pin);
|
---|
761 | connect(sineVoltage.n, plug_n.pin);
|
---|
762 | end SineVoltage;
|
---|
763 | end Sources;
|
---|
764 |
|
---|
765 | package Interfaces
|
---|
766 | extends Modelica.Icons.InterfacesPackage;
|
---|
767 |
|
---|
768 | connector Plug
|
---|
769 | parameter Integer m(final min = 1) = 3;
|
---|
770 | Modelica.Electrical.Analog.Interfaces.Pin[m] pin;
|
---|
771 | end Plug;
|
---|
772 |
|
---|
773 | connector PositivePlug
|
---|
774 | extends Plug;
|
---|
775 | end PositivePlug;
|
---|
776 |
|
---|
777 | connector NegativePlug
|
---|
778 | extends Plug;
|
---|
779 | end NegativePlug;
|
---|
780 |
|
---|
781 | partial model ConditionalHeatPort
|
---|
782 | parameter Integer mh(min = 1) = 3;
|
---|
783 | parameter Boolean useHeatPort = false;
|
---|
784 | parameter Modelica.SIunits.Temperature[mh] T = fill(293.15, mh);
|
---|
785 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a[mh] heatPort if useHeatPort;
|
---|
786 | end ConditionalHeatPort;
|
---|
787 |
|
---|
788 | partial model TwoPlug
|
---|
789 | parameter Integer m(min = 1) = 3;
|
---|
790 | Modelica.SIunits.Voltage[m] v;
|
---|
791 | Modelica.SIunits.Current[m] i;
|
---|
792 | PositivePlug plug_p(final m = m);
|
---|
793 | NegativePlug plug_n(final m = m);
|
---|
794 | equation
|
---|
795 | v = plug_p.pin.v - plug_n.pin.v;
|
---|
796 | i = plug_p.pin.i;
|
---|
797 | end TwoPlug;
|
---|
798 |
|
---|
799 | partial model OnePort
|
---|
800 | extends TwoPlug;
|
---|
801 | equation
|
---|
802 | plug_p.pin.i + plug_n.pin.i = zeros(m);
|
---|
803 | end OnePort;
|
---|
804 | end Interfaces;
|
---|
805 | end MultiPhase;
|
---|
806 | end Electrical;
|
---|
807 |
|
---|
808 | package Mechanics
|
---|
809 | extends Modelica.Icons.Package;
|
---|
810 |
|
---|
811 | package Rotational
|
---|
812 | extends Modelica.Icons.Package;
|
---|
813 |
|
---|
814 | package Components
|
---|
815 | extends Modelica.Icons.Package;
|
---|
816 |
|
---|
817 | model Fixed
|
---|
818 | parameter .Modelica.SIunits.Angle phi0 = 0;
|
---|
819 | Interfaces.Flange_b flange;
|
---|
820 | equation
|
---|
821 | flange.phi = phi0;
|
---|
822 | end Fixed;
|
---|
823 |
|
---|
824 | model Inertia
|
---|
825 | Rotational.Interfaces.Flange_a flange_a;
|
---|
826 | Rotational.Interfaces.Flange_b flange_b;
|
---|
827 | parameter .Modelica.SIunits.Inertia J(min = 0, start = 1);
|
---|
828 | parameter StateSelect stateSelect = StateSelect.default;
|
---|
829 | .Modelica.SIunits.Angle phi(stateSelect = stateSelect);
|
---|
830 | .Modelica.SIunits.AngularVelocity w(stateSelect = stateSelect);
|
---|
831 | .Modelica.SIunits.AngularAcceleration a;
|
---|
832 | equation
|
---|
833 | phi = flange_a.phi;
|
---|
834 | phi = flange_b.phi;
|
---|
835 | w = der(phi);
|
---|
836 | a = der(w);
|
---|
837 | J * a = flange_a.tau + flange_b.tau;
|
---|
838 | end Inertia;
|
---|
839 | end Components;
|
---|
840 |
|
---|
841 | package Sensors
|
---|
842 | extends Modelica.Icons.SensorsPackage;
|
---|
843 |
|
---|
844 | model SpeedSensor
|
---|
845 | extends Rotational.Interfaces.PartialAbsoluteSensor;
|
---|
846 | Modelica.Blocks.Interfaces.RealOutput w(unit = "rad/s");
|
---|
847 | equation
|
---|
848 | w = der(flange.phi);
|
---|
849 | end SpeedSensor;
|
---|
850 | end Sensors;
|
---|
851 |
|
---|
852 | package Sources
|
---|
853 | extends Modelica.Icons.SourcesPackage;
|
---|
854 |
|
---|
855 | model Torque
|
---|
856 | extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2;
|
---|
857 | Modelica.Blocks.Interfaces.RealInput tau(unit = "N.m");
|
---|
858 | equation
|
---|
859 | flange.tau = -tau;
|
---|
860 | end Torque;
|
---|
861 | end Sources;
|
---|
862 |
|
---|
863 | package Interfaces
|
---|
864 | extends Modelica.Icons.InterfacesPackage;
|
---|
865 |
|
---|
866 | connector Flange_a
|
---|
867 | .Modelica.SIunits.Angle phi;
|
---|
868 | flow .Modelica.SIunits.Torque tau;
|
---|
869 | end Flange_a;
|
---|
870 |
|
---|
871 | connector Flange_b
|
---|
872 | .Modelica.SIunits.Angle phi;
|
---|
873 | flow .Modelica.SIunits.Torque tau;
|
---|
874 | end Flange_b;
|
---|
875 |
|
---|
876 | connector Support
|
---|
877 | .Modelica.SIunits.Angle phi;
|
---|
878 | flow .Modelica.SIunits.Torque tau;
|
---|
879 | end Support;
|
---|
880 |
|
---|
881 | partial model PartialElementaryOneFlangeAndSupport2
|
---|
882 | parameter Boolean useSupport = false;
|
---|
883 | Flange_b flange;
|
---|
884 | Support support(phi = phi_support, tau = -flange.tau) if useSupport;
|
---|
885 | protected
|
---|
886 | Modelica.SIunits.Angle phi_support;
|
---|
887 | equation
|
---|
888 | if not useSupport then
|
---|
889 | phi_support = 0;
|
---|
890 | end if;
|
---|
891 | end PartialElementaryOneFlangeAndSupport2;
|
---|
892 |
|
---|
893 | partial model PartialAbsoluteSensor
|
---|
894 | extends Modelica.Icons.RotationalSensor;
|
---|
895 | Flange_a flange;
|
---|
896 | equation
|
---|
897 | 0 = flange.tau;
|
---|
898 | end PartialAbsoluteSensor;
|
---|
899 | end Interfaces;
|
---|
900 | end Rotational;
|
---|
901 | end Mechanics;
|
---|
902 |
|
---|
903 | package Thermal
|
---|
904 | extends Modelica.Icons.Package;
|
---|
905 |
|
---|
906 | package HeatTransfer
|
---|
907 | extends Modelica.Icons.Package;
|
---|
908 |
|
---|
909 | package Components
|
---|
910 | extends Modelica.Icons.Package;
|
---|
911 |
|
---|
912 | model ThermalCollector
|
---|
913 | parameter Integer m(min = 1) = 3;
|
---|
914 | Interfaces.HeatPort_a[m] port_a;
|
---|
915 | Interfaces.HeatPort_b port_b;
|
---|
916 | equation
|
---|
917 | port_b.Q_flow + sum(port_a.Q_flow) = 0;
|
---|
918 | port_a.T = fill(port_b.T, m);
|
---|
919 | end ThermalCollector;
|
---|
920 | end Components;
|
---|
921 |
|
---|
922 | package Sources
|
---|
923 | extends Modelica.Icons.SourcesPackage;
|
---|
924 |
|
---|
925 | model FixedTemperature
|
---|
926 | parameter Modelica.SIunits.Temperature T;
|
---|
927 | Interfaces.HeatPort_b port;
|
---|
928 | equation
|
---|
929 | port.T = T;
|
---|
930 | end FixedTemperature;
|
---|
931 |
|
---|
932 | model PrescribedTemperature
|
---|
933 | Interfaces.HeatPort_b port;
|
---|
934 | Modelica.Blocks.Interfaces.RealInput T(unit = "K");
|
---|
935 | equation
|
---|
936 | port.T = T;
|
---|
937 | end PrescribedTemperature;
|
---|
938 | end Sources;
|
---|
939 |
|
---|
940 | package Interfaces
|
---|
941 | extends Modelica.Icons.InterfacesPackage;
|
---|
942 |
|
---|
943 | partial connector HeatPort
|
---|
944 | Modelica.SIunits.Temperature T;
|
---|
945 | flow Modelica.SIunits.HeatFlowRate Q_flow;
|
---|
946 | end HeatPort;
|
---|
947 |
|
---|
948 | connector HeatPort_a
|
---|
949 | extends HeatPort;
|
---|
950 | end HeatPort_a;
|
---|
951 |
|
---|
952 | connector HeatPort_b
|
---|
953 | extends HeatPort;
|
---|
954 | end HeatPort_b;
|
---|
955 |
|
---|
956 | partial model PartialElementaryConditionalHeatPortWithoutT
|
---|
957 | parameter Boolean useHeatPort = false;
|
---|
958 | Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort(final Q_flow = -lossPower) if useHeatPort;
|
---|
959 | Modelica.SIunits.Power lossPower;
|
---|
960 | end PartialElementaryConditionalHeatPortWithoutT;
|
---|
961 | end Interfaces;
|
---|
962 | end HeatTransfer;
|
---|
963 | end Thermal;
|
---|
964 |
|
---|
965 | package Math
|
---|
966 | extends Modelica.Icons.Package;
|
---|
967 |
|
---|
968 | package Icons
|
---|
969 | extends Modelica.Icons.IconsPackage;
|
---|
970 |
|
---|
971 | partial function AxisLeft end AxisLeft;
|
---|
972 |
|
---|
973 | partial function AxisCenter end AxisCenter;
|
---|
974 | end Icons;
|
---|
975 |
|
---|
976 | function sin
|
---|
977 | extends Modelica.Math.Icons.AxisLeft;
|
---|
978 | input Modelica.SIunits.Angle u;
|
---|
979 | output Real y;
|
---|
980 | external "builtin" y = sin(u);
|
---|
981 | end sin;
|
---|
982 |
|
---|
983 | function asin
|
---|
984 | extends Modelica.Math.Icons.AxisCenter;
|
---|
985 | input Real u;
|
---|
986 | output .Modelica.SIunits.Angle y;
|
---|
987 | external "builtin" y = asin(u);
|
---|
988 | end asin;
|
---|
989 |
|
---|
990 | function exp
|
---|
991 | extends Modelica.Math.Icons.AxisCenter;
|
---|
992 | input Real u;
|
---|
993 | output Real y;
|
---|
994 | external "builtin" y = exp(u);
|
---|
995 | end exp;
|
---|
996 | end Math;
|
---|
997 |
|
---|
998 | package Constants
|
---|
999 | extends Modelica.Icons.Package;
|
---|
1000 | final constant Real pi = 2 * Math.asin(1.0);
|
---|
1001 | final constant Real eps = ModelicaServices.Machine.eps;
|
---|
1002 | final constant Real small = ModelicaServices.Machine.small;
|
---|
1003 | final constant .Modelica.SIunits.Velocity c = 299792458;
|
---|
1004 | final constant Real mue_0(final unit = "N/A2") = 4 * pi * 0.0000001;
|
---|
1005 | end Constants;
|
---|
1006 |
|
---|
1007 | package Icons
|
---|
1008 | extends Icons.Package;
|
---|
1009 |
|
---|
1010 | partial package Package end Package;
|
---|
1011 |
|
---|
1012 | partial package VariantsPackage
|
---|
1013 | extends Modelica.Icons.Package;
|
---|
1014 | end VariantsPackage;
|
---|
1015 |
|
---|
1016 | partial package InterfacesPackage
|
---|
1017 | extends Modelica.Icons.Package;
|
---|
1018 | end InterfacesPackage;
|
---|
1019 |
|
---|
1020 | partial package SourcesPackage
|
---|
1021 | extends Modelica.Icons.Package;
|
---|
1022 | end SourcesPackage;
|
---|
1023 |
|
---|
1024 | partial package SensorsPackage
|
---|
1025 | extends Modelica.Icons.Package;
|
---|
1026 | end SensorsPackage;
|
---|
1027 |
|
---|
1028 | partial package UtilitiesPackage
|
---|
1029 | extends Modelica.Icons.Package;
|
---|
1030 | end UtilitiesPackage;
|
---|
1031 |
|
---|
1032 | partial package IconsPackage
|
---|
1033 | extends Modelica.Icons.Package;
|
---|
1034 | end IconsPackage;
|
---|
1035 |
|
---|
1036 | partial class RotationalSensor end RotationalSensor;
|
---|
1037 |
|
---|
1038 | partial function Function end Function;
|
---|
1039 |
|
---|
1040 | partial record Record end Record;
|
---|
1041 | end Icons;
|
---|
1042 |
|
---|
1043 | package SIunits
|
---|
1044 | extends Modelica.Icons.Package;
|
---|
1045 |
|
---|
1046 | package Conversions
|
---|
1047 | extends Modelica.Icons.Package;
|
---|
1048 |
|
---|
1049 | package NonSIunits
|
---|
1050 | extends Modelica.Icons.Package;
|
---|
1051 | type Temperature_degC = Real(final quantity = "ThermodynamicTemperature", final unit = "degC");
|
---|
1052 | end NonSIunits;
|
---|
1053 | end Conversions;
|
---|
1054 |
|
---|
1055 | type Angle = Real(final quantity = "Angle", final unit = "rad", displayUnit = "deg");
|
---|
1056 | type Time = Real(final quantity = "Time", final unit = "s");
|
---|
1057 | type AngularVelocity = Real(final quantity = "AngularVelocity", final unit = "rad/s");
|
---|
1058 | type AngularAcceleration = Real(final quantity = "AngularAcceleration", final unit = "rad/s2");
|
---|
1059 | type Velocity = Real(final quantity = "Velocity", final unit = "m/s");
|
---|
1060 | type Acceleration = Real(final quantity = "Acceleration", final unit = "m/s2");
|
---|
1061 | type Frequency = Real(final quantity = "Frequency", final unit = "Hz");
|
---|
1062 | type MomentOfInertia = Real(final quantity = "MomentOfInertia", final unit = "kg.m2");
|
---|
1063 | type Inertia = MomentOfInertia;
|
---|
1064 | type Torque = Real(final quantity = "Torque", final unit = "N.m");
|
---|
1065 | type Power = Real(final quantity = "Power", final unit = "W");
|
---|
1066 | type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC");
|
---|
1067 | type Temperature = ThermodynamicTemperature;
|
---|
1068 | type LinearTemperatureCoefficient = Real(final quantity = "LinearTemperatureCoefficient", final unit = "1/K");
|
---|
1069 | type HeatFlowRate = Real(final quantity = "Power", final unit = "W");
|
---|
1070 | type ElectricCurrent = Real(final quantity = "ElectricCurrent", final unit = "A");
|
---|
1071 | type Current = ElectricCurrent;
|
---|
1072 | type ElectricPotential = Real(final quantity = "ElectricPotential", final unit = "V");
|
---|
1073 | type Voltage = ElectricPotential;
|
---|
1074 | type MagneticFlux = Real(final quantity = "MagneticFlux", final unit = "Wb");
|
---|
1075 | type Inductance = Real(final quantity = "Inductance", final unit = "H");
|
---|
1076 | type Resistance = Real(final quantity = "Resistance", final unit = "Ohm");
|
---|
1077 | type Conductance = Real(final quantity = "Conductance", final unit = "S");
|
---|
1078 | type FaradayConstant = Real(final quantity = "FaradayConstant", final unit = "C/mol");
|
---|
1079 | end SIunits;
|
---|
1080 | end Modelica;
|
---|