Skip to content

Commit

Permalink
Merge pull request #1076 from lbl-srg/issue1073_nPanels
Browse files Browse the repository at this point in the history
Issue1073 n panels
  • Loading branch information
mwetter authored Nov 22, 2017
2 parents 3e988ae + cec8ef4 commit 18464c7
Show file tree
Hide file tree
Showing 20 changed files with 373 additions and 50 deletions.
8 changes: 7 additions & 1 deletion Buildings/Fluid/SolarCollectors/ASHRAE93.mo
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ model ASHRAE93 "Model of a flat plate solar thermal collector"
final G_nominal=per.G_nominal,
dT_nominal=per.dT_nominal,
final A_c=TotalArea_internal,
m_flow_nominal=per.mperA_flow_nominal*per.A,
m_flow_nominal=per.mperA_flow_nominal*per.A*nPanels_internal,
final cp_default=cp_default)
"Calculates the heat lost to the surroundings using the ASHRAE93 standard calculations"
annotation (Placement(transformation(extent={{-20,6},{0,26}})));
Expand Down Expand Up @@ -176,6 +176,12 @@ equation
</html>", revisions="<html>
<ul>
<li>
November 21, 2017, by Michael Wetter:<br/>
Corrected error in heat loss calculations that did not scale correctly with <code>nPanels</code>.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/1073\">issue 1073</a>.
</li>
<li>
October 18, 2013, by Michael Wetter:<br/>
Removed duplicate connection.
</li>
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Fluid/SolarCollectors/BaseClasses/ASHRAEHeatLoss.mo
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ protected
"Coefficient describing heat loss to ambient conditions";
initial equation
//Identifies useful heat gain at nominal conditions
QUse_nominal = G_nominal * A_c * y_intercept + slope * A_c * (dT_nominal);
QUse_nominal = G_nominal * A_c * y_intercept + slope * A_c * dT_nominal;
//Identifies TFlu[nSeg] at nominal conditions
m_flow_nominal * cp_default * (dT_nominal_fluid[nSeg]) = QUse_nominal;
//Identifies heat lost to environment at nominal conditions
QLos_nominal = -slope * A_c * (dT_nominal);
QLos_nominal = -slope * A_c * dT_nominal;
//Governing equation for the first segment (i=1)
G_nominal * y_intercept * A_c/nSeg - UA/nSeg * (dT_nominal) = m_flow_nominal * cp_default
G_nominal * y_intercept * A_c/nSeg - UA/nSeg * dT_nominal = m_flow_nominal * cp_default
* (dT_nominal_fluid[1]);
//Loop with the governing equations for segments 2:nSeg-1
for i in 2:nSeg-1 loop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ block EN12975HeatLoss
protected
final parameter Modelica.SIunits.ThermalConductance UA(
fixed = false,
start=QLos_nominal/(dT_nominal))
start=QLos_nominal/dT_nominal)
"Coefficient describing heat loss to ambient conditions";
initial equation
//Identifies useful heat gain at nominal conditions
QUse_nominal = G_nominal * A_c * y_intercept -C1 * A_c *
(dT_nominal) - C2 * A_c * (dT_nominal)^2;
dT_nominal - C2 * A_c * dT_nominal^2;
//Identifies TFlu[nSeg] at nominal conditions
m_flow_nominal * cp_default * (dT_nominal_fluid[nSeg]) = QUse_nominal;
//Identifies heat lost to environment at nominal conditions
QLos_nominal = -C1 * A_c * (dT_nominal)-C2 * A_c * (dT_nominal)^2;
QLos_nominal = -C1 * A_c * dT_nominal-C2 * A_c * dT_nominal^2;
//Governing equation for the first segment (i=1)
G_nominal * y_intercept * A_c/nSeg - UA/nSeg * (dT_nominal)
G_nominal * y_intercept * A_c/nSeg - UA/nSeg * dT_nominal
= m_flow_nominal * cp_default * (dT_nominal_fluid[1]);
//Loop with the governing equations for segments 2:nSeg-1
for i in 2:nSeg-1 loop
Expand Down
10 changes: 8 additions & 2 deletions Buildings/Fluid/SolarCollectors/EN12975.mo
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extends Buildings.Fluid.SolarCollectors.BaseClasses.PartialSolarCollector(final
redeclare package Medium = Medium,
final G_nominal=per.G_nominal,
final dT_nominal=per.dT_nominal,
final m_flow_nominal=per.mperA_flow_nominal*per.A,
final m_flow_nominal=per.mperA_flow_nominal*per.A*nPanels_internal,
final cp_default=cp_default)
"Calculates the heat lost to the surroundings using the EN12975 standard calculations"
annotation (Placement(transformation(extent={{-20,6},{0,26}})));
Expand Down Expand Up @@ -102,7 +102,13 @@ equation
<a href=\"http://www.energyplus.gov\">EnergyPlus 7.0.0 Engineering Reference</a>, October 13, 2011.<br/>
</p>
</html>", revisions="<html>
<ul>
<ul>
<li>
November 21, 2017, by Michael Wetter:<br/>
Corrected error in heat loss calculations that did not scale correctly with <code>nPanels</code>.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/1073\">issue 1073</a>.
</li>
<li>
January 4, 2013, by Peter Grant:<br/>
First implementation.
Expand Down
138 changes: 138 additions & 0 deletions Buildings/Fluid/SolarCollectors/Validation/EN12975NPanels.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
within Buildings.Fluid.SolarCollectors.Validation;
model EN12975NPanels
"Validation model for collector according to EN12975 with different settings for nPanel"
extends Modelica.Icons.Example;
replaceable package Medium = Buildings.Media.Water "Medium in the system";

