Skip to content

Commit

Permalink
Add initial PVSystem model with single diode #1575
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraMaier committed Aug 2, 2022
1 parent dcc6f21 commit 22c222d
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 3 deletions.
144 changes: 144 additions & 0 deletions IBPSA/Electrical/BaseClasses/PVSystem/PartialPVSystem.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
within IBPSA.Electrical.BaseClasses.PVSystem;
partial model PartialPVSystem "Base PV model with internal or external MPP tracking"

extends IBPSA.Electrical.BaseClasses.PVSystem.BaseClasses.Icons.partialPVIcon;

replaceable model ElectricalModel =
IBPSA.Electrical.BaseClasses.PVSystem.BaseClasses.PartialPVElectrical
"Model with electrical characteristics";

replaceable model ThermalModel =
IBPSA.Electrical.BaseClasses.PVSystem.BaseClasses.PartialPVThermal
"Model with thermal characteristics";

replaceable model OpticalModel =
IBPSA.Electrical.BaseClasses.PVSystem.BaseClasses.PartialPVOptical
"Model with optical characteristics"
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));

replaceable parameter IBPSA.Electrical.DataBase.PVSimpleBaseDataDefinition data
constrainedby IBPSA.Electrical.DataBase.PVSimpleBaseDataDefinition
"PV Panel data definition"
annotation (choicesAllMatching);

parameter Boolean use_MPP_in = false
"If true then MPP via real interface else internal automatic MPP tracking"
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);

parameter Boolean use_Til_in = false
"If true then tilt via real interface else parameter"
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);

parameter Modelica.Units.SI.Angle til if not use_Til_in
"Prescribed tilt angle (used if til=Parameter)" annotation(Dialog(enable=not use_Til_in, tab="Advanced"));

parameter Boolean use_Azi_in = false
"If true then azimuth angle is controlled via real interface else parameter"
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);

parameter Modelica.Units.SI.Angle azi if not use_Azi_in
"Prescribed azimuth angle (used if azi=Parameter)"
annotation(Dialog(enable=not use_Azi_in, tab="Advanced"));

parameter Boolean use_Sha_in = false
"If true then shading is real interface else neglected"
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);

parameter Boolean use_age_in = false
"If true then ageing is real interface else parameter"
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);

parameter Real ageing if not use_age_in
"Prescribed ageing factor [0,1] (used if ageig=Parameter)" annotation(Dialog(enable=not use_age_in, tab="Advanced"));

parameter Boolean use_heat_port = false
"If true then heat port is enables as interface"
annotation(Dialog(tab="Advanced"), Evaluate=true, HideResult=true);

