Ticket #5377: TestUpdate.mo

File TestUpdate.mo, 9.7 KB (added by massimo ceraolo, 6 years ago)
Line 
1package TestUpdate "PM SMA package"
2 //package Propulsion
3 extends Modelica.Icons.Package;
4 //end Propulsion;
5
6 model FromPark "Semplice PMM con modello funzionale inverter"
7 parameter Integer p "Number or pole pairs";
8 Modelica.Electrical.Machines.SpacePhasors.Blocks.FromSpacePhasor fromSpacePhasor annotation(
9 Placement(transformation(extent = {{60, 0}, {80, 20}})));
10 Modelica.Electrical.Machines.SpacePhasors.Blocks.Rotator rotator annotation(
11 Placement(transformation(extent = {{0, 6}, {20, 26}})));
12 Modelica.Blocks.Routing.Multiplex2 multiplex2_1 annotation(
13 Placement(transformation(extent = {{-40, 0}, {-20, 20}})));
14 Modelica.Blocks.Interfaces.RealOutput y[3] annotation(
15 Placement(transformation(extent = {{100, -10}, {120, 10}}), iconTransformation(extent = {{100, -10}, {120, 10}})));
16 Modelica.Blocks.Interfaces.RealInput Xd annotation(
17 Placement(transformation(extent = {{-140, 40}, {-100, 80}}), iconTransformation(extent = {{-140, 40}, {-100, 80}})));
18 Modelica.Blocks.Interfaces.RealInput Xq annotation(
19 Placement(transformation(extent = {{-140, -80}, {-100, -40}}), iconTransformation(extent = {{-140, -80}, {-100, -40}})));
20 Modelica.Blocks.Interfaces.RealInput phi annotation(
21 Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -120}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -120})));
22 Modelica.Blocks.Math.Gain gain(k = -p) annotation(
23 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {10, -50})));
24 Modelica.Blocks.Sources.Constant const annotation(
25 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {50, -30})));
26 equation
27 connect(multiplex2_1.y, rotator.u) annotation(
28 Line(points = {{-19, 10}, {-10, 10}, {-10, 16}, {-2, 16}}, color = {0, 0, 127}, smooth = Smooth.None));
29 connect(fromSpacePhasor.u, rotator.y) annotation(
30 Line(points = {{58, 10}, {40, 10}, {40, 16}, {21, 16}}, color = {0, 0, 127}, smooth = Smooth.None));
31 connect(fromSpacePhasor.y, y) annotation(
32 Line(points = {{81, 10}, {94, 10}, {94, 0}, {110, 0}}, color = {0, 0, 127}, smooth = Smooth.None));
33 connect(multiplex2_1.u1[1], Xd) annotation(
34 Line(points = {{-42, 16}, {-60, 16}, {-60, 60}, {-120, 60}}, color = {0, 0, 127}, smooth = Smooth.None));
35 connect(multiplex2_1.u2[1], Xq) annotation(
36 Line(points = {{-42, 4}, {-60, 4}, {-60, -60}, {-120, -60}}, color = {0, 0, 127}, smooth = Smooth.None));
37 connect(rotator.angle, gain.y) annotation(
38 Line(points = {{10, 4}, {10, -39}}, color = {0, 0, 127}, smooth = Smooth.None));
39 connect(gain.u, phi) annotation(
40 Line(points = {{10, -62}, {10, -120}, {0, -120}}, color = {0, 0, 127}, smooth = Smooth.None));
41 connect(fromSpacePhasor.zero, const.y) annotation(
42 Line(points = {{58, 2}, {50, 2}, {50, -19}}, color = {0, 0, 127}, smooth = Smooth.None));
43 annotation(
44 Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}})),
45 experiment(StopTime = 5, Interval = 0.001),
46 Documentation(info = "<html>
47 <p>Converts variables form Park into phase quantities</p>
48 </html>"),
49 __Dymola_experimentSetupOutput,
50 Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(lineColor = {0, 0, 127}, extent = {{-96, 28}, {96, -26}}, textString = "P=>"), Text(lineColor = {0, 0, 255}, extent = {{-108, 150}, {102, 110}}, textString = "%name")}));
51 end FromPark;
52
53 model FullFlux
54 // extends Modelica.Icons.Example;
55 Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet smpm(useDamperCage = false) annotation(
56 Placement(visible = true, transformation(extent = {{-6, -50}, {14, -30}}, rotation = 0)));
57 Modelica.Electrical.MultiPhase.Sources.SignalCurrent signalCurr(final m = 3) annotation(
58 Placement(visible = true, transformation(origin = {28, 6}, extent = {{-10, 10}, {10, -10}}, rotation = 180)));
59 Modelica.Electrical.MultiPhase.Basic.Star star(final m = 3) annotation(
60 Placement(visible = true, transformation(origin = {56, 6}, extent = {{10, -10}, {-10, 10}}, rotation = 180)));
61 Modelica.Electrical.Analog.Basic.Ground ground1 annotation(
62 Placement(visible = true, transformation(origin = {82, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
63 Modelica.Electrical.Analog.Basic.Ground groundM annotation(
64 Placement(visible = true, transformation(origin = {-20, -22}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
65 Modelica.Mechanics.Rotational.Sensors.AngleSensor angleS annotation(
66 Placement(visible = true, transformation(origin = {24, -26}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
67 Modelica.Mechanics.Rotational.Components.Inertia inertia1(J = 0.29, phi(fixed = true, start = 0), w(fixed = true, start = 0)) annotation(
68 Placement(visible = true, transformation(extent = {{32, -50}, {52, -30}}, rotation = 0)));
69 Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque tRes1(w_nominal(displayUnit = "rpm") = 157.07963267949, tau_nominal = -150) annotation(
70 Placement(visible = true, transformation(extent = {{84, -50}, {64, -30}}, rotation = 0)));
71 FromPark fromPark(p = smpm.p) annotation(
72 Placement(visible = true, transformation(extent = {{-18, 10}, {2, 30}}, rotation = 0)));
73 Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection = "Y") annotation(
74 Placement(visible = true, transformation(extent = {{-6, -22}, {14, -2}}, rotation = 0)));
75 Modelica.Blocks.Math.Gain toIq(k = 0.659) annotation(
76 Placement(transformation(extent = {{-8, -8}, {8, 8}}, rotation = 90, origin = {-40, -4})));
77 Modelica.Blocks.Sources.Ramp tqRef(duration = 2, startTime = 1, offset = 20, height = 120) annotation(
78 Placement(transformation(extent = {{-76, -36}, {-56, -16}})));
79 Modelica.Blocks.Sources.Ramp IdRef(duration = 1, height = 0, startTime = 2) annotation(
80 Placement(transformation(extent = {{-68, 12}, {-48, 32}})));
81 equation
82 connect(tRes1.flange, inertia1.flange_b) annotation(
83 Line(points = {{64, -40}, {52, -40}}));
84 connect(terminalBox.plug_sp, smpm.plug_sp) annotation(
85 Line(points = {{10, -18}, {12, -18}, {12, -24}, {10, -24}, {10, -30}}, color = {0, 0, 255}));
86 connect(terminalBox.plug_sn, smpm.plug_sn) annotation(
87 Line(points = {{-2, -18}, {-2, -30}}, color = {0, 0, 255}));
88 connect(signalCurr.plug_n, terminalBox.plugSupply) annotation(
89 Line(points = {{18, 6}, {4, 6}, {4, -16}}, color = {0, 0, 255}));
90 connect(groundM.p, terminalBox.starpoint) annotation(
91 Line(points = {{-10, -22}, {-7.5, -22}, {-7.5, -16}, {-5, -16}}, color = {0, 0, 255}));
92 connect(inertia1.flange_a, smpm.flange) annotation(
93 Line(points = {{32, -40}, {14, -40}}));
94 connect(angleS.flange, smpm.flange) annotation(
95 Line(points = {{24, -36}, {24, -40}, {14, -40}}));
96 connect(fromPark.y, signalCurr.i) annotation(
97 Line(points = {{3, 20}, {28, 20}, {28, 13}}, color = {0, 0, 127}));
98 connect(signalCurr.plug_p, star.plug_p) annotation(
99 Line(points = {{38, 6}, {46, 6}}, color = {0, 0, 255}));
100 connect(star.pin_n, ground1.p) annotation(
101 Line(points = {{66, 6}, {72, 6}}, color = {0, 0, 255}));
102 connect(angleS.phi, fromPark.phi) annotation(
103 Line(points = {{24, -15}, {24, -8}, {-8, -8}, {-8, 8}}, color = {0, 0, 127}));
104 connect(toIq.y, fromPark.Xq) annotation(
105 Line(points = {{-40, 4.8}, {-40, 14}, {-20, 14}}, color = {0, 0, 127}));
106 connect(tqRef.y, toIq.u) annotation(
107 Line(points = {{-55, -26}, {-40, -26}, {-40, -13.6}}, color = {0, 0, 127}));
108 connect(IdRef.y, fromPark.Xd) annotation(
109 Line(points = {{-47, 22}, {-36, 22}, {-36, 26}, {-20, 26}}, color = {0, 0, 127}));
110 annotation(
111 experiment(StopTime = 5, Interval = 0.001),
112 __Dymola_experimentSetupOutput,
113 Documentation(info = "<html><head></head><body><p>Az. brushless con controllo manuale. Propedeutico a quelli con l'MTPA che fanno tutto automaticamente&nbsp;</p><p>Prima si simula con Id=0, poi si mette un po' di Id negativa per portare la tensione di picco entro i 141V, senza superare il limite di corrente di 141 A di picco.</p><p>Torque constant=0.659 Nm/A</p><p>Ok OM 1.11</p><ul>
114 </ul>
115 </body></html>"),
116 Icon(coordinateSystem(extent = {{-100, -80}, {100, 60}})),
117 Diagram(coordinateSystem(extent = {{-80, -60}, {100, 40}}, preserveAspectRatio = false, initialScale = 0.1), graphics = {Text(origin = {35, 39}, extent = {{-23, 3}, {45, -19}}, textString = "Aggiungere deflussaggio per tenere la tensione nei limiti\nsenza superare i limiti di corrent. Es. 50 A", horizontalAlignment = TextAlignment.Left)}),
118 __OpenModelica_commandLineOptions = "");
119 end FullFlux;
120 annotation(
121 uses(Modelica(version = "3.2.2")),
122 Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1)),
123 Documentation(info = "<html>
124<p>Library containing models of components, subsystems and full vehicle examples for simulation of electric and Hybrid vehicular power trains.</p>
125<p>A general description of the library composition and on how to use it effectively is in the compaion paper:</p>
126<p>M. Ceraolo &QUOT;Modelica Electric and hybrid power trains library&QUOT; submitted for publication at the 11th International Modelica Conference, 2015, September 21-23, Palais des congr&egrave;s de Versailles, 23-23 September, France</p>
127</html>"));
128end TestUpdate;