parameter Integer nPanels=10 "Number of panels";

Buildings.Fluid.SolarCollectors.EN12975 solCol(
redeclare package Medium = Medium,
per=datSolCol,
shaCoe=0,
azi=0,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
rho=0.2,
nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number,
nPanels=1,
nSeg=30,
lat=0.6457718232379,
til=0.78539816339745)
"Flat plate solar collector model, has been modified for validation purposes"
annotation (Placement(transformation(extent={{20,20},{40,40}})));

Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
"modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos")
"Weather data file reader"
annotation (Placement(transformation(extent={{-40,60},{-20,80}})));
Buildings.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
use_p_in=false,
p(displayUnit="Pa") = 101325,
nPorts=1) "Outlet for water flow"
annotation (Placement(transformation(extent={{80,20},{60,40}})));
Buildings.Fluid.Sources.MassFlowSource_T bou(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
use_T_in=false,
T=303.15) "Inlet for water flow, at a prescribed flow rate and temperature"
annotation (Placement(transformation(extent={{-12,20},{8,40}})));

Buildings.Fluid.SolarCollectors.EN12975 solCol1(
redeclare package Medium = Medium,
per=datSolCol,
shaCoe=0,
azi=0,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
rho=0.2,
nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number,
nSeg=30,
lat=0.6457718232379,
til=0.78539816339745,
nPanels=nPanels)
"Flat plate solar collector model, has been modified for validation purposes"
annotation (Placement(transformation(extent={{20,-40},{40,-20}})));
Buildings.Fluid.Sources.Boundary_pT sou1(
redeclare package Medium = Medium,
use_p_in=false,
p(displayUnit="Pa") = 101325,
nPorts=1) "Outlet for water flow"
annotation (Placement(transformation(extent={{80,-40},{60,-20}})));
Buildings.Fluid.Sources.MassFlowSource_T bou1(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
use_T_in=false,
T=303.15) "Inlet for water flow, at a prescribed flow rate and temperature"
annotation (Placement(transformation(extent={{-12,-40},{8,-20}})));
Modelica.Blocks.Math.Gain gaiNPan(k=nPanels) "Gain for number of panels"
annotation (Placement(transformation(extent={{-52,-32},{-32,-12}})));
Modelica.Blocks.Sources.RealExpression difHeaGai(y=solCol.heaGai[30].Q_flow
- solCol1.heaGai[30].Q_flow/nPanels)
"Difference in heat gain at last panel between model with 1 and with 30 panels"
annotation (Placement(transformation(extent={{-68,-72},{-48,-52}})));
Modelica.Blocks.Sources.RealExpression difHeaLos(y=solCol.QLos[30].Q_flow -
solCol1.QLos[30].Q_flow/nPanels)
"Difference in heat loss at last panel between model with 1 and with 30 panels"
annotation (Placement(transformation(extent={{-68,-92},{-48,-72}})));
Modelica.Blocks.Sources.Constant m_flow_nominal(k=datSolCol.A*datSolCol.mperA_flow_nominal)
"Nominal flow rate for one panel"
annotation (Placement(transformation(extent={{-88,30},{-68,50}})));
parameter Data.Concentrating.C_VerificationModel datSolCol
annotation (Placement(transformation(extent={{60,60},{80,80}})));
equation
connect(weaDat.weaBus, solCol1.weaBus) annotation (Line(
points={{-20,70},{14,70},{14,-20},{20,-20},{20,-20.4}},
color={255,204,51},
thickness=0.5,
smooth=Smooth.None));
connect(bou1.ports[1], solCol1.port_a) annotation (Line(
points={{8,-30},{20,-30}},
color={0,127,255},
smooth=Smooth.None));
connect(sou1.ports[1], solCol1.port_b) annotation (Line(
points={{60,-30},{40,-30}},
color={0,127,255},
smooth=Smooth.None));
connect(gaiNPan.y, bou1.m_flow_in)
annotation (Line(points={{-31,-22},{-12,-22}}, color={0,0,127}));
connect(solCol.port_a, bou.ports[1])
annotation (Line(points={{20,30},{8,30}}, color={0,127,255}));
connect(solCol.port_b, sou.ports[1])
annotation (Line(points={{40,30},{60,30}}, color={0,127,255}));
connect(solCol.weaBus, weaDat.weaBus) annotation (Line(
points={{20,39.6},{18,39.6},{18,40},{14,40},{14,70},{-20,70}},
color={255,204,51},
thickness=0.5));
connect(m_flow_nominal.y, bou.m_flow_in) annotation (Line(points={{-67,40},{-22,
40},{-22,38},{-12,38}}, color={0,0,127}));
connect(gaiNPan.u, m_flow_nominal.y) annotation (Line(points={{-54,-22},{-60,
-22},{-60,40},{-67,40}}, color={0,0,127}));
annotation (
Documentation(info="<html>
<p>
This model validates the solar collector model
<a href=\"modelica://Buildings.Fluid.SolarCollectors.EN12975\">
Buildings.Fluid.SolarCollectors.EN12975</a>
for the case
where the number of panels is <i>1</i> for the instance <code>solCol</code>
and <i>10</i> for the instance <code>solCol1</code>.
The instances <code>difHeaGai</code> and <code>difHeaLos</code>
compare the heat gain and heat loss between the two models.
The output of these blocks should be zero, except for rounding errors.
</p>
</html>", revisions="<html>
<ul>
<li>
November 21, 2017, by Michael Wetter:<br/>
First implementation to validate
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/1073\">#1073</a>.
</li>
</ul>
</html>"),
__Dymola_Commands(file=
"modelica://Buildings/Resources/Scripts/Dymola/Fluid/SolarCollectors/Validation/EN12975NPanels.mos"
"Simulate and plot"),
experiment(Tolerance=1e-6, StopTime=86400));
end EN12975NPanels;
28 changes: 14 additions & 14 deletions Buildings/Fluid/SolarCollectors/Validation/FlatPlate.mo
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ model FlatPlate "Validation model for FlatPlate"
lat=0.6457718232379,
til=0.78539816339745)
"Flat plate solar collector model, has been modified for validation purposes"
annotation (Placement(transformation(extent={{20,-20},{40,0}})));
annotation (Placement(transformation(extent={{20,20},{40,40}})));

Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
"modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos")
"Weather data file reader"
annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
annotation (Placement(transformation(extent={{-40,60},{-20,80}})));
Buildings.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
use_p_in=false,
p(displayUnit="Pa") = 101325,
nPorts=1) "Outlet for water flow"
annotation (Placement(transformation(extent={{80,-20},{60,0}})));
annotation (Placement(transformation(extent={{80,20},{60,40}})));
Buildings.Fluid.Sources.MassFlowSource_T bou(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
use_T_in=true)
"Inlet for water flow, at a prescribed flow rate and temperature"
annotation (Placement(transformation(extent={{-12,-20},{8,0}})));
annotation (Placement(transformation(extent={{-12,20},{8,40}})));
Modelica.Blocks.Sources.CombiTimeTable datRea(
tableOnFile=true,
tableName="TRNSYS",
Expand All @@ -43,43 +43,43 @@ model FlatPlate "Validation model for FlatPlate"
"modelica://Buildings/Fluid/SolarCollectors/Examples/ValidationData/TRNSYSAnnualData.txt"),
smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments)
"Data reader with inlet conditions from TRNSYS"
annotation (Placement(transformation(extent={{-90,-12},{-70,8}})));
annotation (Placement(transformation(extent={{-90,28},{-70,48}})));

