Ticket #5817: InvSW.mo

File InvSW.mo, 5.3 KB (added by massimo ceraolo, 7 years ago)
Line 
1model InvSW "Three-phase (multiphase) with bidirectional switches"
2 Modelica.SIunits.Power aronPower;
3 Modelica.Electrical.MultiPhase.Basic.Star star2 annotation(
4 Placement(visible = true, transformation(origin = {78, -30}, extent = {{10, -10}, {-10, 10}}, rotation = 90)));
5 Modelica.Electrical.MultiPhase.Basic.Resistor Rload(R = fill(2, 3)) annotation(
6 Placement(visible = true, transformation(origin = {78, -4}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
7 Modelica.Electrical.MultiPhase.Basic.Capacitor Cf(C = fill(0.000634, 3)) annotation(
8 Placement(visible = true, transformation(origin = {32, -4}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
9 Modelica.Electrical.MultiPhase.Basic.Inductor Lf(L = fill(0.001, 3)) annotation(
10 Placement(visible = true, transformation(origin = {16, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
11 Modelica.Electrical.MultiPhase.Basic.Resistor Rf(R = fill(0.05, 3)) annotation(
12 Placement(visible = true, transformation(origin = {-8, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
13 Modelica.Electrical.MultiPhase.Basic.Star star1 annotation(
14 Placement(visible = true, transformation(origin = {-42, -44}, extent = {{10, -10}, {-10, 10}}, rotation = 90)));
15 Modelica.Electrical.MultiPhase.Basic.Star star annotation(
16 Placement(visible = true, transformation(origin = {-42, 56}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
17 Modelica.Electrical.MultiPhase.Ideal.IdealClosingSwitch downSW(Ron = fill(1e-5, 3), Goff = fill(1e-5, 3)) annotation(
18 Placement(visible = true, transformation(origin = {-42, -14}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
19 Modelica.Electrical.MultiPhase.Ideal.IdealClosingSwitch upSW(Ron = fill(1e-5, 3), Goff = fill(1e-5, 3)) annotation(
20 Placement(visible = true, transformation(origin = {-42, 28}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
21 Modelica.Electrical.Analog.Sources.ConstantVoltage V1(V = 50) annotation(
22 Placement(visible = true, transformation(origin = {-70, -18}, extent = {{-10, 10}, {10, -10}}, rotation = 270)));
23 Modelica.Electrical.Analog.Sources.ConstantVoltage V2(V = 50) annotation(
24 Placement(visible = true, transformation(origin = {-70, 26}, extent = {{-10, 10}, {10, -10}}, rotation = 270)));
25 Modelica.Electrical.Analog.Basic.Ground ground2 annotation(
26 Placement(visible = true, transformation(origin = {-92, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
27 Modelica.Blocks.Sources.BooleanPulse booleanPulse[3](width = fill(50, 3), period = fill(1 / 50, 3), startTime = 1 / 50 * {-1 / 3, 0, 1 / 3}) annotation(
28 Placement(visible = true, transformation(extent = {{16, 40}, {-4, 60}}, rotation = 0)));
29 Modelica.Blocks.MathBoolean.Not myNot[3] annotation(
30 Placement(visible = true, transformation(origin = {-24, 20}, extent = {{-4, -4}, {4, 4}}, rotation = 270)));
31equation
32 connect(upSW.plug_p, star.plug_p) annotation(
33 Line(points = {{-42, 38}, {-42, 46}}, color = {0, 0, 255}));
34 connect(V2.p, star.pin_n) annotation(
35 Line(points = {{-70, 36}, {-70, 70}, {-42, 70}, {-42, 66}}, color = {0, 0, 255}));
36 connect(ground2.p, V2.n) annotation(
37 Line(points = {{-92, 0}, {-70, 0}, {-70, 16}}, color = {0, 0, 255}));
38 connect(V2.n, V1.p) annotation(
39 Line(points = {{-70, 16}, {-70, -8}}, color = {0, 0, 255}));
40 connect(V1.n, star1.pin_n) annotation(
41 Line(points = {{-70, -28}, {-70, -54}, {-42, -54}}, color = {0, 0, 255}));
42 connect(upSW.plug_n, downSW.plug_p) annotation(
43 Line(points = {{-42, 18}, {-42, -4}}, color = {0, 0, 255}));
44 connect(Rf.plug_p, downSW.plug_p) annotation(
45 Line(points = {{-18, 6}, {-42, 6}, {-42, -4}}, color = {0, 0, 255}));
46 connect(downSW.plug_n, star1.plug_p) annotation(
47 Line(points = {{-42, -24}, {-42, -34}}, color = {0, 0, 255}));
48 connect(Rf.plug_n, Lf.plug_p) annotation(
49 Line(points = {{2, 6}, {6, 6}}, color = {0, 0, 255}));
50 connect(Cf.plug_p, Lf.plug_n) annotation(
51 Line(points = {{32, 6}, {31, 6}, {31, 6}, {30, 6}, {26, 6}}, color = {0, 0, 255}));
52 connect(Cf.plug_n, Rload.plug_n) annotation(
53 Line(points = {{32, -14}, {78, -14}}, color = {0, 0, 255}));
54 connect(Rload.plug_n, star2.plug_p) annotation(
55 Line(points = {{78, -14}, {78, -20}}, color = {0, 0, 255}));
56 aronPower = Rload.plug_p.pin[1].v * Rload.plug_p.pin[1].i + Rload.plug_p.pin[2].v * Rload.plug_p.pin[2].i + Rload.plug_p.pin[3].v * Rload.plug_p.pin[3].i;
57 connect(booleanPulse.y, upSW.control) annotation(
58 Line(points = {{-5, 50}, {-30, 50}, {-30, 28}}, color = {255, 0, 255}));
59 connect(myNot.u, booleanPulse.y) annotation(
60 Line(points = {{-24, 25.6}, {-24, 50}, {-5, 50}}, color = {255, 0, 255}));
61 connect(myNot.y, downSW.control) annotation(
62 Line(points = {{-24, 15.2}, {-26, 15.2}, {-26, -14}, {-30, -14}}, color = {255, 0, 255}));
63 connect(Cf.plug_p, Rload.plug_p) annotation(
64 Line(points = {{32, 6}, {78, 6}, {78, 6}, {78, 6}}, color = {0, 0, 255}));
65 annotation(
66 Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -60}, {100, 80}})),
67 experimentSetupOutput,
68 Documentation(info = "<html><head></head><body><p><br></p>
69</body></html>"),
70 experiment(StartTime = 0, StopTime = 0.1, Tolerance = 0.0001, Interval = 0.0002),
71 __OpenModelica_commandLineOptions = "");
72end InvSW;