This package contains models for the heat transfer in rooms
and through the building envelope.
Room model that assumes the air to be completely mixed.
model MixedAir
"Model of a room in which the air is completely mixed"
extends Buildings.Fluid.Interfaces.LumpedVolumeDeclarations;
extends Buildings.Rooms.BaseClasses.ConstructionRecords;
parameter Integer nPorts=0
"Number of ports";
parameter Modelica.SIunits.Angle lat
"Latitude";
final parameter Modelica.SIunits.Volume V=AFlo*hRoo
"Volume";
parameter Modelica.SIunits.Area AFlo
"Floor area";
parameter Modelica.SIunits.Length hRoo
"Average room height";
////////////////////////////////////////////////////////////////////////
// Fluid and heat ports
Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts](
redeclare each package Medium = Medium)
"Fluid inlets and outlets";
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorAir
"Heat port to air volume";
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorRad
"Heat port for radiative heat gain and radiative temperature";
////////////////////////////////////////////////////////////////////////
// Constructions
Constructions.Construction conExt[NConExt](
A=datConExt.A,
til=datConExt.til,
final layers={datConExt[i].layers
for i
in 1:NConExt},
steadyStateInitial=datConExt.steadyStateInitial,
T_a_start=datConExt.T_a_start,
T_b_start=datConExt.T_b_start)
if haveConExt
"Heat conduction through exterior construction that have no window";
Constructions.ConstructionWithWindow conExtWin[NConExtWin](
A=datConExtWin.A,
til=datConExtWin.til,
final layers={datConExtWin[i].layers
for i
in 1:NConExtWin},
steadyStateInitial=datConExtWin.steadyStateInitial,
T_a_start=datConExtWin.T_a_start,
T_b_start=datConExtWin.T_b_start,
AWin=datConExtWin.AWin,
fFra=datConExtWin.fFra,
glaSys=datConExtWin.glaSys)
if haveConExtWin
"Heat conduction through exterior construction that have a window";
Constructions.Construction conPar[NConPar](
A=datConPar.A,
til=datConPar.til,
final layers={datConPar[i].layers
for i
in 1:NConPar},
steadyStateInitial=datConPar.steadyStateInitial,
T_a_start=datConPar.T_a_start,
T_b_start=datConPar.T_b_start)
if haveConPar
"Heat conduction through partitions that have both sides inside the thermal zone";
Constructions.Construction conBou[NConBou](
A=datConBou.A,
til=datConBou.til,
final layers={datConBou[i].layers
for i
in 1:NConBou},
steadyStateInitial=datConBou.steadyStateInitial,
T_a_start=datConBou.T_a_start,
T_b_start=datConBou.T_b_start)
if haveConBou
"Heat conduction through opaque constructions that have the boundary conditions of the other side exposed";
parameter Boolean linearizeRadiation=true
"Set to true to linearize emissive power";
////////////////////////////////////////////////////////////////////////
// Convection
parameter Buildings.HeatTransfer.Types.InteriorConvection intConMod=Buildings.HeatTransfer.Types.InteriorConvection.Temperature
"Convective heat transfer model for room-facing surfaces of opaque constructions";
parameter Modelica.SIunits.CoefficientOfHeatTransfer hIntFixed=3.0
"Constant convection coefficient for room-facing surfaces of opaque constructions";
parameter Buildings.HeatTransfer.Types.ExteriorConvection extConMod=Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind
"Convective heat transfer model for exterior facing surfaces of opaque constructions";
parameter Modelica.SIunits.CoefficientOfHeatTransfer hExtFixed=10.0
"Constant convection coefficient for exterior facing surfaces of opaque constructions";
parameter Modelica.SIunits.MassFlowRate m_flow_nominal(min=0) = V*1.2/3600
"Nominal mass flow rate";
parameter Boolean homotopyInitialization
"= true, use homotopy method";
////////////////////////////////////////////////////////////////////////
// Models for boundary conditions
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a surf_conBou[nConBou]
if
haveConBou
"Heat port at surface b of construction conBou";
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a surf_surBou[nSurBou]
if
haveSurBou
"Heat port of surface that is connected to the room air";
Modelica.Blocks.Interfaces.RealInput uSha[nConExtWin](
each min=0,
each max=1)
if
haveShade
"Control signal for the shading device (removed if no shade is present)";
Modelica.Blocks.Interfaces.RealInput qGai_flow[3](unit="W/m2")
"Radiant, convective and latent heat input into room (positive if heat gain)";
// Reassign the tilt since a construction that is declared as a ceiling of the
// room model has an exterior-facing surface that is a floor
BaseClasses.ExteriorBoundaryConditions bouConExt(
final nCon=nConExt,
final lat=lat,
linearizeRadiation=linearizeRadiation,
final conMod=extConMod,
final conPar=datConExt,
final hFixed=hExtFixed)
if haveConExt
"Exterior boundary conditions for constructions without a window";
// Reassign the tilt since a construction that is declared as a ceiling of the
// room model has an exterior-facing surface that is a floor
BaseClasses.ExteriorBoundaryConditionsWithWindow bouConExtWin(
final nCon=nConExtWin,
final lat=lat,
final conPar=datConExtWin,
linearizeRadiation=linearizeRadiation,
final conMod=extConMod,
final hFixed=hExtFixed)
if haveConExtWin
"Exterior boundary conditions for constructions with a window";
HeatTransfer.Windows.BaseClasses.WindowRadiation conExtWinRad[NConExtWin](
final AWin=(1 .- datConExtWin.fFra) .* datConExtWin.AWin,
final N=datConExtWin.glaSys.nLay,
final tauGlaSol=datConExtWin.glaSys.glass.tauSol,
final rhoGlaSol_a=datConExtWin.glaSys.glass.rhoSol_a,
final rhoGlaSol_b=datConExtWin.glaSys.glass.rhoSol_b,
final xGla=datConExtWin.glaSys.glass.x,
final tauShaSol_a=datConExtWin.glaSys.shade.tauSol_a,
final tauShaSol_b=datConExtWin.glaSys.shade.tauSol_b,
final rhoShaSol_a=datConExtWin.glaSys.shade.rhoSol_a,
final rhoShaSol_b=datConExtWin.glaSys.shade.rhoSol_b,
final haveExteriorShade=datConExtWin.glaSys.haveExteriorShade,
final haveInteriorShade=datConExtWin.glaSys.haveInteriorShade)
if
haveConExtWin
"Model for solar radiation through shades and window";
BoundaryConditions.WeatherData.Bus weaBus;
Buildings.Rooms.BaseClasses.AirHeatMassBalanceMixed air(
redeclare final package Medium = Medium,
final energyDynamics=energyDynamics,
final massDynamics=massDynamics,
nPorts=nPorts + 1,
final V=V,
final nConExt=nConExt,
final nConExtWin=nConExtWin,
final nConPar=nConPar,
final nConBou=nConBou,
final nSurBou=nSurBou,
final datConExt=datConExt,
final datConExtWin=datConExtWin,
final datConPar=datConPar,
final datConBou=datConBou,
final surBou=surBou,
final homotopyInitialization=homotopyInitialization,
final p_start=p_start,
final T_start=T_start,
final X_start=X_start,
final C_start=C_start,
final C_nominal=C_nominal,
final m_flow_nominal=m_flow_nominal,
final haveShade=haveShade,
final conMod=intConMod,
final hFixed=hIntFixed)
"Convective heat and mass balance of air";
Buildings.Rooms.BaseClasses.SolarRadiationExchange solRadExc(
final nConExt=nConExt,
final nConExtWin=nConExtWin,
final nConPar=nConPar,
final nConBou=nConBou,
final nSurBou=nSurBou,
final datConExt = datConExt,
final datConExtWin = datConExtWin,
final datConPar = datConPar,
final datConBou = datConBou,
final surBou = surBou,
final isFloorConExt=isFloorConExt,
final isFloorConExtWin=isFloorConExtWin,
final isFloorConPar_a=isFloorConPar_a,
final isFloorConPar_b=isFloorConPar_b,
final isFloorConBou=isFloorConBou,
final isFloorSurBou=isFloorSurBou,
final tauGla={datConExtWin[i].glaSys.glass[datConExtWin[i].glaSys.nLay].tauSol
for i
in 1:NConExtWin})
if
haveConExtWin
"Solar radiative heat exchange";
Buildings.Rooms.BaseClasses.InfraredRadiationGainDistribution irRadGai(
final nConExt=nConExt,
final nConExtWin=nConExtWin,
final nConPar=nConPar,
final nConBou=nConBou,
final nSurBou=nSurBou,
final datConExt = datConExt,
final datConExtWin = datConExtWin,
final datConPar = datConPar,
final datConBou = datConBou,
final surBou = surBou,
final haveShade=haveShade)
"Distribution for infrared radiative heat gains (e.g., due to equipment and people)";
Buildings.Rooms.BaseClasses.InfraredRadiationExchange irRadExc(
final nConExt=nConExt,
final nConExtWin=nConExtWin,
final nConPar=nConPar,
final nConBou=nConBou,
final nSurBou=nSurBou,
final datConExt = datConExt,
final datConExtWin = datConExtWin,
final datConPar = datConPar,
final datConBou = datConBou,
final surBou = surBou,
final linearizeRadiation = linearizeRadiation)
"Infrared radiative heat exchange";
Buildings.Rooms.BaseClasses.RadiationTemperature radTem(
final nConExt=nConExt,
final nConExtWin=nConExtWin,
final nConPar=nConPar,
final nConBou=nConBou,
final nSurBou=nSurBou,
final datConExt=datConExt,
final datConExtWin=datConExtWin,
final datConPar=datConPar,
final datConBou=datConBou,
final surBou=surBou,
final haveShade=haveShade)
"Radiative temperature of the room";
HeatTransfer.Windows.BaseClasses.ShadeRadiation shaRad[NConExtWin](
final A=(1 .- datConExtWin.fFra) .* datConExtWin.AWin,
final thisSideHasShade=haveInteriorShade,
final absIR_air=datConExtWin.glaSys.shade.absIR_a,
final absIR_glass={(datConExtWin[i].glaSys.glass[datConExtWin[i].glaSys.nLay].absIR_b)
for i
in 1:NConExtWin},
final tauIR_air=tauIRSha_air,
final tauIR_glass=tauIRSha_glass,
each final linearize = linearizeRadiation)
if
haveShade
"Radiation model for room-side window shade";
protected
final parameter Modelica.SIunits.TransmissionCoefficient tauIRSha_air[NConExtWin]=
datConExtWin.glaSys.shade.tauIR_a
"Infrared transmissivity of shade for radiation coming from the exterior or the room";
final parameter Modelica.SIunits.TransmissionCoefficient tauIRSha_glass[
NConExtWin]=
datConExtWin.glaSys.shade.tauIR_b
"Infrared transmissivity of shade for radiation coming from the glass";
final parameter Boolean haveExteriorShade[NConExtWin]=
{datConExtWin[i].glaSys.haveExteriorShade
for i
in 1:NConExtWin}
"Set to true if window has exterior shade (at surface a)";
final parameter Boolean haveInteriorShade[NConExtWin]=
{datConExtWin[i].glaSys.haveInteriorShade
for i
in 1:NConExtWin}
"Set to true if window has interior shade (at surface b)";
final parameter Boolean haveShade=
Modelica.Math.BooleanVectors.anyTrue(haveExteriorShade[:])
or
Modelica.Math.BooleanVectors.anyTrue(haveInteriorShade[:])
"Set to true if the windows have a shade";
final parameter Boolean isFloorConExt[NConExt]=
datConExt.isFloor
"Flag to indicate if floor for exterior constructions";
final parameter Boolean isFloorConExtWin[NConExtWin]=
datConExtWin.isFloor
"Flag to indicate if floor for constructions";
final parameter Boolean isFloorConPar_a[NConPar]=
datConPar.isFloor
"Flag to indicate if floor for constructions";
final parameter Boolean isFloorConPar_b[NConPar]=
datConPar.isCeiling
"Flag to indicate if floor for constructions";
final parameter Boolean isFloorConBou[NConBou]=
datConBou.isFloor
"Flag to indicate if floor for constructions with exterior boundary conditions exposed to outside of room model";
parameter Boolean isFloorSurBou[NSurBou]=
surBou.isFloor
"Flag to indicate if floor for constructions that are modeled outside of this room";
HeatTransfer.Windows.BaseClasses.ShadingSignal shaSig[NConExtWin](
each final haveShade=haveShade)
if
haveConExtWin
"Shading signal";
Buildings.Rooms.BaseClasses.HeatGain heaGai(
redeclare package Medium = Medium,
final AFlo=AFlo)
"Model to convert internal heat gains";
Buildings.Rooms.BaseClasses.RadiationAdapter radiationAdapter;
Modelica.Blocks.Math.Add add;
Modelica.Blocks.Math.Add sumJToWin[NConExtWin](
each final k1=1,
each final k2=1)
if
haveConExtWin
"Sum of radiosity flows from room surfaces toward the window";
HeatTransfer.Radiosity.RadiositySplitter radShaOut[NConExtWin]
if
haveConExtWin
"Splitter for radiosity that strikes shading device or unshaded part of window";
Modelica.Blocks.Math.Sum sumJFroWin[NConExtWin](
each nin=
if haveShade
then 2
else 1)
if
haveConExtWin
"Sum of radiosity fom window to room surfaces";
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TSha[NConExtWin]
if
haveShade
"Temperature of shading device";
equation
connect(conBou.opa_a, surf_conBou);
connect(uSha, conExtWin.uSha);
connect(uSha, bouConExtWin.uSha);
connect(bouConExtWin.opa_a, conExtWin.opa_a);
connect(conExtWin.JInUns_a, bouConExtWin.JOutUns);
connect(bouConExtWin.JInUns, conExtWin.JOutUns_a);
connect(conExtWin.glaUns_a, bouConExtWin.glaUns);
connect(bouConExtWin.glaSha, conExtWin.glaSha_a);
connect(conExtWin.JInSha_a, bouConExtWin.JOutSha);
connect(bouConExtWin.JInSha, conExtWin.JOutSha_a);
connect(conExtWin.fra_a, bouConExtWin.fra);
connect(conExt.opa_a, bouConExt.opa_a);
connect(weaBus, bouConExtWin.weaBus);
connect(weaBus, bouConExt.weaBus);
connect(bouConExtWin.QAbsSolSha_flow, conExtWinRad.QAbsExtSha_flow);
connect(bouConExtWin.inc, conExtWinRad.incAng);
connect(bouConExtWin.HDir, conExtWinRad.HDir);
connect(bouConExtWin.HDif, conExtWinRad.HDif);
connect(uSha, conExtWinRad.uSha);
connect(conExtWin.QAbsSha_flow, conExtWinRad.QAbsGlaSha_flow);
connect(conExtWinRad.QAbsGlaUns_flow, conExtWin.QAbsUns_flow);
// Connect statements from the model BaseClasses.MixedAir
connect(conExt.opa_b, irRadExc.conExt);
connect(conExtWin.fra_b, irRadExc.conExtWinFra);
connect(conPar.opa_a, irRadExc.conPar_a);
connect(conPar.opa_b, irRadExc.conPar_b);
connect(conBou.opa_b, irRadExc.conBou);
connect(surf_surBou, irRadExc.conSurBou);
connect(irRadGai.conExt, conExt.opa_b);
connect(irRadGai.conExtWinFra, conExtWin.fra_b);
connect(irRadGai.conPar_a, conPar.opa_a);
connect(irRadGai.conPar_b, conPar.opa_b);
connect(irRadGai.conBou, conBou.opa_b);
connect(irRadGai.conSurBou, surf_surBou);
connect(irRadGai.uSha, uSha);
connect(heaGai.qGai_flow, qGai_flow);
connect(conExtWin.opa_b, irRadExc.conExtWin);
connect(conExtWin.opa_b, irRadGai.conExtWin);
connect(conExt.opa_b, solRadExc.conExt);
connect(conExtWin.fra_b, solRadExc.conExtWinFra);
connect(conPar.opa_a, solRadExc.conPar_a);
connect(conPar.opa_b, solRadExc.conPar_b);
connect(conBou.opa_b, solRadExc.conBou);
connect(surf_surBou, solRadExc.conSurBou);
connect(conExtWin.opa_b, solRadExc.conExtWin);
connect(solRadExc.JInConExtWin, conExtWinRad.QTra_flow);
connect(solRadExc.HOutConExtWin,conExtWinRad.HRoo);
connect(uSha, radTem.uSha);
connect(conExt.opa_b, radTem.conExt);
connect(conExtWin.opa_b, radTem.conExtWin);
connect(conExtWin.fra_b, radTem.conExtWinFra);
connect(conPar.opa_a, radTem.conPar_a);
connect(conPar.opa_b, radTem.conPar_b);
connect(conBou.opa_b, radTem.conBou);
connect(surf_surBou, radTem.conSurBou);
connect(radTem.glaUns, conExtWin.glaUns_b);
connect(radTem.glaSha, conExtWin.glaSha_b);
connect(radTem.TRad, radiationAdapter.TRad);
connect(radiationAdapter.rad, heaPorRad);
connect(radiationAdapter.QRad_flow, add.u1);
connect(heaGai.QRad_flow, add.u2);
connect(add.y, irRadGai.Q_flow);
connect(irRadExc.JOutConExtWin, sumJToWin.u1);
connect(irRadGai.JOutConExtWin, sumJToWin.u2);
connect(uSha, shaSig.u);
connect(shaSig.y, radShaOut.u);
connect(shaSig.y, shaRad.u);
connect(sumJToWin.y, radShaOut.JIn);
connect(radShaOut.JOut_1, shaRad.JIn_air);
connect(radShaOut.JOut_2, conExtWin.JInUns_b);
connect(shaRad.JOut_glass, conExtWin.JInSha_b);
connect(conExtWin.JOutSha_b, shaRad.JIn_glass);
connect(irRadExc.JInConExtWin, sumJFroWin.y);
connect(shaRad.QSolAbs_flow, conExtWinRad.QAbsIntSha_flow);
connect(sumJFroWin.u[1], conExtWin.JOutUns_b);
connect(sumJFroWin.u[2], shaRad.JOut_air);
connect(radTem.sha, TSha.port);
for i
in 1:nPorts
loop
connect(ports[i],air. ports[i]);
end for;
connect(heaGai.QLat_flow,air. ports[nPorts + 1]);
connect(air.heaPorAir, heaGai.QCon_flow);
connect(air.conExt, conExt.opa_b);
connect(air.conExtWin, conExtWin.opa_b);
connect(air.glaUns, conExtWin.glaUns_b);
connect(air.glaSha, conExtWin.glaSha_b);
connect(air.conExtWinFra, conExtWin.fra_b);
connect(air.conPar_a, conPar.opa_a);
connect(air.conPar_b, conPar.opa_b);
connect(air.conBou, conBou.opa_b);
connect(air.conSurBou, surf_surBou);
connect(air.uSha, uSha);
connect(shaRad.QRadAbs_flow,air. QRadAbs_flow);
connect(air.TSha, shaRad.TSha);
connect(air.heaPorAir, heaPorAir);
connect(air.TSha, TSha.T);
end MixedAir;