Modelica.Blocks.Math.Add add
"Converts TRNSYS data from degree Celsius to Kelving"
annotation (Placement(transformation(extent={{-50,-40},{-30,-20}})));
annotation (Placement(transformation(extent={{-50,0},{-30,20}})));
Modelica.Blocks.Sources.Constant const(k=273.15)
"Used to convert TRNSYS data from degree Celsius to Kelving"
annotation (Placement(transformation(extent={{-90,-46},{-70,-26}})));
annotation (Placement(transformation(extent={{-90,-6},{-70,14}})));

equation
connect(weaDat.weaBus, solCol.weaBus) annotation (Line(
points={{-20,30},{20,30},{20,-0.4}},
points={{-20,70},{20,70},{20,39.6}},
color={255,204,51},
thickness=0.5,
smooth=Smooth.None));
connect(bou.ports[1], solCol.port_a) annotation (Line(
points={{8,-10},{20,-10}},
points={{8,30},{20,30}},
color={0,127,255},
smooth=Smooth.None));
connect(const.y, add.u2) annotation (Line(
points={{-69,-36},{-52,-36}},
points={{-69,4},{-52,4}},
color={0,0,127},
smooth=Smooth.None));
connect(add.y, bou.T_in) annotation (Line(
points={{-29,-30},{-24,-30},{-24,-6},{-14,-6}},
points={{-29,10},{-24,10},{-24,34},{-14,34}},
color={0,0,127},
smooth=Smooth.None));
connect(datRea.y[1], add.u1) annotation (Line(
points={{-69,-2},{-60,-2},{-60,-24},{-52,-24}},
points={{-69,38},{-60,38},{-60,16},{-52,16}},
color={0,0,127},
smooth=Smooth.None));
connect(datRea.y[4], bou.m_flow_in) annotation (Line(
points={{-69,-2},{-12,-2}},
points={{-69,38},{-12,38}},
color={0,0,127},
smooth=Smooth.None));
connect(sou.ports[1], solCol.port_b) annotation (Line(
points={{60,-10},{40,-10}},
points={{60,30},{40,30}},
color={0,127,255},
smooth=Smooth.None));
annotation (
Expand Down
Loading

0 comments on commit 18464c7

Please sign in to comment.