Skip to content
3 changes: 2 additions & 1 deletion BESMod/Systems/BaseClasses/PartialBuildingEnergySystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ partial model PartialBuildingEnergySystem "Partial BES"
choicesAllMatching=true, Placement(transformation(extent={{-280,124},{
-224,178}})));
replaceable BESMod.Systems.Demand.DHW.BaseClasses.PartialDHW
DHW if systemParameters.use_hydraulic constrainedby
DHW(final use_openModelica=use_openModelica)
if systemParameters.use_hydraulic constrainedby
Demand.DHW.BaseClasses.PartialDHW(
redeclare final package Medium = MediumDHW,
final TDHW_nominal=systemParameters.TSetDHW,
Expand Down
19 changes: 10 additions & 9 deletions BESMod/Systems/Demand/Building/TEASERThermalZone.mo
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ model TEASERThermalZone
parameter Real ventRate[nZones]=fill(0, nZones) "Constant mechanical ventilation rate";

parameter Boolean use_verboseEnergyBalance=true "=false to disable the integration of the verbose energy balance";
final parameter Boolean use_verboseEnergyBalanceInternal = not use_openModelica and use_verboseEnergyBalance;
parameter Modelica.Units.SI.TemperatureDifference dTComfort=2
"Temperature difference to room set temperature at which the comfort is still acceptable. In DIN EN 15251, all temperatures below 22 °C - 2 K count as discomfort. Hence the default value. If your room set temperature is lower, consider using smaller values.";
parameter Boolean incElePro = false
Expand Down Expand Up @@ -55,14 +56,14 @@ model TEASERThermalZone

Modelica.Blocks.Sources.RealExpression QVent[nZones](y=
portVent_in.m_flow.*inStream(portVent_in.h_outflow) .+ portVent_out.m_flow
.*portVent_out.h_outflow) if use_ventilation and use_verboseEnergyBalance
.*portVent_out.h_outflow) if use_ventilation and use_verboseEnergyBalanceInternal
"Internal gains" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-216})));
Modelica.Blocks.Sources.RealExpression QAirExc[nZones](y=
thermalZone.airExc.Q_flow) if use_verboseEnergyBalance "Internal gains" annotation (
thermalZone.airExc.Q_flow) if use_verboseEnergyBalanceInternal "Internal gains" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand All @@ -73,7 +74,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_verboseEnergyBalanceInternal
annotation (Placement(transformation(extent={{-10,10},{10,-10}},
rotation=0,
origin={-90,-198})));
Expand Down Expand Up @@ -115,10 +116,10 @@ model TEASERThermalZone
Utilities.KPIs.ZoneEnergyBalance zoneEneBal[nZones](each final
with_ventilation=use_ventilation, each final with_floor=zoneParam[1].AFloor
> 0)
if use_verboseEnergyBalance "Zone energy balance"
if use_verboseEnergyBalanceInternal "Zone energy balance"
annotation (Placement(transformation(extent={{-60,-200},{-22,-140}})));
Modelica.Blocks.Sources.RealExpression QExtWall_flow[nZones](y=thermalZone.ROM.extWall.Q_flow)
if use_verboseEnergyBalance "External wall heat flow rate" annotation (
if use_verboseEnergyBalanceInternal "External wall heat flow rate" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand All @@ -132,28 +133,28 @@ model TEASERThermalZone
"Zone temperature KPIs for operative temperature"
annotation (Placement(transformation(extent={{0,-80},{20,-60}})));
Modelica.Blocks.Sources.RealExpression QRoof_flow[nZones](y=thermalZone.ROM.roof.Q_flow)
if use_verboseEnergyBalance "Roof heat flow rate" annotation (Placement(
if use_verboseEnergyBalanceInternal "Roof heat flow rate" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-120})));
Modelica.Blocks.Sources.RealExpression QFloor_flow[nZones](y=thermalZone.ROM.floor.Q_flow)
if use_verboseEnergyBalance and zoneParam[1].AFloor > 0
if use_verboseEnergyBalanceInternal and zoneParam[1].AFloor > 0
"Floor heat flow rate" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-134})));
Modelica.Blocks.Sources.RealExpression QWin_flow[nZones](y=thermalZone.ROM.window.Q_flow)
if use_verboseEnergyBalance "Window heat flow rate" annotation (
if use_verboseEnergyBalanceInternal "Window heat flow rate" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,-148})));
Modelica.Blocks.Sources.RealExpression QSol_flow[nZones](y={if ATot[i] > 0 then
sum({thermalZone[i].ROM.solRad[n]*thermalZone[i].ROM.ATransparent[n]*
thermalZone[i].ROM.gWin for n in 1:thermalZone[i].ROM.nOrientations})
else 0 for i in 1:nZones}) if use_verboseEnergyBalance
else 0 for i in 1:nZones}) if use_verboseEnergyBalanceInternal
"Solar radiative heat flow rate" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand Down
6 changes: 2 additions & 4 deletions BESMod/Systems/Demand/DHW/BaseClasses/PartialDHW.mo
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ partial model PartialDHW "Partial model for domestic hot water (DHW)"
annotation (Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem"));
parameter Modelica.Units.SI.HeatFlowRate QDHW_flow_nominal = mDHW_flow_nominal * cp * (TDHW_nominal - TDHWCold_nominal) "Nominal heat flow rate of DHW system" annotation (Dialog(group=
"Design - Bottom Up: Parameters are defined by the subsystem"));
parameter Modelica.Units.SI.Time tCrit(displayUnit="h") "Time for critical period. Based on EN 15450" annotation (Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem", enable=designType
<> BESMod.Systems.Hydraulical.Distribution.Types.DHWDesignType.NoStorage));
parameter Real QCrit "Energy demand in kWh during critical period. Based on EN 15450" annotation (Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem", enable=designType
== BESMod.Systems.Hydraulical.Distribution.Types.DHWDesignType.PartStorage));
parameter Modelica.Units.SI.Time tCrit(displayUnit="h") "Time for critical period. Based on EN 15450" annotation (Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem"));
parameter Real QCrit "Energy demand in kWh during critical period. Based on EN 15450" annotation (Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem"));

Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare final package Medium =
Medium) "Inlet for the demand of DHW" annotation (Placement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Modelica.Blocks.Math.UnitConversions.From_degC fromDegC
final m_flow_small=1E-4*abs(mDHW_flow_nominal),
final show_T=show_T,
final m_flow_nominal=mDHW_flow_nominal,
final dp_nominal(displayUnit="Pa") = if dpDHW_nominal <> 0 then
final dp_nominal(displayUnit="Pa") = if dpDHW_nominal > Modelica.Constants.eps then
dpDHW_nominal else 100,
final addPowerToMedium=false,
final use_riseTime=false) annotation (Placement(transformation(
Expand Down
3 changes: 1 addition & 2 deletions BESMod/Systems/Demand/DHW/StandardProfiles.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ model StandardProfiles "DHW profiles based on EU 812/2013"
mDHW_flow_nominal=DHWProfile.m_flow_nominal,
combiTimeTableDHWInput(tableOnFile=false, table=DHWProfile.table));
replaceable parameter Systems.Demand.DHW.RecordsCollection.ProfileM
DHWProfile constrainedby Systems.Demand.DHW.RecordsCollection.PartialDHWTap annotation (choicesAllMatching=true, Dialog(
enable=not use_dhwCalc and use_dhw));
DHWProfile constrainedby Systems.Demand.DHW.RecordsCollection.PartialDHWTap annotation (choicesAllMatching=true);


annotation (Documentation(info="<html><p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ partial model PartialTwoStorageParallel
rotation=180,
origin={76,80})));

BESMod.Utilities.KPIs.EnergyKPICalculator eneKPICalDHWHeaRod(use_inpCon=false, y=
QHRStoDHWPre_flow.Q_flow) if parStoDHW.use_hr annotation (Placement(
BESMod.Utilities.KPIs.EnergyKPICalculator eneKPICalDHWHeaRod(use_inpCon=false,
y=heaRodDHW.PEleHea) if parStoDHW.use_hr annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-50,-170})));
BESMod.Utilities.KPIs.EnergyKPICalculator eneKPICalBufHeaRod(use_inpCon=false, y=
QHRStoBufPre_flow.Q_flow) if parStoBuf.use_hr
heaRodBuf.PEleHea) if parStoBuf.use_hr
annotation (Placement(transformation(extent={{-100,-180},{-80,-160}})));

