Skip to content

Commit

Permalink
Adapt formatting #1575
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraMaier committed Oct 8, 2023
1 parent 0100780 commit aa801be
Show file tree
Hide file tree
Showing 13 changed files with 241 additions and 197 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ partial model PartialPVElectrical
Modelica.Units.SI.ElectricCurrent IPh "Photo current";
Modelica.Blocks.Interfaces.RealInput TCel(final unit="K",final displayUnit="degC")
"Cell temperature"
annotation (Placement(transformation(extent={{-140,30},{-100,70}})));
annotation (Placement(transformation(extent={{-140,20},{-100,60}})));

public
Modelica.Blocks.Interfaces.RealInput absRadRat(final unit="1")
"Ratio of absorbed radiation under operating conditions to standard conditions"
annotation (Placement(transformation(extent={{-140,-50},{-100,-10}})));
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Modelica.Blocks.Interfaces.RealInput HGloTil(final unit="W/m2")
"Total solar irradiance on the tilted surface"
annotation (Placement(transformation(extent={{-140,-90},{-100,-50}})));
annotation (Placement(transformation(extent={{-140,-60},{-100,-20}})));
Modelica.Blocks.Interfaces.RealOutput eta(final unit="1")
"Efficiency of the PV module under operating conditions"
annotation (Placement(transformation(extent={{100,-60},{120,-40}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ protected
final parameter Real TCoeVOC(unit="V/K") = dat.TCoeVOC
"Temperature coefficient for open circuit voltage, <0";

final parameter Modelica.Units.SI.LinearTemperatureCoefficient alphaISC=dat.alphaISC
"Normalized temperature coefficient for short circuit current, >0";
final parameter Modelica.Units.SI.LinearTemperatureCoefficient alphaISC=
dat.alphaISC "Normalized temperature coefficient for short circuit current, >0";

final parameter Modelica.Units.SI.LinearTemperatureCoefficient betaVOC=dat.betaVOC
"Normalized temperature coefficient for open circuit voltage, <0";
final parameter Modelica.Units.SI.LinearTemperatureCoefficient betaVOC=
dat.betaVOC "Normalized temperature coefficient for open circuit voltage, <0";

final parameter Modelica.Units.SI.LinearTemperatureCoefficient gammaPMP=dat.gammaPMP
"Normalized temperature coefficient for power at MPP";
final parameter Modelica.Units.SI.LinearTemperatureCoefficient gammaPMP=
dat.gammaPMP "Normalized temperature coefficient for power at MPP";

final parameter Modelica.Units.SI.Temperature TCel0 = 25.0 + 273.15
"Thermodynamic cell temperature under standard conditions";
Expand Down Expand Up @@ -85,7 +85,8 @@ protected
smooth=Smooth.Bezier)}), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Documentation(info="<html>
<p>This is a partial model for the electrical surrogate model of a photovoltaic model modeled as a single diode circuit.</p>
<p>
This is a partial model for the electrical surrogate model of a photovoltaic model modeled as a single diode circuit.</p>
</html>", revisions="<html>
<ul>
<li>
Expand Down
21 changes: 11 additions & 10 deletions IBPSA/Electrical/BaseClasses/PV/BaseClasses/PartialPVOptical.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ within IBPSA.Electrical.BaseClasses.PV.BaseClasses;
partial model PartialPVOptical


parameter PVOptical.PVType PVTecTyp=IBPSA.Electrical.BaseClasses.PV.BaseClasses.PVOptical.PVType.MonoSI
parameter PVOptical.PVType PVTecTyp=
IBPSA.Electrical.BaseClasses.PV.BaseClasses.PVOptical.PVType.MonoSI
"Type of PV technology";

parameter Boolean use_Til_in = false
Expand All @@ -18,21 +19,21 @@ partial model PartialPVOptical
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
Modelica.Blocks.Interfaces.RealInput zenAng(final unit="rad", final
displayUnit="deg") "Zenith angle for object"
annotation (Placement(transformation(extent={{-140,50},{-100,90}}),
iconTransformation(extent={{-140,50},{-100,90}})));
annotation (Placement(transformation(extent={{-140,60},{-100,100}}),
iconTransformation(extent={{-140,60},{-100,100}})));
Modelica.Blocks.Interfaces.RealInput HGloHor(final unit="W/m2") "Global horizontal irradiation"
annotation (Placement(transformation(extent={{-140,-30},{-100,10}}),
iconTransformation(extent={{-140,-30},{-100,10}})));
annotation (Placement(transformation(extent={{-140,-20},{-100,20}}),
iconTransformation(extent={{-140,-20},{-100,20}})));
Modelica.Blocks.Interfaces.RealInput HDifHor(final unit="W/m2") "Diffuse horizontal irradiation"
annotation (Placement(transformation(extent={{-140,-70},{-100,-30}}),
iconTransformation(extent={{-140,-70},{-100,-30}})));
annotation (Placement(transformation(extent={{-140,-60},{-100,-20}}),
iconTransformation(extent={{-140,-60},{-100,-20}})));
Modelica.Blocks.Interfaces.RealInput incAng(final unit="rad", final
displayUnit="deg") "Incidence angle"
annotation (Placement(transformation(extent={{-140,10},{-100,50}}),
iconTransformation(extent={{-140,10},{-100,50}})));
annotation (Placement(transformation(extent={{-140,20},{-100,60}}),
iconTransformation(extent={{-140,20},{-100,60}})));
Modelica.Blocks.Interfaces.RealInput tilSet(final unit="rad") if use_Til_in
"Conditional input for tilt angle control" annotation (Placement(
transformation(extent={{-140,-110},{-100,-70}}),
transformation(extent={{-140,-100},{-100,-60}}),
iconTransformation(
extent={{-140,-80},{-100,-40}})));

Expand Down
16 changes: 8 additions & 8 deletions IBPSA/Electrical/BaseClasses/PV/BaseClasses/PartialPVThermal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ partial model PartialPVThermal
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
Modelica.Blocks.Interfaces.RealInput TDryBul(final unit="K", final displayUnit="degC")
"Ambient temperature (dry bulb)"
annotation (Placement(transformation(extent={{-140,70},{-100,110}}),
iconTransformation(extent={{-140,70},{-100,110}})));
annotation (Placement(transformation(extent={{-140,60},{-100,100}}),
iconTransformation(extent={{-140,60},{-100,100}})));
Modelica.Blocks.Interfaces.RealInput winVel(final unit="m/s")
"Wind velocity"
annotation (Placement(transformation(extent={{-140,10},{-100,50}}),
iconTransformation(extent={{-140,10},{-100,50}})));
annotation (Placement(transformation(extent={{-140,20},{-100,60}}),
iconTransformation(extent={{-140,20},{-100,60}})));
Modelica.Blocks.Interfaces.RealInput HGloTil(final unit="W/m2")
"Total solar irradiance on the tilted surface"
annotation (Placement(transformation(extent={{-140,-110},{-100,-70}}),
iconTransformation(extent={{-140,-110},{-100,-70}})));
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}}),
iconTransformation(extent={{-140,-100},{-100,-60}})));
Modelica.Blocks.Interfaces.RealInput eta(final unit="1")
"Efficiency of the PV module under operating conditions"
annotation (Placement(transformation(extent={{-140,-50},{-100,-10}}),
iconTransformation(extent={{-140,-50},{-100,-10}})));
annotation (Placement(transformation(extent={{-140,-60},{-100,-20}}),
iconTransformation(extent={{-140,-60},{-100,-20}})));
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
-100},{120,100}}), graphics={
Text(extent={{-84,-68},{0,-102}},textString= "%name"),
Expand Down
20 changes: 13 additions & 7 deletions IBPSA/Electrical/BaseClasses/PV/PVElectricalSingleDiodeMPP.mo
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
within IBPSA.Electrical.BaseClasses.PV;
model PVElectricalSingleDiodeMPP "Analytical 5-p model for PV I-V characteristics with temperature dependency based on 5 parameters with automatic MPP control"
model PVElectricalSingleDiodeMPP
"Analytical 5-p model for PV I-V characteristics with temperature dependency based on 5 parameters with automatic MPP control"
extends
IBPSA.Electrical.BaseClasses.PV.BaseClasses.PartialPVElectricalSingleDiode;

Expand Down Expand Up @@ -55,8 +56,8 @@ equation

a_0 =VOC0*(1 - TCel0*betaVOC)/(50.1 - TCel0*alphaISC);

w_0 =IBPSA.Electrical.BaseClasses.PV.BaseClasses.lambertWSimple(exp(1/(a_0/
VOC0) + 1));
w_0 =IBPSA.Electrical.BaseClasses.PV.BaseClasses.lambertWSimple(
exp(1/(a_0/VOC0) + 1));

R_s0 =(a_0*(w_0 - 1) - VMP0)/IMP0;

Expand All @@ -76,14 +77,19 @@ equation

R_s = R_s0;

IPh = if absRadRat > 0 then absRadRat*(I_ph0 + TCoeISC*(TCel - TCel0)) else 0;
IPh = if absRadRat > 0
then absRadRat*(I_ph0 + TCoeISC*(TCel - TCel0))
else 0;

R_sh/R_sh0 = if noEvent(absRadRat > Modelica.Constants.eps) then 1/absRadRat else 0;
R_sh/R_sh0 = if noEvent(absRadRat > Modelica.Constants.eps)
then 1/absRadRat
else 0;

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

I_mp =if noEvent(absRadRat <= Modelica.Constants.eps or w <= Modelica.Constants.eps)
then 0 else IPh*(1 - 1/w) - a*(w - 1)/R_sh;
I_mp =if noEvent(absRadRat <= Modelica.Constants.eps
or w <= Modelica.Constants.eps)
then 0 else IPh*(1 - 1/w) - a*(w - 1)/R_sh;

V_mp = if absRadRat <= 0 then 0 else a*(w-1)-R_s*I_mp;

Expand Down
87 changes: 51 additions & 36 deletions IBPSA/Electrical/BaseClasses/PV/PVOpticalAbsRat.mo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ model PVOpticalAbsRat

Real incAngMod(final unit="1", min=0) "Incidence angle modifier";

Real incAngModGro(final unit="1", min=0) "Incidence angle modifier for ground refelction";
Real incAngModGro(final unit="1", min=0)
"Incidence angle modifier for ground refelction";

Real incAngModDif(final unit="1", min=0)
"Incidence angle modifier for diffuse radiation";
Expand Down Expand Up @@ -73,8 +74,8 @@ model PVOpticalAbsRat
//Conditional connectors

protected
parameter Real tau_0(final unit="1")=exp(-(glaExtCoe*glaThi))*(1 - ((refInd - 1)/(
refInd + 1))^2)
parameter Real tau_0(final unit="1")=exp(-(glaExtCoe*glaThi))*
(1 - ((refInd - 1)/(refInd + 1))^2)
"Transmittance at standard conditions (incAng=refAng=0)";


Expand All @@ -91,36 +92,45 @@ Modelica.Constants.pi/2*0.999) then asin(sin(incAng)/refInd) else
0;

