Skip to content

Commit 23067b0

Browse files
authored
Add files via upload
Initial Upload of the library
1 parent 353ed7a commit 23067b0

70 files changed

Lines changed: 3676 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Images/Microgrid.png

17.5 KB
Loading

Images/simulation.png

29.3 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
within OpenModelica_Microgrids.Components;
2+
3+
model PhaseAngle
4+
parameter Real freq(start = 50);
5+
Modelica.Blocks.Math.Gain deg2rad(k = 2 * 3.1416) annotation(
6+
Placement(visible = true, transformation(origin = {14, 0}, extent = {{-4, -4}, {4, 4}}, rotation = 0)));
7+
Modelica.Blocks.Sources.Constant f_nom(k = freq) annotation(
8+
Placement(visible = true, transformation(origin = {-18, 0}, extent = {{-4, -4}, {4, 4}}, rotation = 0)));
9+
Modelica.Blocks.Continuous.Integrator f2theta(y_start = 0) annotation(
10+
Placement(visible = true, transformation(origin = {0, 0}, extent = {{-4, -4}, {4, 4}}, rotation = 0)));
11+
Modelica.Blocks.Interfaces.RealOutput theta annotation(
12+
Placement(visible = true, transformation(origin = {108, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
13+
equation
14+
connect(f_nom.y, f2theta.u) annotation(
15+
Line(points = {{-14, 0}, {-5, 0}}, color = {0, 0, 127}));
16+
connect(f2theta.y, deg2rad.u) annotation(
17+
Line(points = {{4, 0}, {9, 0}}, color = {0, 0, 127}));
18+
connect(deg2rad.y, theta) annotation(
19+
Line(points = {{18, 0}, {108, 0}}, color = {0, 0, 127}));
20+
end PhaseAngle;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
within OpenModelica_Microgrids;
2+
package Components
3+
4+
5+
extends Modelica.Icons.UtilitiesPackage;
6+
end Components;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PhaseAngle
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
within OpenModelica_Microgrids.Examples;
2+
3+
model ControlledNetworkSingleInverter
4+
OpenModelica_Microgrids.Inverters.Inverter inverter1 annotation(
5+
Placement(visible = true, transformation(origin = {-70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
6+
OpenModelica_Microgrids.Filter.IdealFilter.LC lc1(L1 = 0.001, L2 = 0.001, L3 = 0.001) annotation(
7+
Placement(visible = true, transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
8+
OpenModelica_Microgrids.Loads.RL rl1(L1 = 0.0005, L2 = 0.0005, L3 = 0.0005) annotation(
9+
Placement(visible = true, transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
10+
OpenModelica_Microgrids.PLLs.PLL_DQ pll_dq annotation(
11+
Placement(visible = true, transformation(origin = {2, 62}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
12+
OpenModelica_Microgrids.Transformations.ABC2DQ_Currents abc2dq_current annotation(
13+
Placement(visible = true, transformation(origin = {0, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
14+
Modelica.Blocks.Sources.RealExpression realExpression(y = -350) annotation(
15+
Placement(visible = true, transformation(origin = {2, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
16+
Modelica.Blocks.Sources.RealExpression realExpression1(y = 230 * 1.41427) annotation(
17+
Placement(visible = true, transformation(origin = {5, 77}, extent = {{-13, -11}, {13, 11}}, rotation = 0)));
18+
OpenModelica_Microgrids.Transformations.DQ2ABC dq2abc annotation(
19+
Placement(visible = true, transformation(origin = {36, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
20+
Modelica.Blocks.Continuous.LimPID pid(Td = 0, Ti = 0.006, k = 0.3, limitsAtInit = true, yMax = 150) annotation(
21+
Placement(visible = true, transformation(origin = {78, 86}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
22+
Modelica.Blocks.Continuous.LimPID PID(Td = 0, Ti = 0.06, k = 0.3, limitsAtInit = true, yMax = 50) annotation(
23+
Placement(visible = true, transformation(origin = {44, 74}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
24+
Modelica.Blocks.Continuous.LimPID PID1(Td = 0, Ti = 1.33, k = 0.013, limitsAtInit = true, yMax = 1 / 2.8284, yMin = -1 / 2.8284) annotation(
25+
Placement(visible = true, transformation(origin = {-34, -34}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
26+
Modelica.Blocks.Continuous.LimPID PID2(Td = 0, Ti = 1.33, k = 0.013, limitsAtInit = true, yMax = 1 / 2.8284, yMin = -1 / 2.8284) annotation(
27+
Placement(visible = true, transformation(origin = {-34, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
28+
OpenModelica_Microgrids.Components.PhaseAngle angle annotation(
29+
Placement(visible = true, transformation(origin = {19, 5}, extent = {{-5, -5}, {5, 5}}, rotation = 0)));
30+
equation
31+
connect(inverter1.pin3, lc1.pin3) annotation(
32+
Line(points = {{-60, 36}, {-40, 36}}, color = {0, 0, 255}));
33+
connect(inverter1.pin2, lc1.pin2) annotation(
34+
Line(points = {{-60, 30}, {-40, 30}}, color = {0, 0, 255}));
35+
connect(inverter1.pin1, lc1.pin1) annotation(
36+
Line(points = {{-60, 24}, {-40, 24}}, color = {0, 0, 255}));
37+
connect(lc1.pin6, abc2dq_current.a) annotation(
38+
Line(points = {{-20, 36}, {-10, 36}, {-10, 36}, {-10, 36}}, color = {0, 0, 255}));
39+
connect(lc1.pin5, abc2dq_current.b) annotation(
40+
Line(points = {{-20, 30}, {-10, 30}, {-10, 30}, {-10, 30}}, color = {0, 0, 255}));
41+
connect(lc1.pin4, abc2dq_current.c) annotation(
42+
Line(points = {{-20, 24}, {-10, 24}, {-10, 24}, {-10, 24}}, color = {0, 0, 255}));
43+
connect(abc2dq_current.pin3, rl1.pin3) annotation(
44+
Line(points = {{10, 36}, {20, 36}, {20, 36}, {20, 36}}, color = {0, 0, 255}));
45+
connect(abc2dq_current.pin2, rl1.pin2) annotation(
46+
Line(points = {{10, 30}, {20, 30}, {20, 30}, {20, 30}}, color = {0, 0, 255}));
47+
connect(abc2dq_current.pin1, rl1.pin1) annotation(
48+
Line(points = {{10, 24}, {20, 24}, {20, 24}, {20, 24}}, color = {0, 0, 255}));
49+
connect(lc1.pin6, pll_dq.a) annotation(
50+
Line(points = {{-20, 36}, {-16, 36}, {-16, 68}, {-8, 68}}, color = {0, 0, 255}));
51+
connect(lc1.pin5, pll_dq.b) annotation(
52+
Line(points = {{-20, 30}, {-14, 30}, {-14, 62}, {-8, 62}, {-8, 62}, {-8, 62}}, color = {0, 0, 255}));
53+
connect(lc1.pin4, pll_dq.c) annotation(
54+
Line(points = {{-20, 24}, {-12, 24}, {-12, 56}, {-8, 56}, {-8, 56}, {-8, 56}}, color = {0, 0, 255}));
55+
connect(dq2abc.a, inverter1.u3) annotation(
56+
Line(points = {{46, -12}, {78, -12}, {78, -66}, {-116, -66}, {-116, 36}, {-80, 36}, {-80, 36}}, color = {0, 0, 127}));
57+
connect(dq2abc.b, inverter1.u2) annotation(
58+
Line(points = {{46, -18}, {72, -18}, {72, -58}, {72, -58}, {72, -60}, {-110, -60}, {-110, 30}, {-80, 30}, {-80, 30}}, color = {0, 0, 127}));
59+
connect(inverter1.u1, dq2abc.c) annotation(
60+
Line(points = {{-80, 24}, {-102, 24}, {-102, 24}, {-104, 24}, {-104, -54}, {66, -54}, {66, -24}, {46, -24}, {46, -24}}, color = {0, 0, 127}));
61+
connect(pll_dq.d, PID.u_m) annotation(
62+
Line(points = {{14, 62}, {32, 62}, {32, 60}, {40, 60}, {40, 58}, {44, 58}, {44, 62}, {44, 62}}, color = {0, 0, 127}));
63+
connect(realExpression1.y, PID.u_s) annotation(
64+
Line(points = {{20, 78}, {30, 78}, {30, 74}, {32, 74}}, color = {0, 0, 127}));
65+
connect(pll_dq.q, pid.u_m) annotation(
66+
Line(points = {{14, 56}, {78, 56}, {78, 72}, {78, 72}, {78, 74}}, color = {0, 0, 127}));
67+
connect(realExpression.y, pid.u_s) annotation(
68+
Line(points = {{14, 90}, {58, 90}, {58, 86}, {66, 86}, {66, 86}}, color = {0, 0, 127}));
69+
connect(abc2dq_current.d, PID2.u_m) annotation(
70+
Line(points = {{-4, 20}, {-4, 20}, {-4, 16}, {-58, 16}, {-58, -20}, {-34, -20}, {-34, -16}, {-34, -16}}, color = {0, 0, 127}));
71+
connect(abc2dq_current.q, PID1.u_m) annotation(
72+
Line(points = {{4, 20}, {4, 20}, {4, 10}, {-20, 10}, {-20, -50}, {-34, -50}, {-34, -46}, {-34, -46}, {-34, -46}}, color = {0, 0, 127}));
73+
connect(pll_dq.theta, abc2dq_current.theta) annotation(
74+
Line(points = {{14, 68}, {22, 68}, {22, 48}, {0, 48}, {0, 42}, {0, 42}, {0, 42}}, color = {0, 0, 127}));
75+
connect(pid.y, PID1.u_s) annotation(
76+
Line(points = {{90, 86}, {94, 86}, {94, 14}, {-60, 14}, {-60, -34}, {-46, -34}}, color = {0, 0, 127}));
77+
connect(PID2.u_s, PID.y) annotation(
78+
Line(points = {{-46, -4}, {-56, -4}, {-56, 12}, {60, 12}, {60, 74}, {56, 74}, {56, 74}}, color = {0, 0, 127}));
79+
connect(PID2.y, dq2abc.d) annotation(
80+
Line(points = {{-22, -4}, {16, -4}, {16, -14}, {26, -14}, {26, -14}}, color = {0, 0, 127}));
81+
connect(PID1.y, dq2abc.q) annotation(
82+
Line(points = {{-22, -34}, {24, -34}, {24, -22}, {24, -22}, {24, -22}, {26, -22}}, color = {0, 0, 127}));
83+
connect(angle.theta, dq2abc.theta) annotation(
84+
Line(points = {{24, 6}, {32, 6}, {32, -6}, {32, -6}}, color = {0, 0, 127}));
85+
annotation(
86+
Diagram);
87+
end ControlledNetworkSingleInverter;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
within OpenModelica_Microgrids.Examples;
2+
3+
model NetworkSineTest
4+
5+
Modelica.Blocks.Sources.Sine sine(amplitude = 230, freqHz = 50) annotation(
6+
Placement(visible = true, transformation(origin = {-76, -82}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
7+
Modelica.Blocks.Sources.Sine sine1(amplitude = 230, freqHz = 50, phase = 2.0944) annotation(
8+
Placement(visible = true, transformation(origin = {-76, -48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
9+
Modelica.Blocks.Sources.Sine sine2(amplitude = 230, freqHz = 50, phase = 4.18879) annotation(
10+
Placement(visible = true, transformation(origin = {-76, -16}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
11+
Modelica.Blocks.Sources.Sine sine3(amplitude = 230, freqHz = 50) annotation(
12+
Placement(visible = true, transformation(origin = {-76, 14}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
13+
Modelica.Blocks.Sources.Sine sine4(amplitude = 230, freqHz = 50, phase = 2.0944) annotation(
14+
Placement(visible = true, transformation(origin = {-76, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
15+
Modelica.Blocks.Sources.Sine sine5(amplitude = 230, freqHz = 50, phase = 4.18879) annotation(
16+
Placement(visible = true, transformation(origin = {-76, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
17+
OpenModelica_Microgrids.Grids.Network network1 annotation(
18+
Placement(visible = true, transformation(origin = {38, 2}, extent = {{-46, -46}, {46, 46}}, rotation = 0)));
19+
equation
20+
connect(sine5.y, network1.i1p3) annotation(
21+
Line(points = {{-64, 80}, {-34, 80}, {-34, 22}, {-10, 22}, {-10, 22}}, color = {0, 0, 127}));
22+
connect(sine4.y, network1.i1p2) annotation(
23+
Line(points = {{-64, 48}, {-40, 48}, {-40, 16}, {-10, 16}, {-10, 16}}, color = {0, 0, 127}));
24+
connect(sine3.y, network1.i1p1) annotation(
25+
Line(points = {{-64, 14}, {-34, 14}, {-34, 10}, {-10, 10}, {-10, 10}}, color = {0, 0, 127}));
26+
connect(sine2.y, network1.i2p3) annotation(
27+
Line(points = {{-64, -16}, {-64, -16}, {-64, -6}, {-10, -6}, {-10, -6}}, color = {0, 0, 127}));
28+
connect(sine1.y, network1.i2p2) annotation(
29+
Line(points = {{-64, -48}, {-50, -48}, {-50, -12}, {-10, -12}, {-10, -12}, {-10, -12}}, color = {0, 0, 127}));
30+
connect(sine.y, network1.i2p1) annotation(
31+
Line(points = {{-64, -82}, {-32, -82}, {-32, -18}, {-10, -18}, {-10, -18}}, color = {0, 0, 127}));
32+
end NetworkSineTest;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
within OpenModelica_Microgrids.Examples;
2+
3+
model PLL_Test
4+
5+
OpenModelica_Microgrids.Transformations.ABC2AlphaBeta abc2AlphaBeta annotation(
6+
Placement(visible = true, transformation(origin = {-14, 4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
7+
Modelica.Blocks.Sources.Sine sine(amplitude = 230 * 1.414, freqHz = 50) annotation(
8+
Placement(visible = true, transformation(origin = {-90, 34}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
9+
Modelica.Blocks.Sources.Sine sine1(amplitude = 230 * 1.414, freqHz = 50, phase = -2.0944) annotation(
10+
Placement(visible = true, transformation(origin = {-88, 6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
11+
Modelica.Blocks.Sources.Sine sine2(amplitude = 230 * 1.414, freqHz = 50, phase = -4.18879) annotation(
12+
Placement(visible = true, transformation(origin = {-88, -26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
13+
OpenModelica_Microgrids.Inverters.Inverter inverter annotation(
14+
Placement(visible = true, transformation(origin = {-14, 58}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
15+
OpenModelica_Microgrids.PLLs.PLL pll annotation(
16+
Placement(visible = true, transformation(origin = {28, 56}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
17+
equation
18+
connect(abc2AlphaBeta.a, sine.y) annotation(
19+
Line(points = {{-24, 8}, {-44, 8}, {-44, 34}, {-78, 34}, {-78, 34}}, color = {0, 0, 127}));
20+
connect(abc2AlphaBeta.b, sine1.y) annotation(
21+
Line(points = {{-24, 6}, {-77, 6}}, color = {0, 0, 127}));
22+
connect(sine2.y, abc2AlphaBeta.c) annotation(
23+
Line(points = {{-76, -26}, {-44, -26}, {-44, 2}, {-24, 2}, {-24, 2}}, color = {0, 0, 127}));
24+
connect(inverter.u3, sine.y) annotation(
25+
Line(points = {{-24, 64}, {-70, 64}, {-70, 34}, {-78, 34}}, color = {0, 0, 127}));
26+
connect(inverter.u2, sine1.y) annotation(
27+
Line(points = {{-24, 58}, {-60, 58}, {-60, 6}, {-76, 6}}, color = {0, 0, 127}));
28+
connect(inverter.u1, sine2.y) annotation(
29+
Line(points = {{-24, 52}, {-54, 52}, {-54, -26}, {-76, -26}}, color = {0, 0, 127}));
30+
connect(pll.a, inverter.pin3) annotation(
31+
Line(points = {{18, 60}, {4, 60}, {4, 64}, {-4, 64}, {-4, 64}}, color = {0, 0, 255}));
32+
connect(pll.b, inverter.pin2) annotation(
33+
Line(points = {{18, 58}, {-4, 58}, {-4, 58}, {-4, 58}}, color = {0, 0, 255}));
34+
connect(pll.c, inverter.pin1) annotation(
35+
Line(points = {{18, 54}, {4, 54}, {4, 52}, {-4, 52}, {-4, 52}}, color = {0, 0, 255}));
36+
end PLL_Test;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
within OpenModelica_Microgrids;
2+
3+
package Examples
4+
extends Modelica.Icons.ExamplesPackage;
5+
6+
end Examples;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NetworkSineTest
2+
ControlledNetworkSingleInverter
3+
PLL_Test

0 commit comments

Comments
 (0)