Skip to content

Commit 0172e69

Browse files
authored
Merge pull request OpenIPSL#345 from ALSETLab/master
Updates to the PV all-in-one model
2 parents 0b5a3ef + c90392b commit 0172e69

13 files changed

Lines changed: 373 additions & 116 deletions

File tree

OpenIPSL/Electrical/Renewables/PSSE/AddOnBlocks.mo

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
within OpenIPSL.Electrical.Renewables.PSSE.AddOnBlocks;
2+
model IrradianceToPower "PV Array Power Output from Irradiance."
3+
4+
parameter Modelica.Units.SI.ApparentPower M_b = 100000000 "Equipment apparent power";
5+
parameter Modelica.Units.SI.ActivePower Ypv = 1000 "Rated capacity of the PV array";
6+
parameter Modelica.Units.SI.Temperature Tcstc = 25 "PV cell temperature under standard test conditions";
7+
parameter Real fpv = 0.9 "PV derating factor";
8+
parameter Real ap = -0.48 "Temperature coefficient of power";
9+
parameter Modelica.Units.SI.RadiantEnergyFluenceRate Gtstc = 1000 "Radiant energy fluence rate of PV array";
10+
11+
Modelica.Blocks.Interfaces.RealOutput Ppv
12+
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
13+
Modelica.Blocks.Sources.CombiTimeTable SolarRadiation(table=
14+
SolarRadiationTable)
15+
annotation (Placement(transformation(extent={{-80,40},{-60,60}})));
16+
Modelica.Blocks.Sources.CombiTimeTable SolarArrayTemperature(table=
17+
SolarArrayTemperatureTable)
18+
annotation (Placement(transformation(extent={{-80,-60},{-60,-40}})));
19+
20+
parameter Real SolarRadiationTable[:,:]=fill(0.0, 0, 2)
21+
"Table matrix (time = first column; e.g., table=[0, 0; 1, 1; 2, 4])";
22+
parameter Real SolarArrayTemperatureTable[:,:]=fill(0.0, 0, 2)
23+
"Table matrix (time = first column; e.g., table=[0, 0; 1, 1; 2, 4])";
24+
equation
25+
26+
Ppv = (Ypv/M_b)*fpv*(SolarRadiation.y[1]/Gtstc)*(1 + ap*(SolarArrayTemperature.y[1] - Tcstc));
27+
28+
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
29+
Rectangle(extent={{-100,100},{100,-100}}, lineColor={28,108,200}),
30+
Polygon(
31+
points={{-100,-60},{-60,-100},{-100,-100},{-100,-60}},
32+
lineColor={0,0,0},
33+
fillColor={255,170,85},
34+
fillPattern=FillPattern.Solid),
35+
Polygon(
36+
points={{-100,-20},{-20,-100},{-60,-100},{-100,-60},{-100,-20}},
37+
lineColor={0,0,0},
38+
fillColor={255,255,170},
39+
fillPattern=FillPattern.Solid),
40+
Polygon(
41+
points={{-100,20},{20,-100},{-20,-100},{-100,-20},{-100,20}},
42+
lineColor={0,0,0},
43+
fillColor={255,170,85},
44+
fillPattern=FillPattern.Solid),
45+
Polygon(
46+
points={{-100,60},{60,-100},{20,-100},{-100,20},{-100,60}},
47+
lineColor={0,0,0},
48+
fillColor={255,255,170},
49+
fillPattern=FillPattern.Solid),
50+
Polygon(
51+
points={{-100,100},{100,-100},{60,-100},{-100,60},{-100,100}},
52+
lineColor={0,0,0},
53+
fillColor={255,170,85},
54+
fillPattern=FillPattern.Solid),
55+
Polygon(
56+
points={{-100,100},{100,-100},{100,-60},{-60,100},{-100,100}},
57+
lineColor={0,0,0},
58+
fillColor={255,255,170},
59+
fillPattern=FillPattern.Solid),
60+
Polygon(
61+
points={{-20,100},{100,-20},{100,-60},{-60,100},{-20,100}},
62+
lineColor={0,0,0},
63+
fillColor={255,170,85},
64+
fillPattern=FillPattern.Solid),
65+
Polygon(
66+
points={{-20,100},{100,-20},{100,20},{20,100},{-20,100}},
67+
lineColor={0,0,0},
68+
fillColor={255,255,170},
69+
fillPattern=FillPattern.Solid),
70+
Polygon(
71+
points={{60,100},{100,60},{100,20},{20,100},{60,100}},
72+
lineColor={0,0,0},
73+
fillColor={255,170,85},
74+
fillPattern=FillPattern.Solid),
75+
Polygon(
76+
points={{60,100},{100,60},{100,60},{100,100},{60,100}},
77+
lineColor={0,0,0},
78+
fillColor={255,255,170},
79+
fillPattern=FillPattern.Solid),
80+
Text(
81+
extent={{-100,100},{100,-100}},
82+
textColor={0,0,255},
83+
textString="Irradiance
84+
to
85+
Power")}));
86+
end IrradianceToPower;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
within OpenIPSL.Electrical.Renewables.PSSE;
2+
package AddOnBlocks "This package contains additional add ons that can be added to the original renewable models."
3+
end AddOnBlocks;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IrradianceToPower

OpenIPSL/Electrical/Renewables/PSSE/PV.mo

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ extends OpenIPSL.Electrical.Essentials.pfComponent(
1515
parameter Integer QFunctionality = 0 "BESS Reactive Power Control Options" annotation (Dialog(group= "Reactive Power Control Options"), choices(choice=0 "Constant local PF control", choice=1 "Constant local Q control", choice=2 "Local V control", choice=3 "Local coordinated V/Q control", choice=4 "Plant level Q control", choice=5 "Plant level V control", choice=6 "Plant level Q control + local coordinated V/Q control", choice=7 "Plant level V control + local coordinated V/Q control"));
1616
parameter Integer PFunctionality = 0 "BESS Real Power Control Options" annotation (Dialog(group= "Active Power Control Options", enable=(QFunctionality >=4)), choices(choice=0 "No governor response", choice=1 "Governor response with up and down regulation"));
1717

18+
// Irradiance to Power parameter selection
19+
parameter Boolean Irr2Pow = false "Irradiance to Power Options" annotation (Dialog(group= "Irradiance to Power Add-On Capability"));
1820
replaceable
1921
OpenIPSL.Electrical.Renewables.PSSE.InverterInterface.BaseClasses.BaseREGC
2022
RenewableGenerator(
@@ -46,7 +48,7 @@ extends OpenIPSL.Electrical.Essentials.pfComponent(
4648
refflag=refflag) if QFunctionality >= 4 annotation (choicesAllMatching=true,
4749
Placement(transformation(extent={{-78,-20},{-38,20}})));
4850
Modelica.Blocks.Math.Gain gain(k=1)
49-
if QFunctionality < 4
51+
if QFunctionality < 4 and not Irr2Pow
5052
annotation (Placement(transformation(
5153
extent={{-6,-6},{6,6}},
5254
rotation=180,
@@ -59,8 +61,10 @@ extends OpenIPSL.Electrical.Essentials.pfComponent(
5961
origin={-6,-80})));
6062
Modelica.Blocks.Sources.Constant freq_ref(k=SysData.fn) if QFunctionality >= 4
6163
annotation (Placement(transformation(extent={{-70,-60},{-80,-50}})));
62-
Modelica.Blocks.Interfaces.RealInput FREQ if QFunctionality >= 4 "Connection Point Frequency"
63-
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
64+
Modelica.Blocks.Interfaces.RealInput FREQ if QFunctionality >= 4
65+
"Connection Point Frequency"
66+
annotation (Placement(transformation(extent={{-140,-60},{-100,-20}}),
67+
iconTransformation(extent={{-140,-60},{-100,-20}})));
6468

6569
Modelica.Blocks.Interfaces.RealInput branch_ir if QFunctionality >= 4 "Measured Branch Real Current"
6670
annotation (Placement(transformation(
@@ -94,6 +98,27 @@ extends OpenIPSL.Electrical.Essentials.pfComponent(
9498
extent={{-20,-20},{20,20}},
9599
rotation=270,
96100
origin={60,100})));
101+
Modelica.Blocks.Interfaces.RealInput i2p if Irr2Pow
102+
"Irradiance to Power input" annotation (Placement(transformation(extent={{-140,
103+
20},{-100,60}}), iconTransformation(extent={{-140,20},{-100,60}})));
104+
Modelica.Blocks.Math.Gain gain2(k=1)
105+
if Irr2Pow and QFunctionality < 4
106+
annotation (Placement(transformation(
107+
extent={{-6,-6},{6,6}},
108+
rotation=0,
109+
origin={-86,80})));
110+
Modelica.Blocks.Math.Gain gain3(k=1)
111+
if Irr2Pow and QFunctionality >= 4
112+
annotation (Placement(transformation(
113+
extent={{-6,-6},{6,6}},
114+
rotation=0,
115+
origin={-86,60})));
116+
Modelica.Blocks.Math.Gain gain4(k=1)
117+
if QFunctionality >= 4 and not Irr2Pow
118+
annotation (Placement(transformation(
119+
extent={{-6,-6},{6,6}},
120+
rotation=180,
121+
origin={-60,-86})));
97122
protected
98123
parameter Boolean pfflag = (if QFunctionality == 0 then true else false);
99124
parameter Boolean vflag = (if QFunctionality == 3 or QFunctionality == 6 or QFunctionality == 7 then true else false);
@@ -102,8 +127,8 @@ protected
102127
parameter Boolean fflag = (if PFunctionality == 1 then true else false);
103128
equation
104129
connect(RenewableController.Iqcmd, RenewableGenerator.Iqcmd)
105-
annotation (Line(points={{20.6667,11.3333},{23.9048,11.3333},{23.9048,
106-
11.4286},{27.1429,11.4286}}, color={0,0,127}));
130+
annotation (Line(points={{20.6667,11.3333},{23.9048,11.3333},{23.9048,11.4286},
131+
{27.1429,11.4286}}, color={0,0,127}));
107132
connect(RenewableGenerator.IQ0, RenewableController.iq0) annotation (Line(
108133
points={{32.8571,-21.4286},{32.8571,-28},{16,-28},{16,-21.3333}},
109134
color={0,0,127}));
@@ -140,28 +165,23 @@ equation
140165
{-58,-36},{0,-36},{0,-21.3333}}, color={0,0,127}));
141166
connect(PlantController.q0, RenewableController.q0) annotation (Line(points={{-46,-22},
142167
{-46,-40},{-8,-40},{-8,-21.3333}}, color={0,0,127}));
143-
connect(gain.u, RenewableGenerator.p_0) annotation (Line(points={{1.2,-60},{
144-
67.1429,-60},{67.1429,-21.4286}},
145-
color={0,0,127}));
146-
connect(gain1.y, RenewableController.Qext) annotation (Line(points={{-12.6,
147-
-80},{-32,-80},{-32,-5.33333},{-21.3333,-5.33333}},
148-
color={0,0,127}));
168+
connect(gain.u, RenewableGenerator.p_0) annotation (Line(points={{1.2,-60},{67.1429,
169+
-60},{67.1429,-21.4286}}, color={0,0,127}));
170+
connect(gain1.y, RenewableController.Qext) annotation (Line(points={{-12.6,-80},
171+
{-32,-80},{-32,-5.33333},{-21.3333,-5.33333}}, color={0,0,127}));
149172
connect(gain.y, RenewableController.Pref) annotation (Line(points={{-12.6,-60},
150173
{-30,-60},{-30,-10.6667},{-21.3333,-10.6667}}, color={0,0,127}));
151-
connect(gain1.u, RenewableGenerator.q_0) annotation (Line(points={{1.2,-80},{
152-
58.5714,-80},{58.5714,-21.4286}},
153-
color={0,0,127}));
174+
connect(gain1.u, RenewableGenerator.q_0) annotation (Line(points={{1.2,-80},{58.5714,
175+
-80},{58.5714,-21.4286}}, color={0,0,127}));
154176
connect(freq_ref.y, PlantController.Freq_ref) annotation (Line(points={{-80.5,
155177
-55},{-88,-55},{-88,-12},{-80,-12}}, color={0,0,127}));
156-
connect(PlantController.Plant_pref, RenewableGenerator.p_0) annotation (Line(
157-
points={{-80,4},{-96,4},{-96,-92},{67.1429,-92},{67.1429,-21.4286}},
158-
color={0,0,127}));
159178
connect(PlantController.Qref, RenewableGenerator.q_0) annotation (Line(points={{-80,12},
160179
{-98,12},{-98,-98},{58.5714,-98},{58.5714,-21.4286}}, color={
161180
0,0,127}));
162181
connect(RenewableGenerator.p, pwPin)
163182
annotation (Line(points={{70,0},{100,0}}, color={0,0,255}));
164-
connect(PlantController.Freq, FREQ) annotation (Line(points={{-80,-4},{-92,-4},{-92,0},{-120,0}},
183+
connect(PlantController.Freq, FREQ) annotation (Line(points={{-80,-4},{-92,-4},
184+
{-92,-40},{-120,-40}},
165185
color={0,0,127}));
166186
connect(PlantController.branch_ii, branch_ii) annotation (Line(points={{-62,22},{-62,96},{-40,96},{-40,120}},
167187
color={0,0,127}));
@@ -173,6 +193,20 @@ equation
173193
color={0,0,127}));
174194
connect(RenewableController.Ipcmd, RenewableGenerator.Ipcmd) annotation (Line(points={{20.6667,
175195
-11.3333},{23.9048,-11.3333},{23.9048,-11.4286},{27.1429,-11.4286}}, color={0,0,127}));
196+
connect(i2p, gain2.u)
197+
annotation (Line(points={{-120,40},{-98,40},{-98,80},{-93.2,80}},
198+
color={0,0,127}));
199+
connect(gain2.y, RenewableController.Pref) annotation (Line(points={{-79.4,80},
200+
{-36,80},{-36,22},{-34,22},{-34,-10.6667},{-21.3333,-10.6667}},
201+
color={0,0,127}));
202+
connect(gain3.u, i2p) annotation (Line(points={{-93.2,60},{-98,60},{-98,40},{-120,
203+
40}}, color={0,0,127}));
204+
connect(gain4.u, RenewableGenerator.p_0) annotation (Line(points={{-52.8,-86},
205+
{-40,-86},{-40,-94},{67.1429,-94},{67.1429,-21.4286}}, color={0,0,127}));
206+
connect(gain4.y, PlantController.Plant_pref) annotation (Line(points={{-66.6,-86},
207+
{-94,-86},{-94,4},{-80,4}}, color={0,0,127}));
208+
connect(gain3.y, PlantController.Plant_pref) annotation (Line(points={{-79.4,60},
209+
{-76,60},{-76,32},{-88,32},{-88,4},{-80,4}}, color={0,0,127}));
176210
annotation (Icon(graphics={ Ellipse(
177211
extent={{-100,100},{100,-100}},
178212
lineColor={0,0,0},
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
within OpenIPSL.Tests.BaseClasses;
2+
partial model SMIBAddOn
3+
"SMIB - Single Machine Infinite Base system with one load for renewable source validation."
4+
extends Modelica.Icons.Example;
5+
OpenIPSL.Electrical.Branches.PwLine pwLine(
6+
R=2.50000E-2,
7+
X=2.50000E-2,
8+
G=0,
9+
B=0.05000/2) annotation (Placement(transformation(extent={{40,-4},{60,16}})));
10+
OpenIPSL.Electrical.Branches.PwLine pwLine1(
11+
R=2.50000E-2,
12+
X=2.50000E-2,
13+
G=0,
14+
B=0.05000/2) annotation (Placement(transformation(extent={{40,-16},{60,4}})));
15+
OpenIPSL.Electrical.Branches.PwLine pwLine2(
16+
G=0,
17+
B=0,
18+
R=2.50000E-3,
19+
X=2.50000E-3)
20+
annotation (Placement(transformation(extent={{4,-10},{24,10}})));
21+
OpenIPSL.Electrical.Events.PwFault pwFault(
22+
R=0.5,
23+
X=0.5,
24+
t1=2.00,
25+
t2=2.15)
26+
annotation (Placement(transformation(extent={{42,-36},{58,-20}})));
27+
inner OpenIPSL.Electrical.SystemBase SysData(fn=50, S_b=100000000) annotation (Placement(transformation(extent={{-100,80},
28+
{-60,100}})));
29+
OpenIPSL.Electrical.Buses.Bus PV_BUS
30+
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
31+
OpenIPSL.Electrical.Buses.Bus FAULT
32+
annotation (Placement(transformation(extent={{18,-10},{38,10}})));
33+
OpenIPSL.Electrical.Buses.Bus GEN2
34+
annotation (Placement(transformation(extent={{60,-10},{80,10}})));
35+
Electrical.Sources.VoltageSourceReImInput voltageSourceReImInput
36+
annotation (Placement(transformation(extent={{96,-10},{76,10}})));
37+
Modelica.Blocks.Sources.RealExpression imagPart annotation (Placement(transformation(extent={{80,-30},{100,-10}})));
38+
Modelica.Blocks.Sources.RealExpression realPart(y=if time <= 50000 then 1 else 0.99) annotation (Placement(transformation(extent={{80,10},{100,30}})));
39+
equation
40+
connect(FAULT.p,pwLine. p)
41+
annotation (Line(points={{28,0},{36,0},{36,6},{41,6}}, color={0,0,255}));
42+
connect(pwLine1.p,pwLine. p) annotation (Line(points={{41,-6},{36,-6},{36,6},
43+
{41,6}}, color={0,0,255}));
44+
connect(pwFault.p,FAULT. p) annotation (Line(points={{40.6667,-28},{32,-28},{32,0},{28,0}},
45+
color={0,0,255}));
46+
connect(pwLine.n,GEN2. p)
47+
annotation (Line(points={{59,6},{64,6},{64,0},{70,0}}, color={0,0,255}));
48+
connect(pwLine1.n,GEN2. p) annotation (Line(points={{59,-6},{64,-6},{64,0},{
49+
70,0}}, color={0,0,255}));
50+
connect(pwLine2.n, FAULT.p)
51+
annotation (Line(points={{23,0},{28,0}}, color={0,0,255}));
52+
connect(PV_BUS.p, pwLine2.p)
53+
annotation (Line(points={{0,0},{5,0}}, color={0,0,255}));
54+
connect(voltageSourceReImInput.p, GEN2.p)
55+
annotation (Line(points={{75,0},{70,0}}, color={0,0,255}));
56+
connect(voltageSourceReImInput.vIm, imagPart.y) annotation (Line(points={{98,-4},{104,-4},{104,-20},{101,-20}}, color={0,0,127}));
57+
connect(realPart.y, voltageSourceReImInput.vRe) annotation (Line(points={{101,20},{104,20},{104,4},{98,4}}, color={0,0,127}));
58+
end SMIBAddOn;

OpenIPSL/Tests/BaseClasses/SMIBRenewable.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ equation
5353
annotation (Line(points={{16,0},{24,0},{24,20},{35,20}}, color={0,0,255}));
5454
connect(pwLine1.p,pwLine. p) annotation (Line(points={{35,-20},{24,-20},{24,20},
5555
{35,20}}, color={0,0,255}));
56-
connect(pwFault.p,FAULT. p) annotation (Line(points={{30.3333,-50},{20,-50},{
57-
20,0},{16,0}}, color={0,0,255}));
56+
connect(pwFault.p,FAULT. p) annotation (Line(points={{30.3333,-50},{20,-50},{20,0},{16,0}},
57+
color={0,0,255}));
5858
connect(pwLine.n,GEN2. p)
5959
annotation (Line(points={{53,20},{64,20},{64,0},{74,0}}, color={0,0,255}));
6060
connect(pwLine1.n,GEN2. p) annotation (Line(points={{53,-20},{64,-20},{64,0},{
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
LoadTestBase
22
MachineTestBase
33
SMIB
4+
SMIBAddOn
45
SMIBRenewable
56
TGTestBase

OpenIPSL/Tests/Renewable/PSSE/BESSPlant.mo

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ equation
6161
connect(pwCurrent.ii, bESS.branch_ii) annotation (Line(points={{-14,-6.6},{
6262
-14,-20},{-56,-20},{-56,-10}}, color={0,0,127}));
6363
annotation (experiment(
64-
StopTime=5,
65-
__Dymola_NumberOfIntervals=5000,
66-
__Dymola_Algorithm="Dassl"), Documentation(
64+
StopTime=5), Documentation(
6765
info="<html>
6866
<p>
6967
Simulate for 5 seconds.

0 commit comments

Comments
 (0)