Modelica.Blocks.Math.MultiSum multiSum(nu=4) annotation (Placement(
Expand All @@ -251,8 +251,8 @@ partial model PartialTwoStorageParallel
BESMod.Systems.Hydraulical.Distribution.Components.ConditionalPrescibedHeater heaRodBuf(Q_flow_nominal=parStoBuf.QHR_flow_nominal,
useHeater=parStoBuf.use_hr) "Heating rod in buffer storage"
annotation (Placement(transformation(extent={{-90,10},{-70,30}})));
BESMod.Systems.Hydraulical.Distribution.Components.ConditionalPrescibedHeater heaRodparStoDHW(Q_flow_nominal=
parStoDHW.QHR_flow_nominal, useHeater=parStoDHW.use_hr)
BESMod.Systems.Hydraulical.Distribution.Components.ConditionalPrescibedHeater
heaRodDHW(Q_flow_nominal=parStoDHW.QHR_flow_nominal, useHeater=parStoDHW.use_hr)
"Heating rod in DHW storage"
annotation (Placement(transformation(extent={{-90,-60},{-70,-40}})));
BESMod.Systems.Hydraulical.Components.PreconfiguredControlledMovers.PreconfiguredDPControlled
Expand Down Expand Up @@ -397,19 +397,19 @@ equation
index=1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(heaRodparStoDHW.uHea, sigBusDistr.uHRStoDHW) annotation (Line(points={
{-91.8,-50},{-126,-50},{-126,102},{2,102},{2,101},{0,101}}, color={0,0,
127}), Text(
connect(heaRodDHW.uHea, sigBusDistr.uHRStoDHW) annotation (Line(points={{-91.8,
-50},{-126,-50},{-126,102},{2,102},{2,101},{0,101}}, color={0,0,127}),
Text(
string="%second",
index=1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(heaRodparStoDHW.port, stoDHW.heatingRod)
connect(heaRodDHW.port, stoDHW.heatingRod)
annotation (Line(points={{-70,-50},{-50,-50}}, color={191,0,0}));
connect(heaRodBuf.port, stoBuf.heatingRod)
annotation (Line(points={{-70,20},{-50,20}}, color={191,0,0}));
connect(heaRodparStoDHW.PEleHea, multiSum.u[1]) annotation (Line(points={{-69,-57},
{-66,-57},{-66,-113.363},{-58,-113.363}}, color={0,0,127}));
connect(heaRodDHW.PEleHea, multiSum.u[1]) annotation (Line(points={{-69,-57},
{-66,-57},{-66,-113.363},{-58,-113.363}}, color={0,0,127}));
connect(heaRodBuf.PEleHea, multiSum.u[2]) annotation (Line(points={{-69,13},{
-64,13},{-64,-108},{-58,-108},{-58,-111.787}},
color={0,0,127}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ partial model PartialTest
Modelica.Media.Interfaces.PartialMedium annotation (choicesAllMatching=true);

replaceable
.BESMod.Systems.Hydraulical.Distribution.BaseClasses.PartialDistribution distribution
BESMod.Systems.Hydraulical.Distribution.BaseClasses.PartialDistribution distribution
constrainedby
.BESMod.Systems.Hydraulical.Distribution.BaseClasses.PartialDistribution(
BESMod.Systems.Hydraulical.Distribution.BaseClasses.PartialDistribution(
redeclare package Medium = Medium,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
Q_flow_nominal=fill(sum(systemParameters.QBui_flow_nominal), distribution.nParallelDem),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ record DHWDesignParameters
parameter Modelica.Units.SI.Volume VDHWDayAt60 "Daily volume of DHW tapping" annotation (Dialog(group="DHW"));
parameter Modelica.Units.SI.HeatFlowRate QDHW_flow_nominal "Nominal heat flow rate of DHW system" annotation (Dialog(group=
"DHW"));
parameter Modelica.Units.SI.Time tCrit(displayUnit="h") "Time for critical period. Based on EN 15450" annotation (Dialog(group="Design - Top Down: Parameters are given by the parent system", enable=designType
<> BESMod.Systems.Hydraulical.Distribution.Types.DHWDesignType.NoStorage));
parameter Real QCrit "Energy demand in kWh during critical period. Based on EN 15450" annotation (Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem", enable=designType
== BESMod.Systems.Hydraulical.Distribution.Types.DHWDesignType.PartStorage));
parameter Modelica.Units.SI.Time tCrit(displayUnit="h") "Time for critical period. Based on EN 15450" annotation (Dialog(group="Design - Top Down: Parameters are given by the parent system"));
parameter Real QCrit "Energy demand in kWh during critical period. Based on EN 15450" annotation (Dialog(group="Design - Bottom Up: Parameters are defined by the subsystem"));


end DHWDesignParameters;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within BESMod.Systems.Hydraulical.Transfer.Functions;
within BESMod.Systems.Hydraulical.Transfer.Functions;
function GetAverageVolumeOfWater
"Calculate the average water volume for the whole heating unit based on the type of the unit and the installed heating load"
input Modelica.Units.SI.HeatFlowRate Q_flow_nominal "Nominal heat flow rate";
Expand Down
6 changes: 3 additions & 3 deletions BESMod/Systems/Hydraulical/Transfer/IdealValveRadiator.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ model IdealValveRadiator
TTra_design={if use_oldRad_design[i] then TTraOld_design[i] else TTra_nominal[i] for i in 1:nParallelDem},
res(each final disableComputeFlowResistance=false));

parameter Boolean use_oldRad_design[nParallelDem]={not QOld_flow_design[i]==Q_flow_nominal[i] for i in 1:nParallelDem}
parameter Boolean use_oldRad_design[nParallelDem]={abs(QOld_flow_design[i]-Q_flow_nominal[i])>1 for i in 1:nParallelDem}
"If true, radiator design of old building state is used"
annotation (Dialog(group="Design - Internal: Parameters are defined by the subsystem"));
replaceable parameter
Expand Down Expand Up @@ -89,7 +89,7 @@ model IdealValveRadiator
each displayUnit="degC") = Medium.temperature(Medium.setState_phX(
portTra_in.p,
inStream(portTra_in.h_outflow),
inStream(portTra_in.Xi_outflow)))) "Real expression for supply temperature"
inStream(portTra_in.Xi_outflow)))) if not use_openModelica "Real expression for supply temperature"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand All @@ -99,7 +99,7 @@ model IdealValveRadiator
each displayUnit="degC") = Medium.temperature(Medium.setState_phX(
portTra_out.p,
actualStream(portTra_out.h_outflow),
inStream(portTra_out.Xi_outflow)))) "Real expression for return temperature"
inStream(portTra_out.Xi_outflow)))) if not use_openModelica "Real expression for return temperature"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand Down
17 changes: 10 additions & 7 deletions BESMod/Systems/Hydraulical/Transfer/RadiatorPressureBased.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ model RadiatorPressureBased "Pressure Based transfer system"
Q_flow_design={if use_oldRad_design[i] then QOld_flow_design[i] else Q_flow_nominal[i] for i in 1:nParallelDem},
TTra_design={if use_oldRad_design[i] then TTraOld_design[i] else TTra_nominal[i] for i in 1:nParallelDem});
final parameter Modelica.Units.SI.PressureDifference dpFixedTotal_nominal[nParallelDem] = dpPipSca_design.*(1 + parRad.perPreLosRad);
parameter Boolean use_oldRad_design[nParallelDem]={not QOld_flow_design[i]==Q_flow_nominal[i] for i in 1:nParallelDem}
parameter Boolean use_oldRad_design[nParallelDem]={abs(QOld_flow_design[i]-Q_flow_nominal[i])>1 for i in 1:nParallelDem}
"If true, radiator design of the building with no retrofit (old state) is used"
annotation (Dialog(group="Design - Internal: Parameters are defined by the subsystem"));

