Ticket #5461: DiscGenerator.mo

File DiscGenerator.mo, 7.1 KB (added by Dietmar Winkler, 6 years ago)
Line 
1package DiscGenerator
2 model EMF "Electromotoric force (electric/mechanic transformer)"
3 import SI = Modelica.SIunits;
4
5 parameter SI.MagneticFluxDensity B = 0.05 "Magnetic Flux Density of the Magnets";
6 parameter SI.Radius r_o "Outer Radius of the Copper Disc";
7 parameter SI.Radius r_i "Inner Radius of the Copper Disc";
8 parameter SI.Resistivity p_Cu = 1.68e-8 "Resistivity of Copper";
9 parameter SI.Area A = 4.2e-6 "Smallest Cross-sectional Area of Conducting Path";
10 parameter SI.Length lDisc = r_o - r_i "Length of Conducting Path along the Radius of the Disc";
11 parameter SI.Length lRail = 9e-3 "Length of Conducting Rail from Disc to Commutator";
12 parameter SI.Length lCom = 15.158e-3 "Length of Conducting Path along the Commutator";
13 Real wrapAngle;
14 Real cosine;
15 SI.Length lDelta "Variable Length of the Conducting Path";
16 SI.Length l "Length of Conducting Path";
17 SI.Resistance R_disc "Resistance of the Rotor";
18 SI.Current i "Current flowing from positive to negative pin";
19 SI.Angle phi "Angle of shaft flange with respect to support (= flange.phi - support.phi)";
20 SI.AngularVelocity w "Angular velocity of flange relative to support";
21 SI.Torque tau "Torque of flange";
22 SI.Torque tauElectrical "Electrical torque";
23 Modelica.Electrical.Analog.Interfaces.PositivePin p "Positive electrical pin" annotation(
24 Placement(transformation(origin = {0, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
25 Modelica.Electrical.Analog.Interfaces.NegativePin n "Negative electrical pin" annotation(
26 Placement(transformation(origin = {0, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
27 Modelica.Mechanics.Rotational.Interfaces.Flange_b flange "Flange" annotation(
28 Placement(transformation(extent = {{90, -10}, {110, 10}}, rotation = 0)));
29 Modelica.Electrical.Analog.Sources.SignalVoltage InducedVoltage annotation(
30 Placement(visible = true, transformation(origin = {0, -34}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
31 Modelica.Electrical.Analog.Basic.VariableResistor discResistance annotation(
32 Placement(visible = true, transformation(origin = {0, 24}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
33 equation
34//v = p.v - n.v;
35//0 = p.i + n.i;
36 i = p.i;
37 phi = flange.phi;
38//wrapAngle = Modelica.Math.wrapAngle(phi,positiveRange = true);
39 wrapAngle = mod(phi, Modelica.Constants.pi / 2) / (Modelica.Constants.pi / 2);
40 cosine = cos(2 * Modelica.Constants.pi * wrapAngle);
41 lDelta = 0.015158 * cosine;
42 l = lDisc + lRail + lCom + lDelta;
43 discResistance.R = p_Cu * (l / A);
44// TODO : use the calculated resistance of the copper for the voltage and current calculations
45 w = der(phi);
46 tau = flange.tau;
47 tauElectrical = B * i * (r_o ^ 2 / 2 - r_i ^ 2 / 2);
48 tauElectrical = -tau;
49 InducedVoltage.v = 0.5 * w * B * (r_o ^ 2 - r_i ^ 2);
50 connect(InducedVoltage.n, n) annotation(
51 Line(points = {{0, -44}, {0, -44}, {0, -100}, {0, -100}}, color = {0, 0, 255}));
52 connect(p, discResistance.p) annotation(
53 Line(points = {{0, 100}, {0, 100}, {0, 34}, {0, 34}}, color = {0, 0, 255}));
54 connect(discResistance.n, InducedVoltage.p) annotation(
55 Line(points = {{0, 14}, {0, 14}, {0, -24}, {0, -24}}, color = {0, 0, 255}));
56 annotation(
57 defaultComponentName = "emf",
58 Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-85, 10}, {-36, -10}}, fillPattern = FillPattern.HorizontalCylinder, fillColor = {192, 192, 192}), Rectangle(extent = {{35, 10}, {100, -10}}, fillPattern = FillPattern.HorizontalCylinder, fillColor = {192, 192, 192}), Ellipse(extent = {{-40, 40}, {40, -40}}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, lineColor = {0, 0, 255}), Text(extent = {{-150, 90}, {150, 50}}, textString = "%name", lineColor = {0, 0, 255}), Text(extent = {{-150, -50}, {150, -90}}, textString = "k=%k"), Line(visible = not useSupport, points = {{-100, -30}, {-40, -30}}), Line(visible = not useSupport, points = {{-100, -50}, {-80, -30}}), Line(visible = not useSupport, points = {{-80, -50}, {-60, -30}}), Line(visible = not useSupport, points = {{-60, -50}, {-40, -30}}), Line(visible = not useSupport, points = {{-70, -30}, {-70, -10}}), Line(points = {{0, 40}, {0, 50}}, color = {0, 0, 255}), Line(points = {{0, -50}, {0, -40}}, color = {0, 0, 255})}),
59 Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{-17, 95}, {-20, 85}, {-23, 95}, {-17, 95}}, lineColor = {160, 160, 164}, fillColor = {160, 160, 164}, fillPattern = FillPattern.Solid), Line(points = {{-20, 110}, {-20, 85}}, color = {160, 160, 164}), Text(extent = {{-40, 110}, {-30, 90}}, lineColor = {160, 160, 164}, textString = "i"), Line(points = {{9, 75}, {19, 75}}, color = {192, 192, 192}), Line(points = {{-20, -110}, {-20, -85}}, color = {160, 160, 164}), Polygon(points = {{-17, -100}, {-20, -110}, {-23, -100}, {-17, -100}}, lineColor = {160, 160, 164}, fillColor = {160, 160, 164}, fillPattern = FillPattern.Solid), Text(extent = {{-40, -110}, {-30, -90}}, lineColor = {160, 160, 164}, textString = "i"), Line(points = {{8, -79}, {18, -79}}, color = {192, 192, 192}), Line(points = {{14, 80}, {14, 70}}, color = {192, 192, 192})}),
60 Documentation(info = "<html>
61 <p>EMF transforms electrical energy into rotational mechanical energy. It is used as basic building block of an electrical motor. The mechanical connector flange can be connected to elements of the Modelica.Mechanics.Rotational library. flange.tau is the cut-torque, flange.phi is the angle at the rotational connection.</p>
62 </html>", revisions = "<html>
63 <ul>
64 <li><em> 1998 </em>
65 by Martin Otter<br> initially implemented<br>
66 </li>
67 </ul>
68 </html>"));
69 end EMF;
70
71 model TestGen
72 Modelica.Electrical.Analog.Basic.Ground ground1 annotation(
73 Placement(visible = true, transformation(origin = {46, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
74 Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeed1(w_fixed = 1) annotation(
75 Placement(visible = true, transformation(origin = {-58, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
76 Modelica.Electrical.Analog.Basic.Resistor Load annotation(
77 Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
78 DiscGenerator.EMF DiscGenerator annotation(
79 Placement(visible = true, transformation(origin = {-14, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
80 equation
81 connect(constantSpeed1.flange, DiscGenerator.flange) annotation(
82 Line(points = {{-48, 0}, {-14, 0}, {-14, 0}, {-14, 0}}));
83 connect(DiscGenerator.p, Load.p) annotation(
84 Line(points = {{-14, 10}, {46, 10}, {46, 10}, {46, 10}}, color = {0, 0, 255}));
85 connect(DiscGenerator.n, Load.n) annotation(
86 Line(points = {{-14, -10}, {46, -10}, {46, -10}, {46, -10}}, color = {0, 0, 255}));
87 connect(Load.n, ground1.p) annotation(
88 Line(points = {{46, -10}, {46, -10}, {46, -28}, {46, -28}}, color = {0, 0, 255}));
89 end TestGen;
90end DiscGenerator;