Skip to content

Commit 7875491

Browse files
committed
Adapt units and cleanup #1575
1 parent 5d04aad commit 7875491

18 files changed

+296
-319
lines changed

IBPSA/Electrical/BaseClasses/PV/BaseClasses/Icons/partialPVIcon.mo

+24-30
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,55 @@ partial model partialPVIcon "Partial model for basic PV model icon"
55
Rectangle(extent={{-100,100},{100,-100}},
66
lineColor={215,215,215},fillColor={215,215,215},
77
fillPattern = FillPattern.Solid),
8-
Rectangle(extent={{-62,18},{-34,-10}},
9-
lineColor={0,0,255},fillColor={0,0,255},
8+
Rectangle(extent={{-62,30},{-34,2}},lineColor={0,0,255},fillColor={0,0,255},
109
fillPattern = FillPattern.Solid),
11-
Rectangle(extent={{-30,18},{-2,-10}},
12-
lineColor={0,0,255},fillColor={0,0,255},
10+
Rectangle(extent={{-30,30},{-2,2}},lineColor={0,0,255},fillColor={0,0,255},
1311
fillPattern = FillPattern.Solid),
14-
Rectangle(extent={{2,18},{30,-10}},
15-
lineColor={0,0,255},fillColor={0,0,255},
12+
Rectangle(extent={{2,30},{30,2}}, lineColor={0,0,255},fillColor={0,0,255},
1613
fillPattern = FillPattern.Solid),
17-
Rectangle(extent={{-62,-14},{-34,-42}},
18-
lineColor={0,0,255},fillColor={0,0,255},
14+
Rectangle(extent={{-62,-2},{-34,-30}},lineColor={0,0,255},fillColor={0,0,255},
1915
fillPattern = FillPattern.Solid),
20-
Rectangle(extent={{-30,-14},{-2,-42}},
21-
lineColor={0,0,255},fillColor={0,0,255},
16+
Rectangle(extent={{-30,-2},{-2,-30}},lineColor={0,0,255},fillColor={0,0,255},
2217
fillPattern = FillPattern.Solid),
23-
Rectangle(extent={{2,-14},{30,-42}},lineColor={0,0,255},fillColor={0,0,255},
18+
Rectangle(extent={{2,-2},{30,-30}}, lineColor={0,0,255},fillColor={0,0,255},
2419
fillPattern = FillPattern.Solid),
25-
Rectangle(extent={{-62,-46},{-34,-74}},lineColor={0,0,255},fillColor={0,0,255},
20+
Rectangle(extent={{-62,-34},{-34,-62}},lineColor={0,0,255},fillColor={0,0,255},
2621
fillPattern = FillPattern.Solid),
27-
Rectangle(extent={{-30,50},{-2,22}},lineColor={0,0,255},fillColor={0,0,255},
22+
Rectangle(extent={{-30,62},{-2,34}},lineColor={0,0,255},fillColor={0,0,255},
2823
fillPattern = FillPattern.Solid),
29-
Rectangle(extent={{2,50},{30,22}}, lineColor={0,0,255},fillColor={0,0,255},
24+
Rectangle(extent={{2,62},{30,34}}, lineColor={0,0,255},fillColor={0,0,255},
3025
fillPattern = FillPattern.Solid),
31-
Rectangle(extent={{-62,50},{-34,22}},lineColor={0,0,255},fillColor={0,0,255},
26+
Rectangle(extent={{-62,62},{-34,34}},lineColor={0,0,255},fillColor={0,0,255},
3227
fillPattern = FillPattern.Solid),
33-
Rectangle(extent={{-30,-46},{-2,-74}},lineColor={0,0,255},fillColor={0,0,255},
28+
Rectangle(extent={{-30,-34},{-2,-62}},lineColor={0,0,255},fillColor={0,0,255},
3429
fillPattern = FillPattern.Solid),
35-
Rectangle(extent={{2,-46},{30,-74}}, lineColor={0,0,255},fillColor={0,0,255},
30+
Rectangle(extent={{2,-34},{30,-62}}, lineColor={0,0,255},fillColor={0,0,255},
3631
fillPattern = FillPattern.Solid),
37-
Rectangle(extent={{-94,50},{-66,22}},lineColor={0,0,255},fillColor={0,0,255},
32+
Rectangle(extent={{-94,62},{-66,34}},lineColor={0,0,255},fillColor={0,0,255},
3833
fillPattern = FillPattern.Solid),
39-
Rectangle(extent={{-94,18},{-66,-10}},
40-
lineColor={0,0,255},fillColor={0,0,255},
34+
Rectangle(extent={{-94,30},{-66,2}}, lineColor={0,0,255},fillColor={0,0,255},
4135
fillPattern = FillPattern.Solid),
42-
Rectangle(extent={{-94,-14},{-66,-42}},
36+
Rectangle(extent={{-94,-2},{-66,-30}},
4337
lineColor={0,0,255},fillColor={0,0,255},
4438
fillPattern = FillPattern.Solid),
45-
Rectangle(extent={{-94,-46},{-66,-74}},
39+
Rectangle(extent={{-94,-34},{-66,-62}},
4640
lineColor={0,0,255},fillColor={0,0,255},
4741
fillPattern = FillPattern.Solid),
48-
Rectangle(extent={{34,50},{62,22}}, lineColor={0,0,255},fillColor={0,0,255},
42+
Rectangle(extent={{34,62},{62,34}}, lineColor={0,0,255},fillColor={0,0,255},
4943
fillPattern = FillPattern.Solid),
50-
Rectangle(extent={{34,18},{62,-10}}, lineColor={0,0,255},fillColor={0,0,255},
44+
Rectangle(extent={{34,30},{62,2}}, lineColor={0,0,255},fillColor={0,0,255},
5145
fillPattern = FillPattern.Solid),
52-
Rectangle(extent={{34,-14},{62,-42}},lineColor={0,0,255},fillColor={0,0,255},
46+
Rectangle(extent={{34,-2},{62,-30}}, lineColor={0,0,255},fillColor={0,0,255},
5347
fillPattern = FillPattern.Solid),
54-
Rectangle(extent={{34,-46},{62,-74}},lineColor={0,0,255},fillColor={0,0,255},
48+
Rectangle(extent={{34,-34},{62,-62}},lineColor={0,0,255},fillColor={0,0,255},
5549
fillPattern = FillPattern.Solid),
56-
Rectangle(extent={{66,-46},{94,-74}},lineColor={0,0,255},fillColor={0,0,255},
50+
Rectangle(extent={{66,-34},{94,-62}},lineColor={0,0,255},fillColor={0,0,255},
5751
fillPattern = FillPattern.Solid),
58-
Rectangle(extent={{66,-14},{94,-42}},lineColor={0,0,255},fillColor={0,0,255},
52+
Rectangle(extent={{66,-2},{94,-30}}, lineColor={0,0,255},fillColor={0,0,255},
5953
fillPattern = FillPattern.Solid),
60-
Rectangle(extent={{66,18},{94,-10}}, lineColor={0,0,255},fillColor={0,0,255},
54+
Rectangle(extent={{66,30},{94,2}}, lineColor={0,0,255},fillColor={0,0,255},
6155
fillPattern = FillPattern.Solid),
62-
Rectangle(extent={{66,50},{94,22}}, lineColor={0,0,255},fillColor={0,0,255},
56+
Rectangle(extent={{66,62},{94,34}}, lineColor={0,0,255},fillColor={0,0,255},
6357
fillPattern = FillPattern.Solid),
6458
Text(
6559
extent={{-150,150},{150,110}},

IBPSA/Electrical/BaseClasses/PV/BaseClasses/PartialPVElectrical.mo

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ partial model PartialPVElectrical
1919
final parameter Integer nPar=dat.nPar
2020
"Number of parallel connected cells within the PV module";
2121

22-
final parameter Real Eg0(unit="eV") = dat.Eg0
22+
final parameter Modelica.Units.SI.Energy Eg0 = dat.Eg0
2323
"Band gap energy under standard conditions";
2424

2525
Modelica.Units.SI.ElectricCurrent IPh "Photo current";

IBPSA/Electrical/BaseClasses/PV/PVElectricalSingleDiodeMPP.mo

+39-44
Original file line numberDiff line numberDiff line change
@@ -6,109 +6,104 @@ model PVElectricalSingleDiodeMPP
66

77
// Main parameters under standard conditions
88

9-
Modelica.Units.SI.ElectricCurrent I_ph0
9+
Modelica.Units.SI.ElectricCurrent IPh0
1010
"Photo current under standard conditions";
11-
Modelica.Units.SI.ElectricCurrent I_s0
11+
Modelica.Units.SI.ElectricCurrent IS0
1212
"Saturation current under standard conditions";
13-
Modelica.Units.SI.Resistance R_s0
13+
Modelica.Units.SI.Resistance RS0
1414
"Series resistance under standard conditions";
15-
Modelica.Units.SI.Resistance R_sh0
15+
Modelica.Units.SI.Resistance RSh0
1616
"Shunt resistance under standard conditions";
17-
Real a_0(unit = "V")
18-
"Modified diode ideality factor under standard conditions";
19-
Real w_0(final unit = "1")
17+
Real a0(unit="V") "Modified diode ideality factor under standard conditions";
18+
Real w0(final unit="1")
2019
"MPP auxiliary correlation coefficient under standard conditions";
2120

2221
// Additional parameters and constants
2322

2423
constant Real euler=Modelica.Math.exp(1.0)
2524
"Euler constant";
26-
constant Real q(unit = "C")= 1.602176620924561e-19
25+
constant Real q(unit = "A.s")= 1.602176620924561e-19
2726
"Elementary charge";
2827

29-
Modelica.Units.SI.ElectricCurrent I_mp(start=0.5*IMP0)
28+
Modelica.Units.SI.ElectricCurrent IMP(start=0.5*IMP0)
3029
"MPP current at operating conditions";
3130

32-
Modelica.Units.SI.Voltage V_mp "MPP voltage at operating conditions";
31+
Modelica.Units.SI.Voltage VMP "MPP voltage at operating conditions";
3332

3433
Modelica.Units.SI.Energy Eg "Band gap energy at operating conditions";
3534

36-
Modelica.Units.SI.ElectricCurrent I_s "Saturation current at operating conditions";
35+
Modelica.Units.SI.ElectricCurrent IS
36+
"Saturation current at operating conditions";
3737

38-
Modelica.Units.SI.Resistance R_s "Series resistance at operating conditions";
38+
Modelica.Units.SI.Resistance RS "Series resistance at operating conditions";
3939

40-
Modelica.Units.SI.Resistance R_sh "Shunt resistance at operating conditions";
40+
Modelica.Units.SI.Resistance RSh "Shunt resistance at operating conditions";
4141

4242
Real a(final unit = "V", start = 1.3)
4343
"Modified diode ideality factor";
4444

45-
Modelica.Units.SI.Power P_mod "Output power of one PV module";
45+
Modelica.Units.SI.Power PMod "Output power of one PV module";
4646

4747
Real w(final unit = "1", start = 0)
4848
"MPP auxiliary correlation coefficient";
4949

50-
Modelica.Units.SI.Voltage V_oc
50+
Modelica.Units.SI.Voltage VOC
5151
"Open circuit voltage under operating conditions";
5252

5353
equation
5454

5555
// Analytical parameter extraction equations under standard conditions (Batzelis et al., 2016)
5656

57-
a_0 =VOC0*(1 - TCel0*betaVOC)/(50.1 - TCel0*alphaISC);
57+
a0 = VOC0*(1 - TCel0*betaVOC)/(50.1 - TCel0*alphaISC);
5858

59-
w_0 =IBPSA.Electrical.BaseClasses.PV.BaseClasses.lambertWSimple(
60-
exp(1/(a_0/VOC0) + 1));
59+
w0 = IBPSA.Electrical.BaseClasses.PV.BaseClasses.lambertWSimple(exp(1/(a0/
60+
VOC0) + 1));
6161

62-
R_s0 =(a_0*(w_0 - 1) - VMP0)/IMP0;
62+
RS0 = (a0*(w0 - 1) - VMP0)/IMP0;
6363

64-
R_sh0 =a_0*(w_0 - 1)/(ISC0*(1 - 1/w_0) - IMP0);
64+
RSh0 = a0*(w0 - 1)/(ISC0*(1 - 1/w0) - IMP0);
6565

66-
I_ph0 =(1 + R_s0/R_sh0)*ISC0;
66+
IPh0 = (1 + RS0/RSh0)*ISC0;
6767

68-
I_s0 =I_ph0*exp(-1/(a_0/VOC0));
68+
IS0 = IPh0*exp(-1/(a0/VOC0));
6969

7070
// Parameter extrapolation equations to operating conditions (DeSoto et al., 2006)
7171

72-
a/a_0 = TCel/TCel0;
72+
a/a0 = TCel/TCel0;
7373

74-
I_s/I_s0 = (TCel/TCel0)^3*exp(1/k*(Eg0*q/TCel0-Eg/TCel));
74+
IS/IS0 = (TCel/TCel0)^3*exp(1/k*(Eg0/TCel0 - Eg/TCel));
7575

76-
Eg/(Eg0*q) =1 - dat.C*(TCel - TCel0);
76+
Eg/(Eg0) =1 - dat.C*(TCel - TCel0);
7777

78-
R_s = R_s0;
78+
RS = RS0;
7979

80-
IPh = if absRadRat > 0
81-
then absRadRat*(I_ph0 + TCoeISC*(TCel - TCel0))
82-
else 0;
80+
IPh =if absRadRat > 0 then absRadRat*(IPh0 + TCoeISC*(TCel - TCel0)) else 0;
8381

84-
R_sh/R_sh0 = if noEvent(absRadRat > Modelica.Constants.eps)
85-
then 1/absRadRat
86-
else 0;
82+
RSh/RSh0 = if noEvent(absRadRat > Modelica.Constants.eps) then 1/absRadRat
83+
else 0;
8784

8885
// Simplified power correlations at MPP using Lambert W function (Batzelis et al., 2016)
8986

90-
I_mp =if noEvent(absRadRat <= Modelica.Constants.eps
91-
or w <= Modelica.Constants.eps)
92-
then 0 else IPh*(1 - 1/w) - a*(w - 1)/R_sh;
87+
IMP = if noEvent(absRadRat <= Modelica.Constants.eps or w <= Modelica.Constants.eps)
88+
then 0 else IPh*(1 - 1/w) - a*(w - 1)/RSh;
9389

94-
V_mp = if absRadRat <= 0 then 0 else a*(w-1)-R_s*I_mp;
90+
VMP = if absRadRat <= 0 then 0 else a*(w - 1) - RS*IMP;
9591

96-
V_oc =if IPh >= Modelica.Constants.eps*10 then a*log(abs((IPh/I_s + 1)))
97-
else 0;
92+
VOC = if IPh >= Modelica.Constants.eps*10 then a*log(abs((IPh/IS + 1))) else 0;
9893

99-
w = if noEvent(V_oc >= Modelica.Constants.eps) then
100-
IBPSA.Electrical.BaseClasses.PV.BaseClasses.lambertWSimple(exp(1/(a/V_oc)
101-
+ 1)) else 0;
94+
w =if noEvent(VOC >= Modelica.Constants.eps) then
95+
IBPSA.Electrical.BaseClasses.PV.BaseClasses.lambertWSimple(exp(1/(a/VOC) + 1))
96+
else 0;
10297

10398

10499
// Efficiency and Performance
105100

106-
eta=if noEvent(HGloTil <= Modelica.Constants.eps*10) then 0 else P_mod/(
101+
eta=if noEvent(HGloTil <= Modelica.Constants.eps*10) then 0 else PMod/(
107102
HGloTil*APan);
108103

109-
P_mod = V_mp*I_mp;
104+
PMod = VMP*IMP;
110105

111-
P=max(0, min(PMax*nMod, P_mod*nMod));
106+
P=max(0, min(PMax*nMod, PMod*nMod));
112107

113108
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-80},
114109
{100,80}})), Diagram(

IBPSA/Electrical/BaseClasses/PV/PartialPVSystem.mo

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
within IBPSA.Electrical.BaseClasses.PV;
22
partial model PartialPVSystem "Base PV model with internal or external MPP tracking"
3-
43
extends IBPSA.Electrical.BaseClasses.PV.BaseClasses.Icons.partialPVIcon;
54

5+
replaceable package PhaseSystem =
6+
IBPSA.Electrical.PhaseSystems.PartialPhaseSystem constrainedby
7+
IBPSA.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"
8+
annotation (choicesAllMatching=true);
9+
610
replaceable parameter Data.PV.Generic dat constrainedby
711
IBPSA.Electrical.Data.PV.Generic "PV Panel data definition"
812
annotation (choicesAllMatching=true);
@@ -34,6 +38,9 @@ partial model PartialPVSystem "Base PV model with internal or external MPP track
3438
"If true then the zenith angle is needed as input for absorption ratio calculations"
3539
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);
3640

41+
parameter Boolean use_ter = true
42+
"If true then the electrical terminal connector is used";
43+
3744
parameter Boolean use_incAng = true
3845
"If true then the incidence angle is needed as input for absorption ratio calculations"
3946
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);
@@ -53,17 +60,17 @@ partial model PartialPVSystem "Base PV model with internal or external MPP track
5360
"Global irradiation on tilted surface"
5461
annotation (Placement(transformation(extent={{-20,-20},{20,20}},
5562
rotation=0,
56-
origin={-120,-70}),
63+
origin={-120,-90}),
5764
iconTransformation(extent={{-20,-20},{20,20}},
5865
rotation=0,
59-
origin={-120,-70})));
66+
origin={-120,-90})));
6067
Modelica.Blocks.Interfaces.RealInput TDryBul(final unit="K") "Ambient dry bulb temperature"
6168
annotation (Placement(transformation(extent={{-20,-20},{20,20}},
6269
rotation=0,
63-
origin={-120,-10}),
70+
origin={-120,-30}),
6471
iconTransformation(extent={{-20,-20},{20,20}},
6572
rotation=0,
66-
origin={-120,-10})));
73+
origin={-120,-30})));
6774
Modelica.Blocks.Interfaces.RealInput vWinSpe(final unit="m/s") "Wind speed" annotation (
6875
Placement(transformation(extent={{-20,-20},{20,20}},
6976
rotation=0,
@@ -103,18 +110,18 @@ partial model PartialPVSystem "Base PV model with internal or external MPP track
103110
"Global irradiation on horizontal surface" annotation (Placement(
104111
transformation(extent={{-20,-20},{20,20}},
105112
rotation=0,
106-
origin={-120,-40}), iconTransformation(extent={{-20,-20},
113+
origin={-120,-60}), iconTransformation(extent={{-20,-20},
107114
{20,20}},
108115
rotation=0,
109-
origin={-120,-40})));
116+
origin={-120,-60})));
110117
Modelica.Blocks.Interfaces.RealInput HDifHor(final unit="W/m2") if use_HDifHor
111118
"Diffuse irradiation on horizontal surface" annotation (Placement(
112119
transformation(extent={{-20,-20},{20,20}},
113120
rotation=0,
114-
origin={-120,-100}), iconTransformation(
121+
origin={-120,-120}), iconTransformation(
115122
extent={{-20,-20},{20,20}},
116123
rotation=0,
117-
origin={-120,-100})));
124+
origin={-120,-120})));
118125
Modelica.Blocks.Interfaces.RealInput incAng(final unit="rad") if use_incAng
119126
"Incidence angle of irradiation"
120127
annotation (Placement(transformation(extent={{-140,30},{-100,70}},
@@ -123,6 +130,9 @@ partial model PartialPVSystem "Base PV model with internal or external MPP track
123130
"Zenith angle of irradiation"
124131
annotation (Placement(transformation(extent={{-140,60},{-100,100}},
125132
rotation=0)));
133+
replaceable Buildings.Electrical.Interfaces.Terminal terminal(
134+
redeclare final package PhaseSystem = PhaseSystem) if use_ter "Generalized terminal"
135+
annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
126136

127137
protected
128138
Modelica.Blocks.Interfaces.RealInput Til_in_int

0 commit comments

Comments
 (0)