Ticket #4251: RLCPkg.mo

File RLCPkg.mo, 2.1 KB (added by massimo ceraolo, 8 years ago)
Line 
1encapsulated package RLCPkg "RLC with P-Q"
2 import Modelica;
3
4 model RLC
5 Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage(V = 1, freqHz = 50) annotation(
6 Placement(visible = true, transformation(origin = {-42, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
7 Modelica.Electrical.Analog.Basic.Resistor resistor(R = 1) annotation(
8 Placement(visible = true, transformation(extent = {{-10, 30}, {10, 50}}, rotation = 0)));
9 Modelica.Electrical.Analog.Basic.Capacitor capacitor(C = 10e-6) annotation(
10 Placement(visible = true, transformation(origin = {50, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
11 Modelica.Electrical.Analog.Basic.Inductor inductor(L = 0.01) annotation(
12 Placement(visible = true, transformation(origin = {50, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
13 Modelica.Electrical.Analog.Basic.Ground ground annotation(
14 Placement(visible = true, transformation(extent = {{-72, -46}, {-52, -26}}, rotation = 0)));
15 equation
16 connect(ground.p, sineVoltage.n) annotation(
17 Line(points = {{-62, -26}, {-62, -8}, {-42, -8}}, color = {0, 0, 255}));
18 connect(inductor.n, capacitor.p) annotation(
19 Line(points = {{50, -2}, {50, -20}}, color = {0, 0, 255}));
20 connect(inductor.p, resistor.n) annotation(
21 Line(points = {{50, 18}, {50, 40}, {10, 40}}, color = {0, 0, 255}));
22 connect(sineVoltage.n, capacitor.n) annotation(
23 Line(points = {{-42, -8}, {-42, -40}, {50, -40}}, color = {0, 0, 255}));
24 connect(resistor.p, sineVoltage.p) annotation(
25 Line(points = {{-10, 40}, {-42, 40}, {-42, 12}}, color = {0, 0, 255}));
26 annotation(
27 experiment(StopTime = 0.1, __Dymola_NumberOfIntervals = 5000),
28 experimentSetupOutput,
29 Diagram(coordinateSystem(extent = {{-100, -60}, {100, 60}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})),
30 Icon(coordinateSystem(extent = {{-100, -60}, {100, 60}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})));
31 end RLC;
32 annotation(
33 uses(Modelica(version = "3.2.2")));
34end RLCPkg;