Expand Down Expand Up @@ -106,14 +106,14 @@ model RadiatorPressureBased "Pressure Based transfer system"
Distribution.Components.Valves.PressureReliefValve pressureReliefValve(
redeclare final package Medium = Medium,
m_flow_nominal=mSup_flow_design[1],
final dpFullOpen_nominal=dpSup_design[1],
final dpFullOpen_nominal=dpFullOpen_nominal,
final dpThreshold_nominal=perPreRelValOpens*dpSup_design[1],
final facDpValve_nominal=valveAutho[1],
final l=leakageOpening) if use_preRelVal annotation (Placement(
transformation(
extent={{10,-10},{-10,10}},
rotation=90,
origin={-90,-10})));
origin={-90,-8})));
Modelica.Blocks.Routing.RealPassThrough reaPasThrOpe[nParallelDem] annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
Expand All @@ -138,7 +138,7 @@ model RadiatorPressureBased "Pressure Based transfer system"
each displayUnit="degC") = Medium.temperature(Medium.setState_phX(
portTra_out.p,
actualStream(portTra_out.h_outflow),
inStream(portTra_out.Xi_outflow)))) "Real expression for return temperature"
inStream(portTra_out.Xi_outflow)))) if not use_openModelica "Real expression for return temperature"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand All @@ -148,11 +148,14 @@ model RadiatorPressureBased "Pressure Based transfer system"
each displayUnit="degC") = Medium.temperature(Medium.setState_phX(
portTra_in.p,
inStream(portTra_in.h_outflow),
inStream(portTra_in.Xi_outflow)))) "Real expression for supply temperature"
inStream(portTra_in.Xi_outflow)))) if not use_openModelica "Real expression for supply temperature"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-30,-54})));
parameter Modelica.Units.SI.PressureDifference dpFullOpen_nominal=
dpSup_design[1] "Pressure difference at which valve is fully open"
annotation (Dialog(tab="Pressure losses", group="Relief Valve"));
equation
connect(rad.heatPortRad, heatPortRad) annotation (Line(points={{-2.8,-32},{40,
-32},{40,-40},{100,-40}}, color={191,0,0}));
Expand Down Expand Up @@ -183,7 +186,7 @@ equation
points={{60,-70},{72,-70},{72,-98}},
color={0,0,0},
thickness=1));
connect(pressureReliefValve.port_b, portTra_out[1]) annotation (Line(points={{-90,-20},
connect(pressureReliefValve.port_b, portTra_out[1]) annotation (Line(points={{-90,-18},
{-90,-42},{-100,-42}}, color={0,127,255}));
connect(reaPasThrOpe.u, traControlBus.opening) annotation (Line(points={{30,
82},{30,94},{0,94},{0,100}}, color={0,0,127}), Text(
Expand All @@ -200,7 +203,7 @@ equation
connect(volRet.ports[1], portTra_out[1]) annotation (Line(points={{-62,-32},{-62,
-42},{-100,-42}}, color={0,127,255}));
connect(pressureReliefValve.port_a, portTra_in[1])
annotation (Line(points={{-90,0},{-90,38},{-100,38}}, color={0,127,255}));
annotation (Line(points={{-90,2},{-90,38},{-100,38}}, color={0,127,255}));
connect(volSup.ports[1], resMaiLin[1].port_b) annotation (Line(points={{-50,30},
{-54,30},{-54,40},{-60,40}},
color={0,127,255}));
Expand Down
4 changes: 2 additions & 2 deletions BESMod/Systems/Hydraulical/Transfer/UFHTransferSystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ model UFHTransferSystem
each displayUnit="degC") = Medium.temperature(Medium.setState_phX(
portTra_out.p,
actualStream(portTra_out.h_outflow),
inStream(portTra_out.Xi_outflow)))) "Real expression for return temperature"
inStream(portTra_out.Xi_outflow)))) if not use_openModelica "Real expression for return temperature"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand All @@ -108,7 +108,7 @@ model UFHTransferSystem
each displayUnit="degC") = Medium.temperature(Medium.setState_phX(
portTra_in.p,
inStream(portTra_in.h_outflow),
inStream(portTra_in.Xi_outflow)))) "Real expression for supply temperature"
inStream(portTra_in.Xi_outflow)))) if not use_openModelica "Real expression for supply temperature"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
Expand Down
Loading