//Refraction angle that the ground-reflected irradiation is refracted by due to the glazing
refAngGro = if noEvent(incAngGro >= Modelica.Constants.eps and incAngGro <= Modelica.Constants.pi/2*
0.999) then asin(sin(incAngGro)/refInd) else
0;
refAngGro = if noEvent(incAngGro >= Modelica.Constants.eps and
incAngGro <= Modelica.Constants.pi/2*0.999) then
asin(sin(incAngGro)/refInd)
else
0;

//Refraction angle that the diffuse irradiation is refracted by due to the glazing
refAngDif =if noEvent(airMasMod.airMasMod >= Modelica.Constants.eps and
incAngDif <= Modelica.Constants.pi/2*0.999) then asin(sin(incAngDif)/refInd)
else 0;
incAngDif <= Modelica.Constants.pi/2*0.999)
then asin(sin(incAngDif)/refInd)
else 0;

//Transmission coefficient calculated based on the incidence angle
tau = if noEvent(incAng >= Modelica.Constants.eps and incAng <= Modelica.Constants.pi/
2*0.999 and refAng >= Modelica.Constants.eps) then exp(-(glaExtCoe*glaThi/cos(refAng)))*(1
- 0.5*((sin(refAng - incAng)^2)/(sin(refAng + incAng)^2) + (
tan(refAng - incAng)^2)/(tan(refAng + incAng)^2))) else
0;
tau = if noEvent(incAng >= Modelica.Constants.eps and
incAng <= Modelica.Constants.pi/2*0.999 and
refAng >= Modelica.Constants.eps) then
exp(-(glaExtCoe*glaThi/cos(refAng)))*
(1- 0.5*((sin(refAng - incAng)^2)/(sin(refAng + incAng)^2) +
(tan(refAng - incAng)^2)/(tan(refAng + incAng)^2))) else
0;

