Skip to content

Commit

Permalink
fix wrong solar gain in eneBal (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
HvanderStok authored Jan 17, 2025
1 parent f691ced commit e3e195d
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions BESMod/Systems/Demand/Building/TEASERThermalZone.mo
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ model TEASERThermalZone
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensorConv[
nZones]
annotation (Placement(transformation(extent={{-80,40},{-60,60}})));
Modelica.Blocks.Math.Add addTra
[nZones] if use_verboseEnergyBalance
Modelica.Blocks.Math.Add addTra[nZones] if use_verboseEnergyBalance
annotation (Placement(transformation(extent={{-10,10},{10,-10}},
rotation=0,
origin={-90,-198})));
Expand Down Expand Up @@ -149,13 +148,31 @@ model TEASERThermalZone
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-148})));
Modelica.Blocks.Sources.RealExpression QSol_flow[nZones](y={sum(thermalZone[i].simpleExternalShading.corrIrr)
for i in 1:nZones})
if use_verboseEnergyBalance "Solar heat flow rate" annotation (
Placement(transformation(
Modelica.Blocks.Sources.RealExpression QSolRad_flow[nZones](
y={if ATot[i] > 0 and sum(thermalZone[i].ROM.ATransparent) > 0 then
sum({thermalZone[i].ROM.radHeatSol[n].Q_flow
for n in 1:thermalZone[i].ROM.nOrientations})
else 0 for i in 1:nZones}) if use_verboseEnergyBalance
"Solar radiative heat flow rate" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-170})));
Modelica.Blocks.Sources.RealExpression QSolConv_flow[nZones](
y={if thermalZone[i].ROM.ratioWinConRad > 0 and
(ATot[i] > 0 or thermalZone[i].ROM.VAir > 0) and
sum(thermalZone[i].ROM.ATransparent) > 0 then
sum({thermalZone[i].ROM.convHeatSol.Q_flow})
else 0 for i in 1:nZones}) if use_verboseEnergyBalance
"Solar convective heat flow rate" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-174})));
origin={-90,-184})));
Modelica.Blocks.Math.Add addSol[nZones] if use_verboseEnergyBalance
annotation (Placement(transformation(
extent={{-4,4},{4,-4}},
rotation=0,
origin={-74,-178})));

Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preAbsHeaGaiRad(
final T_ref=293.15, final alpha=0) if use_absIntGai
"Add absolute radiative heat gain" annotation (Placement(transformation(
Expand All @@ -168,7 +185,8 @@ model TEASERThermalZone
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-30})));

protected
parameter Modelica.Units.SI.Area ATot[nZones]={sum(zoneParam[i].AExt)+sum(zoneParam[i].AWin) for i in 1:nZones} "Sum of wall surface areas";
initial equation
assert(if use_absIntGai then nZones == 1 else true, "use_absIntGai is only supported for single zones");
equation
Expand Down Expand Up @@ -375,8 +393,6 @@ equation
{-76,-134},{-76,-152},{-63.8,-152}}, color={0,0,127}));
connect(zoneEneBal.QWin_flow, QWin_flow.y) annotation (Line(points={{-63.8,-158},
{-74,-158},{-74,-148},{-79,-148}}, color={0,0,127}));
connect(QSol_flow.y, zoneEneBal.QSol_flow) annotation (Line(points={{-79,-174},
{-72,-174},{-72,-170},{-63.8,-170}}, color={0,0,127}));
connect(thermalZone.QIntGains_flow[1], zoneEneBal.QLig_flow) annotation (Line(
points={{-42.7,32.4},{-120,32.4},{-120,-176},{-63.8,-176}}, color={0,0,127}));
connect(thermalZone.QIntGains_flow[3], zoneEneBal.QPer_flow) annotation (Line(
Expand Down Expand Up @@ -404,6 +420,12 @@ equation
connect(preAbsHeaGaiRad.port, thermalZone[1].intGainsRad) annotation (Line(points={{-80,-10},
{-52,-10},{-52,60.24},{-39.74,60.24}},
color={191,0,0}));
connect(addSol.y, zoneEneBal.QSol_flow) annotation (Line(points={{-69.6,-178},
{-66,-178},{-66,-170},{-63.8,-170}}, color={0,0,127}));
connect(QSolConv_flow.y, addSol.u1) annotation (Line(points={{-79,-184},{-79,
-182.2},{-78.8,-182.2},{-78.8,-180.4}}, color={0,0,127}));
connect(QSolRad_flow.y, addSol.u2) annotation (Line(points={{-79,-170},{-79,
-172.8},{-78.8,-172.8},{-78.8,-175.6}}, color={0,0,127}));
annotation (Diagram(coordinateSystem(extent={{-100,-220},{100,100}})),
Documentation(info="<html>
<p>This model uses the reduced-order approach with the common TEASER output to model the building envelope. Relevant KPIs are calculated.</p>
Expand Down

0 comments on commit e3e195d

Please sign in to comment.