Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong calculation of nominal mass flow rate in PartialSolarCollector #1960

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
26 changes: 15 additions & 11 deletions IBPSA/Fluid/SolarCollectors/BaseClasses/PartialSolarCollector.mo
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ partial model PartialSolarCollector "Partial model for solar collectors"
IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Series
"Selection of system configuration"
annotation(Dialog(group="Configuration declarations"));
parameter Integer nPanelsSer=0 "Number of array panels in series"
annotation(Dialog(group="Configuration declarations", enable= (sysConfig == IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Array)));
parameter Integer nPanelsPar=0 "Number of array panels in parallel"
annotation(Dialog(group="Configuration declarations", enable= (sysConfig == IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Array)));

Expand Down Expand Up @@ -158,14 +156,14 @@ protected
totalArea/per.A "Number of panels used in the simulation";
parameter Real nPanelsSer_internal=
if sysConfig == IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Series then
nPanels
nPanels_internal
else if sysConfig == IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Parallel then
1
else
nPanelsSer "Number of panels in series";
nPanels_internal/nPanelsPar_internal "Number of panels in series";
parameter Real nPanelsPar_internal=
if sysConfig == IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Parallel then
nPanels
nPanels_internal
else if sysConfig == IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Series then
1
else
Expand All @@ -186,12 +184,10 @@ initial equation
": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.",
level = AssertionLevel.warning);

if sysConfig==IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Array then
assert(abs(nPanelsPar_internal*nPanelsSer_internal-nPanels_internal) < 1E-6,
"In " + getInstanceName() +
": The product of the number of panels in series and parallel is not equal to the total number of panels in the array.",
level = AssertionLevel.error);
end if;
assert(mod(ATot_internal,per.A)/per.A <= 0.01,
"In " + getInstanceName() +
": The total collector area is not an exact multitude of a single collector's area.",
level = AssertionLevel.warning);

equation
connect(shaCoe_internal,shaCoe_in);
Expand Down Expand Up @@ -258,6 +254,14 @@ EnergyPlus 23.2.0 Engineering Reference</a>
</html>", revisions="<html>
<ul>
<li>
February 4, 2025, by Jelger Jansen:<br/>
Use <code>nPanels_internal</code> when calculating <code>nPanelsPar_internal</code> and <code>nPanelsSer_internal</code>.
Only request <code>nPanelsPar</code> as an input for an array of collectors and
add assert to check if the total collector area is an exact multitude of a single collector's area.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1956\">IBPSA, #1956</a>.
</li>
<li>
February 27, 2024, by Jelger Jansen:<br/>
Refactor model.<br/>
This is for
Expand Down
7 changes: 6 additions & 1 deletion IBPSA/Fluid/SolarCollectors/Examples/FlatPlate.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ model FlatPlate "Test model for FlatPlate"
rho=0.2,
nColType=IBPSA.Fluid.SolarCollectors.Types.NumberSelection.Number,
sysConfig=IBPSA.Fluid.SolarCollectors.Types.SystemConfiguration.Array,
nPanelsSer=5,
nPanelsPar=5,
per=IBPSA.Fluid.SolarCollectors.Data.GlazedFlatPlate.FP_GuangdongFSPTY95(),
nPanels=25,
Expand Down Expand Up @@ -86,6 +85,12 @@ for a variable fluid flow rate and weather data from San Francisco, CA, USA.
revisions="<html>
<ul>
<li>
February 4, 2025, by Jelger Jansen:<br/>
Remove <code>nPanelsSer</code> as a model parameter.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1956\">IBPSA, #1956</a>.
</li>
<li>
February 15, 2024, by Jelger Jansen:<br/>
Refactor model.<br/>
This is for
Expand Down