//Transmission coefficient for the ground-reflected irradiation calculated based on the incidence angle
//of the ground-reflected irradiation
tau_gro = if noEvent(incAngGro >= Modelica.Constants.eps and refAngGro >= Modelica.Constants.eps) then exp(-(
glaExtCoe*glaThi/cos(refAngGro)))*(1 - 0.5*((sin(refAngGro - incAngGro)^2)/
(sin(refAngGro + incAngGro)^2) + (tan(refAngGro - incAngGro)^2)/(tan(
refAngGro + incAngGro)^2))) else
0;

//Transmission coefficient for the diffuse irradiation calculated based on the incidence angle
//of the diffuse irradiation
tau_dif = if noEvent(incAngDif >= Modelica.Constants.eps and refAngDif >=
Modelica.Constants.eps) then exp(-(glaExtCoe*glaThi/cos(refAngDif)))*(1 -
0.5*((sin(refAngDif - incAngDif)^2)/(sin(refAngDif + incAngDif)^2) + (tan(
refAngDif - incAngDif)^2)/(tan(refAngDif + incAngDif)^2))) else 0;
tau_gro = if noEvent(incAngGro >= Modelica.Constants.eps and
refAngGro >= Modelica.Constants.eps) then
exp(-(glaExtCoe*glaThi/cos(refAngGro)))*
(1 - 0.5*((sin(refAngGro - incAngGro)^2)/(sin(refAngGro + incAngGro)^2)
+ (tan(refAngGro - incAngGro)^2)/(tan(refAngGro + incAngGro)^2)))
else 0;

