Ticket #5505: TwoLegs.mo

File TwoLegs.mo, 6.8 KB (added by massimo ceraolo, 7 years ago)
Line 
1model TwoLegs "Switch-diode pais, two-legs, square wave"
2 Modelica.Electrical.Analog.Basic.Ground ground annotation(
3 Placement(visible = true, transformation(extent = {{82, -54}, {102, -34}}, rotation = 0)));
4 Modelica.Electrical.Analog.Sources.ConstantVoltage V1(V = 225.0) annotation(
5 Placement(visible = true, transformation(origin = {-70, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
6 Modelica.Blocks.Sources.BooleanPulse booleanPulse(period = 1 / 50) annotation(
7 Placement(visible = true, transformation(extent = {{100, 54}, {80, 74}}, rotation = 0)));
8 Modelica.Blocks.MathBoolean.Not nor1 annotation(
9 Placement(visible = true, transformation(origin = {-8, -14}, extent = {{-4, -4}, {4, 4}}, rotation = 270)));
10 Modelica.Electrical.Analog.Ideal.IdealDiode uD(Vknee = 0.1) annotation(
11 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-50, 40})));
12 Modelica.Electrical.Analog.Ideal.IdealGTOThyristor uSW(Vknee = 0.1) annotation(
13 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-30, 40})));
14 Modelica.Electrical.Analog.Ideal.IdealGTOThyristor dSW(Vknee = 0.1) annotation(
15 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-30, -18})));
16 Modelica.Electrical.Analog.Ideal.IdealDiode dD(Vknee = 0.1) annotation(
17 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-50, -18})));
18 Modelica.Electrical.Analog.Basic.Inductor inductor(L = 67.36e-3) annotation(
19 Placement(visible = true, transformation(origin = {92, 18}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
20 Modelica.Electrical.Analog.Basic.Resistor Load(R = 42.32) annotation(
21 Placement(visible = true, transformation(origin = {92, -10}, extent = {{-10, 10}, {10, -10}}, rotation = 270)));
22 Modelica.Electrical.Analog.Ideal.IdealDiode uD1(Vknee = 0.1) annotation(
23 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {12, 40})));
24 Modelica.Electrical.Analog.Ideal.IdealGTOThyristor uSW1(Vknee = 0.1) annotation(
25 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {32, 40})));
26 Modelica.Electrical.Analog.Ideal.IdealGTOThyristor dSW1(Vknee = 0.1) annotation(
27 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {32, -18})));
28 Modelica.Electrical.Analog.Ideal.IdealDiode dD1(Vknee = 0.1) annotation(
29 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {12, -18})));
30 Modelica.Blocks.MathBoolean.Not nor2 annotation(
31 Placement(visible = true, transformation(origin = {42, 50}, extent = {{-4, -4}, {4, 4}}, rotation = 270)));
32 Modelica.Electrical.Analog.Sensors.PowerSensor powerSensor annotation(
33 Placement(transformation(extent = {{62, 24}, {82, 44}})));
34 Modelica.Blocks.Math.Mean meanP(f = 50) annotation(
35 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {64, -30})));
36equation
37 connect(nor1.u, nor2.u) annotation(
38 Line(points = {{-8, -8.4}, {-8, 64}, {42, 64}, {42, 56}}, color = {255, 0, 255}));
39 connect(uSW.fire, nor2.u) annotation(
40 Line(points = {{-19, 33}, {-14, 33}, {-14, 64}, {42, 64}, {42, 56}}, color = {255, 0, 255}));
41 connect(dSW1.fire, nor2.u) annotation(
42 Line(points = {{43, -25}, {50, -25}, {50, 64}, {42, 64}, {42, 56}}, color = {255, 0, 255}));
43 connect(booleanPulse.y, nor2.u) annotation(
44 Line(points = {{79, 64}, {42, 64}, {42, 56}}, color = {255, 0, 255}));
45 connect(nor2.y, uSW1.fire) annotation(
46 Line(points = {{42, 45}, {42, 33}, {43, 33}}, color = {255, 0, 255}));
47 connect(inductor.n, Load.p) annotation(
48 Line(points = {{92, 8}, {92, 0}}, color = {0, 0, 255}));
49 connect(uSW.p, uD.n) annotation(
50 Line(points = {{-30, 50}, {-30, 54}, {-50, 54}, {-50, 50}}, color = {0, 0, 255}));
51 connect(uD.p, uSW.n) annotation(
52 Line(points = {{-50, 30}, {-50, 22}, {-30, 22}, {-30, 30}}, color = {0, 0, 255}));
53 connect(dD.n, dSW.p) annotation(
54 Line(points = {{-50, -8}, {-30, -8}}, color = {0, 0, 255}));
55 connect(dSW.n, dD.p) annotation(
56 Line(points = {{-30, -28}, {-30, -42}, {-50, -42}, {-50, -28}}, color = {0, 0, 255}));
57 connect(V1.p, uD.n) annotation(
58 Line(points = {{-70, 28}, {-70, 60}, {-40, 60}, {-40, 54}, {-50, 54}, {-50, 50}}, color = {0, 0, 255}));
59 connect(uD.p, dSW.p) annotation(
60 Line(points = {{-50, 30}, {-50, 22}, {-40, 22}, {-40, -8}, {-30, -8}}, color = {0, 0, 255}));
61 connect(uSW1.p, uD1.n) annotation(
62 Line(points = {{32, 50}, {32, 54}, {12, 54}, {12, 50}}, color = {0, 0, 255}));
63 connect(uD1.p, uSW1.n) annotation(
64 Line(points = {{12, 30}, {12, 22}, {32, 22}, {32, 30}}, color = {0, 0, 255}));
65 connect(dD1.n, dSW1.p) annotation(
66 Line(points = {{12, -8}, {32, -8}}, color = {0, 0, 255}));
67 connect(dSW1.n, dD1.p) annotation(
68 Line(points = {{32, -28}, {32, -42}, {12, -42}, {12, -28}}, color = {0, 0, 255}));
69 connect(V1.p, uD1.n) annotation(
70 Line(points = {{-70, 28}, {-70, 60}, {22, 60}, {22, 54}, {12, 54}, {12, 50}}, color = {0, 0, 255}));
71 connect(uD1.p, dSW1.p) annotation(
72 Line(points = {{12, 30}, {12, 22}, {22, 22}, {22, -8}, {32, -8}}, color = {0, 0, 255}));
73 connect(Load.n, dSW1.p) annotation(
74 Line(points = {{92, -20}, {92, -24}, {78, -24}, {78, 2}, {32, 2}, {32, -8}}, color = {0, 0, 255}));
75 connect(ground.p, dSW1.p) annotation(
76 Line(points = {{92, -34}, {92, -24}, {78, -24}, {78, 2}, {32, 2}, {32, -8}}, color = {0, 0, 255}));
77 connect(V1.n, dD.p) annotation(
78 Line(points = {{-70, 8}, {-70, -42}, {-50, -42}, {-50, -28}}, color = {0, 0, 255}));
79 connect(nor1.y, dSW.fire) annotation(
80 Line(points = {{-8, -18.8}, {-8, -25}, {-19, -25}}, color = {255, 0, 255}));
81 connect(V1.n, dD1.p) annotation(
82 Line(points = {{-70, 8}, {-70, -42}, {12, -42}, {12, -28}}, color = {0, 0, 255}));
83 connect(powerSensor.pv, powerSensor.nc) annotation(
84 Line(points = {{72, 44}, {82, 44}, {82, 34}}, color = {0, 0, 255}));
85 connect(powerSensor.nc, inductor.p) annotation(
86 Line(points = {{82, 34}, {92, 34}, {92, 28}}, color = {0, 0, 255}));
87 connect(powerSensor.pc, dSW.p) annotation(
88 Line(points = {{62, 34}, {62, 16}, {-40, 16}, {-40, -8}, {-30, -8}}, color = {0, 0, 255}));
89 connect(meanP.u, powerSensor.power) annotation(
90 Line(points = {{64, -18}, {64, 23}}, color = {0, 0, 127}));
91 annotation(
92 Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-80, -60}, {120, 80}})),
93 experiment(StopTime = 0.1, StartTime = 0, Tolerance = 1e-06, Interval = 0.0002),
94 Documentation(info = "<html><head></head><body><p><br></p>
95</body></html>", revisions = "<html><head></head><body>no newInst</body></html>"),
96 Icon(coordinateSystem(extent = {{-80, -60}, {120, 80}}, preserveAspectRatio = false)));
97end TwoLegs;