Package with base classes for Buildings.ThermalZones.Detailed
Information
This package contains base classes that are used to construct the models in
Buildings.ThermalZones.Detailed.
Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).
Package Content
Name |
Description |
CFDAirHeatMassBalance
|
Heat and mass balance of the air based on computational fluid dynamics |
CFDExchange
|
Block that exchanges data with the CFD code |
CFDFluidInterface
|
|
CFDSurfaceInterface
|
|
CFDThread
|
class used to handle CFD thread |
ExteriorBoundaryConditions
|
Model for convection and radiation bounary condition of exterior constructions |
ExteriorBoundaryConditionsWithWindow
|
Model for exterior boundary conditions for constructions with a window |
HeatGain
|
Model to convert internal heat gain signals |
InfraredRadiationExchange
|
Infrared radiation heat exchange between the room facing surfaces |
InfraredRadiationGainDistribution
|
Infrared radiative heat gain distribution between the room facing surfaces |
MixedAirHeatMassBalance
|
Heat and mass balance of the air, assuming completely mixed air |
PartialAirHeatMassBalance
|
Partial model for heat and mass balance of the air |
PartialSurfaceInterface
|
Partial model that is used for infrared radiation balance |
PartialSurfaceInterfaceRadiative
|
Partial model that is used for infrared radiation balance |
RadiationAdapter
|
Model to connect between signals and heat port for radiative gains of the room |
RadiationTemperature
|
Radiative temperature of the room |
RoomHeatMassBalance
|
Base model for a room |
SkyRadiationExchange
|
Radiative heat exchange with the sky and the ambient |
SolarRadiationExchange
|
Solar radiation heat exchange between the room facing surfaces |
cfdExchangeData
|
Exchange data between CFD and Modelica |
cfdStartCosimulation
|
Start the coupled simulation with CFD |
to_W
|
Add unit [W] to data |
CFDSurfaceIdentifier
|
Data record to identify surfaces in the CFD code |
ConstructionNumbers
|
Data records for construction data |
ConstructionRecords
|
Data records for construction data |
OpaqueSurface
|
Record for exterior constructions that have no window |
Overhang
|
Record for window overhang |
ParameterConstruction
|
Record for exterior constructions that have no window |
ParameterConstructionWithWindow
|
Record for exterior constructions that have a window |
PartialParameterConstruction
|
Partial record for constructions |
SideFins
|
Record for window side fins |
Examples
|
Collection of models that illustrate model use and test models |
Heat and mass balance of the air based on computational fluid dynamics
Information
This model computes the heat and mass balance of the air using Computational Fluid Dynamics program.
For a documentation of the exchange parameters and variables, see
Buildings.ThermalZones.Detailed.UsersGuide.CFD.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialAirHeatMassBalance (Partial model for heat and mass balance of the air).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
replaceable package Medium | PartialMedium | Medium in the component |
Boolean | haveShade | | Set to true if at least one window has an interior or exterior shade |
Volume | V | | Volume [m3] |
String | cfdFilNam | | CFD input file name |
Boolean | useCFD | true | Set to false to deactivate the CFD interface and use instead yFixed as output |
Boolean | haveSensor | | Flag, true if the model has at least one sensor |
Integer | nSen | | Number of sensors that are connected to CFD output |
String | sensorName[nSen] | | Names of sensors as declared in the CFD input file |
String | portName[nPorts] | | Names of fluid ports as declared in the CFD input file |
Real | uSha_fixed[nConExtWin] | | Constant control signal for the shading device (0: unshaded; 1: fully shaded) |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Sampling |
Time | samplePeriod | | Sample period of component [s] |
Dynamics |
Equations |
Dynamics | massDynamics | | Formulation of mass balance |
Initialization |
AbsolutePressure | p_start | | Start value of pressure [Pa] |
Connectors
Type | Name | Description |
input RealInput | uSha[NConExtWin] | Input connector, used to scale the surface area to take into account an operable shading device, 0: unshaded; 1: fully shaded |
input RealInput | QRadAbs_flow[NConExtWin] | Total net radiation that is absorbed by the shade (positive if absorbed) [W] |
input RealInput | QCon_flow | Convective sensible heat gains of the room |
input RealInput | QLat_flow | Latent heat gains for the room |
output RealOutput | TSha[NConExtWin] | Shade temperature [K] |
VesselFluidPorts_b | ports[nPorts] | Fluid inlets and outlets |
HeatPort_a | heaPorAir | Heat port to air volume |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | glaUns[NConExtWin] | Heat port that connects to room-side surface of unshaded glass |
HeatPort_a | glaSha[NConExtWin] | Heat port that connects to room-side surface of shaded glass |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
replaceable package Medium | Medium in the component |
output RealOutput | yCFD[nSen] | Sensor for output from CFD |
Modelica definition
model CFDAirHeatMassBalance
extends Buildings.ThermalZones.Detailed.BaseClasses.PartialAirHeatMassBalance;
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
parameter Modelica.Fluid.Types.Dynamics massDynamics
;
parameter Medium.AbsolutePressure p_start ;
parameter String cfdFilNam ;
parameter Boolean useCFD=true
;
parameter Modelica.SIunits.Time samplePeriod(min=100*Modelica.Constants.eps)
;
parameter Boolean haveSensor
;
parameter Integer nSen(min=0)
;
parameter String sensorName[nSen]
;
parameter String portName[nPorts]
;
parameter Real uSha_fixed[nConExtWin]
;
CFDExchange cfd(
final cfdFilNam=cfdFilNam,
final startTime=startTime,
final activateInterface=useCFD,
final samplePeriod=
if useCFD
then samplePeriod
else Modelica.Constants.inf,
final nWri=kFluIntC_inflow + Medium.nC*nPorts,
final nRea=kSen + nSen,
final nSur=nSur,
final surIde=surIde,
final haveShade=haveShade,
final haveSensor=haveSensor,
final sensorName=sensorName,
final portName=portName,
final yFixed=yFixed,
final nXi=Medium.nXi,
final nC=Medium.nC,
rho_start=rho_start,
nConExtWin=NConExtWin) ;
Modelica.Blocks.Interfaces.RealOutput yCFD[nSen]
if haveSensor
;
protected
parameter Modelica.SIunits.Time startTime(fixed=false)
;
parameter Real yFixed[kSen + nSen](
each fixed=false)
;
parameter Modelica.SIunits.HeatFlowRate Q_flow_fixed[kSurBou + nSurBou]=
fill(0, kSurBou + nSurBou) ;
parameter Modelica.SIunits.Temperature TRooAve_fixed=Medium.T_default
;
parameter Modelica.SIunits.Temperature TSha_fixed[NConExtWin]=
fill(Medium.T_default, NConExtWin) ;
parameter Modelica.SIunits.Temperature T_outflow_fixed[nPorts]=
fill(Medium.T_default, nPorts)
;
parameter Real Xi_outflow_fixed[nPorts*Medium.nXi](
each fixed=false)
;
parameter Real C_outflow_fixed[nPorts*Medium.nC](
each fixed=false)
;
parameter Modelica.SIunits.Density rho_start=
Medium.density(
Medium.setState_pTX(
T=Medium.T_default,
p=p_start,
X=Medium.X_default)) ;
final parameter CFDSurfaceIdentifier surIde[kSurBou + nSurBou]=
assignSurfaceIdentifier(
nConExt=nConExt,
nConExtWin=nConExtWin,
nConPar=nConPar,
nConBou=nConBou,
nSurBou=nSurBou,
nSur=nSur,
haveShade=haveShade,
nameConExt=datConExt.name,
AConExt=datConExt.A,
tilConExt=datConExt.til,
bouConConExt=datConExt.boundaryCondition,
nameConExtWin=datConExtWin.name,
AConExtWin=datConExtWin.AOpa,
tilConExtWin=datConExtWin.til,
bouConConExtWin=datConExtWin.boundaryCondition,
AGla=datConExtWin.AGla,
AFra=datConExtWin.AFra,
uSha=uSha_fixed,
nameConPar=datConPar.name,
AConPar=datConPar.A,
tilConPar=datConPar.til,
bouConConPar=datConPar.boundaryCondition,
nameConBou=datConBou.name,
AConBou=datConBou.A,
tilConBou=datConBou.til,
bouConConBou=datConBou.boundaryCondition,
nameSurBou=surBou.name,
ASurBou=surBou.A,
tilSurBou=surBou.til,
bouConSurBou=surBou.boundaryCondition)
;
CFDSurfaceInterface cfdConExt[NConExt](
final bouCon=datConExt[:].boundaryCondition)
if haveConExt ;
CFDSurfaceInterface cfdConExtWin[NConExtWin](
final bouCon=datConExtWin[:].boundaryCondition)
if haveConExtWin
;
CFDSurfaceInterface cfdGlaUns[NConExtWin](
final bouCon=datConExtWin[:].boundaryCondition)
if haveConExtWin ;
CFDSurfaceInterface cfdGlaSha[NConExtWin](
final bouCon=datConExtWin[:].boundaryCondition)
if haveShade ;
CFDSurfaceInterface cfdConExtWinFra[NConExtWin](
final bouCon=datConExtWin[:].boundaryCondition)
if haveConExtWin ;
CFDSurfaceInterface cfdConPar_a[NConPar](
final bouCon=datConPar[:].boundaryCondition)
if haveConPar
;
CFDSurfaceInterface cfdConPar_b[NConPar](
final bouCon=datConPar[:].boundaryCondition)
if haveConPar
;
CFDSurfaceInterface cfdConBou[NConBou](
final bouCon=datConBou[:].boundaryCondition)
if haveConBou
;
CFDSurfaceInterface cfdSurBou[NSurBou](
final bouCon=surBou[:].boundaryCondition)
if haveSurBou
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature cfdHeaPorAir
;
CFDFluidInterface fluInt(
redeclare final package Medium =
Medium,
final massDynamics=massDynamics,
final nPorts=nPorts,
final V=V,
final p_start=p_start,
rho_start=rho_start) ;
final parameter Integer kConExt=0
;
final parameter Integer kConExtWin=kConExt + nConExt
;
final parameter Integer kGlaUns=kConExtWin + nConExtWin
;
final parameter Integer kGlaSha=kGlaUns + nConExtWin
;
final parameter Integer kConExtWinFra=
if haveShade
then kGlaSha + nConExtWin
else kGlaSha ;
final parameter Integer kConPar_a=kConExtWinFra + nConExtWin
;
final parameter Integer kConPar_b=kConPar_a + nConPar
;
final parameter Integer kConBou=kConPar_b + nConPar
;
final parameter Integer kSurBou=kConBou + nConBou
;
final parameter Integer kHeaPorAir=kSurBou + nSurBou
;
final parameter Integer kUSha=kSurBou + nSurBou
;
final parameter Integer kQRadAbs_flow=
if haveShade
then kUSha + nConExtWin
else kUSha
;
final parameter Integer kTSha=kHeaPorAir + 1
;
final parameter Integer kQConGai_flow=
if haveShade
then kQRadAbs_flow +
nConExtWin
else kQRadAbs_flow
;
final parameter Integer kQLatGai_flow=kQConGai_flow + 1
;
final parameter Integer kFluIntP=kQLatGai_flow + 1
;
final parameter Integer kFluIntM_flow=kFluIntP + 1
;
final parameter Integer kFluIntT_inflow=kFluIntM_flow + nPorts
;
final parameter Integer kFluIntXi_inflow=kFluIntT_inflow + nPorts
;
final parameter Integer kFluIntC_inflow=kFluIntXi_inflow + nPorts*Medium.nXi
;
final parameter Integer kFluIntT_outflow=
if haveShade
then kTSha + nConExtWin
else kTSha
;
final parameter Integer kFluIntXi_outflow=kFluIntT_outflow + nPorts
;
final parameter Integer kFluIntC_outflow=kFluIntXi_outflow + nPorts*Medium.nXi
;
final parameter Integer kSen=kFluIntC_outflow + nPorts*Medium.nC
;
final parameter Integer nSur=kSurBou + nSurBou ;
protected
function assignSurfaceIdentifier
input Integer nConExt(min=0) ;
input Integer nConExtWin(min=0) ;
input Integer nConPar(min=0) ;
input Integer nConBou(min=0)
;
input Integer nSurBou(min=0)
;
input Integer nSur(min=2) ;
input Boolean haveShade
;
input String nameConExt[nConExt] ;
input Modelica.SIunits.Area AConExt[nConExt] ;
input Modelica.SIunits.Angle tilConExt[nConExt] ;
input Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions bouConConExt[nConExt]
;
input String nameConExtWin[nConExtWin] ;
input Modelica.SIunits.Area AConExtWin[nConExtWin] ;
input Modelica.SIunits.Angle tilConExtWin[nConExtWin] ;
input Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions bouConConExtWin[
nConExtWin] ;
input Modelica.SIunits.Area AGla[nConExtWin] ;
input Modelica.SIunits.Area AFra[nConExtWin] ;
input Real uSha[nConExtWin] ;
input String nameConPar[nConPar] ;
input Modelica.SIunits.Area AConPar[nConPar] ;
input Modelica.SIunits.Angle tilConPar[nConPar] ;
input Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions bouConConPar[nConPar]
;
input String nameConBou[nConBou] ;
input Modelica.SIunits.Area AConBou[nConBou] ;
input Modelica.SIunits.Angle tilConBou[nConBou] ;
input Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions bouConConBou[nConBou]
;
input String nameSurBou[nSurBou] ;
input Modelica.SIunits.Area ASurBou[nSurBou] ;
input Modelica.SIunits.Angle tilSurBou[nSurBou] ;
input Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions bouConSurBou[nSurBou]
;
output CFDSurfaceIdentifier id[nSur] ;
algorithm
id :=
cat(
1,
{
CFDSurfaceIdentifier(
name=nameConExt[i],
A=AConExt[i],
til=tilConExt[i],
bouCon=bouConConExt[i])
for i
in 1:nConExt},
{
CFDSurfaceIdentifier(
name=nameConExtWin[i],
A=AConExtWin[i],
til=tilConExtWin[i],
bouCon=bouConConExtWin[i])
for i
in 1:nConExtWin},
{
CFDSurfaceIdentifier(
name=nameConExtWin[i] + " (glass, unshaded)",
A=AGla[i]*(1-uSha[i]),
til=tilConExtWin[i],
bouCon=bouConConExtWin[i])
for i
in 1:nConExtWin},
{
CFDSurfaceIdentifier(
name=nameConExtWin[i] + " (glass, shaded)",
A=AGla[i]*uSha[i],
til=tilConExtWin[i],
bouCon=bouConConExtWin[i])
for i
in 1:(
if haveShade
then nConExtWin
else 0)},
{
CFDSurfaceIdentifier(
name=nameConExtWin[i] + " (frame)",
A=AFra[i],
til=tilConExtWin[i],
bouCon=bouConConExtWin[i])
for i
in 1:nConExtWin},
{
CFDSurfaceIdentifier(
name=nameConPar[i] + " (surface a)",
A=AConPar[i],
til=tilConPar[i],
bouCon=bouConConPar[i])
for i
in 1:nConPar},
{
CFDSurfaceIdentifier(
name=nameConPar[i] + " (surface b)",
A=AConPar[i],
til=tilConPar[i] + Modelica.Constants.pi/180,
bouCon=bouConConPar[i])
for i
in 1:nConPar},
{
CFDSurfaceIdentifier(
name=nameConBou[i],
A=AConBou[i],
til=tilConBou[i],
bouCon=bouConConBou[i])
for i
in 1:nConBou},
{
CFDSurfaceIdentifier(
name=nameSurBou[i],
A=ASurBou[i],
til=tilSurBou[i],
bouCon=bouConSurBou[i])
for i
in 1:nSurBou});
end assignSurfaceIdentifier;
public
Modelica.Blocks.Math.Add QTotCon_flow
;
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor senHeaFlo
;
to_W QTotCon_flow_W;
initial equation
startTime = time;
for i
in 1:nPorts
loop
for j
in 1:Medium.nXi
loop
Xi_outflow_fixed[(i - 1)*Medium.nXi + j] = Medium.X_default[j];
end for;
end for;
for i
in 1:nPorts
loop
for j
in 1:Medium.nC
loop
C_outflow_fixed[(i - 1)*Medium.nC + j] = 0;
end for;
end for;
for i
in 1:kSurBou + nSurBou
loop
yFixed[i] = Q_flow_fixed[i];
end for;
yFixed[kHeaPorAir + 1] = TRooAve_fixed;
if haveShade
then
for i
in 1:nConExtWin
loop
yFixed[kTSha + i] = TSha_fixed[i];
end for;
end if;
for i
in 1:nPorts
loop
yFixed[kFluIntT_outflow + i] = T_outflow_fixed[i];
for j
in 1:Medium.nXi
loop
yFixed[kFluIntXi_outflow + (i - 1)*Medium.nXi + j] = Xi_outflow_fixed[(i
- 1)*Medium.nXi + j];
end for;
for j
in 1:Medium.nC
loop
yFixed[kFluIntC_outflow + (i - 1)*Medium.nC + j] = C_outflow_fixed[(i - 1)
*Medium.nC + j];
end for;
end for;
for i
in 1:nSen
loop
yFixed[kSen + i] = 0;
end for;
equation
if haveConExt
then
for i
in 1:nConExt
loop
if datConExt[i].boundaryCondition == Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature
then
connect(cfd.u[kConExt + i], cfdConExt[i].T_out);
connect(cfd.y[kConExt + i], cfdConExt[i].Q_flow_in);
else
connect(cfd.u[kConExt + i], cfdConExt[i].Q_flow_out);
connect(cfd.y[kConExt + i], cfdConExt[i].T_in);
end if;
end for;
end if;
if haveConExtWin
then
for i
in 1:nConExtWin
loop
if datConExtWin[i].boundaryCondition == Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature
then
connect(cfd.u[kConExtWin + i], cfdConExtWin[i].T_out);
connect(cfd.y[kConExtWin + i], cfdConExtWin[i].Q_flow_in);
connect(cfd.u[kGlaUns + i], cfdGlaUns[i].T_out);
connect(cfd.y[kGlaUns + i], cfdGlaUns[i].Q_flow_in);
connect(cfd.u[kConExtWinFra + i], cfdConExtWinFra[i].T_out);
connect(cfd.y[kConExtWinFra + i], cfdConExtWinFra[i].Q_flow_in);
else
connect(cfd.u[kConExtWin + i], cfdConExtWin[i].Q_flow_out);
connect(cfd.y[kConExtWin + i], cfdConExtWin[i].T_in);
connect(cfd.u[kGlaUns + i], cfdGlaUns[i].Q_flow_out);
connect(cfd.y[kGlaUns + i], cfdGlaUns[i].T_in);
connect(cfd.u[kConExtWinFra + i], cfdConExtWinFra[i].Q_flow_out);
connect(cfd.y[kConExtWinFra + i], cfdConExtWinFra[i].T_in);
end if;
end for;
end if;
if haveShade
then
for i
in 1:nConExtWin
loop
if datConExtWin[i].boundaryCondition == Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature
then
connect(cfd.u[kGlaSha + i], cfdGlaSha[i].T_out);
connect(cfd.y[kGlaSha + i], cfdGlaSha[i].Q_flow_in);
else
connect(cfd.u[kGlaSha + i], cfdGlaSha[i].Q_flow_out);
connect(cfd.y[kGlaSha + i], cfdGlaSha[i].T_in);
end if;
end for;
end if;
if haveConPar
then
for i
in 1:nConPar
loop
if datConPar[i].boundaryCondition == Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature
then
connect(cfd.u[kConPar_a + i], cfdConPar_a[i].T_out);
connect(cfd.y[kConPar_a + i], cfdConPar_a[i].Q_flow_in);
connect(cfd.u[kConPar_b + i], cfdConPar_b[i].T_out);
connect(cfd.y[kConPar_b + i], cfdConPar_b[i].Q_flow_in);
else
connect(cfd.u[kConPar_a + i], cfdConPar_a[i].Q_flow_out);
connect(cfd.y[kConPar_a + i], cfdConPar_a[i].T_in);
connect(cfd.u[kConPar_b + i], cfdConPar_b[i].Q_flow_out);
connect(cfd.y[kConPar_b + i], cfdConPar_b[i].T_in);
end if;
end for;
end if;
if haveConBou
then
for i
in 1:nConBou
loop
if datConBou[i].boundaryCondition == Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature
then
connect(cfd.u[kConBou + i], cfdConBou[i].T_out);
connect(cfd.y[kConBou + i], cfdConBou[i].Q_flow_in);
else
connect(cfd.u[kConBou + i], cfdConBou[i].Q_flow_out);
connect(cfd.y[kConBou + i], cfdConBou[i].T_in);
end if;
end for;
end if;
if haveSurBou
then
for i
in 1:nSurBou
loop
if surBou[i].boundaryCondition == Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature
then
connect(cfd.u[kSurBou + i], cfdSurBou[i].T_out);
connect(cfd.y[kSurBou + i], cfdSurBou[i].Q_flow_in);
else
connect(cfd.u[kSurBou + i], cfdSurBou[i].Q_flow_out);
connect(cfd.y[kSurBou + i], cfdSurBou[i].T_in);
end if;
end for;
end if;
connect(cfdConExt.port, conExt);
connect(cfdConExtWin.port, conExtWin);
connect(cfdGlaUns.port, glaUns);
connect(cfdGlaSha.port, glaSha);
connect(cfdConExtWinFra.port, conExtWinFra);
connect(cfdConPar_a.port, conPar_a);
connect(cfdConPar_b.port, conPar_b);
connect(cfdConBou.port, conBou);
connect(cfdSurBou.port, conSurBou);
connect(cfd.y[kHeaPorAir + 1], cfdHeaPorAir.T);
if haveShade
then
for i
in 1:nConExtWin
loop
connect(cfd.u[kUSha + i], uSha[i]);
connect(cfd.u[kQRadAbs_flow + i], QRadAbs_flow[i]);
connect(cfd.y[kTSha + i], TSha[i]);
end for;
end if;
connect(QTotCon_flow_W.y, cfd.u[kQConGai_flow + 1]);
connect(QLat_flow, cfd.u[kQLatGai_flow + 1]);
connect(ports, fluInt.ports);
connect(cfd.u[kFluIntP + 1], fluInt.p);
for i
in 1:nPorts
loop
connect(cfd.u[kFluIntM_flow + i], fluInt.m_flow[i]);
connect(cfd.u[kFluIntT_inflow + i], fluInt.T_inflow[i]);
for j
in 1:Medium.nXi
loop
connect(cfd.u[kFluIntXi_inflow + (i - 1)*Medium.nXi + j], fluInt.Xi_inflow[
(i - 1)*Medium.nXi + j]);
end for;
for j
in 1:Medium.nC
loop
connect(cfd.u[kFluIntC_inflow + (i - 1)*Medium.nC + j], fluInt.C_inflow[(
i - 1)*Medium.nC + j]);
end for;
end for;
for i
in 1:nPorts
loop
connect(cfd.y[kFluIntT_outflow + i], fluInt.T_outflow[i]);
for j
in 1:Medium.nXi
loop
connect(cfd.y[kFluIntXi_outflow + (i - 1)*Medium.nXi + j], fluInt.Xi_outflow[
(i - 1)*Medium.nXi + j]);
end for;
for j
in 1:Medium.nC
loop
connect(cfd.y[kFluIntC_outflow + (i - 1)*Medium.nC + j], fluInt.C_outflow[
(i - 1)*Medium.nC + j]);
end for;
end for;
if haveSensor
then
for i
in 1:nSen
loop
connect(cfd.y[kSen + i], yCFD[i]);
end for;
end if;
connect(heaPorAir, senHeaFlo.port_a);
connect(senHeaFlo.port_b, cfdHeaPorAir.port);
connect(senHeaFlo.Q_flow, QTotCon_flow.u1);
connect(QCon_flow, QTotCon_flow.u2);
connect(QTotCon_flow.y, QTotCon_flow_W.u);
end CFDAirHeatMassBalance;
Block that exchanges data with the CFD code
Information
This block samples interface variables and exchanges data with the CFD code.
For a documentation of the exchange parameters and variables, see
Buildings.ThermalZones.Detailed.UsersGuide.CFD.
Extends from Modelica.Blocks.Interfaces.DiscreteBlock (Base class of discrete control blocks).
Parameters
Type | Name | Default | Description |
Time | samplePeriod | | Sample period of component [s] |
Time | startTime | 0 | First sample time instant [s] |
String | cfdFilNam | | CFD input file name |
Boolean | activateInterface | true | Set to false to deactivate interface and use instead yFixed as output |
Integer | nXi | | Number of independent species concentration of the inflowing medium |
Integer | nC | | Number of trace substances of the inflowing medium |
Integer | nWri | | Number of values to write to the CFD simulation |
Integer | nRea | | Number of double values to be read from the CFD simulation |
Integer | flaWri[nWri] | ones(nWri) | Flag for double values (0: use current value, 1: use average over interval, 2: use integral over interval) |
Real | yFixed[nRea] | | Fixed output, used if activateInterface=false |
Integer | nSur | | Number of surfaces |
Integer | nConExtWin | | number of exterior construction with window |
CFDSurfaceIdentifier | surIde[nSur] | | Surface identifiers |
Boolean | haveShade | | Set to true if at least one window in the room has a shade |
Boolean | haveSensor | | Flag, true if the model has at least one sensor |
String | sensorName[:] | | Names of sensors as declared in the CFD input file |
String | portName[:] | | Names of fluid ports as declared in the CFD input file |
Boolean | verbose | false | Set to true for verbose output |
Density | rho_start | | Density at initial state [kg/m3] |
Connectors
Type | Name | Description |
input RealInput | u[nWri] | Inputs to CFD |
output RealOutput | y[nRea] | Outputs received from CFD |
Modelica definition
block CFDExchange
extends Modelica.Blocks.Interfaces.DiscreteBlock(
firstTrigger(start=false,
fixed=true));
parameter String cfdFilNam ;
parameter Boolean activateInterface=true
;
parameter Integer nXi
;
parameter Integer nC ;
parameter Integer nWri(min=0)
;
parameter Integer nRea(min=0)
;
parameter Integer flaWri[nWri] =
ones(nWri)
;
parameter Real yFixed[nRea] ;
parameter Integer nSur(min=2) ;
parameter Integer nConExtWin(min=0)
;
parameter CFDSurfaceIdentifier surIde[nSur] ;
parameter Boolean haveShade
;
parameter Boolean haveSensor
;
parameter String sensorName[:]
;
parameter String portName[:]
;
parameter Boolean verbose=false ;
parameter Modelica.SIunits.Density rho_start ;
CFDThread CFDThre =
CFDThread()
;
Modelica.Blocks.Interfaces.RealInput u[nWri] ;
discrete Modelica.Blocks.Interfaces.RealOutput y[nRea] ;
Real uInt[nWri] ;
discrete Real uIntPre[nWri] ;
discrete Real uWri[nWri] ;
protected
final parameter Integer nSen(min=0) =
size(sensorName, 1)
;
final parameter Integer nPorts=
size(portName, 1)
;
discrete Modelica.SIunits.Time modTimRea(fixed=false)
;
discrete Integer retVal(start=0, fixed=true) ;
function sendParameters
input String cfdFilNam ;
input String[nSur] name ;
input Modelica.SIunits.Area[nSur] A ;
input Modelica.SIunits.Angle[nSur] til ;
input Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions[nSur] bouCon
;
input Integer nPorts(min=0)
;
input String portName[nPorts]
;
input Boolean haveSensor ;
input String sensorName[nSen]
;
input Boolean haveShade ;
input Integer nSur(min=2) ;
input Integer nSen(min=0)
;
input Integer nConExtWin(min=0)
;
input Boolean verbose ;
input Integer nXi
;
input Integer nC ;
input Modelica.SIunits.Density rho_start ;
protected
Integer coSimFlag=0;
algorithm
if verbose
then
Modelica.Utilities.Streams.print("CFDExchange:sendParameter");
end if;
for i
in 1:nSur
loop
assert(A[i] > 0, "Surface must be bigger than zero.");
end for;
Modelica.Utilities.Streams.print(string="Start cosimulation");
coSimFlag :=
cfdStartCosimulation(
cfdFilNam,
name,
A,
til,
bouCon,
nPorts,
portName,
haveSensor,
sensorName,
haveShade,
nSur,
nSen,
nConExtWin,
nXi,
nC,
rho_start);
assert(coSimFlag < 0.5, "Could not start the cosimulation.");
end sendParameters;
function exchange
input Integer flag ;
input Modelica.SIunits.Time t ;
input Modelica.SIunits.Time dt(min=100*Modelica.Constants.eps)
;
input Real[nU] u ;
input Integer nU ;
input Real[nY] yFixed ;
input Integer nY ;
output Modelica.SIunits.Time modTimRea
;
input Boolean verbose ;
output Real[nY] y ;
output Integer retVal
;
algorithm
if verbose
then
Modelica.Utilities.Streams.print("CFDExchange:exchange at t=" +
String(t));
end if;
(modTimRea,y,retVal) :=
cfdExchangeData(
flag,
t,
dt,
u,
nU,
nY);
end exchange;
function returnNonUniqueStrings
input Integer n(min=2) ;
input Boolean ideNam[n - 1]
;
input String names[n] ;
output String s ;
algorithm
s := "";
for i
in 1:n - 1
loop
if ideNam[i]
then
s := s + "\n '" + names[i] + "'";
end if;
end for;
end returnNonUniqueStrings;
function assertStringsAreUnique
input String descriptiveName
;
input Integer n(min=2) ;
input String names[n] ;
protected
Boolean ideNam[n-1]
;
algorithm
if n > 1
then
for i
in 1:n-1
loop
for j
in i+1:n
loop
ideNam[i] :=
Modelica.Utilities.Strings.isEqual(names[i], names[j]);
if ideNam[i]
then
break;
end if;
end for;
end for;
assert(
not Modelica.Math.BooleanVectors.anyTrue(ideNam),
"For the CFD interface, all " + descriptiveName +
" must have a name that is unique within each room.
The following "
+ descriptiveName + " names are used more than once in the room model:" +
returnNonUniqueStrings(n, ideNam, names));
else
ideNam :=
fill(false,
max(0, n - 1));
end if;
end assertStringsAreUnique;
initial equation
if verbose
then
Modelica.Utilities.Streams.print(string="
CFDExchange has the following surfaces:");
for i
in 1:nSur
loop
Modelica.Utilities.Streams.print(string="
name = " + surIde[i].name + "
A = " +
String(surIde[i].A) + " [m2]
tilt = " +
String(surIde[i].til*180/Modelica.Constants.pi) + " [deg]");
end for;
if haveSensor
then
Modelica.Utilities.Streams.print(string="
CFDExchange has the following sensors:");
for i
in 1:nSen
loop
Modelica.Utilities.Streams.print(string=" " + sensorName[i]);
end for;
else
Modelica.Utilities.Streams.print(string="CFDExchange has no sensors.");
end if;
end if;
assertStringsAreUnique(descriptiveName="surface",
n=nSur,
names={surIde[i].name
for i
in 1:nSur});
assertStringsAreUnique(descriptiveName="sensor",
n=nSen,
names=sensorName);
assertStringsAreUnique(descriptiveName="ports",
n=nPorts,
names=portName);
sendParameters(
cfdFilNam=cfdFilNam,
name=surIde[:].name,
A=surIde[:].A,
til=surIde[:].til,
bouCon=surIde[:].bouCon,
haveSensor=haveSensor,
portName=portName,
sensorName=sensorName,
haveShade=haveShade,
nSur=nSur,
nSen=nSen,
nConExtWin=nConExtWin,
nPorts=nPorts,
nXi=nXi,
nC=nC,
rho_start=rho_start,
verbose=verbose);
uInt =
zeros(nWri);
uIntPre =
zeros(nWri);
for i
in 1:nWri
loop
assert(flaWri[i] >= 0
and flaWri[i] <= 2,
"Parameter flaWri out of range for " +
String(i) + "-th component.");
end for;
uWri = u;
y=yFixed;
modTimRea = time;
equation
for i
in 1:nWri
loop
der(uInt[i]) =
if (flaWri[i] > 0)
then u[i]
else 0;
end for;
when sampleTrigger
then
for i
in 1:nWri
loop
if (flaWri[i] == 0)
then
uWri[i] =
pre(u[i]);
elseif (flaWri[i] == 1)
then
if (time<startTime+0.1*samplePeriod)
then
uWri[i] =
pre(u[i]);
else
uWri[i] = (uInt[i] -
pre(uIntPre[i]))/samplePeriod;
end if;
else
uWri[i] = uInt[i] -
pre(uIntPre[i]);
end if;
end for;
uIntPre = uInt;
end when;
algorithm
when sampleTrigger
then
if activateInterface
then
(modTimRea,y,retVal) :=
exchange(
flag=0,
t=time,
dt=samplePeriod,
u=uWri,
nU=
size(u, 1),
yFixed=yFixed,
nY=
size(y, 1),
verbose=verbose);
else
modTimRea := time;
y := yFixed;
retVal := 0;
end if;
assert(retVal >= 0,
"Obtained negative return value during data transfer with CFD.\n" +
" Aborting simulation. Check CFD log file.\n" +
" Received: retVal = " +
String(retVal));
end when;
end CFDExchange;
Information
This model is used to connect the fluid port with
the block that communicates with the CFD program.
This model also implements the pressure balance of the medium, as the
FFD implementation uses a constant pressure that is independent of the
pressure of the Modelica model.
If the parameter massDynamics == Modelica.Fluid.Types.Dynamics.SteadyState
,
then there is a steady-state mass balance and the pressure of the room
is an algebraic variable.
Otherwise, the time derivative of the pressure is
dp⁄dt = p_start ∑ ṁi ⁄ mstart,
where
p_start is the initial pressure,
∑ ṁi is the sum of the mass flow rates over all ports, and
mstart is the initial mass of the room.
Extends from Buildings.BaseClasses.BaseIcon (Base icon).
Parameters
Type | Name | Default | Description |
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
Density | rho_start | | Density, used to compute fluid mass [kg/m3] |
Volume | V | | Volume [m3] |
Dynamics |
Equations |
Dynamics | massDynamics | Modelica.Fluid.Types.Dynamic... | Formulation of mass balance |
Initialization |
AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the component |
input RealInput | T_outflow[nPorts] | Temperature if m_flow < 0 [K] |
input RealInput | Xi_outflow[nPorts*Medium.nXi] | Species concentration if m_flow < 0 [1] |
input RealInput | C_outflow[nPorts*Medium.nC] | Trace substances if m_flow < 0 |
output RealOutput | p | Room-averaged total pressure [Pa] |
output RealOutput | m_flow[nPorts] | Mass flow rates [kg/s] |
output RealOutput | T_inflow[nPorts] | Temperature if m_flow >= 0 [K] |
output RealOutput | Xi_inflow[nPorts*Medium.nXi] | Species concentration if m_flow >= 0 [1] |
output RealOutput | C_inflow[nPorts*Medium.nC] | Trace substances if m_flow >= 0 |
VesselFluidPorts_b | ports[nPorts] | Fluid inlets and outlets |
Modelica definition
model CFDFluidInterface
extends Buildings.BaseClasses.BaseIcon;
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
parameter Modelica.Fluid.Types.Dynamics massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
;
parameter Medium.AbsolutePressure p_start = Medium.p_default
;
parameter Integer nPorts(min=0)=0 ;
parameter Modelica.SIunits.Density rho_start
;
parameter Modelica.SIunits.Volume V ;
final parameter Modelica.SIunits.Mass m_start = rho_start * V
;
Modelica.Blocks.Interfaces.RealInput T_outflow[nPorts](
each start=Medium.T_default,
each nominal=300,
each unit="K",
each displayUnit="degC") ;
Modelica.Blocks.Interfaces.RealInput Xi_outflow[nPorts*Medium.nXi](
each min=0,
each max=1,
each unit="1")
if Medium.nXi > 0 ;
Modelica.Blocks.Interfaces.RealInput C_outflow[nPorts*Medium.nC](
each min=0)
if Medium.nC > 0 ;
Modelica.Blocks.Interfaces.RealOutput p(
start=p_start,
min=80000,
nominal=100000,
max=120000,
unit="Pa") ;
Modelica.Blocks.Interfaces.RealOutput m_flow[nPorts](
each quantity="MassFlowRate",
each unit="kg/s") ;
Modelica.Blocks.Interfaces.RealOutput T_inflow[nPorts](
each start=Medium.T_default,
each min=200,
each max=373.15,
each nominal=300,
each unit="K",
each displayUnit="degC") ;
Modelica.Blocks.Interfaces.RealOutput Xi_inflow[nPorts*Medium.nXi](
each min=0,
each max=1,
each unit="1")
if Medium.nXi > 0 ;
Modelica.Blocks.Interfaces.RealOutput C_inflow[nPorts*Medium.nC](
each min=0)
if Medium.nC > 0 ;
Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts](
redeclare each final package Medium =
Medium) ;
protected
Modelica.Blocks.Interfaces.RealOutput Xi_inflow_internal[
max(nPorts, nPorts*Medium.nXi)](
each min=0,
each max=1,
each unit="1") ;
Modelica.Blocks.Interfaces.RealOutput C_inflow_internal[
max(nPorts, nPorts*Medium.nC)](
each min=0) ;
Modelica.Blocks.Interfaces.RealInput Xi_outflow_internal[
max(nPorts, nPorts*Medium.nXi)](
each min=0,
each max=1,
each unit="1") ;
Modelica.Blocks.Interfaces.RealInput C_outflow_internal[
max(nPorts, nPorts*Medium.nC)](
each min=0) ;
Modelica.SIunits.MassFlowRate[Medium.nXi] mbXi_flow
;
Modelica.SIunits.MassFlowRate ports_mXi_flow[nPorts,Medium.nXi];
initial equation
if massDynamics == Modelica.Fluid.Types.Dynamics.FixedInitial
then
p = p_start;
else
if massDynamics == Modelica.Fluid.Types.Dynamics.SteadyStateInitial
then
der(p) = 0;
end if;
end if;
equation
if Medium.nXi > 0
then
connect(Xi_inflow_internal, Xi_inflow);
connect(Xi_outflow_internal, Xi_outflow);
else
Xi_inflow_internal =
fill(0, nPorts);
Xi_outflow_internal =
fill(0, nPorts);
end if;
if Medium.nC > 0
then
connect(C_inflow_internal, C_inflow);
connect(C_outflow_internal, C_outflow);
else
C_inflow_internal =
fill(0, nPorts);
C_outflow_internal =
fill(0, nPorts);
end if;
for i
in 1:nPorts
loop
ports_mXi_flow[i,:] = ports[i].m_flow *
actualStream(ports[i].Xi_outflow);
end for;
for i
in 1:Medium.nXi
loop
mbXi_flow[i] =
sum(ports_mXi_flow[:,i]);
end for;
if massDynamics == Modelica.Fluid.Types.Dynamics.SteadyState
then
0 =
sum(ports.m_flow) +
sum(mbXi_flow);
else
der(p) = p_start*(
sum(ports.m_flow))/m_start;
end if;
for i
in 1:nPorts
loop
ports[i].p = p;
end for;
for i
in 1:nPorts
loop
ports[i].h_outflow =
Medium.specificEnthalpy_pTX(
p=p,
T=T_outflow[i],
X=Xi_outflow_internal[(i-1)*Medium.nXi+1:i*Medium.nXi]);
ports[i].Xi_outflow = Xi_outflow_internal[(i-1)*Medium.nXi+1:i*Medium.nXi];
ports[i].C_outflow = C_outflow_internal[ (i-1)*Medium.nC +1:i*Medium.nC];
end for;
for i
in 1:nPorts
loop
m_flow[i] = ports[i].m_flow;
T_inflow[i] =
Medium.temperature(
Medium.setState_phX(
p = p,
h =
inStream(ports[i].h_outflow),
X =
inStream(ports[i].Xi_outflow)));
for j
in 1:Medium.nXi
loop
Xi_inflow_internal[(i-1)*Medium.nXi+j] =
inStream(ports[i].Xi_outflow[j]);
end for;
for j
in 1:Medium.nC
loop
C_inflow_internal[(i-1)*Medium.nC+j] =
inStream(ports[i].C_outflow[j]);
end for;
end for;
end CFDFluidInterface;
Information
This model is used to connect temperatures and heat flow rates between the
block that communicates with the CFD program
and the heat port of the model that encapsulates the air heat and mass balance.
Extends from Buildings.BaseClasses.BaseIcon (Base icon).
Parameters
Connectors
Type | Name | Description |
input RealInput | Q_flow_in | Surface heat flow rate, used for temperature boundary condition |
output RealOutput | T_out | Surface temperature, used for temperature boundary condition |
output RealOutput | Q_flow_out | Surface heat flow rate, used for temperature boundary condition |
input RealInput | T_in | Surface temperature, used for temperature boundary condition |
HeatPort_a | port | Heat ports |
Modelica definition
class used to handle CFD thread
Information
Class derived from ExternalObject
having two local external function definition,
named destructor
and constructor
respectively.
To fix the issue FFD fails in JModelica tests due to unsupported OS #612.
Extends from ExternalObject.
Modelica definition
class CFDThread
extends ExternalObject;
function constructor
output CFDThread FFDThre ;
external"C" FFDThre =
cfdcosim();
end constructor;
function destructor
input CFDThread FFDThre ;
external"C"
cfdSendStopCommand(FFDThre);
end destructor;
end CFDThread;
Model for convection and radiation bounary condition of exterior constructions
Information
This model computes the boundary conditions for the outside-facing surface of
opaque constructions.
The model computes the infrared, solar, and convective heat exchange
between these surfaces and the exterior temperature and the sky temperature.
Input into this model are weather data that may be obtained from
Buildings.BoundaryConditions.WeatherData.
In this model, the solar radiation data are converted from horizontal irradiation to
irradiation on tilted surfaces using models from the package
Buildings.BoundaryConditions.SolarIrradiation.
The convective heat transfer between the exterior surface of the opaque constructions
is computed using
Buildings.HeatTransfer.Convection.
The heat transfer of windows are not computed in this model. They are implemented in
Buildings.ThermalZones.Detailed.BaseClasses.ExteriorBoundaryConditionsWithWindow.
Parameters
Type | Name | Default | Description |
Angle | lat | | Latitude [rad] |
Boolean | linearizeRadiation | | Set to true to linearize emissive power |
ParameterConstruction | conPar[nCon] | redeclare parameter Paramete... | Records for construction |
Exterior constructions |
Integer | nCon | | Number of exterior constructions |
Convective heat transfer |
ExteriorConvection | conMod | Buildings.HeatTransfer.Types... | Convective heat transfer model for opaque part of the constructions |
CoefficientOfHeatTransfer | hFixed | 10.0 | Constant convection coefficient for opaque part of the constructions [W/(m2.K)] |
Connectors
Type | Name | Description |
HeatPort_a | opa_a[nCon] | Heat port at surface a of opaque construction |
Bus | weaBus | |
Modelica definition
model ExteriorBoundaryConditions
parameter Integer nCon(min=1) ;
parameter Modelica.SIunits.Angle lat ;
parameter Boolean linearizeRadiation
;
replaceable parameter ParameterConstruction conPar[nCon]
constrainedby ParameterConstruction
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a opa_a[nCon]
;
parameter Buildings.HeatTransfer.Types.ExteriorConvection conMod=
Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind
;
parameter Modelica.SIunits.CoefficientOfHeatTransfer hFixed=10.0
;
HeatTransfer.Convection.Exterior conOpa[nCon](
A=AOpa,
final til=Modelica.Constants.pi*
ones(nCon) .- conPar[:].til,
final azi=conPar[:].azi,
each conMod=conMod,
each hFixed=hFixed) ;
SkyRadiationExchange skyRadExc(
final n=nCon,
final A=AOpa,
final absIR=conPar[:].layers.absIR_a,
vieFacSky={(Modelica.Constants.pi - conPar[i].til)./Modelica.Constants.pi
for i
in 1:nCon})
;
BoundaryConditions.WeatherData.Bus weaBus;
BoundaryConditions.SolarIrradiation.DirectTiltedSurface HDirTil[
nCon](
each final lat=lat,
final til=conPar[:].til,
final azi=conPar[:].azi) ;
BoundaryConditions.SolarIrradiation.DiffusePerez HDifTil[nCon](
each final lat=lat,
final til=conPar[:].til,
final azi=conPar[:].azi) ;
Modelica.Blocks.Math.Add HTotConExt[nCon](
final k1=conPar[:].layers.absSol_a .* AOpa,
final k2=conPar[:].layers.absSol_a .* AOpa) ;
Buildings.HeatTransfer.Sources.PrescribedHeatFlow solHeaGaiConExt[nCon]
;
protected
parameter Modelica.SIunits.Area AOpa[nCon]=conPar[:].A
;
Buildings.HeatTransfer.Sources.PrescribedTemperature TAirConExt[
nCon] ;
Modelica.Blocks.Routing.Replicator repConExt(nout=nCon) ;
Modelica.Blocks.Routing.Replicator repConExt1(
nout=nCon) ;
Modelica.Blocks.Routing.Replicator repConExt2(
nout=nCon) ;
equation
connect(conOpa.solid, opa_a);
connect(skyRadExc.port, opa_a);
connect(TAirConExt.port, conOpa.fluid);
connect(repConExt.y, TAirConExt.T);
connect(repConExt.u, weaBus.TDryBul);
connect(skyRadExc.TOut, weaBus.TDryBul);
connect(skyRadExc.TBlaSky, weaBus.TBlaSky);
for i
in 1:nCon
loop
connect(weaBus, HDirTil[i].weaBus);
connect(HDifTil[i].weaBus, weaBus);
end for;
connect(HTotConExt.y, solHeaGaiConExt.Q_flow);
connect(solHeaGaiConExt.port, opa_a);
connect(HDirTil.H, HTotConExt.u1);
connect(HDifTil.H, HTotConExt.u2);
connect(repConExt2.u, weaBus.winDir);
connect(repConExt1.u, weaBus.winSpe);
connect(repConExt1.y, conOpa.v);
connect(repConExt2.y, conOpa.dir);
end ExteriorBoundaryConditions;
Model for exterior boundary conditions for constructions with a window
Information
This model computes the boundary conditions for the outside-facing surface of
opaque constructions and of windows.
The model computes the infrared, solar, and convective heat exchange
between these surfaces and the exterior temperature and the sky temperature.
Input into this model are weather data that may be obtained from
Buildings.BoundaryConditions.WeatherData.
This model extends
Buildings.ThermalZones.Detailed.BaseClasses.ExteriorBoundaryConditions,
which models the boundary conditions for the opaque constructions,
and then implements the boundary condition for windows by using
the model
Buildings.HeatTransfer.Windows.ExteriorHeatTransfer.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.ExteriorBoundaryConditions (Model for convection and radiation bounary condition of exterior constructions).
Parameters
Type | Name | Default | Description |
Angle | lat | | Latitude [rad] |
Boolean | linearizeRadiation | | Set to true to linearize emissive power |
Exterior constructions |
Integer | nCon | | Number of exterior constructions |
Convective heat transfer |
ExteriorConvection | conMod | Buildings.HeatTransfer.Types... | Convective heat transfer model for opaque part of the constructions |
CoefficientOfHeatTransfer | hFixed | 10.0 | Constant convection coefficient for opaque part of the constructions [W/(m2.K)] |
Connectors
Type | Name | Description |
HeatPort_a | opa_a[nCon] | Heat port at surface a of opaque construction |
Bus | weaBus | |
input RealInput | uSha[nCon] | Control signal for the shading device, 0: unshaded; 1: fully shaded |
input RealInput | QAbsSolSha_flow[nCon] | Solar radiation absorbed by shade [W] |
output RadiosityOutflow | JOutUns[nCon] | Outgoing radiosity that connects to unshaded part of glass at exterior side [W] |
input RadiosityInflow | JInUns[nCon] | Incoming radiosity that connects to unshaded part of glass at exterior side [W] |
output RadiosityOutflow | JOutSha[nCon] | Outgoing radiosity that connects to shaded part of glass at exterior side [W] |
input RadiosityInflow | JInSha[nCon] | Incoming radiosity that connects to shaded part of glass at exterior side [W] |
HeatPort_a | glaUns[nCon] | Heat port at unshaded glass of exterior-facing surface |
HeatPort_a | glaSha[nCon] | Heat port at shaded glass of exterior-facing surface |
HeatPort_a | fra[nCon] | Heat port at frame of exterior-facing surface |
output RealOutput | HDir[nCon] | Direct solar irradition on tilted surface [W/m2] |
output RealOutput | HDif[nCon] | Diffuse solar irradiation on tilted surface [W/m2] |
output RealOutput | inc[nCon] | Incidence angle [rad] |
Modelica definition
model ExteriorBoundaryConditionsWithWindow
extends Buildings.ThermalZones.Detailed.BaseClasses.ExteriorBoundaryConditions
(
final AOpa=conPar[:].AOpa,
redeclare Buildings.ThermalZones.Detailed.BaseClasses.ParameterConstructionWithWindow
conPar);
final parameter Modelica.SIunits.Area AWin[nCon] = conPar[:].hWin .* conPar[:].wWin
;
final parameter Boolean haveExteriorShade[nCon] = conPar[:].glaSys.haveExteriorShade
;
final parameter Boolean haveInteriorShade[nCon] = conPar[:].glaSys.haveInteriorShade
;
final parameter Boolean haveShade=
Modelica.Math.BooleanVectors.anyTrue(haveExteriorShade)
or
Modelica.Math.BooleanVectors.anyTrue(haveInteriorShade)
;
final parameter Boolean haveOverhangOrSideFins=
Modelica.Math.BooleanVectors.anyTrue(conPar.haveOverhangOrSideFins)
;
Buildings.HeatTransfer.Windows.FixedShade sha[nCon](
final conPar=conPar,
each lat=lat,
azi=conPar.azi)
if haveOverhangOrSideFins ;
Modelica.Blocks.Interfaces.RealInput uSha[nCon](
each min=0,
each max=1)
if haveShade
;
Modelica.Blocks.Interfaces.RealInput QAbsSolSha_flow[nCon](
each final unit="W",
each quantity="Power") ;
HeatTransfer.Windows.ExteriorHeatTransfer conExtWin[nCon](
final A=conPar[:].AWin,
final fFra=conPar[:].fFra,
each final linearizeRadiation = linearizeRadiation,
final vieFacSky={(Modelica.Constants.pi - conPar[i].til) ./ Modelica.Constants.pi
for i
in 1:nCon},
final absIRSha_air=conPar[:].glaSys.shade.absIR_a,
final absIRSha_glass=conPar[:].glaSys.shade.absIR_b,
final tauIRSha_air=conPar[:].glaSys.shade.tauIR_a,
final tauIRSha_glass=conPar[:].glaSys.shade.tauIR_b,
final haveExteriorShade=haveExteriorShade,
final haveInteriorShade=haveInteriorShade)
;
SkyRadiationExchange skyRadExcWin(
final n=nCon,
final absIR=conPar[:].glaSys.absIRFra,
vieFacSky={(Modelica.Constants.pi - conPar[i].til) ./ Modelica.Constants.pi
for i
in
1:nCon},
final A=conPar[:].AWin .* conPar[:].fFra)
;
HeatTransfer.Interfaces.RadiosityOutflow JOutUns[nCon]
;
HeatTransfer.Interfaces.RadiosityInflow JInUns[nCon]
;
HeatTransfer.Interfaces.RadiosityOutflow JOutSha[nCon]
if haveShade
;
HeatTransfer.Interfaces.RadiosityInflow JInSha[nCon]
if haveShade
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a glaUns[nCon]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a glaSha[nCon]
if haveShade ;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a fra[nCon](T(
each nominal=
300,
each start=283.15))
;
Modelica.Blocks.Math.Add HTotConExtWinFra[nCon](
final k1=conPar[:].fFra .* conPar[:].glaSys.absSolFra .* conPar[:].AWin,
final k2=conPar[:].fFra .* conPar[:].glaSys.absSolFra .* conPar[:].AWin)
;
Buildings.HeatTransfer.Sources.PrescribedHeatFlow solHeaGaiConWin[nCon]
;
Modelica.Blocks.Interfaces.RealOutput HDir[nCon](
each final quantity="RadiantEnergyFluenceRate",
each final unit="W/m2") ;
Modelica.Blocks.Interfaces.RealOutput HDif[nCon](
each final quantity="RadiantEnergyFluenceRate",
each final unit="W/m2") ;
Modelica.Blocks.Interfaces.RealOutput inc[nCon](
each final quantity="Angle",
each final unit="rad",
each displayUnit="deg") ;
protected
Buildings.HeatTransfer.Sources.PrescribedTemperature TAirConExtWin[
nCon] ;
Modelica.Blocks.Routing.Replicator repConExtWin(
final nout=nCon)
;
Modelica.Blocks.Routing.Replicator repConExtWinVWin(
final nout=nCon)
;
Modelica.Blocks.Routing.Replicator repConExtWinTSkyBla(
final nout=nCon)
;
equation
connect(uSha, conExtWin.uSha);
connect(JInUns,conExtWin. JInUns);
connect(conExtWin.JOutUns,JOutUns);
connect(conExtWin.glaUns,glaUns);
connect(conExtWin.glaSha,glaSha);
connect(conExtWin.JOutSha,JOutSha);
connect(conExtWin.JInSha,JInSha);
connect(conExtWin.frame,fra);
connect(TAirConExtWin.port,conExtWin. air);
connect(TAirConExtWin.T,repConExtWin. y);
connect(repConExtWin.u, weaBus.TDryBul);
connect(repConExtWinVWin.y,conExtWin. vWin);
connect(repConExtWinVWin.u, weaBus.winSpe);
connect(HTotConExtWinFra.y, solHeaGaiConWin.Q_flow);
connect(solHeaGaiConWin.port, fra);
connect(HDifTil.H, HDif);
connect(HDirTil.inc, inc);
connect(HTotConExtWinFra.u2, HDifTil.H);
connect(skyRadExcWin.TOut, weaBus.TDryBul);
connect(skyRadExcWin.TBlaSky, weaBus.TBlaSky);
connect(skyRadExcWin.port, fra);
connect(repConExtWin.y, conExtWin.TOut);
connect(repConExtWinTSkyBla.y, conExtWin.TBlaSky);
connect(repConExtWinTSkyBla.u, weaBus.TBlaSky);
for i
in 1:nCon
loop
connect(sha[i].weaBus, weaBus);
end for;
connect(HDirTil.inc, sha.incAng);
if haveShade
then
connect(QAbsSolSha_flow, conExtWin.QSolAbs_flow);
end if;
connect(sha.HDirTilUns, HDirTil.H);
if haveOverhangOrSideFins
then
connect(sha.HDirTil, HTotConExtWinFra.u1);
connect(sha.HDirTil, HDir);
else
connect(HDirTil.H, HTotConExtWinFra.u1);
connect(HDirTil.H, HDir);
end if;
end ExteriorBoundaryConditionsWithWindow;
Model to convert internal heat gain signals
Information
This model computes the radiant, convective and latent heat flow rate.
Input into this model are these three components in units of [W/m2].
The inputs need to be positive quantities if heat or moisture is added
to the room.
The outputs are
-
the radiant heat flow in Watts,
-
the convective heat flow in Watts, and
-
the water vapor released into the air.
Extends from Buildings.BaseClasses.BaseIcon (Base icon).
Parameters
Type | Name | Default | Description |
Area | AFlo | | Floor area [m2] |
Connectors
Type | Name | Description |
input RealInput | qGai_flow[3] | Radiant, convective and latent heat input into room (positive if heat gain) |
output RealOutput | QRad_flow | Radiant heat input into room (positive if heat gain) [W] |
output RealOutput | QCon_flow | Convective sensible heat input into room (positive if heat gain) [W] |
output RealOutput | QLat_flow | Latent heat input into room (positive if heat gain) [W] |
Modelica definition
Infrared radiation heat exchange between the room facing surfaces
Information
This model computes the infrared radiative heat transfer between the interior
surfaces of a room. Each opaque surface emits radiation according to
Ei = σ Ai εi
(Ti)4,
where
σ
is the Stefan-Boltzmann constant,
Ai
is the surface area,
εi
is the absorptivity in the infrared spectrum, and
Ti
is the surface temperature.
If the parameter linearizeRadidation
is set to true
,
then the term (Ti)4 is replaced with
T03 Ti,
where T0 = 20°C is a parameter.
The incoming radiation at surface i is
Gi = -∑j Fj,i Jj
where
Fj,i
is the view factor from surface
j to surface i,
Jj
is the radiosity leaving surface j
and the sum is over all surfaces.
For opaque surfaces, it follows from the first law
that the radiosity
Ji
is
Ji = -Ei - (1-εi) Gi.
For windows, the outgoing radiosity is an input into this model
because the window model computes this quantity directly.
For each surface i, the heat balance is
0 = Qi + Ji + Gi.
For opaque surfaces, the heat flow rate
Qi
is set to be equal to the heat flow rate at the heat port.
For the glass of the windows, the radiosity outflow at the connector is
set to the radiosity
Gi
that is leaving the surface.
The view factor from surface i to j is approximated as
Fi,j = Aj ⁄ ∑k Ak.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative (Partial model that is used for infrared radiation balance).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
Boolean | linearizeRadiation | | Set to true to linearize emissive power |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Experimental (may be changed in future releases) |
Boolean | sampleModel | false | Set to true to time-sample the model, which can give shorter simulation time if there is already time sampling in the system model |
Connectors
Type | Name | Description |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
input RadiosityInflow | JInConExtWin[NConExtWin] | Incoming radiosity that connects to non-frame part of the window [W] |
output RadiosityOutflow | JOutConExtWin[NConExtWin] | Outgoing radiosity that connects to non-frame part of the window [W] |
Modelica definition
model InfraredRadiationExchange
extends Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative;
constant Boolean homotopyInitialization = true ;
parameter Boolean linearizeRadiation
;
parameter Boolean sampleModel=false
;
HeatTransfer.Interfaces.RadiosityInflow JInConExtWin[NConExtWin]
if haveConExtWin
;
HeatTransfer.Interfaces.RadiosityOutflow JOutConExtWin[NConExtWin]
;
protected
constant Real T30(unit="K3") = 293.15^3 ;
constant Real T40(unit="K4") = 293.15^4 ;
final parameter Integer NOpa=NConExt + 2*NConExtWin + 2*NConPar + NConBou +
NSurBou ;
final parameter Integer nOpa=nConExt + 2*nConExtWin + 2*nConPar + nConBou +
nSurBou ;
final parameter Integer NWin=NConExtWin ;
final parameter Integer nWin=nConExtWin ;
final parameter Integer NTot=NOpa + NWin ;
final parameter Integer nTot=nOpa + nWin ;
final parameter Real epsOpa[nOpa](
each min=0,
each max=1,
each fixed=false) ;
final parameter Real rhoOpa[nOpa](
each min=0,
each max=1,
each fixed=false) ;
final parameter Modelica.SIunits.Area AOpa[nOpa](
each fixed=false)
;
final parameter Modelica.SIunits.Area A[nTot](
each fixed=false)
;
final parameter Real kOpa[nOpa](
each unit="W/K4",
each fixed=false)
;
final parameter Real kOpaInv[nOpa](
each unit="K4/W",
each fixed=false)
;
final parameter Real F[nTot, nTot](
each min=0,
each max=1,
each fixed=false) ;
parameter Modelica.SIunits.Time t0(fixed=false) ;
Buildings.HeatTransfer.Interfaces.RadiosityInflow JInConExtWin_internal[
NConExtWin](start=AConExtWinGla*0.8*Modelica.Constants.sigma*293.15^4,
each fixed=sampleModel
and nConExtWin > 0)
;
Modelica.SIunits.HeatFlowRate J[nTot](
each max=0,
start=-A .* 0.8*Modelica.Constants.sigma*293.15^4,
fixed={sampleModel
and (i <= nOpa
or i > nOpa + nWin)
for i
in 1:nTot},
each nominal=10*0.8*Modelica.Constants.sigma*293.15^4)
;
Modelica.SIunits.HeatFlowRate G[nTot](
each min=0,
start=A .* 0.8*Modelica.Constants.sigma*293.15^4,
each nominal=10*0.8*Modelica.Constants.sigma*293.15^4)
;
Modelica.SIunits.Temperature TOpa[nOpa](
each start=293.15,
each nominal=
293.15) ;
Real T4Opa[nOpa](
each unit="K4",
each start=T40,
each nominal=293.15^4) ;
Modelica.SIunits.HeatFlowRate Q_flow[nTot](
each start=0,
each fixed=
sampleModel) ;
parameter Modelica.SIunits.Temperature T0=293.15
;
final parameter Real T03(
min=0,
unit="K3") = T0^3 ;
Modelica.SIunits.HeatFlowRate sumEBal(start=0, fixed=sampleModel)
;
initial equation
assert(homotopyInitialization, "In " +
getInstanceName() +
": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.",
level = AssertionLevel.warning);
for i
in 1:nConExt
loop
epsOpa[i] = epsConExt[i];
AOpa[i] = AConExt[i];
kOpa[i] = Modelica.Constants.sigma*epsConExt[i]*AOpa[i];
end for;
for i
in 1:nConPar
loop
epsOpa[i + nConExt] = epsConPar_a[i];
AOpa[i + nConExt] = AConPar[i];
kOpa[i + nConExt] = Modelica.Constants.sigma*epsConPar_a[i]*AOpa[i +
nConExt];
epsOpa[i + nConExt + nConPar] = epsConPar_b[i];
AOpa[i + nConExt + nConPar] = AConPar[i];
kOpa[i + nConExt + nConPar] = Modelica.Constants.sigma*epsConPar_b[i]*AOpa[
i + nConExt + nConPar];
end for;
for i
in 1:nConBou
loop
epsOpa[i + nConExt + 2*nConPar] = epsConBou[i];
AOpa[i + nConExt + 2*nConPar] = AConBou[i];
kOpa[i + nConExt + 2*nConPar] = Modelica.Constants.sigma*epsConBou[i]*AOpa[
i + nConExt + 2*nConPar];
end for;
for i
in 1:nSurBou
loop
epsOpa[i + nConExt + 2*nConPar + nConBou] = epsSurBou[i];
AOpa[i + nConExt + 2*nConPar + nConBou] = ASurBou[i];
kOpa[i + nConExt + 2*nConPar + nConBou] = Modelica.Constants.sigma*
epsSurBou[i]*AOpa[i + nConExt + 2*nConPar + nConBou];
end for;
for i
in 1:nConExtWin
loop
epsOpa[i + nConExt + 2*nConPar + nConBou + nSurBou] = epsConExtWinOpa[i];
AOpa[i + nConExt + 2*nConPar + nConBou + nSurBou] = AConExtWinOpa[i];
kOpa[i + nConExt + 2*nConPar + nConBou + nSurBou] = Modelica.Constants.sigma
*epsConExtWinOpa[i]*AOpa[i + nConExt + 2*nConPar + nConBou + nSurBou];
epsOpa[i + nConExt + 2*nConPar + nConBou + nSurBou + nConExtWin] =
epsConExtWinFra[i];
AOpa[i + nConExt + 2*nConPar + nConBou + nSurBou + nConExtWin] =
AConExtWinFra[i];
kOpa[i + nConExt + 2*nConPar + nConBou + nSurBou + nConExtWin] = Modelica.Constants.sigma
*epsConExtWinFra[i]*AOpa[i + nConExt + 2*nConPar + nConBou + nSurBou +
nConExtWin];
end for;
for i
in 1:nOpa
loop
A[i] = AOpa[i];
end for;
for i
in 1:nWin
loop
A[i + nOpa] = AConExtWinGla[i];
end for;
rhoOpa = 1 .- epsOpa;
for i
in 1:nTot
loop
for j
in 1:nTot
loop
F[i, j] = A[j]/
sum((A[k])
for k
in 1:nTot);
end for;
end for;
for i
in 1:nOpa
loop
kOpaInv[i] = 1/kOpa[i];
end for;
for i
in 1:nTot
loop
assert((
abs(1 -
sum(F[i, j]
for j
in 1:nTot))) < 1E-10,
"Program error: Sum 1 of view factors is " +
String(
sum(F[i, j]
for j
in
1:nTot)));
end for;
t0 = time;
equation
connect(JInConExtWin, JInConExtWin_internal);
if not haveConExtWin
then
JInConExtWin_internal =
fill(0, NConExtWin);
end if;
for i
in 1:nConExt
loop
TOpa[i] = conExt[i].T;
end for;
for i
in 1:nConPar
loop
TOpa[i + nConExt] = conPar_a[i].T;
TOpa[i + nConExt + nConPar] = conPar_b[i].T;
end for;
for i
in 1:nConBou
loop
TOpa[i + nConExt + 2*nConPar] = conBou[i].T;
end for;
for i
in 1:nSurBou
loop
TOpa[i + nConExt + 2*nConPar + nConBou] = conSurBou[i].T;
end for;
for i
in 1:nConExtWin
loop
TOpa[i + nConExt + 2*nConPar + nConBou + nSurBou] = conExtWin[i].T;
TOpa[i + nConExt + 2*nConPar + nConBou + nConExtWin + nSurBou] =
conExtWinFra[i].T;
end for;
if sampleModel
then
when sample(t0, 2*60)
then
G = -
transpose(F)*
pre(J);
Q_flow = -
pre(J) - G;
sumEBal =
sum(conExt.Q_flow) +
sum(conPar_a.Q_flow) +
sum(conPar_b.Q_flow)
+
sum(conBou.Q_flow) +
sum(conSurBou.Q_flow) +
sum(conExtWin.Q_flow)
+
sum(conExtWinFra.Q_flow) + (
sum(JInConExtWin_internal) -
sum(
JOutConExtWin));
end when;
else
G = -
transpose(F)*J;
Q_flow = -J - G;
sumEBal =
sum(conExt.Q_flow) +
sum(conPar_a.Q_flow) +
sum(conPar_b.Q_flow)
+
sum(conBou.Q_flow) +
sum(conSurBou.Q_flow) +
sum(conExtWin.Q_flow) +
sum(conExtWinFra.Q_flow) + (
sum(JInConExtWin_internal) -
sum(
JOutConExtWin));
assert(
abs(sumEBal) < 1E-1, "Program error: Energy is not conserved in InfraredRadiationExchange.
Sum of all energy is " +
String(sumEBal));
end if;
for j
in 1:nOpa
loop
T4Opa[j] = (-J[j] - rhoOpa[j]*G[j])*kOpaInv[j];
end for;
if linearizeRadiation
then
TOpa = (T4Opa .+ 3*T40)/(4*T30);
else
if homotopyInitialization
then
TOpa =
homotopy(actual=
Buildings.Utilities.Math.Functions.powerLinearized(
x=T4Opa,
x0=243.15^4,
n=0.25), simplified=(T4Opa .+ 3*T40)/(4*T30));
else
TOpa =
Buildings.Utilities.Math.Functions.powerLinearized(
x=T4Opa,
x0=243.15^4,
n=0.25);
end if;
end if;
for j
in 1:nWin
loop
J[j + nOpa] = -JInConExtWin_internal[j];
G[j + nOpa] = +JOutConExtWin[j];
end for;
for i
in 1:nConExt
loop
Q_flow[i] = conExt[i].Q_flow;
end for;
if nConExt == 0
then
conExt[1].T = T0;
end if;
for i
in 1:nConPar
loop
Q_flow[i + nConExt] = conPar_a[i].Q_flow;
Q_flow[i + nConExt + nConPar] = conPar_b[i].Q_flow;
end for;
if nConPar == 0
then
conPar_a[1].T = T0;
conPar_b[1].T = T0;
end if;
for i
in 1:nConBou
loop
Q_flow[i + nConExt + 2*nConPar] = conBou[i].Q_flow;
end for;
if nConBou == 0
then
conBou[1].T = T0;
end if;
for i
in 1:nSurBou
loop
Q_flow[i + nConExt + 2*nConPar + nConBou] = conSurBou[i].Q_flow;
end for;
if nSurBou == 0
then
conSurBou[1].T = T0;
end if;
for i
in 1:nConExtWin
loop
Q_flow[i + nConExt + 2*nConPar + nConBou + nSurBou] = conExtWin[i].Q_flow;
Q_flow[i + nConExt + 2*nConPar + nConBou + nSurBou + nConExtWin] =
conExtWinFra[i].Q_flow;
end for;
if nConExtWin == 0
then
conExtWin[1].T = T0;
conExtWinFra[1].T = T0;
JOutConExtWin[1] = 0;
end if;
end InfraredRadiationExchange;
Infrared radiative heat gain distribution between the room facing surfaces
Information
This model computes the distribution of the infrared radiant heat gain
to the room surfaces.
The infrared radiant heat gain
Q is an input to this model.
It is distributed to the individual surfaces according to
Qi = Q Ai εi ⁄
∑k Ak εk.
For opaque surfaces, the heat flow rate
Qi
is set to be equal to the heat flow rate at the heat port.
For the glass of the windows, the heat flow rate
Qi is set to the radiosity
Ji
that will strike the glass or the window shade.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative (Partial model that is used for infrared radiation balance).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
Boolean | haveShade | | Set to true if a shade is present |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Connectors
Type | Name | Description |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
input RealInput | uSha[NConExtWin] | Control signal for the shading device (removed if no shade is present) |
input RealInput | Q_flow | Radiative heat input into room (positive if heat gain) |
output RadiosityOutflow | JOutConExtWin[NConExtWin] | Outgoing radiosity that connects to shaded and unshaded part of glass [W] |
Modelica definition
model InfraredRadiationGainDistribution
extends Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative;
parameter Boolean haveShade ;
Modelica.Blocks.Interfaces.RealInput uSha[NConExtWin](
each min=0,
each max=1)
if haveShade
;
Modelica.Blocks.Interfaces.RealInput Q_flow
;
Buildings.HeatTransfer.Interfaces.RadiosityOutflow[NConExtWin] JOutConExtWin
;
protected
Real fraConExt[NConExt] = AEpsConExt*sumAEpsInv
;
Real fraConExtWinOpa[NConExtWin] = AEpsConExtWinOpa*sumAEpsInv
;
Real fraConExtWinGla[NConExtWin] = (AEpsConExtWinSha + AEpsConExtWinUns)*sumAEpsInv
;
Real fraConExtWinFra[NConExtWin] = AEpsConExtWinFra*sumAEpsInv
;
Real fraConPar_a[NConPar] = AEpsConPar_a*sumAEpsInv
;
Real fraConPar_b[NConPar] = AEpsConPar_b*sumAEpsInv
;
Real fraConBou[NConBou] = AEpsConBou*sumAEpsInv
;
Real fraSurBou[NSurBou] = AEpsSurBou*sumAEpsInv
;
parameter Real AEpsConExt[NConExt] = {AConExt[i]*epsConExt[i]
for i
in 1:NConExt}
;
parameter Real AEpsConExtWinOpa[NConExtWin] = {AConExtWinOpa[i]*epsConExtWinOpa[i]
for i
in 1:NConExtWin}
;
Real AEpsConExtWinUns[NConExtWin] = {shaSig[i].yCom * AConExtWinGla[i]*epsConExtWinUns[i]
for i
in 1:NConExtWin}
;
Real AEpsConExtWinSha[NConExtWin] = {shaSig[i].y * AConExtWinGla[i]*epsConExtWinSha[i]
for i
in 1:NConExtWin}
;
parameter Real AEpsConExtWinFra[NConExtWin] = {AConExtWinFra[i]*epsConExtWinFra[i]
for i
in 1:NConExtWin}
;
parameter Real AEpsConPar_a[NConPar] = {AConPar[i]*epsConPar_a[i]
for i
in 1:NConPar}
;
parameter Real AEpsConPar_b[NConPar] = {AConPar[i]*epsConPar_b[i]
for i
in 1:NConPar}
;
parameter Real AEpsConBou[NConBou] = {AConBou[i]*epsConBou[i]
for i
in 1:NConBou}
;
parameter Real AEpsSurBou[NSurBou] = {ASurBou[i]*epsSurBou[i]
for i
in 1:NSurBou}
;
parameter Real sumAEpsNoWin(fixed=false)
;
Real sumAEpsInv
;
Buildings.HeatTransfer.Windows.BaseClasses.ShadingSignal shaSig[NConExtWin](
each final haveShade=haveShade)
;
initial equation
sumAEpsNoWin =
sum(AEpsConExt)+
sum(AEpsConExtWinOpa)+
sum(AEpsConExtWinFra)
+
sum(AEpsConPar_a)+
sum(AEpsConPar_b)+
sum(AEpsConBou)+
sum(AEpsSurBou);
equation
connect(uSha, shaSig.u);
sumAEpsInv = 1.0/(sumAEpsNoWin +
sum(AEpsConExtWinUns) +
sum(AEpsConExtWinSha));
if haveConExt
then
conExt.Q_flow = -fraConExt*Q_flow;
else
conExt[1].T = 293.15;
end if;
if haveConExtWin
then
conExtWin.Q_flow = -fraConExtWinOpa*Q_flow;
else
conExtWin[1].T = 293.15;
end if;
if haveConPar
then
conPar_a.Q_flow = -fraConPar_a*Q_flow;
conPar_b.Q_flow = -fraConPar_b*Q_flow;
else
conPar_a[1].T = 293.15;
conPar_b[1].T = 293.15;
end if;
if haveConBou
then
conBou.Q_flow = -fraConBou*Q_flow;
else
conBou[1].T = 293.15;
end if;
if haveSurBou
then
conSurBou.Q_flow = -fraSurBou*Q_flow;
else
conSurBou[1].T = 293.15;
end if;
JOutConExtWin = +fraConExtWinGla*Q_flow;
if haveConExtWin
then
conExtWinFra.Q_flow = -fraConExtWinFra*Q_flow;
else
conExtWinFra[1].T = 293.15;
end if;
assert(
abs(1 -
sum(fraConExt) -
sum(fraConExtWinOpa)-
sum(fraConExtWinGla) -
sum(fraConExtWinFra)
-
sum(fraConPar_a) -
sum(fraConPar_b)
-
sum(fraConBou) -
sum(fraSurBou)) < 1E-5,
"Programming error: Radiation balance is wrong. Check equations.");
end InfraredRadiationGainDistribution;
Heat and mass balance of the air, assuming completely mixed air
Information
This model computes the heat and mass balance of the air.
The model assumes a completely mixed air volume.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialAirHeatMassBalance (Partial model for heat and mass balance of the air), Buildings.Fluid.Interfaces.LumpedVolumeDeclarations (Declarations for lumped volumes).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
replaceable package Medium | PartialMedium | Medium in the component |
Boolean | haveShade | | Set to true if at least one window has an interior or exterior shade |
Volume | V | | Volume [m3] |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Nominal condition |
MassFlowRate | m_flow_nominal | | Nominal mass flow rate [kg/s] |
Convective heat transfer |
InteriorConvection | conMod | | Convective heat transfer model for opaque constructions |
CoefficientOfHeatTransfer | hFixed | | Constant convection coefficient for opaque constructions [W/(m2.K)] |
Ports |
Boolean | use_C_flow | | Set to true to enable input connector for trace substance |
Dynamics |
Equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance: dynamic (3 initialization options) or steady state |
Dynamics | massDynamics | energyDynamics | Type of mass balance: dynamic (3 initialization options) or steady state |
Real | mSenFac | 1 | Factor for scaling the sensible thermal mass of the volume |
Initialization |
AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
Temperature | T_start | Medium.T_default | Start value of temperature [K] |
MassFraction | X_start[Medium.nX] | Medium.X_default | Start value of mass fractions m_i/m [kg/kg] |
ExtraProperty | C_start[Medium.nC] | fill(0, Medium.nC) | Start value of trace substances |
ExtraProperty | C_nominal[Medium.nC] | fill(1E-2, Medium.nC) | Nominal value of trace substances. (Set to typical order of magnitude.) |
Connectors
Type | Name | Description |
input RealInput | uSha[NConExtWin] | Input connector, used to scale the surface area to take into account an operable shading device, 0: unshaded; 1: fully shaded |
input RealInput | QRadAbs_flow[NConExtWin] | Total net radiation that is absorbed by the shade (positive if absorbed) [W] |
input RealInput | QCon_flow | Convective sensible heat gains of the room |
input RealInput | QLat_flow | Latent heat gains for the room |
output RealOutput | TSha[NConExtWin] | Shade temperature [K] |
VesselFluidPorts_b | ports[nPorts] | Fluid inlets and outlets |
HeatPort_a | heaPorAir | Heat port to air volume |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | glaUns[NConExtWin] | Heat port that connects to room-side surface of unshaded glass |
HeatPort_a | glaSha[NConExtWin] | Heat port that connects to room-side surface of shaded glass |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
input RealInput | C_flow[Medium.nC] | Trace substance mass flow rate added to the room air. Enable if use_C_flow = true |
Modelica definition
model MixedAirHeatMassBalance
extends Buildings.ThermalZones.Detailed.BaseClasses.PartialAirHeatMassBalance;
extends Buildings.Fluid.Interfaces.LumpedVolumeDeclarations;
constant Boolean homotopyInitialization = true ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal(min=0)
;
parameter Buildings.HeatTransfer.Types.InteriorConvection conMod
;
parameter Modelica.SIunits.CoefficientOfHeatTransfer hFixed
;
parameter Boolean use_C_flow
;
Modelica.Blocks.Interfaces.RealInput C_flow[Medium.nC]
if use_C_flow
;
Fluid.MixingVolumes.MixingVolumeMoistAir vol(
redeclare package Medium =
Medium,
final energyDynamics=energyDynamics,
final massDynamics=massDynamics,
final V=V,
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 mSenFac=mSenFac,
final m_flow_nominal = m_flow_nominal,
final prescribedHeatFlowRate = true,
final nPorts=nPorts,
m_flow_small=1E-4*
abs(m_flow_nominal),
allowFlowReversal=true,
final use_C_flow=use_C_flow) ;
HeatTransfer.Convection.Interior convConExt[NConExt](
final A=AConExt,
final til = datConExt.til,
each conMod=conMod,
each hFixed=hFixed,
each final homotopyInitialization=homotopyInitialization)
if haveConExt ;
HeatTransfer.Convection.Interior convConExtWin[NConExtWin](
final A=AConExtWinOpa,
final til = datConExtWin.til,
each conMod=conMod,
each hFixed=hFixed,
each final homotopyInitialization=homotopyInitialization)
if haveConExtWin ;
HeatTransfer.Windows.InteriorHeatTransferConvective convConWin[NConExtWin](
final fFra=datConExtWin.fFra,
final haveExteriorShade={datConExtWin[i].glaSys.haveExteriorShade
for i
in 1:NConExtWin},
final haveInteriorShade={datConExtWin[i].glaSys.haveInteriorShade
for i
in 1:NConExtWin},
final til=datConExtWin.til,
each conMod=conMod,
each hFixed=hFixed,
final A=AConExtWinGla + AConExtWinFra)
if haveConExtWin ;
HeatTransfer.Convection.Interior convConPar_a[nConPar](
final A=AConPar,
final til=Modelica.Constants.pi .- datConPar.til,
each conMod=conMod,
each hFixed=hFixed,
each final homotopyInitialization=homotopyInitialization)
if haveConPar ;
HeatTransfer.Convection.Interior convConPar_b[nConPar](
final A=AConPar,
final til = datConPar.til,
each conMod=conMod,
each hFixed=hFixed,
each final homotopyInitialization=homotopyInitialization)
if haveConPar ;
HeatTransfer.Convection.Interior convConBou[nConBou](
final A=AConBou,
final til = datConBou.til,
each conMod=conMod,
each hFixed=hFixed,
each final homotopyInitialization=homotopyInitialization)
if haveConBou ;
HeatTransfer.Convection.Interior convSurBou[nSurBou](
final A=ASurBou,
final til = surBou.til,
each conMod=conMod,
each hFixed=hFixed,
each final homotopyInitialization=homotopyInitialization)
if haveSurBou ;
protected
constant Modelica.SIunits.SpecificEnergy h_fg=
Buildings.Media.Air.enthalpyOfCondensingGas(273.15+37) ;
Modelica.Blocks.Math.Gain mWat_flow(
final k(unit="kg/J")=1/h_fg,
u(
final unit="W"),
y(
final unit="kg/s")) ;
HeatTransfer.Sources.PrescribedHeatFlow conQCon_flow
;
HeatTransfer.Sources.PrescribedHeatFlow conQLat_flow
;
Modelica.Thermal.HeatTransfer.Components.ThermalCollector theConConExt(
final m=nConExt)
if haveConExt
;
Modelica.Thermal.HeatTransfer.Components.ThermalCollector theConConExtWin(
final m=nConExtWin)
if haveConExtWin
;
Modelica.Thermal.HeatTransfer.Components.ThermalCollector theConConWin(
final m=nConExtWin)
if haveConExtWin
;
Modelica.Thermal.HeatTransfer.Components.ThermalCollector theConConPar_a(
final m=nConPar)
if haveConPar
;
Modelica.Thermal.HeatTransfer.Components.ThermalCollector theConConPar_b(
final m=nConPar)
if haveConPar
;
Modelica.Thermal.HeatTransfer.Components.ThermalCollector theConConBou(
final m=nConBou)
if haveConBou
;
Modelica.Thermal.HeatTransfer.Components.ThermalCollector theConSurBou(
final m=nSurBou)
if haveSurBou
;
initial equation
assert(homotopyInitialization, "In " +
getInstanceName() +
": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.",
level = AssertionLevel.warning);
equation
connect(convConPar_a.fluid,theConConPar_a.port_a);
connect(convConPar_b.fluid,theConConPar_b.port_a);
connect(convConBou.fluid,theConConBou.port_a);
connect(convSurBou.fluid,theConSurBou.port_a);
connect(theConConPar_a.port_b,vol.heatPort);
connect(theConConPar_b.port_b,vol.heatPort);
connect(theConConBou.port_b,vol.heatPort);
connect(theConSurBou.port_b,vol.heatPort);
connect(conExtWinFra,convConWin.frame);
connect(convConExt.solid, conExt);
connect(convConExt.fluid,theConConExt.port_a);
connect(theConConExt.port_b,vol.heatPort);
connect(theConConExtWin.port_b,vol.heatPort);
connect(convConExtWin.fluid,theConConExtWin.port_a);
connect(convConExtWin.solid, conExtWin);
connect(theConConWin.port_b,vol.heatPort);
connect(convConWin.air,theConConWin.port_a);
connect(convConWin.glaSha, glaSha);
connect(convConWin.glaUns, glaUns);
connect(convConPar_a.solid, conPar_a);
connect(convConPar_b.solid, conPar_b);
connect(convConBou.solid, conBou);
connect(convSurBou.solid, conSurBou);
for i
in 1:nPorts
loop
connect(vol.ports[i], ports[i]);
end for;
connect(heaPorAir, vol.heatPort);
connect(uSha, convConWin.uSha);
connect(convConWin.QRadAbs_flow, QRadAbs_flow);
connect(convConWin.TSha, TSha);
connect(conQCon_flow.port, vol.heatPort);
connect(QCon_flow, conQCon_flow.Q_flow);
connect(QLat_flow, mWat_flow.u);
connect(mWat_flow.y, vol.mWat_flow);
connect(conQLat_flow.Q_flow, QLat_flow);
connect(conQLat_flow.port, vol.heatPort);
connect(vol.C_flow, C_flow);
end MixedAirHeatMassBalance;
Partial model for heat and mass balance of the air
Information
This is a partial model that is used to implement the heat and mass balance of the air.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.ConstructionRecords (Data records for construction data).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
Boolean | haveShade | | Set to true if at least one window has an interior or exterior shade |
Volume | V | | Volume [m3] |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the component |
input RealInput | uSha[NConExtWin] | Input connector, used to scale the surface area to take into account an operable shading device, 0: unshaded; 1: fully shaded |
input RealInput | QRadAbs_flow[NConExtWin] | Total net radiation that is absorbed by the shade (positive if absorbed) [W] |
input RealInput | QCon_flow | Convective sensible heat gains of the room |
input RealInput | QLat_flow | Latent heat gains for the room |
output RealOutput | TSha[NConExtWin] | Shade temperature [K] |
VesselFluidPorts_b | ports[nPorts] | Fluid inlets and outlets |
HeatPort_a | heaPorAir | Heat port to air volume |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | glaUns[NConExtWin] | Heat port that connects to room-side surface of unshaded glass |
HeatPort_a | glaSha[NConExtWin] | Heat port that connects to room-side surface of shaded glass |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
Modelica definition
Partial model that is used for infrared radiation balance
Information
This partial model is used as a base class for models that need to exchange
heat with room-facing surfaces. It defines parameters for the surface areas.
The model is used as a base class to implement the convective model, and the various
radiation models.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.ConstructionRecords (Data records for construction data).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Connectors
Type | Name | Description |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
Modelica definition
partial model PartialSurfaceInterface
extends Buildings.ThermalZones.Detailed.BaseClasses.ConstructionRecords;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a conExt[NConExt]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a conExtWin[NConExtWin]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a conExtWinFra[NConExtWin]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a conPar_a[NConPar]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a conPar_b[NConPar]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a conBou[NConBou]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a conSurBou[NSurBou]
;
protected
final parameter Modelica.SIunits.Area AConExt[NConExt] = datConExt.A
;
final parameter Modelica.SIunits.Area AConExtWinOpa[NConExtWin] = datConExtWin.AOpa
;
final parameter Modelica.SIunits.Area AConExtWinGla[NConExtWin] = (1 .- datConExtWin.fFra) .* datConExtWin.AWin
;
final parameter Modelica.SIunits.Area AConExtWinFra[NConExtWin] = datConExtWin.fFra .* datConExtWin.AWin
;
final parameter Modelica.SIunits.Area AConPar[NConPar] = datConPar.A
;
final parameter Modelica.SIunits.Area AConBou[NConBou] = datConBou.A
;
final parameter Modelica.SIunits.Area ASurBou[NSurBou] = surBou.A
;
protected
function checkSurfaceAreas
input Integer n ;
input Modelica.SIunits.Area A[:] ;
input String name ;
algorithm
if n == 0
then
assert(
Modelica.Math.Vectors.norm(v=A, p=1) < 1E-10,
"Error in declaration of room model: Construction record '" +
name +
"' has the following areas: " +
Modelica.Math.Vectors.toString(A) +
"However, the room model is declared as having zero surfaces.
Check the parameters of the room model.");
else
for i
in 1:n
loop
assert(A[i] > 0, "Error in declaration of room model: Construction record '" + name + "' has the following areas: " +
Modelica.Math.Vectors.toString(A) +
"However, the surface areas must be bigger than zero.
Check the parameters of the room model.");
end for;
end if;
end checkSurfaceAreas;
initial algorithm
checkSurfaceAreas(nConExt, datConExt.A, "datConExt");
checkSurfaceAreas(nConExtWin, datConExtWin.AWin, "datConExtWin");
checkSurfaceAreas(nConPar, datConPar.A, "datConPar");
checkSurfaceAreas(nConBou, datConBou.A, "datConBou");
checkSurfaceAreas(nSurBou, surBou.A, "surBou");
end PartialSurfaceInterface;
Partial model that is used for infrared radiation balance
Information
This partial model is used as a base class for models that need to exchange
heat with room-facing surfaces by radiation. It declares parameters that are
needed for the radiative balance.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterface (Partial model that is used for infrared radiation balance).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Connectors
Type | Name | Description |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
Modelica definition
Model to connect between signals and heat port for radiative gains of the room
Information
This model can be used as a thermal adapter in situations where the temperature
and the heat flow rate are computed in separate models.
For example, this thermal adapter is used in the room model, which computes
the distribution of radiative heat gains (such as due to a radiator) in
Buildings.ThermalZones.Detailed.BaseClasses.InfraredRadiationGainDistribution
and computes the radiative temperature in
Buildings.ThermalZones.Detailed.BaseClasses.RadiationTemperature.
This adapter combines the heat flow rate and the temperatures that are computed in these
separate models, and exposes these two quantities at its heat port.
Extends from Buildings.BaseClasses.BaseIcon (Base icon).
Connectors
Type | Name | Description |
HeatPort_a | rad | Port for radiative heat gain and radiation temperature |
input RealInput | TRad | Radiation temperature of room |
output RealOutput | QRad_flow | Radiative heat gain |
Modelica definition
Radiative temperature of the room
Information
This model computes the radiative temperature in the room.
For a room with windows but no shade, the radiative temperature is
computed as
Trad = ∑i (Ai εi Ti)
⁄
∑i (Ai εi)
where
Trad is the radiative temperature of the room,
Ai are the surface areas of the room,
εi are the infrared emissivities of the surfaces, and
Ti are the surface temperatures.
If a the windows have a shade, then the equation is modified to take the actual shaded and non-shaded
surface area into account. In this situation, the shaded part of a window has a infrared radiative power
of
E = A ( u εs Ts +
(1-u) εg τs Tgs)
where
A is the surface area of the glass,
u is the control signal of the shade,
εs is the infrared absorptivity of the shade,
Ts is the temperature of the shade,
εg is the infrared absorptivity of the glass,
τs is the infrared transmittance of the shade, and
Tgs is the glass temperature behind the shade.
For the unshaded part of the window, the radiative power is
E = A (1-u) εg Tgn
where
Tgn is the glass temperature of the non-shaded part of the window.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative (Partial model that is used for infrared radiation balance).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
Boolean | haveShade | | Set to true if the windows have a shade |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Connectors
Type | Name | Description |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
HeatPort_a | glaUns[NConExtWin] | Heat port that connects to room-side surface of unshaded glass |
HeatPort_a | glaSha[NConExtWin] | Heat port that connects to room-side surface of shaded glass |
HeatPort_a | sha[NConExtWin] | Heat port that connects to shade |
input RealInput | uSha[NConExtWin] | Control signal for the shading device (removed if no shade is present) |
output RealOutput | TRad | Radiative temperature [K] |
Modelica definition
model RadiationTemperature
extends Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a glaUns[NConExtWin]
if haveConExtWin
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a glaSha[NConExtWin]
if haveShade ;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a sha[NConExtWin]
if haveShade ;
parameter Boolean haveShade ;
Modelica.Blocks.Interfaces.RealInput uSha[NConExtWin](
each min=0,
each max=1)
if haveShade
;
Modelica.Blocks.Interfaces.RealOutput TRad(min=0, unit="K", displayUnit="degC")
;
protected
final parameter Integer NOpa = NConExt+2*NConExtWin+2*NConPar+NConBou+NSurBou
;
final parameter Integer NWin = NConExtWin ;
final parameter Integer NTot = NOpa + NWin ;
final parameter Modelica.SIunits.Area AGla[NWin] = datConExtWin.AGla
;
final parameter Real epsGla[NWin](
each min=0,
each max=1)=
{datConExtWin[i].glaSys.glass[
size(datConExtWin[i].glaSys.glass, 1)].absIR_b
for i
in 1:NWin}
;
final parameter Real epsSha[NWin](
each min=0,
each max=1)=
{datConExtWin[i].glaSys.shade.absIR_a
for i
in 1:NWin}
;
final parameter Real tauSha[NWin](
each min=0,
each max=1)=
{(
if datConExtWin[i].glaSys.haveInteriorShade
then
datConExtWin[i].glaSys.shade.tauIR_a
else 1)
for i
in 1:NWin}
;
final parameter Modelica.SIunits.Area epsAOpa[NOpa](
each fixed=false)
;
final parameter Modelica.SIunits.Area epsAGla[NWin](
each fixed=false)
;
final parameter Modelica.SIunits.Area epsASha[NWin](
each fixed=false)
;
final parameter Modelica.SIunits.Area epsTauASha[NWin](
each fixed=false)
;
Modelica.SIunits.Temperature TOpa[NOpa](
each start=293.15,
each nominal=293.15)
;
Modelica.SIunits.Temperature TGlaUns[NWin](
each start=293.15,
each nominal=293.15)
;
Modelica.SIunits.Temperature TGlaSha[NWin](
each start=293.15,
each nominal=293.15)
;
Modelica.SIunits.Temperature TSha[NWin](
each start=293.15,
each nominal=293.15)
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a glaUns_internal[NConExtWin]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a glaSha_internal[NConExtWin]
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a sha_internal[NConExtWin]
;
Modelica.Blocks.Interfaces.RealInput uSha_internal[NConExtWin](
each min=0,
each max=1)
;
initial equation
for i
in 1:NConExt
loop
epsAOpa[i] = epsConExt[i] * AConExt[i];
end for;
for i
in 1:NConPar
loop
epsAOpa[i+NConExt] = epsConPar_a[i] * AConPar[i];
epsAOpa[i+NConExt+NConPar] = epsConPar_b[i] * AConPar[i];
end for;
for i
in 1:NConBou
loop
epsAOpa[i+NConExt+2*NConPar] = epsConBou[i] * AConBou[i];
end for;
for i
in 1:NSurBou
loop
epsAOpa[i+NConExt+2*NConPar+NConBou] = epsSurBou[i] * ASurBou[i];
end for;
for i
in 1:NConExtWin
loop
epsAOpa[i+NConExt+2*NConPar+NConBou+NSurBou] = epsConExtWinOpa[i] * AConExtWinOpa[i];
epsAOpa[i+NConExt+2*NConPar+NConBou+NSurBou+NConExtWin] = epsConExtWinFra[i] * AConExtWinFra[i];
end for;
for i
in 1:NConExtWin
loop
epsAGla[i] = AGla[i] * epsGla[i];
epsASha[i] = AGla[i] * epsSha[i];
epsTauASha[i] = AGla[i] * epsGla[i] * tauSha[i];
end for;
equation
connect(glaUns, glaUns_internal);
connect(glaSha, glaSha_internal);
connect(sha, sha_internal);
connect(uSha, uSha_internal);
if not haveConExtWin
then
glaUns_internal.T =
fill(293.15, NConExtWin);
end if;
if not haveShade
then
glaSha_internal.T =
fill(293.15, NConExtWin);
sha_internal.T =
fill(293.15, NConExtWin);
uSha_internal =
fill(0, NConExtWin);
end if;
for i
in 1:NConExt
loop
TOpa[i] = conExt[i].T;
end for;
for i
in 1:NConPar
loop
TOpa[i+NConExt] = conPar_a[i].T;
TOpa[i+NConExt+NConPar] = conPar_b[i].T;
end for;
for i
in 1:NConBou
loop
TOpa[i+NConExt+2*NConPar] = conBou[i].T;
end for;
for i
in 1:NSurBou
loop
TOpa[i+NConExt+2*NConPar+NConBou] = conSurBou[i].T;
end for;
for i
in 1:NConExtWin
loop
TOpa[i+NConExt+2*NConPar+NConBou+NSurBou] = conExtWin[i].T;
TOpa[i+NConExt+2*NConPar+NConBou+NConExtWin+NSurBou] = conExtWinFra[i].T;
end for;
for i
in 1:NConExtWin
loop
TGlaUns[i] = glaUns_internal[i].T;
TGlaSha[i] = glaSha_internal[i].T;
TSha[i] = sha_internal[i].T;
end for;
if haveShade
then
TRad = (
sum(epsAOpa[i] * TOpa[i]
for i
in 1:NOpa)
+
sum(
( uSha_internal[i] * (epsASha[i] * TSha[i] + epsTauASha[i] * TGlaSha[i]) +
(1-uSha_internal[i]) * epsAGla[i] * TGlaUns[i])
for i
in 1:NConExtWin)) /
(
sum(epsAOpa) +
sum(
( uSha_internal[i] * (epsASha[i] + epsTauASha[i]) + (1-uSha_internal[i]) * epsAGla[i])
for i
in 1:NConExtWin));
else
TRad = (
sum(epsAOpa[i] * TOpa[i]
for i
in 1:NOpa) +
sum(epsAGla .* TGlaUns)) / (
sum(epsAOpa) +
sum(epsAGla));
end if;
if haveConExt
then
for i
in 1:NConExt
loop
0 = conExt[i].Q_flow;
end for;
else
conExt[1].T = 293.15;
end if;
if haveConPar
then
for i
in 1:NConPar
loop
0 = conPar_a[i].Q_flow;
0 = conPar_b[i].Q_flow;
end for;
else
conPar_a[1].T = 293.15;
conPar_b[1].T = 293.15;
end if;
if haveConBou
then
for i
in 1:NConBou
loop
0 = conBou[i].Q_flow;
end for;
else
conBou[1].T = 293.15;
end if;
if haveSurBou
then
for i
in 1:NSurBou
loop
0 = conSurBou[i].Q_flow;
end for;
else
conSurBou[1].T = 293.15;
end if;
if haveConExtWin
then
for i
in 1:NConExtWin
loop
0 = conExtWin[i].Q_flow;
0 = conExtWinFra[i].Q_flow;
end for;
else
conExtWin[1].T = 293.15;
conExtWinFra[1].T = 293.15;
end if;
end RadiationTemperature;
Base model for a room
Information
Partial model for a room heat and mass balance.
This is the base class for
Buildings.ThermalZones.Detailed.CFD
and for
Buildings.ThermalZones.Detailed.MixedAir
See
Buildings.ThermalZones.Detailed.UsersGuide
for detailed explanations.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.ConstructionRecords (Data records for construction data).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
Angle | lat | | Latitude [rad] |
Area | AFlo | | Floor area [m2] |
Length | hRoo | | Average room height [m] |
Boolean | linearizeRadiation | true | Set to true to linearize emissive power |
PartialAirHeatMassBalance | air | redeclare BaseClasses.Partia... | Convective heat and mass balance of air |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Convective heat transfer |
InteriorConvection | intConMod | Buildings.HeatTransfer.Types... | Convective heat transfer model for room-facing surfaces of opaque constructions |
CoefficientOfHeatTransfer | hIntFixed | 3.0 | Constant convection coefficient for room-facing surfaces of opaque constructions [W/(m2.K)] |
ExteriorConvection | extConMod | Buildings.HeatTransfer.Types... | Convective heat transfer model for exterior facing surfaces of opaque constructions |
CoefficientOfHeatTransfer | hExtFixed | 10.0 | Constant convection coefficient for exterior facing surfaces of opaque constructions [W/(m2.K)] |
Nominal condition |
MassFlowRate | m_flow_nominal | V*1.2/3600 | Nominal mass flow rate [kg/s] |
Dynamics |
Glazing system |
Boolean | steadyStateWindow | false | Set to false to add thermal capacity at window, which generally leads to faster simulation |
Experimental (may be changed in future releases) |
Boolean | sampleModel | false | Set to true to time-sample the model, which can give shorter simulation time if there is already time sampling in the system model |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the component |
VesselFluidPorts_b | ports[nPorts] | Fluid inlets and outlets |
HeatPort_a | heaPorAir | Heat port to air volume |
HeatPort_a | heaPorRad | Heat port for radiative heat gain and radiative temperature |
input RealInput | uWin[nConExtWin] | Control signal for window state (used for electrochromic windows, removed otherwise) [1] |
HeatPort_a | surf_conBou[nConBou] | Heat port at surface b of construction conBou |
HeatPort_a | surf_surBou[nSurBou] | Heat port of surface that is connected to the room air |
input RealInput | qGai_flow[3] | Radiant, convective and latent heat input into room (positive if heat gain) [W/m2] |
Bus | weaBus | Weather data |
Modelica definition
partial model RoomHeatMassBalance
extends Buildings.ThermalZones.Detailed.BaseClasses.ConstructionRecords;
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
constant Boolean homotopyInitialization = true ;
parameter Integer nPorts=0 ;
Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts](
redeclare each package Medium =
Medium) ;
parameter Modelica.SIunits.Angle lat ;
final parameter Modelica.SIunits.Volume V=AFlo*hRoo ;
parameter Modelica.SIunits.Area AFlo ;
parameter Modelica.SIunits.Length hRoo ;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorAir
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorRad
;
Constructions.Construction conExt[NConExt](
final A=datConExt.A,
final til=datConExt.til,
final layers=datConExt.layers,
final steadyStateInitial=datConExt.steadyStateInitial,
final T_a_start=datConExt.T_a_start,
final T_b_start=datConExt.T_b_start,
final stateAtSurface_a = datConExt.stateAtSurface_a,
final stateAtSurface_b = datConExt.stateAtSurface_b)
if haveConExt
;
Constructions.ConstructionWithWindow conExtWin[NConExtWin](
final A=datConExtWin.A,
final til=datConExtWin.til,
final layers=datConExtWin.layers,
final steadyStateInitial=datConExtWin.steadyStateInitial,
final T_a_start=datConExtWin.T_a_start,
final T_b_start=datConExtWin.T_b_start,
final AWin=datConExtWin.AWin,
final fFra=datConExtWin.fFra,
final glaSys=datConExtWin.glaSys,
each final homotopyInitialization=homotopyInitialization,
each final linearizeRadiation=linearizeRadiation,
each final steadyStateWindow=steadyStateWindow,
final stateAtSurface_a = datConExtWin.stateAtSurface_a,
final stateAtSurface_b = datConExtWin.stateAtSurface_b)
if haveConExtWin
;
Constructions.Construction conPar[NConPar](
A=datConPar.A,
til=datConPar.til,
final layers=datConPar.layers,
steadyStateInitial=datConPar.steadyStateInitial,
T_a_start=datConPar.T_a_start,
T_b_start=datConPar.T_b_start,
final stateAtSurface_a = datConPar.stateAtSurface_a,
final stateAtSurface_b = datConPar.stateAtSurface_b)
if haveConPar
;
Constructions.Construction conBou[NConBou](
A=datConBou.A,
til=datConBou.til,
final layers=datConBou.layers,
steadyStateInitial=datConBou.steadyStateInitial,
T_a_start=datConBou.T_a_start,
T_b_start=datConBou.T_b_start,
final stateAtSurface_a = datConBou.stateAtSurface_a,
final stateAtSurface_b = datConBou.stateAtSurface_b)
if haveConBou
;
parameter Boolean linearizeRadiation=true
;
parameter Boolean steadyStateWindow = false
;
parameter Buildings.HeatTransfer.Types.InteriorConvection intConMod=Buildings.HeatTransfer.Types.InteriorConvection.Temperature
;
parameter Modelica.SIunits.CoefficientOfHeatTransfer hIntFixed=3.0
;
parameter Buildings.HeatTransfer.Types.ExteriorConvection extConMod=Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind
;
parameter Modelica.SIunits.CoefficientOfHeatTransfer hExtFixed=10.0
;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal(min=0) = V*1.2/3600
;
parameter Boolean sampleModel = false
;
Modelica.Blocks.Interfaces.RealInput uWin[nConExtWin](
each min=0,
each max=1,
each unit="1")
if haveControllableWindow
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a surf_conBou[nConBou]
if haveConBou ;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a surf_surBou[nSurBou]
if haveSurBou ;
Modelica.Blocks.Interfaces.RealInput qGai_flow[3](
each unit="W/m2")
;
BaseClasses.ExteriorBoundaryConditions bouConExt(
final nCon=nConExt,
final lat=lat,
linearizeRadiation=linearizeRadiation,
final conMod=extConMod,
final conPar=datConExt,
final hFixed=hExtFixed)
if haveConExt
;
BaseClasses.ExteriorBoundaryConditionsWithWindow bouConExtWin(
final nCon=nConExtWin,
final lat=lat,
final conPar=datConExtWin,
linearizeRadiation=linearizeRadiation,
final conMod=extConMod,
final hFixed=hExtFixed)
if haveConExtWin
;
HeatTransfer.Windows.BaseClasses.WindowRadiation conExtWinRad[NConExtWin](
final AWin=(1 .- datConExtWin.fFra) .* datConExtWin.AWin,
final N={
size(datConExtWin[i].glaSys.glass, 1)
for i
in 1:NConExtWin},
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 ;
BoundaryConditions.WeatherData.Bus weaBus ;
replaceable BaseClasses.PartialAirHeatMassBalance air
constrainedby BaseClasses.PartialAirHeatMassBalance(
redeclare final package Medium =
Medium,
nPorts=nPorts,
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,
final V=V) ;
Buildings.ThermalZones.Detailed.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[
size(datConExtWin[i].glaSys.glass, 1)].tauSol[1]
for i
in 1:NConExtWin})
if haveConExtWin ;
Buildings.ThermalZones.Detailed.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)
;
Buildings.ThermalZones.Detailed.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,
final homotopyInitialization = homotopyInitialization,
final sampleModel = sampleModel)
;
Buildings.ThermalZones.Detailed.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) ;
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[
size(datConExtWin[i].glaSys.glass, 1)].absIR_b)
for i
in 1:NConExtWin},
final tauIR_air=tauIRSha_air,
final tauIR_glass=tauIRSha_glass,
each final linearize = linearizeRadiation,
each final homotopyInitialization=homotopyInitialization)
if haveShade ;
protected
final parameter Modelica.SIunits.TransmissionCoefficient tauIRSha_air[NConExtWin]=
datConExtWin.glaSys.shade.tauIR_a
;
final parameter Modelica.SIunits.TransmissionCoefficient tauIRSha_glass[NConExtWin]=
datConExtWin.glaSys.shade.tauIR_b
;
final parameter Boolean haveControllableWindow=
Modelica.Math.BooleanVectors.anyTrue(
{datConExtWin[i].glaSys.haveControllableWindow
for i
in 1:NConExtWin})
;
final parameter Boolean haveExteriorShade[NConExtWin]=
{datConExtWin[i].glaSys.haveExteriorShade
for i
in 1:NConExtWin}
;
final parameter Boolean haveInteriorShade[NConExtWin]=
{datConExtWin[i].glaSys.haveInteriorShade
for i
in 1:NConExtWin}
;
final parameter Boolean haveShade=
Modelica.Math.BooleanVectors.anyTrue(haveExteriorShade[:])
or
Modelica.Math.BooleanVectors.anyTrue(haveInteriorShade[:])
;
final parameter Boolean isFloorConExt[NConExt]=
datConExt.isFloor ;
final parameter Boolean isFloorConExtWin[NConExtWin]=
datConExtWin.isFloor ;
final parameter Boolean isFloorConPar_a[NConPar]=
datConPar.isFloor ;
final parameter Boolean isFloorConPar_b[NConPar]=
datConPar.isCeiling ;
final parameter Boolean isFloorConBou[NConBou]=
datConBou.isFloor
;
parameter Boolean isFloorSurBou[NSurBou]=
surBou.isFloor
;
HeatTransfer.Windows.BaseClasses.ShadingSignal shaSig[NConExtWin](
each final haveShade=haveShade)
if haveConExtWin ;
Buildings.ThermalZones.Detailed.BaseClasses.HeatGain heaGai(
final AFlo=AFlo)
;
Buildings.ThermalZones.Detailed.BaseClasses.RadiationAdapter radiationAdapter;
Modelica.Blocks.Math.Add add;
Modelica.Blocks.Math.Add sumJToWin[NConExtWin](
each final k1=1,
each final k2=1)
if haveConExtWin
;
HeatTransfer.Radiosity.RadiositySplitter radShaOut[NConExtWin]
if haveConExtWin
;
Modelica.Blocks.Math.Sum sumJFroWin[NConExtWin](
each nin=
if haveShade
then 2
else 1)
if haveConExtWin ;
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TSha[NConExtWin]
if haveShade ;
initial equation
assert(homotopyInitialization, "In " +
getInstanceName() +
": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.",
level = AssertionLevel.warning);
equation
connect(conBou.opa_a, surf_conBou);
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(conExtWin.QAbsSha_flow, conExtWinRad.QAbsGlaSha_flow);
connect(conExtWinRad.QAbsGlaUns_flow, conExtWin.QAbsUns_flow);
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(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.JInDifConExtWin, conExtWinRad.QTraDif_flow);
connect(solRadExc.HOutConExtWin,conExtWinRad.HRoo);
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(add.y, irRadGai.Q_flow);
connect(irRadExc.JOutConExtWin, sumJToWin.u1);
connect(irRadGai.JOutConExtWin, sumJToWin.u2);
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(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(shaRad.QRadAbs_flow,air. QRadAbs_flow);
connect(air.TSha, shaRad.TSha);
connect(air.heaPorAir, heaPorAir);
connect(air.TSha, TSha.T);
connect(uWin, conExtWinRad.uSta);
connect(qGai_flow,heaGai. qGai_flow);
connect(air.QCon_flow,heaGai. QCon_flow);
connect(air.QLat_flow,heaGai. QLat_flow);
connect(heaGai.QRad_flow, add.u2);
connect(conExtWinRad.QTraDir_flow, solRadExc.JInDirConExtWin);
end RoomHeatMassBalance;
Radiative heat exchange with the sky and the ambient
Information
This model computes the infrared radiative heat flow
between exterior building surfaces and the ambient. The ambient consists
of the sky black-body radiation and the outdoor temperature
(which is used as an approximation to the surface temperature of
the ground and neighboring buildings).
Extends from Buildings.BaseClasses.BaseIcon (Base icon).
Parameters
Type | Name | Default | Description |
Integer | n | | Number of constructions |
Area | A[n] | | Area of exterior constructions [m2] |
Real | vieFacSky[n] | | View factor to sky (=1 for roofs) |
Emissivity | absIR[n] | | Infrared absorptivity of building surface [1] |
Connectors
Type | Name | Description |
HeatPort_a | port[n] | Heat port |
input RealInput | TOut | Outside air temperature [K] |
input RealInput | TBlaSky | Black body sky temperature [K] |
Modelica definition
Solar radiation heat exchange between the room facing surfaces
Information
This model computes the distribution of the solar radiation gain
to the room surfaces.
Let
Nw
denote the number of windows,
Nf
the number of floor elements and
Nn
the number of non-floor elements such as ceiling, wall and window elements.
Input to the model are the diffuse and direct solar radiosities
Jidif, i ∈ {1, … , Nw}
and
Jidir, i ∈ {1, … , Nw}
that were transmitted through the window.
The total incoming solar radiation is therefore for the diffuse irradiation
Hdif = ∑i=1Nw
Jdifi
and for the direct irradiation
Hdir = ∑i=1Nw
Jdiri.
It is assumed that the diffuse irradiation is distributed to all
surfaces proportionally to the product of surface emissivity plus transmissivity
(which generally is zero except for windows) times the area.
For the direct irradiation, it is assumed that it
first hits the floor where some of it is absorbed,
and some of it is diffusely reflected to all other surfaces. Only the first
reflection is taken into account and the location of the floor patch
relative to the window is neglected.
Hence, the diffuse radiation that is absorbed by each area is
Qidif = Hdif (εi+τi) Ai
⁄ ∑j=1N Aj,
where the sum is over all areas. Hence, this calculation treats the wall
that contains the window identical as any other construction, which is
a simplification.
Similarly, the direct radiation that is
absorbed by each floor patch i ∈ {1, …, Nf},
and may be partially transmitted in
the unusual case that the floor contains a window, is
Qidir = Hdir (εi+τi) Ai
⁄ ∑j=1Nf Aj.
The sum of the direct radiation that is reflected by the floor is therefore
Jf = Hdir
∑i=1Nf
(1-εi-τi) Ai
⁄ ∑j=1Nf Aj.
This reflected radiosity is then distributed to all non-floor areas
i ∈ {1, …, Nn}
using
Qidir = Jf
Ai (εi+τi)
⁄
∑k=1Nn
Ak (εk+τk)
The heat flow rate that is absorbed by each surface is
Qi = Qidif + Qidir.
For opaque surfaces, the heat flow rate
Qi
is set to be equal to the heat flow rate at the heat port.
For the glass of the windows, the heat flow rate
Qi is set to the radiosity
Jouti
that will strike the glass or the window shade as diffuse solar
radiation.
Main assumptions
The main assumptions or simplifications are that the shaded and unshaded part of the window
have the same solar absorbtance.
Furthermore, if the room has electrochromic windows, the optical properties
are taken from the state 1, which generally is
the uncontrolled state. The error should be small as in the controlled state,
there is little solar radiation entering the room, and with this simplification,
the main error is that the radiation that is reflected in the room and hits the
window is larger than it otherwise would be.
This simplification allows lumping the solar distribution into
a parameter.
The model also assumes that all radiation first hits the floor from
which it is diffusely distributed to the other surfaces.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative (Partial model that is used for infrared radiation balance).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
Boolean | isFloorConExt[NConExt] | | Flag to indicate if floor for exterior constructions |
Boolean | isFloorConExtWin[NConExtWin] | | Flag to indicate if floor for constructions |
Boolean | isFloorConPar_a[NConPar] | | Flag to indicate if floor for constructions |
Boolean | isFloorConPar_b[NConPar] | | Flag to indicate if floor for constructions |
Boolean | isFloorConBou[NConBou] | | Flag to indicate if floor for constructions with exterior boundary conditions exposed to outside of room model |
Boolean | isFloorSurBou[NSurBou] | | Flag to indicate if floor for constructions that are modeled outside of this room |
Emissivity | tauGla[NConExtWin] | | Transmissivity of window [1] |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Connectors
Type | Name | Description |
HeatPort_a | conExt[NConExt] | Heat port that connects to room-side surface of exterior constructions |
HeatPort_a | conExtWin[NConExtWin] | Heat port that connects to room-side surface of exterior constructions that contain a window |
HeatPort_a | conExtWinFra[NConExtWin] | Heat port that connects to room-side surface of window frame |
HeatPort_a | conPar_a[NConPar] | Heat port that connects to room-side surface a of partition constructions |
HeatPort_a | conPar_b[NConPar] | Heat port that connects to room-side surface b of partition constructions |
HeatPort_a | conBou[NConBou] | Heat port that connects to room-side surface of constructions that expose their other surface to the outside |
HeatPort_a | conSurBou[NSurBou] | Heat port to surfaces of models that compute the heat conduction outside of this room |
input RealInput | JInDifConExtWin[NConExtWin] | Diffuse solar radiation transmitted by window per unit area [W] |
input RealInput | JInDirConExtWin[NConExtWin] | Direct solar radiation transmitted by window per unit area [W] |
output RealOutput | HOutConExtWin[NConExtWin] | Outgoing solar radiation that strikes window per unit area [W/m2] |
Modelica definition
model SolarRadiationExchange
extends Buildings.ThermalZones.Detailed.BaseClasses.PartialSurfaceInterfaceRadiative
(
final epsConExt = datConExt.layers.absSol_b,
final epsConExtWinOpa = datConExtWin.layers.absSol_b,
final epsConExtWinUns={(1-datConExtWin[i].glaSys.glass[
size(datConExtWin[i].glaSys.glass, 1)].tauSol[1]
-datConExtWin[i].glaSys.glass[
size(datConExtWin[i].glaSys.glass, 1)].rhoSol_b[1])
for i
in 1:NConExtWin},
final epsConExtWinSha = {(1-datConExtWin[i].glaSys.glass[
size(datConExtWin[i].glaSys.glass, 1)].tauSol[1]
-datConExtWin[i].glaSys.glass[
size(datConExtWin[i].glaSys.glass, 1)].rhoSol_b[1])
for i
in 1:NConExtWin},
final epsConExtWinFra = datConExtWin.glaSys.absSolFra,
final epsConPar_a = datConPar.layers.absSol_a,
final epsConPar_b = datConPar.layers.absSol_b,
final epsConBou = datConBou.layers.absSol_b,
final epsSurBou = surBou.absSol);
parameter Boolean isFloorConExt[NConExt]
;
parameter Boolean isFloorConExtWin[NConExtWin]
;
parameter Boolean isFloorConPar_a[NConPar]
;
parameter Boolean isFloorConPar_b[NConPar]
;
parameter Boolean isFloorConBou[NConBou]
;
parameter Boolean isFloorSurBou[NSurBou]
;
parameter Modelica.SIunits.Emissivity tauGla[NConExtWin]
;
Modelica.Blocks.Interfaces.RealInput JInDifConExtWin[NConExtWin](
each unit="W")
;
Modelica.Blocks.Interfaces.RealInput JInDirConExtWin[NConExtWin](
each unit="W")
;
Modelica.Blocks.Interfaces.RealOutput HOutConExtWin[NConExtWin](
each unit="W/m2")
;
Modelica.SIunits.HeatFlowRate JOutConExtWin[NConExtWin]
;
protected
final parameter Real kDir1(unit="1", fixed=false)
;
final parameter Real kDir2(fixed=false)
;
Modelica.SIunits.HeatFlowRate Q_flow[NTot]
;
final parameter Integer NOpa = NConExt+2*NConExtWin+2*NConPar+NConBou+NSurBou
;
final parameter Integer NWin = NConExtWin ;
final parameter Integer NTot = NOpa + NWin ;
final parameter Boolean isFlo[NTot](
each fixed=false)
;
final parameter Real eps[NTot](
each min=0,
each max=1,
each fixed=false)
;
final parameter Real tau[NTot](
each min=0,
each max=1,
each fixed=false)
;
final parameter Modelica.SIunits.Area AFlo(fixed=false) ;
final parameter Modelica.SIunits.Area A[NTot](
each fixed=false) ;
final parameter Real kDif[NTot](
each unit="1",
each fixed=false)
;
final parameter Real kDir[NTot](
each unit="1",
each fixed=false)
;
final parameter Real epsTauA[NTot](
each unit="m2",
each fixed=false) ;
final parameter Real sumEpsTauA(unit="m2", fixed=false)
;
initial equation
for i
in 1:NConExt
loop
eps[i] = epsConExt[i];
A[i] = AConExt[i];
isFlo[i] = isFloorConExt[i];
end for;
for i
in 1:NConPar
loop
eps[i+NConExt] = epsConPar_a[i];
A[i+NConExt] = AConPar[i];
isFlo[i+NConExt] = isFloorConPar_a[i];
eps[i+NConExt+NConPar] = epsConPar_b[i];
A[i+NConExt+NConPar] = AConPar[i];
isFlo[i+NConExt+NConPar] = isFloorConPar_b[i];
end for;
for i
in 1:NConBou
loop
eps[i+NConExt+2*NConPar] = epsConBou[i];
A[i+NConExt+2*NConPar] = AConBou[i];
isFlo[i+NConExt+2*NConPar] = isFloorConBou[i];
end for;
for i
in 1:NSurBou
loop
eps[i+NConExt+2*NConPar+NConBou] = epsSurBou[i];
A[i+NConExt+2*NConPar+NConBou] = ASurBou[i];
isFlo[i+NConExt+2*NConPar+NConBou] = isFloorSurBou[i];
end for;
for i
in 1:NConExtWin
loop
eps[i+NConExt+2*NConPar+NConBou+NSurBou] = epsConExtWinOpa[i];
A[i+NConExt+2*NConPar+NConBou+NSurBou] = AConExtWinOpa[i];
isFlo[i+NConExt+2*NConPar+NConBou+NSurBou] = isFloorConExtWin[i];
eps[i+NConExt+2*NConPar+NConBou+NSurBou+NConExtWin] = epsConExtWinFra[i];
A[i+NConExt+2*NConPar+NConBou+NSurBou+NConExtWin] = AConExtWinFra[i];
isFlo[i+NConExt+2*NConPar+NConBou+NSurBou+NConExtWin] = isFloorConExtWin[i];
end for;
for i
in 1:NConExtWin
loop
eps[i+NConExt+2*NConPar+NConBou+NSurBou+2*NConExtWin] = epsConExtWinUns[i];
isFlo[i+NConExt+2*NConPar+NConBou+NSurBou+2*NConExtWin] = isFloorConExtWin[i];
A[i+NConExt+2*NConPar+NConBou+NSurBou+2*NConExtWin] = AConExtWinGla[i];
end for;
for i
in 1:NOpa
loop
tau[i] = 0;
end for;
for i
in 1:NWin
loop
tau[NOpa+i] = tauGla[i];
end for;
AFlo =
sum( (
if isFlo[i]
then A[i]
else 0)
for i
in 1:NTot);
epsTauA = (eps .+ tau).*A;
sumEpsTauA =
sum(epsTauA[i]
for i
in 1:NTot);
for i
in 1:NTot
loop
kDif[i] = (eps[i] + tau[i])*A[i]/sumEpsTauA;
end for;
kDir1 =
sum((
if isFlo[i]
then (A[i]*(1 - eps[i] - tau[i]))
else 0)
for i
in 1:
NTot)/
max(1E-20, AFlo);
kDir2 =
sum((
if isFlo[i]
then 0
else epsTauA[i])
for i
in 1:NTot);
if (kDir2 > 1E-10)
then
for i
in 1:NTot
loop
if isFlo[i]
then
kDir[i] = epsTauA[i]/AFlo;
else
kDir[i] =kDir1/kDir2*epsTauA[i];
end if;
end for;
else
for i
in 1:NTot
loop
if isFlo[i]
then
kDir[i] = A[i]/AFlo;
else
kDir[i] = 0;
end if;
end for;
end if;
assert( AFlo > 1E-10,
"Error in parameters of the room model: The geometry is incorrect:\n" +
" The room model must have a construction that is a floor,\n" +
" and this construction must not have a window.\n" +
" The parameters for the room model are such that there is no such construction.\n" +
" Revise the model parameters.");
assert(
abs(1 -
sum(kDif)) < 1E-5, "Program error: Sum of diffuse solar distribution factors in room is not equal to one. kDif="
+
String(
sum(kDif)));
assert(
abs(1 -
sum(kDir)) < 1E-5, "Program error: Sum of direct solar distribution factors in room is not equal to one. kDir="
+
String(
sum(kDir)));
equation
Q_flow =-kDif .*
sum(JInDifConExtWin) - kDir .*
sum(JInDirConExtWin);
if haveConExt
then
for i
in 1:NConExt
loop
Q_flow[i] = conExt[i].Q_flow;
end for;
else
conExt[1].T = 293.15;
end if;
if haveConPar
then
for i
in 1:NConPar
loop
Q_flow[i+NConExt] = conPar_a[i].Q_flow;
Q_flow[i+NConExt+NConPar] = conPar_b[i].Q_flow;
end for;
else
conPar_a[1].T = 293.15;
conPar_b[1].T = 293.15;
end if;
if haveConBou
then
for i
in 1:NConBou
loop
Q_flow[i+NConExt+2*NConPar] = conBou[i].Q_flow;
end for;
else
conBou[1].T = 293.15;
end if;
if haveSurBou
then
for i
in 1:NSurBou
loop
Q_flow[i+NConExt+2*NConPar+NConBou] = conSurBou[i].Q_flow;
end for;
else
conSurBou[1].T = 293.15;
end if;
if haveConExtWin
then
for i
in 1:NConExtWin
loop
Q_flow[i+NConExt+2*NConPar+NConBou+NSurBou] = conExtWin[i].Q_flow;
Q_flow[i+NConExt+2*NConPar+NConBou+NSurBou+NConExtWin] = conExtWinFra[i].Q_flow;
end for;
else
conExtWin[1].T = 293.15;
conExtWinFra[1].T = 293.15;
end if;
for j
in 1:NWin
loop
Q_flow[j+NOpa] = JOutConExtWin[j];
HOutConExtWin[j] =
if (AConExtWinGla[j] > 1E-10)
then JOutConExtWin[j] / AConExtWinGla[j]
else 0;
end for;
end SolarRadiationExchange;
Exchange data between CFD and Modelica
Information
This function calls a C function to conduct the data exchange between Modelica and CFD program during the coupled simulation.
Inputs
Outputs
Type | Name | Description |
Time | modTimRea | Current model time from CFD [s] |
Real | y[nY] | Output computed by CFD |
Integer | retVal | Return value for CFD simulation status |
Modelica definition
function cfdExchangeData
input Integer flag ;
input Modelica.SIunits.Time t ;
input Modelica.SIunits.Time dt(min=100*Modelica.Constants.eps)
;
input Real[nU] u ;
input Integer nU ;
input Integer nY ;
output Modelica.SIunits.Time modTimRea ;
output Real[nY] y ;
output Integer retVal ;
external"C" retVal =
cfdExchangeData(
t,
dt,
u,
nU,
nY,
modTimRea,
y);
end cfdExchangeData;
Start the coupled simulation with CFD
Information
This function calls a C function to start the coupled simulation with CFD.
Inputs
Outputs
Type | Name | Description |
Integer | retVal | Return value of the function (0 indicates CFD successfully started.) |
Modelica definition
function cfdStartCosimulation
input String cfdFilNam ;
input String[nSur] name ;
input Modelica.SIunits.Area[nSur] A ;
input Modelica.SIunits.Angle[nSur] til ;
input Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions[nSur] bouCon
;
input Integer nPorts(min=0)
;
input String portName[nPorts]
;
input Boolean haveSensor ;
input String sensorName[nSen]
;
input Boolean haveShade ;
input Integer nSur ;
input Integer nSen(min=0)
;
input Integer nConExtWin(min=0) ;
input Integer nXi(min=0) ;
input Integer nC(min=0) ;
input Modelica.SIunits.Density rho_start ;
output Integer retVal
;
external"C" retVal =
cfdStartCosimulation(
cfdFilNam,
name,
A,
til,
bouCon,
nPorts,
portName,
haveSensor,
sensorName,
haveShade,
nSur,
nSen,
nConExtWin,
nXi,
nC,
rho_start);
end cfdStartCosimulation;
Add unit [W] to data
Information
This component adds the unit [W] into the data.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Connectors
Modelica definition
Data record to identify surfaces in the CFD code
Information
This record is a data structure that is used to assemble
information that is used in the CFD to identify surface data
that are exchanged with Modelica.
Extends from Modelica.Icons.Record (Icon for records).
Parameters
Type | Name | Default | Description |
String | name | | Name of the surface |
Area | A | | Area of the surface [m2] |
Angle | til | | Tilt of the surface [rad] |
CFDBoundaryConditions | bouCon | | Boundary condition used in the CFD simulation |
Modelica definition
Data records for construction data
Information
Record that defines the number of constructions that are
used in the room model.
This record also declares parameters that contain the number of constructions,
such as the number of exterior constructions nConExt
.
This parameter may take on the value 0
.
If this parameter were to be used to declare the size of vectors of
component models, then there may be vectors with zero components.
This can cause problems in Dymola 7.4.
Therefore, a parameter is declared in the form
NConExt = max(1, nConExt)
This parameter is the used by models that extend this model
to set the size of the vector of component models.
There are also parameters that can be used to conditionally remove components,
such as haveConExt
, which is set to
haveConExt = nConExt > 0;
Parameters
Type | Name | Default | Description |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Modelica definition
record ConstructionNumbers
parameter Integer nConExt(min=0) ;
parameter Integer nConExtWin(min=0) ;
parameter Integer nConPar(min=0) ;
parameter Integer nConBou(min=0)
;
parameter Integer nSurBou(min=0)
;
final parameter Integer NConExt(min=1) = max(1, nConExt)
;
final parameter Integer NConExtWin(min=1)=max(1, nConExtWin)
;
final parameter Integer NConPar(min=1)=max(1, nConPar)
;
final parameter Integer NConBou(min=1)=max(1, nConBou)
;
final parameter Integer NSurBou(min=1)=max(1, nSurBou)
;
final parameter Boolean haveConExt = nConExt > 0
;
final parameter Boolean haveConExtWin = nConExtWin > 0
;
final parameter Boolean haveConPar = nConPar > 0
;
final parameter Boolean haveConBou = nConBou > 0
;
final parameter Boolean haveSurBou = nSurBou > 0
;
end ConstructionNumbers;
Data records for construction data
Information
Record that defines the number of constructions that are
used in the room model.
Extends from Buildings.ThermalZones.Detailed.BaseClasses.ConstructionNumbers (Data records for construction data).
Parameters
Type | Name | Default | Description |
ParameterConstruction | datConExt[NConExt] | datConExt(each A=0, each lay... | Data for exterior construction |
ParameterConstructionWithWindow | datConExtWin[NConExtWin] | datConExtWin(each A=0, each ... | Data for exterior construction with window |
ParameterConstruction | datConPar[NConPar] | datConPar(each A=0, each lay... | Data for partition construction |
ParameterConstruction | datConBou[NConBou] | datConBou(each A=0, each lay... | Data for construction boundary |
OpaqueSurface | surBou[NSurBou] | surBou(each A=0, each til=0) | Record for data of surfaces whose heat conduction is modeled outside of this room |
Brick120 | dummyCon | | Dummy construction to assign a parameter to the instance |
SingleClear3 | dummyGlaSys | | Dummy construction to assign a parameter to the instance |
Exterior constructions |
Integer | nConExt | | Number of exterior constructions |
Integer | nConExtWin | | Number of window constructions |
Partition constructions |
Integer | nConPar | | Number of partition constructions |
Boundary constructions |
Integer | nConBou | | Number of constructions that have their outside surface exposed to the boundary of this room |
Integer | nSurBou | | Number of surface heat transfer models that connect to constructions that are modeled outside of this room |
Modelica definition
record ConstructionRecords
extends Buildings.ThermalZones.Detailed.BaseClasses.ConstructionNumbers;
parameter ParameterConstruction datConExt[NConExt](
each A=0,
each layers = dummyCon,
each til=0,
each azi=0) ;
parameter Buildings.ThermalZones.Detailed.BaseClasses.ParameterConstructionWithWindow
datConExtWin[NConExtWin](
each A=0,
each layers = dummyCon,
each til=0,
each azi=0,
each hWin=0,
each wWin=0,
each glaSys=dummyGlaSys) ;
parameter Buildings.ThermalZones.Detailed.BaseClasses.ParameterConstruction datConPar[NConPar](
each A=0,
each layers = dummyCon,
each til=0,
each azi=0) ;
parameter Buildings.ThermalZones.Detailed.BaseClasses.ParameterConstruction datConBou[NConBou](
each A=0,
each layers = dummyCon,
each til=0,
each azi=0) ;
parameter Buildings.ThermalZones.Detailed.BaseClasses.OpaqueSurface surBou[NSurBou](
each A=0,
each til=0)
;
parameter HeatTransfer.Data.OpaqueConstructions.Brick120 dummyCon
;
parameter Buildings.HeatTransfer.Data.GlazingSystems.SingleClear3 dummyGlaSys
;
end ConstructionRecords;
Record for exterior constructions that have no window
Information
This data record is used to set the parameters of opaque surfaces.
The surface tilt is defined in
Buildings.Types.Tilt
Extends from Buildings.HeatTransfer.Data.OpaqueSurfaces.Generic (Thermal properties of opaque surfaces).
Parameters
Type | Name | Default | Description |
Area | A | | Area [m2] |
Angle | til | | Surface tilt (0: ceiling, pi/2: wall, pi: floor [rad] |
Emissivity | absIR | 0.84 | Infrared absorptivity [1] |
Emissivity | absSol | 0.84 | Solar absorptivity [1] |
String | name | "" | Surface name. Optional for MixedAir, required for CFD. |
Boundary condition |
CFDBoundaryConditions | boundaryCondition | Buildings.ThermalZones.Detai... | Boundary condition used in the CFD simulation |
Modelica definition
Record for window overhang
Information
This record declares parameters for window overhangs.
See
Buildings.HeatTransfer.Windows.Overhang
for an explanation of the parameters, and
for the assumptions and limitations
of the overhang model.
Extends from Modelica.Icons.Record (Icon for records).
Parameters
Type | Name | Default | Description |
Overhang |
Length | wL | | Overhang width left to the window, measured from the window corner [m] |
Length | wR | | Overhang width right to the window, measured from the window corner [m] |
Length | dep | | Overhang depth (measured perpendicular to the wall plane) [m] |
Length | gap | | Distance between window upper edge and overhang lower edge [m] |
Modelica definition
Record for exterior constructions that have no window
Information
This data record is used to set the parameters of constructions that do not have a window.
The surface azimuth is defined in
Buildings.Types.Azimuth
and the surface tilt is defined in
Buildings.Types.Tilt
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialParameterConstruction (Partial record for constructions).
Parameters
Type | Name | Default | Description |
String | name | "" | Surface name. Optional for MixedAir, required for FFD. |
Angle | til | | Surface tilt [rad] |
Angle | azi | | Surface azimuth [rad] |
Area | A | | Heat transfer area [m2] |
Opaque construction |
Generic | layers | | Material properties of opaque construction |
Initialization |
Boolean | steadyStateInitial | false | =true initializes dT(0)/dt=0, false initializes T(0) at fixed temperature using T_a_start and T_b_start |
Temperature | T_a_start | 293.15 | Initial temperature at port_a, used if steadyStateInitial = false [K] |
Temperature | T_b_start | 293.15 | Initial temperature at port_b, used if steadyStateInitial = false [K] |
Boundary condition |
CFDBoundaryConditions | boundaryCondition | Buildings.ThermalZones.Detai... | Boundary condition used in the CFD simulation |
Dynamics |
Boolean | stateAtSurface_a | true | =true, a state will be at the surface a |
Boolean | stateAtSurface_b | true | =true, a state will be at the surface b |
Modelica definition
Record for exterior constructions that have a window
Information
This data record is used to set the parameters of constructions that do have a window.
The surface azimuth is defined in
Buildings.Types.Azimuth
and the surface tilt is defined in
Buildings.Types.Tilt
Extends from Buildings.ThermalZones.Detailed.BaseClasses.PartialParameterConstruction (Partial record for constructions).
Parameters
Type | Name | Default | Description |
String | name | "" | Surface name. Optional for MixedAir, required for FFD. |
Angle | til | | Surface tilt [rad] |
Angle | azi | | Surface azimuth [rad] |
Area | A | | Heat transfer area of opaque construction and window combined [m2] |
Opaque construction |
Generic | layers | | Material properties of opaque construction |
Initialization |
Boolean | steadyStateInitial | false | =true initializes dT(0)/dt=0, false initializes T(0) at fixed temperature using T_a_start and T_b_start |
Temperature | T_a_start | 293.15 | Initial temperature at port_a, used if steadyStateInitial = false [K] |
Temperature | T_b_start | 293.15 | Initial temperature at port_b, used if steadyStateInitial = false [K] |
Boundary condition |
CFDBoundaryConditions | boundaryCondition | Buildings.ThermalZones.Detai... | Boundary condition used in the CFD simulation |
Glazing system |
Length | hWin | | Window height [m] |
Length | wWin | | Window width [m] |
Real | fFra | 0.1 | Fraction of window frame divided by total window area |
Overhang | ove | ove(wR=0, wL=0, dep=0, gap=0) | Geometry of overhang |
SideFins | sidFin | sidFin(h=0, dep=0, gap=0) | Geometry of side fins |
Generic | glaSys | | Material properties of glazing system |
Dynamics |
Boolean | stateAtSurface_a | true | =true, a state will be at the surface a |
Boolean | stateAtSurface_b | true | =true, a state will be at the surface b |
Modelica definition
Partial record for constructions
Information
This data record is used to set the parameters of constructions that do not have a window.
The surface azimuth is defined in
Buildings.Types.Azimuth
and the surface tilt is defined in
Buildings.Types.Tilt
Extends from Modelica.Icons.Record (Icon for records).
Parameters
Type | Name | Default | Description |
String | name | "" | Surface name. Optional for MixedAir, required for FFD. |
Angle | til | | Surface tilt [rad] |
Angle | azi | | Surface azimuth [rad] |
Opaque construction |
Generic | layers | | Material properties of opaque construction |
Initialization |
Boolean | steadyStateInitial | false | =true initializes dT(0)/dt=0, false initializes T(0) at fixed temperature using T_a_start and T_b_start |
Temperature | T_a_start | 293.15 | Initial temperature at port_a, used if steadyStateInitial = false [K] |
Temperature | T_b_start | 293.15 | Initial temperature at port_b, used if steadyStateInitial = false [K] |
Boundary condition |
CFDBoundaryConditions | boundaryCondition | Buildings.ThermalZones.Detai... | Boundary condition used in the CFD simulation |
Dynamics |
Boolean | stateAtSurface_a | true | =true, a state will be at the surface a |
Boolean | stateAtSurface_b | true | =true, a state will be at the surface b |
Modelica definition
Record for window side fins
Information
This record declares parameters for window side fins.
See
Buildings.HeatTransfer.Windows.SideFins
for an explanation of the parameters, and
for the assumptions and limitations
of the model for side fins.
Extends from Modelica.Icons.Record (Icon for records).
Parameters
Type | Name | Default | Description |
Side fin |
Length | h | | Height of side fin that extends above window, measured from top of window [m] |
Length | dep | | Side fin depth (measured perpendicular to the wall plane) [m] |
Length | gap | | Distance between side fin and window edge [m] |
Modelica definition