//Transmission coefficient for the diffuse irradiation calculated based
//on the incidence angle of the diffuse irradiation
tau_dif = if noEvent(incAngDif >= Modelica.Constants.eps and
refAngDif >= Modelica.Constants.eps) then
exp(-(glaExtCoe*glaThi/cos(refAngDif)))*
(1 - 0.5*((sin(refAngDif - incAngDif)^2)/
(sin(refAngDif + incAngDif)^2) +
(tan(refAngDif - incAngDif)^2)/(tan(refAngDif + incAngDif)^2)))
else 0;

//Incidence angle modifier to account for relation of transmitted irradiation
//at operating conditions compared to standard conditions
Expand All @@ -133,29 +143,34 @@ incAngModGro = tau_gro/tau_0;
incAngModDif =tau_dif/tau_0;

//Incidence angle of the ground-reflected irradiation
incAngGro =(90 - 0.5788*Til_in_int*180/Modelica.Constants.pi + 0.002693*(
Til_in_int*180/Modelica.Constants.pi)^2)*Modelica.Constants.pi/180;
incAngGro =(90 - 0.5788*Til_in_int*180/Modelica.Constants.pi +
0.002693*(Til_in_int*180/Modelica.Constants.pi)^2)*
Modelica.Constants.pi/180;

