You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
parameterReal p0=P_0/M_b "Initial active power (machine base)";
59
+
parameterReal q0=Q_0/M_b "Initial reactive power (machine base)";
60
+
parameter OpenIPSL.Types.PerUnit vr0=v_0*cos(angle_0) "Initial value of the real part of the terminal voltage";
61
+
parameter OpenIPSL.Types.PerUnit vi0=v_0*sin(angle_0) "Initial value of the imaginary part of the terminal voltage";
62
+
parameter OpenIPSL.Types.PerUnit ir0=-CoB*(p0*vr0 + q0*vi0)/(vr0^2+ vi0^2) "Initial value of the real part of the current";
63
+
parameter OpenIPSL.Types.PerUnit ii0=-CoB*(p0*vi0 - q0*vr0)/(vr0^2+ vi0^2) "Initial value of the imaginary part of the current";
85
64
parameter OpenIPSL.Types.PerUnit Er0 = vr0 + CoB*R_a*ir0 - CoB*X_d*ii0 "Initial value of the real part of the internal voltage source phasor";
86
65
parameter OpenIPSL.Types.PerUnit Ei0 = vi0 + CoB*R_a*ii0 + CoB*X_d*ir0 "Initial value of the imaginary part of the internal voltage source phasor";
87
66
parameter OpenIPSL.Types.PerUnit E0 =sqrt(Er0^2+Ei0^2) "Initial value of the internal voltage source phasor magnitude";
88
67
parameter OpenIPSL.Types.Angle delta0 =atan2(Ei0, Er0) "Initial value of the internal voltage source phasor angle";
89
-
90
-
// Internal voltage source variables
91
68
Real Er(start=Er0) "Internal voltage source, real part";
92
69
Real Ei(start=Ei0) "Internal voltage source, imaginary part";
93
70
equation
94
-
// Equations linking the internal voltage source to the terminal bus and the pin
95
-
Er = p.vr + CoB*R_a*(-p.ir) - CoB*X_d*(-p.ii);
96
-
Ei = p.vi + CoB*R_a*(-p.ii) + CoB*X_d*(-p.ir);
97
-
//Power injections
98
-
-P = p.vr*p.ir + p.vi*p.ii;
99
-
-Q = p.vi*p.ir - p.vr*p.ii;
100
-
// Terminal voltage magnitude and angle
101
-
V =sqrt(p.vr^2+ p.vi^2);
102
-
anglev =atan2(p.vi, p.vr);
71
+
Er = p.vr + CoB*R_a*(-p.ir) - CoB*X_d*(-p.ii) "Equation linking the internal voltage source to the terminal bus and the pin";
72
+
Ei = p.vi + CoB*R_a*(-p.ii) + CoB*X_d*(-p.ir) "Equation linking the internal voltage source to the terminal bus and the pin";
73
+
-P = p.vr*p.ir + p.vi*p.ii "Active power injection";
74
+
-Q = p.vi*p.ir - p.vr*p.ii "Reactive power injection";
75
+
V =sqrt(p.vr^2+ p.vi^2) "Terminal voltage magnitude";
76
+
anglev =atan2(p.vi, p.vr) "Terminal voltage angle";
103
77
// Assining variables to outputs
104
-
Emag =sqrt(Er^2+Ei^2);
105
-
Edelta =atan2(Ei,Er);
106
-
Emag0 = E0;
107
-
Eang0 = delta0;
78
+
Emag =sqrt(Er^2+Ei^2) "Attaching a variable to the RealOutput Emag of the model";
79
+
Edelta =atan2(Ei,Er) "Attaching a variable to the RealOutput Edelta of the model";
80
+
Emag0 = E0 "Attaching the initial value to the RealOutput Emag0";
81
+
Eang0 = delta0 "Attaching the initial value to the RealOutput Eang0";
108
82
annotation (Icon(graphics={
109
83
Ellipse(extent={{-100,100},{100,-100}},
110
84
lineColor={0,0,255},
@@ -118,9 +92,5 @@ The initial values of the internal voltage source magnitude and angle are calcul
118
92
119
93
It is based on [Du2021], with the difference that the internal impedance includes a resistance and not only a reactance. </p>
120
94
121
-
<p>
122
-
[Du2021] W. Du, Y. Liu, F.K. Tuffner, R. Huang and Z. Huang: "Model Specification of Droop-Controlled Grid-Forming Inverters (REGFM_A1)", Richland, WA, USA: Pacific Northwest National Laboratory, September 2021. <a href=\"https://www.pnnl.gov/main/publications/external/technical_reports/PNNL-32278.pdf\">document</a>
Copy file name to clipboardExpand all lines: OpenIPSL/Electrical/Sources/SourceBehindImpedance/VoltageSources/VSource.mo
+2-12Lines changed: 2 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -35,17 +35,7 @@ equation
35
35
extent={{-100,140},{100,100}},
36
36
textColor={0,0,0},
37
37
textString="%name")}), Documentation(info="<html>
38
-
<p>
39
-
This model provides a voltage source with an internal (constant) voltage source and internal impedance.
40
-
41
-
The internal voltage source magnitude and angle are calculated based on the impedance and power flow data.
42
-
43
-
It is based on [Du2021], with the difference that the internal impedance includes a resistance and not only a reactance.
44
-
</p>
45
-
46
-
<p>
47
-
[Du2021] W. Du, Y. Liu, F.K. Tuffner, R. Huang and Z. Huang: "Model Specification of Droop-Controlled Grid-Forming Inverters (REGFM_A1)", Richland, WA, USA: Pacific Northwest National Laboratory, September 2021. <a href=\"https://www.pnnl.gov/main/publications/external/technical_reports/PNNL-32278.pdf\">document</a>
48
-
</p>
49
-
38
+
<p>This model provides a voltage source with an internal (constant) voltage source and internal impedance.</p>
39
+
<p>See the documentation of <a href=\"Modelica://OpenIPSL.Electrical.Sources.SourceBehindImpedance.BaseClasses.baseVoltageSource\">BaseClasses.baseVoltageSource</a> for more information.</p>
@@ -99,19 +98,8 @@ which are the real and imaginary input
99
98
textString="%name")}),
100
99
Documentation(info="<html>
101
100
<p>
102
-
This model provides a voltage source with an internal voltage source and internal impedance whose magnitude and angle can be varied via inputs starting from their initial values.
103
-
104
-
The initial values of the internal voltage source magnitude and angle are calculated based on the impedance and power flow data.
105
-
106
-
It is based on [Du2021], with the difference that the internal impedance includes a resistance and not only a reactance.
107
-
108
-
The purpose of this model is to support the development of Grid-Forming Inverter models as described in [Du2021].
101
+
The purpose of this model is to support the development of Grid-Forming Inverter models as described in [Du2021]. The model provides a voltage source with an internal voltage source and internal impedance whose magnitude and angle can be varied via inputs starting from their initial values.
109
102
</p>
110
-
111
-
112
-
<p>
113
-
[Du2021] W. Du, Y. Liu, F.K. Tuffner, R. Huang and Z. Huang: "Model Specification of Droop-Controlled Grid-Forming Inverters (REGFM_A1)", Richland, WA, USA: Pacific Northwest National Laboratory, September 2021. <a href=\"https://www.pnnl.gov/main/publications/external/technical_reports/PNNL-32278.pdf\">document</a>
114
-
</p>
115
-
103
+
<p>See the documentation of <a href=\"Modelica://OpenIPSL.Electrical.Sources.SourceBehindImpedance.BaseClasses.baseVoltageSource\">BaseClasses.baseVoltageSource</a> for more information.</p>
0 commit comments