Modelica.Blocks.Interfaces.RealInput HGloHor "Horizontal global irradiation"
annotation (Placement(transformation(extent={{-110,80},{-88,102}}),
iconTransformation(extent={{-110,80},{-88,102}})));
Modelica.Blocks.Interfaces.RealInput TDryBul "Ambient dry bulb temperature"
annotation (Placement(transformation(extent={{-110,52},{-88,74}}),
iconTransformation(extent={{-110,52},{-88,74}})));
Modelica.Blocks.Interfaces.RealInput vWinSpe "Wind speed" annotation (
Placement(transformation(extent={{-110,26},{-88,48}}), iconTransformation(
extent={{-110,26},{-88,48}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort if use_heat_port
"Heat port for connection with e.g. building facade or mass"
annotation (Placement(transformation(extent={{-10,-110},{10,-90}})));

//Conditional connectors
Modelica.Blocks.Interfaces.RealInput MPPTrackingSet if use_MPP_in
"Conditional input for MPP tracking" annotation (Placement(transformation(
extent={{-110,-2},{-88,20}}), iconTransformation(extent={{-110,-2},{-88,
20}})));
Modelica.Blocks.Interfaces.RealInput tilSet if use_Til_in
"Conditional input for tilt angle control" annotation (Placement(
transformation(extent={{-110,-24},{-88,-2}}), iconTransformation(
extent={{-110,-24},{-88,-2}})));
Modelica.Blocks.Interfaces.RealInput aziSet if use_Azi_in
"Conditional input for azimuth angle control" annotation (Placement(
transformation(extent={{-110,-50},{-88,-28}}), iconTransformation(
extent={{-110,-50},{-88,-28}})));
Modelica.Blocks.Interfaces.RealInput shadingSet if use_Sha_in
"Conditional input for shading [0,1]" annotation (Placement(transformation(
extent={{-110,-76},{-88,-54}}), iconTransformation(extent={{-106,-72},
{-88,-54}})));

Modelica.Blocks.Interfaces.RealInput ageingSet if use_age_in
"Conditional input for ageing [0,1]" annotation (Placement(transformation(
extent={{-110,-104},{-88,-82}}), iconTransformation(extent={{-106,-72},
{-88,-54}})));

Modelica.Blocks.Interfaces.RealOutput DCPower "DC Power output"
annotation (Placement(transformation(extent={{94,-10},{114,10}})));
protected
Modelica.Blocks.Interfaces.RealInput MPP_in_internal
"Needed to connect to conditional MPP tracking connector";

parameter Real MPP = 1 "Dummy MPP parameter";

Modelica.Blocks.Interfaces.RealInput Til_in_internal
"Needed to connect to conditional tilt connector";

Modelica.Blocks.Interfaces.RealInput Azi_in_internal
"Needed to connect to conditional azimuth connector";

Modelica.Blocks.Interfaces.RealInput Sha_in_internal
"Needed to connect to conditional shading connector";

Modelica.Blocks.Interfaces.RealInput Age_in_internal
"Needed to connect to conditional ageing connector";

parameter Real Sha = 1 "Dummy Shading parameter";

equation
connect(MPPTrackingSet, MPP_in_internal);
connect(tilSet, Til_in_internal);
connect(aziSet, Azi_in_internal);
connect(shadingSet, Sha_in_internal);
connect(ageingSet, Age_in_internal);

if not use_MPP_in then
MPP_in_internal = MPP;
end if;

if not use_Til_in then
Til_in_internal = til;
end if;

if not use_Azi_in then
Azi_in_internal = azi;
end if;

if not use_Sha_in then
Sha_in_internal = Sha;
end if;

if not use_age_in then
Age_in_internal = ageing;
end if;

end PartialPVSystem;
45 changes: 45 additions & 0 deletions IBPSA/Electrical/Examples/PVSystemSingleDiode.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
within IBPSA.Electrical.Examples;
model PVSystemSingleDiode
extends Modelica.Icons.Example;
PVSystem.PVSystemSingleDiode pVSystemSingleDiode(
til=0.5235987755983,
azi=0,
ageing=1) annotation (Placement(transformation(extent={{-8,-4},{28,20}})));
BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
"D:/05_Offline/modelica-ibpsa/IBPSA/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos")
annotation (Placement(transformation(extent={{-80,40},{-60,60}})));
BoundaryConditions.WeatherData.Bus weaBus1
"Weather data bus"
annotation (Placement(transformation(extent={{-58,40},{-38,60}})));
equation
connect(weaDat.weaBus, weaBus1) annotation (Line(
points={{-60,50},{-48,50}},
color={255,204,51},
thickness=0.5));
connect(weaBus1.HGloHor, pVSystemSingleDiode.HGloHor) annotation (Line(
points={{-48,50},{-36,50},{-36,22},{-7.82,22},{-7.82,18.92}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(weaBus1.TDryBul, pVSystemSingleDiode.TDryBul) annotation (Line(
points={{-48,50},{-42,50},{-42,15.56},{-7.82,15.56}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(weaBus1.winSpe, pVSystemSingleDiode.vWinSpe) annotation (Line(
points={{-48,50},{-48,12.44},{-7.82,12.44}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end PVSystemSingleDiode;
1 change: 1 addition & 0 deletions IBPSA/Electrical/Examples/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PVSystemSingleDiode
6 changes: 6 additions & 0 deletions IBPSA/Electrical/PVSystem/PVSystemSingleDiode.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
within IBPSA.Electrical.PVSystem;
model PVSystemSingleDiode "Photovoltaic module model based on single diode approach"
extends IBPSA.Electrical.BaseClasses.PVSystem.PartialPVSystem;
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end PVSystemSingleDiode;
4 changes: 4 additions & 0 deletions IBPSA/Electrical/PVSystem/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
within IBPSA.Electrical;
package PVSystem

end PVSystem;
1 change: 1 addition & 0 deletions IBPSA/Electrical/PVSystem/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PVSystemSingleDiode
7 changes: 4 additions & 3 deletions IBPSA/Electrical/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ within IBPSA;
package Electrical "Package with models for electrical systems and components"
extends Modelica.Icons.Package;

annotation (Icon(graphics={Line(points={{6,82},{-60,0},{12,0},{-24,-62},{-36,
-56},{-28,-90},{2,-76},{-8,-70},{52,20},{52,20},{-14,20},{40,82},{6,
82}}, color={0,0,0})}));
annotation (Icon(graphics={Line(points={{8,84},{-58,2},{18,2},{-22,-60},{-36,
-52},{-26,-88},{10,-76},{-6,-68},{60,20},{48,20},{-18,20},{36,84},{
8,84}},
color={0,0,0})}));
end Electrical;
1 change: 1 addition & 0 deletions IBPSA/Electrical/package.order
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DataBase
PVSystem
BaseClasses
Examples
Validation

0 comments on commit 22c222d

Please sign in to comment.