//Incidence angle of the diffuse irradiation
incAngDif =(59.7 - 0.1388*Til_in_int*180/Modelica.Constants.pi + 0.001497*(
Til_in_int*180/Modelica.Constants.pi)^2)*Modelica.Constants.pi/180;
incAngDif =(59.7 - 0.1388*Til_in_int*180/Modelica.Constants.pi +
0.001497*(Til_in_int*180/Modelica.Constants.pi)^2)*
Modelica.Constants.pi/180;

//Geometrical relation of normal to horizontal irradiation
R_b = if noEvent((zen >= Modelica.Constants.pi/2*0.999) or (cos(incAng)
> cos(zen)*4)) then 4 else (cos(incAng)/cos(zen));
R_b = if noEvent((zen >= Modelica.Constants.pi/2*0.999) or
(cos(incAng)> cos(zen)*4))
then 4
else (cos(incAng)/cos(zen));

HGloHor = HDirHor + HDifHor;


//Computes the absorption irradiation ratio for operating conditions following De Soto et al.
absRadRat =if noEvent(HGloHor <= 0.1) then 0 else airMasMod.airMasMod*(HDirHor/
HGloHor0*R_b*incAngMod + HDifHor/HGloHor0*incAngModDif*(0.5*(1 + cos(
Til_in_int))) + HGloHor/HGloHor0*groRef*incAngModGro*(1 - cos(Til_in_int))/
2);
absRadRat =if noEvent(HGloHor <= 0.1) then 0
else airMasMod.airMasMod*(HDirHor/HGloHor0*R_b*incAngMod
+ HDifHor/HGloHor0*incAngModDif*(0.5*(1 + cos(
Til_in_int))) + HGloHor/HGloHor0*groRef*incAngModGro*
(1 - cos(Til_in_int))/2);

connect(airMas.airMas, airMasMod.airMas)
annotation (Line(points={{-39,70},{18,70}}, color={0,0,127}));
connect(zenAng, airMas.zenAng) annotation (Line(points={{-120,70},{-92,70},{-92,
connect(zenAng, airMas.zenAng) annotation (Line(points={{-120,80},{-92,80},{-92,
70},{-62,70}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ extends IBPSA.Electrical.BaseClasses.PV.BaseClasses.PartialPVThermalEmp;

equation

TCel = if noEvent(HGloTil >= Modelica.Constants.eps) then
HGloTil*(exp(-2.98-0.0471*winVel))+(TDryBul)+HGloTil/1000*1
else
(TDryBul);
TCel = HGloTil*(exp(-2.98-0.0471*winVel))+(TDryBul)+HGloTil/1000;

annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extends IBPSA.Electrical.BaseClasses.PV.BaseClasses.PartialPVThermalEmp;

equation

TCel = if HGloTil >= 0.01 then HGloTil*(exp(-2.81-0.0455*winVel))+TDryBul else TDryBul;
TCel = HGloTil*(exp(-2.81-0.0455*winVel))+TDryBul;


annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
Expand Down
5 changes: 2 additions & 3 deletions IBPSA/Electrical/BaseClasses/PV/PVThermalEmpMountOpenRack.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ model PVThermalEmpMountOpenRack

equation

TCel =if noEvent(HGloTil >= Modelica.Constants.eps) then (TDryBul) + (TNOCT -
TDryBul0)*HGloTil/HNOCT*9.5/(5.7 + 3.8*winVel)*(1 - eta/coeTranAbs) else (
TDryBul);
TCel = TDryBul + (TNOCT - TDryBul0)*HGloTil/HNOCT*9.5/(5.7 + 3.8*winVel)*
(1 - eta/coeTranAbs);
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Documentation(info="<html>
Expand Down
Loading

0 comments on commit aa801be

Please sign in to comment.