Test model for natural convection in an empty room with only construction boundary.. This model tests the copuled simulation of

Buildings.ThermalZones.Detailed.CFD
with the FFD program by simulating the natural convection in an empty room with only construction boundaries.

within Buildings.ThermalZones.Detailed.Examples.FFD;
model RoomOnlyConstructionBoundary
  "Test model for natural convection in an empty room with only construction boundary."
  extends Modelica.Icons.Example;
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matLayWal(
      final nLay=1, material={HeatTransfer.Data.Solids.Steel(x=0.001)},
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Smooth)
    "Construction material for all the envelopes"
  extends Buildings.ThermalZones.Detailed.Examples.FFD.BaseClasses.PartialRoom(
    roo(
      datConBou(
        name={"East Wall","West Wall","North Wall","South Wall","Floor","Ceiling"},
      layers={matLayWal,matLayWal,matLayWal,matLayWal,matLayWal,matLayWal},
      each A=1*1,
        til={Buildings.Types.Tilt.Wall,Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Floor,Buildings.Types.Tilt.Ceiling},
        boundaryCondition={Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature})),
      nConBou=6);

  Buildings.HeatTransfer.Sources.FixedTemperature TWalRes[nConBou - 1](
      each T=283.15) "Boundary condition for the other walls"

  HeatTransfer.Sources.FixedTemperature TEasWal(T=313.15)
    "Temperature of the east wall"
equation
  for i in 1:nConBou - 1 loop
    connect(TWalRes[i].port, roo.surf_conBou[i + 1])
  end for;

  connect(TEasWal.port, roo.surf_conBou[1])
end RoomOnlyConstructionBoundary;


Natural convection in an empty room with only exterior walls without windows.. This model tests the coupled simulation of

Buildings.ThermalZones.Detailed.CFD
with the FFD program by simulating the natural convection in an empty room with only exterior walls and without windows.

within Buildings.ThermalZones.Detailed.Examples.FFD;
model RoomOnlyExteriorWallNoWindow
  "Natural convection in an empty room with only exterior walls without windows."
  extends Modelica.Icons.Example;
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matLayWal(
      final nLay=1, material={HeatTransfer.Data.Solids.Steel(x=0.001)},
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Smooth)
    "Construction material for all the envelopes"
  extends Buildings.ThermalZones.Detailed.Examples.FFD.BaseClasses.PartialRoom(
    nConExt=6,
    nConExtWin=0,
    nConPar=0,
    nConBou=0,
    nSurBou=0,
    roo(nConExt=nConExt, datConExt(
        name={"East Wall","West Wall","North Wall","South Wall","Floor","Ceiling"},
        layers={matLayWal,matLayWal,matLayWal,matLayWal,matLayWal,matLayWal},
        each A=1*1,
        til={Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Floor,
            Buildings.Types.Tilt.Ceiling},
        boundaryCondition={
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature}),
        samplePeriod=30));
end RoomOnlyExteriorWallNoWindow;


Natural convection in an empty room with only surface boundary. This model tests the coupled simulation of

Buildings.ThermalZones.Detailed.CFD
with the FFD program by simulating the natural convection in an empty room with only surface boundaries.
It is also used to test the adiabatic boundary conditon in the FFD code.

within Buildings.ThermalZones.Detailed.Examples.FFD;
model RoomOnlySurfaceBoundary
  "Natural convection in an empty room with only surface boundary"
  extends Modelica.Icons.Example;
  extends Buildings.ThermalZones.Detailed.Examples.FFD.BaseClasses.PartialRoom(roo(
      linearizeRadiation=false,
      samplePeriod=60,
      surBou(
        name={"East Wall","West Wall","North Wall","South Wall","Floor","Ceiling"},
        each A=1*1,
        til={Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Floor,
            Buildings.Types.Tilt.Ceiling},
        each absIR=1e-5,
        each absSol=1e-5,
        boundaryCondition={
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate})),
        nSurBou=6);

  Buildings.HeatTransfer.Sources.FixedTemperature TWesWal(T=283.15)
    "Boundary condition for the west wall"

  HeatTransfer.Sources.FixedTemperature TEasWal(T=313.15)
    "Temperature of the east wall"
equation

  connect(TEasWal.port, roo.surf_surBou[1])
  connect(TWesWal.port, roo.surf_surBou[2])
end RoomOnlySurfaceBoundary;


info

within Buildings.ThermalZones.Detailed.Examples.FFD;
package UsersGuide
  extends Modelica.Icons.Information;
end UsersGuide;


Natural convection in an empty room with exterior walls, windows without shade. This model tests the coupled simulation of

Buildings.ThermalZones.Detailed.CFD
with the FFD program by simulating natural convection in a room with only exterior walls and windows.

within Buildings.ThermalZones.Detailed.Examples.FFD;
model WindowWithoutShade
  "Natural convection in an empty room with exterior walls, windows without shade"
  extends Modelica.Icons.Example;
  extends Buildings.ThermalZones.Detailed.Examples.FFD.BaseClasses.PartialRoom(
    nConExt=4,
    nConExtWin=2,
    nConPar=0,
    nConBou=0,
    nSurBou=0,
    roo(
      nConExt=nConExt,
      nConExtWin=nConExtWin,
      datConExt(
        name={"North Wall","South Wall","Floor","Ceiling"},
        each A=1,
        layers={matLayExt,matLayExt,matLayExt,matLayExt},
        til={Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Floor,
            Buildings.Types.Tilt.Ceiling},
        boundaryCondition={
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature}),
      datConExtWin(
        name={"East Wall","West Wall"},
        layers={matLayExt,matLayExt},
        each A=1,
        glaSys={glaSys,glaSys},
        each wWin=1,
        each hWin=0.5,
        each fFra=0.2,
        til={
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall},
        azi={
            Buildings.Types.Azimuth.E,
            Buildings.Types.Azimuth.W},
        boundaryCondition={
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature}),
      cfdFilNam="modelica://Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/WindowWithoutShade.ffd",
      uSha_fixed={0, 0}));

  parameter HeatTransfer.Data.OpaqueConstructions.Insulation100Concrete200 matLayExt
    "Construction material for exterior walls"
  parameter HeatTransfer.Data.GlazingSystems.DoubleClearAir13Clear glaSys(UFra=2,
    shade=Buildings.HeatTransfer.Data.Shades.Gray(),
    haveExteriorShade=false,
    haveInteriorShade=false) "Data record for the glazing system"
end WindowWithoutShade;


Natural convection in an empty room with exterior walls, windows and shades. This model tests the cosimulation of Buildings.ThermalZones.Detailed.CFD with the FFD program by simulating natural convection in a room with only exterior walls and windows with shades.

within Buildings.ThermalZones.Detailed.Examples.FFD;
model WindowWithShade
  "Natural convection in an empty room with exterior walls, windows and shades"
  extends Modelica.Icons.Example;
  extends Buildings.ThermalZones.Detailed.Examples.FFD.BaseClasses.PartialRoom(
    nConExt=4,
    nConExtWin=2,
    nConPar=0,
    nConBou=0,
    nSurBou=0,
    roo(
      nConExt=nConExt,
      nConExtWin=nConExtWin,
      datConExt(
        name={"North Wall","South Wall","Floor","Ceiling"},
        each A=1,
        layers={matLayExt,matLayExt,matLayExt,matLayExt},
        til={
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Floor,
            Buildings.Types.Tilt.Ceiling},
        boundaryCondition={
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature}),
      datConExtWin(
        name={"East Wall","West Wall"},
        layers={matLayExt,matLayExt},
        each A=1,
        glaSys={glaSys,glaSys},
        each wWin=1,
        each hWin=0.5,
        each fFra=0.2,
        til={
            Buildings.Types.Tilt.Wall,
            Buildings.Types.Tilt.Wall},
        azi={
            Buildings.Types.Azimuth.E,
            Buildings.Types.Azimuth.W},
        boundaryCondition={
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
            Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature}),
        uSha_fixed={0.5,0.5},
        samplePeriod=10,
        linearizeRadiation=true,
        cfdFilNam="modelica://Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/WindowWithShade.ffd"));

  parameter HeatTransfer.Data.OpaqueConstructions.Insulation100Concrete200 matLayExt
    "Construction material for exterior walls"

  parameter HeatTransfer.Data.GlazingSystems.DoubleClearAir13Clear glaSys(UFra=2,
    shade=Buildings.HeatTransfer.Data.Shades.Gray(),
    haveExteriorShade=false,
    haveInteriorShade=true) "Data record for the glazing system"
end WindowWithShade;


within Buildings.ThermalZones.Detailed.Examples.FFD;
package BaseClasses "Package with base classes for Buildings.ThermalZones.Detailed.Examples.FFD"
  extends Modelica.Icons.BasesPackage;
end BaseClasses;


Partial model for a room

within Buildings.ThermalZones.Detailed.Examples.FFD.BaseClasses;
partial model PartialRoom "Partial model for a room"
  package MediumA = Buildings.Media.Air (
        T_default=283.15) "Medium model";
  parameter Integer nConExtWin=0 "Number of constructions with a window";
  parameter Integer nConBou=0
    "Number of surface that are connected to constructions that are modeled inside the room";
  parameter Integer nSurBou=0
    "Number of surface that are connected to the room air volume";
  parameter Integer nConExt=0
    "Number of exterior constructions withour a window";
  parameter Integer nConPar=0 "Number of partition constructions";
  Buildings.ThermalZones.Detailed.CFD roo(
    redeclare package Medium = MediumA,
    nConBou=nConBou,
    nSurBou=nSurBou,
    nConExt=nConExt,
    sensorName={"Occupied zone air temperature","Velocity"},
    useCFD=true,
    nConPar=nConPar,
    nConExtWin=nConExtWin,
    AFlo=1*1,
    hRoo=1,
    linearizeRadiation=true,
    samplePeriod=60,
    cfdFilNam="modelica://Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/OnlyWall.ffd",
    massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Room model"
  Modelica.Blocks.Sources.Constant qConGai_flow(k=0) "Convective heat gain"
  Modelica.Blocks.Sources.Constant qRadGai_flow(k=0) "Radiative heat gain"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1
  Modelica.Blocks.Sources.Constant qLatGai_flow(k=0) "Latent heat gain"
  Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
    filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"), TDryBul=
        293.15)
equation
  connect(qRadGai_flow.y, multiplex3_1.u1[1])
  connect(qConGai_flow.y, multiplex3_1.u2[1])
  connect(qLatGai_flow.y, multiplex3_1.u3[1])
  connect(multiplex3_1.y, roo.qGai_flow)
  connect(weaDat.weaBus, roo.weaBus)
end PartialRoom;


Tutorial for Mixed Convection case

within Buildings.ThermalZones.Detailed.Examples.FFD.Tutorial;
model MixedConvection "Tutorial for Mixed Convection case"
  extends Modelica.Icons.Example;
  package MediumA = Buildings.Media.Air (
        T_default=283.15) "Medium model";
  parameter Integer nConExtWin=0 "Number of constructions with a window";
  parameter Integer nConBou=0
    "Number of surface that are connected to constructions that are modeled inside the room";
  parameter Integer nSurBou=6
    "Number of surface that are connected to the room air volume";
  parameter Integer nConExt=0
    "Number of exterior constructions withour a window";
  parameter Integer nConPar=0 "Number of partition constructions";
  Modelica.Blocks.Sources.Constant qRadGai_flow(k=0) "Radiative heat gain"
  Modelica.Blocks.Sources.Constant qConGai_flow(k=0) "Convective heat gain"
  Modelica.Blocks.Sources.Constant qLatGai_flow(k=0) "Latent heat gain"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1
  BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
    Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"),
    TDryBul=293.15)
  Buildings.ThermalZones.Detailed.CFD roo(
    redeclare package Medium = MediumA,
    surBou(
     name={"East Wall","West Wall","North Wall","South Wall","Ceiling","Floor"},
     A={0.9,0.9,1,1,1,1},
     til={Buildings.Types.Tilt.Wall,Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Wall,Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Ceiling,Buildings.Types.Tilt.Floor},
     each absIR=1e-5,
     each absSol=1e-5,
     each boundaryCondition=Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature),
    AFlo = 1*1,
    hRoo = 1,
    linearizeRadiation = false,
    useCFD = true,
    sensorName = {"Occupied zone air temperature", "Velocity"},
    cfdFilNam = "modelica://Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial/MixedConvection.ffd",
    nConExt = nConExt,
    nConExtWin = nConExtWin,
    nConPar = nConPar,
    nConBou = nConBou,
    nSurBou = nSurBou,
    nPorts=2,
    portName={"Inlet","Outlet"},
    samplePeriod = 6)
  HeatTransfer.Sources.FixedTemperature TOthWal[nSurBou-1](each T=283.15)
    "Temperature for other walls"
  HeatTransfer.Sources.FixedTemperature TFlo(T=303.15) "Temperature of floor"
  Fluid.Sources.MassFlowSource_T bouIn(
    nPorts=1,
    redeclare package Medium = MediumA,
    m_flow=0.1,
    T=283.15)
    "Mass flow boundary condition"
  Buildings.Fluid.Sources.Boundary_pT bouOut(
    nPorts=1,
    redeclare package Medium = MediumA)
    "Pressure boundary condition"
equation
  connect(qRadGai_flow.y,multiplex3_1. u1[1])
  connect(qConGai_flow.y,multiplex3_1. u2[1])
  connect(qLatGai_flow.y,multiplex3_1. u3[1])
  connect(multiplex3_1.y,roo. qGai_flow)
  connect(weaDat.weaBus,roo. weaBus)
  connect(TFlo.port, roo.surf_surBou[6])
  connect(TOthWal[1].port, roo.surf_surBou[1])
  connect(TOthWal[2].port, roo.surf_surBou[2])
  connect(TOthWal[3].port, roo.surf_surBou[3])
  connect(TOthWal[4].port, roo.surf_surBou[4])
  connect(TOthWal[5].port, roo.surf_surBou[5])
  connect(bouIn.ports[1], roo.ports[1])
  connect(bouOut.ports[1], roo.ports[2])
  parameter Integer nConExtWin=0;
  parameter Integer nConBou=0;
  parameter Integer nSurBou=6;
  parameter Integer nConExt=0;
  parameter Integer nConPar=0;

Edit roo as below:

Buildings.ThermalZones.Detailed.CFD roo(
  redeclare package Medium = MediumA,
  surBou(
    name={\"East Wall\",\"West Wall\",\"North Wall\",\"South Wall\",\"Ceiling\",\"Floor\"},
    A={0.9,0.9,1,1,1,1},
    til={Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Ceiling,
        Buildings.Types.Tilt.Floor},
    each absIR=1e-5,
    each absSol=1e-5,
    each boundaryCondition=Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature),
    AFlo = 1*1,
    hRoo = 1,
    linearizeRadiation = false,
    useCFD = true,
    sensorName = {\"Occupied zone air temperature\", \"Velocity\"},
    cfdFilNam = \"modelica://Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial/MixedConvection.ffd\",
    nConExt = nConExt,
    nConExtWin = nConExtWin,
    nConPar = nConPar,
    nConBou = nConBou,
    nSurBou = nSurBou,
    nPorts = 2,
    portName={\"Inlet\",\"Outlet\"},
    samplePeriod = 6);

Set the parameters for the following components:

Set qRadGai_flow, qConGai_flow and qLatGai_flow to 0.

Set TFlo to 303.15 Kelvin.

Set TOthWal to 283.15 Kelvin.

Set the values for the parameters of bouIn and bouOut as below:

Fluid.Sources.MassFlowSource_T bouIn(
  redeclare package Medium = MediumA,
  nPorts=1,
  m_flow=0.1,
  T=283.15);

Fluid.Sources.FixedBoundary bouOut(
  redeclare package Medium = MediumA,
  nPorts=1);

Connect the components as shown in the figure below.

Confirm in the textual editor that the connections to
roo.ports are as follows:

connect(bouIn.ports[1], roo.ports[1]);
connect(bouOut.ports[1], roo.ports[2]);

Use the Simplified CFD Interface (SCI) to generate the input file for the FFD.

Use a 20 X 20 X 20 stretched grid.

Set the time step size of the FFD to 0.1 seconds.

Generate the input files, which have by default the names
input.cfd (mesh file) and zeroone.dat (obstacles file).

Rename the files as MixedConvection.cfd and MixedConvection.dat, respectively.

Revise the FFD parameter input file MixedConvection.ffd
(an example file is available in Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial/):

  inpu.parameter_file_format SCI
  inpu.parameter_file_name MixedConvection.cfd
  inpu.block_file_name MixedConvection.dat
  prob.nu 0.000015 // Kinematic viscosity
  prob.rho 1.205 // Density
  prob.gravx 0 // Gravity in x direction
  prob.gravy 0 // Gravity in y direction
  prob.gravz -9.81 // Gravity in z direction
  prob.cond 0.0257 // Conductivity
  prob.Cp 1006.0 // Specific heat capacity
  prob.beta 0.00343 // Thermal expansion coefficient
  prob.diff 0.00001 // Diffusivity for contaminants
  prob.coeff_h 0.0004 // Convective heat transfer coefficient near the wall
  prob.Temp_Buoyancy 10.0 // Reference temperature for calculating buoyance  force
  init.T 10.0 // Initial condition for Temperature
  init.u 0.0 // Initial condition for velocity u
  init.v 0.0 // Initial condition for velocity v
  init.w 0.0 // Initial condition for velocity w

Put the files MixedConvection.ffd, MixedConvection.dat, and MixedConvection.cfd in the
directory Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial/.

Set the simulation stop time of the Modelica model to 180 seconds and choose, for example, the CVode solver.

Translate the model and start the simulation.

Post-process: click the Tecplot macro script
Buildings/Resources/Image/Rooms/Examples/FFD/Tutorial/MixedConvection.mcr
that will generate the temperature contour and velocity vectors shown in the Figure (b).
Note: Tecplot is needed for this.

",revisions="

September 16, 2021, by Michael Wetter:

Removed assignment of parameter lat as this is now obtained from the weather data reader.

This is for
IBPSA, #1477.

September 07, 2017, by Thierry Nouidui:

Refactored the FFD C-code and revised the documentation.
This is for
issue 612.

July 25, 2014, by Michael Wetter:

Revised documentation.

June 27, 2014, by Wei Tian, Thomas Sevilla, Wangda Zuo:

First implementation.

"),
    experiment(Tolerance=1e-06, StopTime=180),
    __Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/ThermalZones/Detailed/Examples/FFD/Tutorial/MixedConvection.mos"
        "Simulate and plot"),
    Diagram(coordinateSystem(extent={{-80,-160},{200,120}}, preserveAspectRatio=false),
        graphics));
end MixedConvection;


Tutorial for Natural Convection case

within Buildings.ThermalZones.Detailed.Examples.FFD.Tutorial;
model NaturalConvection "Tutorial for Natural Convection case"
  extends Modelica.Icons.Example;
  package MediumA =
      Buildings.Media.Air (
        T_default=283.15) "Medium model";
  parameter Integer nConExtWin=0 "Number of constructions with a window";
  parameter Integer nConBou=0
    "Number of surface that are connected to constructions that are modeled inside the room";
  parameter Integer nSurBou=6
    "Number of surface that are connected to the room air volume";
  parameter Integer nConExt=0
    "Number of exterior constructions withour a window";
  parameter Integer nConPar=0 "Number of partition constructions";
  Modelica.Blocks.Sources.Constant qRadGai_flow(k=0) "Radiative heat gain"
  Modelica.Blocks.Sources.Constant qConGai_flow(k=0) "Convective heat gain"
  Modelica.Blocks.Sources.Constant qLatGai_flow(k=0) "Latent heat gain"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1
  BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"),
      TDryBul=293.15)
  Buildings.ThermalZones.Detailed.CFD roo(
   redeclare package Medium = MediumA,
   surBou(
   name={"East Wall","West Wall","North Wall","South Wall","Ceiling","Floor"},
   each A=1*1,
   til={Buildings.Types.Tilt.Wall,Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Wall,Buildings.Types.Tilt.Wall,
        Buildings.Types.Tilt.Ceiling,Buildings.Types.Tilt.Floor},
   each absIR=1e-5,
   each absSol=1e-5,
   boundaryCondition={Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
       Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
       Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
       Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
       Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate}),
   AFlo = 1*1,
   hRoo = 1,
   linearizeRadiation = false,
   useCFD = true,
   sensorName = {"Occupied zone air temperature", "Velocity"},
   cfdFilNam = "modelica://Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial/NaturalConvection.ffd",
   nConExt = nConExt,
   nConExtWin = nConExtWin,
   nConPar = nConPar,
   nConBou = nConBou,
   nSurBou = nSurBou,
   samplePeriod = 60,
   massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
  HeatTransfer.Sources.FixedTemperature           TWesWal(T=274.15)
    "Boundary condition for the west wall"
  HeatTransfer.Sources.FixedTemperature           TEasWal(T=273.15)
    "Temperature of east wall"
equation
  connect(qRadGai_flow.y, multiplex3_1.u1[1])
  connect(qConGai_flow.y, multiplex3_1.u2[1])
  connect(qLatGai_flow.y, multiplex3_1.u3[1])
  connect(multiplex3_1.y, roo.qGai_flow)
  connect(TEasWal.port, roo.surf_surBou[1])
  connect(TWesWal.port, roo.surf_surBou[2])
  connect(weaDat.weaBus, roo.weaBus)
  parameter Integer nConExtWin=0;
  parameter Integer nConBou=0;
  parameter Integer nSurBou=6;
  parameter Integer nConExt=0;
  parameter Integer nConPar=0;

Edit roo as below:

 edeclare package Medium = MediumA,
surBou(
  name={\"East Wall\",\"West Wall\",\"North Wall\",\"South Wall\",\"Ceiling\",\"Floor\"},
  each A=1*1,
  til={Buildings.Types.Tilt.Wall,
    Buildings.Types.Tilt.Wall,
    Buildings.Types.Tilt.Wall,
    Buildings.Types.Tilt.Wall,
    Buildings.Types.Tilt.Ceiling,
    Buildings.Types.Tilt.Floor},
  each absIR=1e-5,
  each absSol=1e-5,
  boundaryCondition={
    Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
    Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.Temperature,
    Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
    Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
    Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate,
    Buildings.ThermalZones.Detailed.Types.CFDBoundaryConditions.HeatFlowRate}),
  AFlo = 1*1,
  hRoo = 1,
  linearizeRadiation = false,
  useCFD = true,
  sensorName = {\"Occupied zone air temperature\", \"Velocity\"},
  cfdFilNam = \"modelica://Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial/NaturalConvection.ffd\",
  nConExt = nConExt,
  nConExtWin = nConExtWin,
  nConPar = nConPar,
  nConBou = nConBou,
  nSurBou = nSurBou,
  T_start=273.15,
  samplePeriod = 60);

Connect the component as shown in the figure below.

Set the values for the following components:

Set qRadGai_flow, qConGai_flow and qLatGai_flow to 0.

Set TEasWal to 273.15 Kelvin.

Set TWesWal to 274.15 Kelvin.

Use the Simplified CFD Interface (SCI) to generate the input file for FFD.

Use a 20 x 20 x 20 uniform grid.

Set the time step size of the FFD to 10 seconds.

Generate the input files which have the default names input.cfd (mesh file) and zeroone.dat (obstacles file).

Rename the files as NaturalConvection.cfd and NaturalConvection.dat, respectively.

Revise the FFD parameter input file NaturalConvection.ffd
(an example file is provided in Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial/):

  inpu.parameter_file_format SCI
  inpu.parameter_file_name NaturalConvection.cfd
  inpu.block_file_name NaturalConvection.dat
  prob.nu 1.5e-5 // Kinematic viscosity
  prob.rho 1 // Density
  prob.gravx 0 // Gravity in x direction
  prob.gravy 0 // Gravity in y direction
  prob.gravz -0.01 // Gravity in z direction
  prob.cond 0.02 // Conductivity
  prob.Cp 1000.0 // Specific heat capacity
  prob.beta 3e-3 // Thermal expansion coefficient
  prob.diff 0.00001 // Diffusivity for contaminants
  prob.alpha 2e-5 // Thermal diffusivity
  prob.coeff_h 0.0004 // Convective heat transfer coefficient near the wall
  prob.Temp_Buoyancy 0.0 // Reference temperature for calculating buoyance force
  init.T 0.0 // Initial condition for Temperature
  init.u 0.0 // Initial condition for velocity u
  init.v 0.0 // Initial condition for velocity v
  init.w 0.0 // Initial condition for velocity w

Please note that some of the physical properties were manipulated to obtain the desired Rayleigh Number of 105.

Store NaturalConvection.ffd, NaturalConvection.dat, and NaturalConvection.cfd
at Buildings/Resources/Data/ThermalZones/Detailed/Examples/FFD/Tutorial.

Set simulation the stop time of the Modelica model 3600 seconds and choose for example the CVode solver.

Translate the model and start the simulation.

Post-process: click the Tecplot macro script
Buildings/Resources/Image/Rooms/Examples/FFD/Tutorial/NaturalConvection.mcr
that will generate the temperature contour and velocity vectors shown in the Figure (b).
Note: Tecplot is needed for this.

",revisions="

September 16, 2021, by Michael Wetter:

Removed assignment of parameter lat as this is now obtained from the weather data reader.

This is for
IBPSA, #1477.

September 07, 2017, by Thierry Nouidui:

Refactored the FFD C-code and revised the documentation.
This is for
issue 612.

July 7, 2015 by Michael Wetter:

Removed model for prescribed heat flow boundary condition
as the value was zero and hence the model is not needed.
This is for issue 439.

July 25, 2014, by Michael Wetter:

Revised documentation.

June 27, 2014, by Wei Tian, Thomas Sevilla, Wangda Zuo:

First implementation.

References

Wangda Zuo, Mingang Jin, Qingyan Chen, 2012.

Reduction of numerical viscosity in FFD model.

Journal of Engineering Applications of Computational Fluid Mechanics, 6(2), p. 234-247.

"));
end NaturalConvection;


within Buildings.ThermalZones.Detailed.Examples.FFD;
package Tutorial "Tutorial with step by step instructions for how to do coupled simulation"
  extends Modelica.Icons.Information;
end Tutorial;


within Buildings.ThermalZones.Detailed;
package FLEXLAB "Models that can be used to model the FLEXLAB"
extends Modelica.Icons.Package;
end FLEXLAB;


User's Guide

within Buildings.ThermalZones.Detailed.FLEXLAB;
package UsersGuide "User's Guide"
  extends Modelica.Icons.Information;
end UsersGuide;


within Buildings.ThermalZones.Detailed.FLEXLAB;
package Data "Data files commonly used in FLEXLAB models"
  extends Modelica.Icons.MaterialPropertiesPackage;
end Data;


within Buildings.ThermalZones.Detailed.FLEXLAB.Data;
package Constructions "Constructions commonly found in FLEXLAB test cells"
extends Modelica.Icons.MaterialPropertiesPackage;
end Constructions;


XGL-1 window constuction used in cells 3A, 3B and RA. ASHRAE 90.1 minimally compliant. This is a model of a window construction used in FLEXLAB test cells. It is minimally
  compliant per the ASHRAE 90.1 specification.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.GlazingSystems;
record ASHRAE901Gla =
  Buildings.HeatTransfer.Data.GlazingSystems.Generic (
  final glass={Buildings.HeatTransfer.Data.Glasses.ID101(),
   Buildings.HeatTransfer.Data.Glasses.ID101()},
  final gas = {Buildings.HeatTransfer.Data.Gases.Air(x=0.0127)},
  UFra=1.4)
  "XGL-1 window constuction used in cells 3A, 3B and RA. ASHRAE 90.1 minimally compliant"


within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions;
package GlazingSystems "Glazing system constructions commonly found in FLEXLAB test cells"
 extends Modelica.Icons.MaterialPropertiesPackage;
end GlazingSystems;


within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions;
package OpaqueConstructions "Opaque constructions found in FLEXLAB test cells"
  extends Modelica.Icons.MaterialPropertiesPackage;
end OpaqueConstructions;


within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions;
package DividingWalls "Walls used to divide test beds and cells"
  extends Modelica.Icons.MaterialPropertiesPackage;
end DividingWalls;


South and north exterior wall in test bed X3. This is a model of exterior walls in test bed X3. It is used to
    represent both the north and south exterior wall of the test cells
    themselves.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record Construction10and23 =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.02413),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127),
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.08255),
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.01588)},
    final nLay = 4) "South and north exterior wall in test bed X3"


Wall construction found in XRA. This is a model of one of the constructions used in test cell XRA. It
    represents the south wall, and the north wall next to the door.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record Construction17and24 =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.04752),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127),
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.01588)},
    final nLay = 3) "Wall construction found in XRA"


South wall in test bed X2. This is a model of the external wall used in test bed X2.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record Construction2 =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.08255),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127),
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.01588)},
    final nLay = 3) "South wall in test bed X2"


North wall of the electrical room in all test cells. This is a model of the north wall of the electrical room in all test cells.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record Construction3 =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.127),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127),
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.2032),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.03175)},
    final nLay = 4) "North wall of the electrical room in all test cells"


Wall construction found in test cell XRB. This is a model of an exterior wall used in test cell XRB.
    It is used to model both the south facing wall, and the north facing
    wall next to the door.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record Construction5and8 =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.1016),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127),
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.01588)},
    final nLay = 3) "Wall construction found in test cell XRB"


South wall in test bed X1. This is a model of the south wall in test bed X1.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record Construction9 =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127),
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.06985),
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.01588)},
    final nLay = 3) "South wall in test bed X1"


Model of an insulated exterior door. This is a model of an insulated exterior door. It is used in all
    FLEXLAB test cell models.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record ExteriorDoorInsulated =
   Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.01588),
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.05),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.01588)},
    final nLay=3) "Model of an insulated exterior door"


Model of an uninsulated exterior door. This is a model of an uninsulated exterior door. It is used in all
    FLEXLAB electrical room models.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.ExteriorConstructions;
record ExteriorDoorUninsulated =
   Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.01588),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.01588)},
    final nLay=2) "Model of an uninsulated exterior door"


Exterior walls in FLEXLAB test cells

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions;
package ExteriorConstructions "Exterior walls in FLEXLAB test cells"
  extends Modelica.Icons.MaterialPropertiesPackage;
end ExteriorConstructions;


within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions;
package PartitionConstructions "Constructions used in partitions contained within a test cell"
  extends Modelica.Icons.MaterialPropertiesPackage;
end PartitionConstructions;


Model of a partition door. Air is neglected. This is a model of a parition door. It is used in every test cell
    as the door between the cell itself and the closet.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.PartitionConstructions;
record PartitionDoor =
   Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.01588),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.01588)},
    final nLay=2) "Model of a partition door. Air is neglected"


Model of a partition wall. Air is neglected. This is a model of a partition wall. It is used in every test cell to
    separate the test cell itself and the attached closet.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.PartitionConstructions;
record PartitionWall =
   Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.01588),
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.01588)},
    final nLay=2) "Model of a partition wall. Air is neglected"


Construction model for a roof minimally compliant with ASHRAE 90.1-1975.
      Used in test cells X1A and X1B. This is a model of a roof which is minimally compliant with ASHRAE 90.1-1975. It is used
    to model the roof in test bed X1.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.Roofs;
record ASHRAE_901_1975Roof =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.016),
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.09652),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127)},
    final nLay=3) "Construction model for a roof minimally compliant with ASHRAE 90.1-1975.
      Used in test cells X1A and X1B"


Construction model for a roof minimally compliant with ASHRAE
    90.1-2010. Used in test cells X3A, X3B, and XRA. This is a model of a roof which is minimally compliant with ASHRAE 90.1-2010.
    It is used in the bed X3 and test cell XRA.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.Roofs;
record ASHRAE_901_2010Roof =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.016),
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.1016),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127)},
    final nLay=3) "Construction model for a roof minimally compliant with ASHRAE
    90.1-2010. Used in test cells X3A, X3B, and XRA"


Construction model for a roof minimally compliant with CA Title 24-2013.
      Used in test cells X2A and X2B. This is a model of a roof construction which is minimally compliant with
    CA Title 24-2013. It is used in test bed 90X2.

within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions.Roofs;
record CA_T24_2013Roof =
  Buildings.HeatTransfer.Data.OpaqueConstructions.Generic(final material={
    Buildings.HeatTransfer.Data.Solids.GypsumBoard(x=0.016),
    Buildings.HeatTransfer.Data.Solids.InsulationBoard(x=0.1016),
    Buildings.HeatTransfer.Data.Solids.Plywood(x=0.0127)},
    final nLay=3) "Construction model for a roof minimally compliant with CA Title 24-2013.
      Used in test cells X2A and X2B"


within Buildings.ThermalZones.Detailed.FLEXLAB.Data.Constructions.OpaqueConstructions;
package Roofs "Roof constructions commonly found in FLEXLAB test cells"
  extends Modelica.Icons.MaterialPropertiesPackage;
end Roofs;


within Buildings.ThermalZones.Detailed.FLEXLAB;
package Rooms "Models of individual rooms in FLEXLAB test beds"
extends Modelica.Icons.Package;
end Rooms;


Unit tests for models in FLEXLAB.Rooms

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms;
package Examples "Unit tests for models in FLEXLAB.Rooms"
extends Modelica.Icons.ExamplesPackage;
end Examples;


Example model showing a use of X3A

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.Examples;
model X3AWithRadiantFloor "Example model showing a use of X3A"
  extends Modelica.Icons.Example;

  package Air = Buildings.Media.Air "Air model used in the example model";
  package Water = Buildings.Media.Water
    "Water model used in the radiant slab loop";

  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.TestCell X3A(
    nPorts=2,
    redeclare package Medium = Air,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
  Modelica.Blocks.Sources.CombiTimeTable intGai(table=[0,0,0,0; 86400,0,0,0],
      tableOnFile=false)
    "Internal gain heat flow (Radiant = 1, Convective = 2, Latent = 3)"
  Modelica.Blocks.Sources.CombiTimeTable shaPos(table=[0,1; 86400,1],
      tableOnFile=false) "Position of the shade"
  Modelica.Blocks.Sources.CombiTimeTable airCon(table=[0,0.1,293.15; 86400,0.1,293.15],
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5) "Inlet air conditions (y[1] = m_flow, y[4] = T)"
  Buildings.Fluid.Sources.MassFlowSource_T airIn(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for X3A"
  Buildings.Fluid.Sources.Boundary_pT
    airOut(nPorts=1, redeclare package Medium = Air) "Air outlet for X3A"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A1(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.09,
    length=32.92,
    disPip=sla4A1.A/sla4A1.length,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north side of cell X3A. Name is taken from drawing M3.02"

  Modelica.Blocks.Sources.CombiTimeTable watCon4A1(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A1(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.Sources.Boundary_pT watOut4A1(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Buildings.HeatTransfer.Sources.PrescribedTemperature preT
    "Temperature of the ground"
  Modelica.Blocks.Sources.CombiTimeTable TGro(
    table=[0,288.15; 86400,288.15], tableOnFile=false)
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic
    slaCon(nLay=3, material={
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.1524,
        k=1.13,
        c=1000,
        d=1400,
        nSta=5),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.127,
        k=0.036,
        c=1200,
        d=40),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.2,
        k=1.8,
        c=1100,
        d=2400)}) "Construction of the slab"
  parameter Buildings.Fluid.Data.Pipes.PEX_RADTEST pipe(dIn=0.015875, dOut=0.01905)

  Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
    Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"))
  Buildings.HeatTransfer.Sources.PrescribedTemperature preT2[2]
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.Electrical ele(
    redeclare package Medium = Air, nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Model of the electrical room"
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.Closet
    clo(
    redeclare package Medium = Air,
    nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Model of the closet"
  Modelica.Blocks.Sources.CombiTimeTable TNei(
    table=[0,293.15,293.15; 86400,293.15,293.15], tableOnFile=false)
    "Temperature of the neighboring test cells (y[1] = X2B, y[2] = X3B)"
  Modelica.Blocks.Sources.CombiTimeTable intGaiEle(
    table=[0,0,0,0; 86400,0,0,0], tableOnFile=false)
    "Internal gain heat flow for the electrical room"
  Modelica.Blocks.Sources.CombiTimeTable airConEle(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected electrical room (y[1] = m_flow, y[4] = T)"

  Modelica.Blocks.Sources.CombiTimeTable airConClo(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected closet (y[1] = m_flow, y[4] = T)"

  Buildings.Fluid.Sources.MassFlowSource_T airInEle(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for the electrical room"
  Buildings.Fluid.Sources.Boundary_pT airOutEle(nPorts=1, redeclare package
      Medium = Air) "Air outlet from the electrical room"
  Buildings.Fluid.Sources.MassFlowSource_T airInClo(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for the closet"
  Buildings.Fluid.Sources.Boundary_pT airOutClo(
    redeclare package Medium = Air, nPorts=1) "Air outlet from the closet"
  Modelica.Blocks.Sources.CombiTimeTable intGaiClo(
    table=[0,0,0,0; 86400,0,0,0], tableOnFile=false)
    "Internal gain heat flow for the closet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4A2(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A2(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A2(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*1.51,
    disPip=sla4A2.A/sla4A2.length,
    length=45.11,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north-central section of cell X3A. Name is taken from drawing M3.02"

  Buildings.Fluid.Sources.Boundary_pT watOut4A2(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4A3(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A3(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A3(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*0.91,
    disPip=sla4A3.A/sla4A3.length,
    length=42.98,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south-central section of cell X3A. Name is taken from drawing M3.02"

  Buildings.Fluid.Sources.Boundary_pT watOut4A3(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4A4(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A4(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A4(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.65,
    disPip=sla4A4.A/sla4A4.length,
    length=50.9,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south section of cell X3A. Name is taken from drawing M3.02"

  Buildings.Fluid.Sources.Boundary_pT watOut4A4(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
equation
  connect(airCon.y[1],airIn. m_flow_in)
  connect(airCon.y[4],airIn. T_in)
  connect(airIn.ports[1], X3A.ports[1])
  connect(airOut.ports[1], X3A.ports[2])
  connect(sla4A1.surf_b, preT.port)
  connect(watIn4A1.ports[1], sla4A1.port_a)
  connect(sla4A1.port_b, watOut4A1.ports[1])
  connect(watCon4A1.y[1], watIn4A1.m_flow_in)
  connect(watCon4A1.y[2], watIn4A1.T_in)
  connect(TGro.y[1],preT. T)
  connect(weaDat.weaBus, X3A.weaBus)
  connect(shaPos.y, X3A.uSha)
  connect(weaDat.weaBus, ele.weaBus)
  connect(weaDat.weaBus,clo. weaBus)
  connect(ele.surf_surBou[1], X3A.surf_conBou[5])
  connect(clo.surf_surBou[1], X3A.surf_conBou[3])
  connect(clo.surf_surBou[2], X3A.surf_conBou[4])
  connect(airConEle.y[4], airInEle.T_in)
  connect(airInEle.ports[1], ele.ports[1])
  connect(ele.ports[2], airOutEle.ports[1])
  connect(ele.surf_surBou[2], clo.surf_conBou[1])
  connect(preT2[1].port, X3A.surf_conBou[1])
  connect(preT2[2].port, X3A.surf_conBou[2])
  connect(airInClo.ports[1],clo. ports[1])
  connect(TNei.y, preT2.T)
  connect(preT2[2].port, clo.surf_conBou[2])
  connect(airConClo.y[4], airInClo.T_in)
  connect(airConEle.y[3], airInEle.m_flow_in)
  connect(airConClo.y[2], airInClo.m_flow_in)
  connect(airOutClo.ports[1],clo. ports[2])
  connect(intGai.y, X3A.qGai_flow)
  connect(intGaiEle.y, ele.qGai_flow)
  connect(intGaiClo.y,clo. qGai_flow)
  connect(preT.port,clo.surf_conBou[3])
  connect(ele.surf_conBou[1], preT.port)
  connect(sla4A1.surf_a, X3A.surf_surBou[1])
  connect(watCon4A2.y[1], watIn4A2.m_flow_in)
  connect(watCon4A2.y[2], watIn4A2.T_in)
  connect(watIn4A2.ports[1], sla4A2.port_a)
  connect(sla4A2.port_b, watOut4A2.ports[1])
  connect(sla4A2.surf_a, X3A.surf_surBou[2])
  connect(preT.port, sla4A2.surf_b)
  connect(watCon4A3.y[1], watIn4A3.m_flow_in)
  connect(watCon4A3.y[2], watIn4A3.T_in)
  connect(watIn4A3.ports[1], sla4A3.port_a)
  connect(sla4A3.port_b, watOut4A3.ports[1])
  connect(sla4A3.surf_a, X3A.surf_surBou[3])
  connect(preT.port, sla4A3.surf_b)
  connect(watCon4A4.y[1], watIn4A4.m_flow_in)
  connect(watCon4A4.y[2], watIn4A4.T_in)
  connect(watIn4A4.ports[1], sla4A4.port_a)
  connect(sla4A4.port_b, watOut4A4.ports[1])
  connect(preT.port, sla4A4.surf_b)
  connect(sla4A4.surf_a, X3A.surf_surBou[4])
end X3AWithRadiantFloor;


Example model showing a use of X3B

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.Examples;
model X3BWithRadiantFloor "Example model showing a use of X3B"
  extends Modelica.Icons.Example;

  package Air = Buildings.Media.Air "Air model used in the example model";
  package Water = Buildings.Media.Water
    "Water model used in the radiant slab loop";

  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.TestCell X3B(
    nPorts=2,
    redeclare package Medium = Air,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    datConBou(stateAtSurface_a = {false, true, true, true}))
  Modelica.Blocks.Sources.CombiTimeTable intGai(table=[0,0,0,0; 86400,0,0,0],
      tableOnFile=false)
    "Internal gain heat flow (Radiant = 1, Convective = 2, Latent = 3)"
  Modelica.Blocks.Sources.CombiTimeTable shaPos(table=[0,1; 86400,1],
      tableOnFile=false) "Position of the shade"
  Modelica.Blocks.Sources.CombiTimeTable airCon(table=[0,0.1,293.15; 86400,0.1,293.15],
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5) "Inlet air conditions (y[1] = m_flow, y[2] = T)"
  Buildings.Fluid.Sources.MassFlowSource_T airIn(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for X3A"
  Buildings.Fluid.Sources.Boundary_pT
    airOut(nPorts=1, redeclare package Medium = Air) "Air outlet for X3A"

  Buildings.HeatTransfer.Sources.PrescribedTemperature preT
    "Temperature of the ground"
  Modelica.Blocks.Sources.CombiTimeTable TGro(
    table=[0,288.15; 86400,288.15], tableOnFile=false)
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic
    slaCon(nLay=3, material={
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.1524,
        k=1.13,
        c=1000,
        d=1400,
        nSta=5),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.127,
        k=0.036,
        c=1200,
        d=40),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.2,
        k=1.8,
        c=1100,
        d=2400)}) "Construction of the slab"
  parameter Buildings.Fluid.Data.Pipes.PEX_RADTEST pipe(dIn=0.015875, dOut=0.01905)

  Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
        Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"))
  Buildings.HeatTransfer.Sources.PrescribedTemperature preT2
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.Electrical ele(
    redeclare package Medium = Air,
    nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Model of the electrical room"
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.Closet
    clo(
    redeclare package Medium = Air,
    nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    datConBou(stateAtSurface_a = {true, false, false}))
    "Model of the closet"
  Modelica.Blocks.Sources.CombiTimeTable TNei(
    tableOnFile=false,
    table=[0,293.15; 86400,293.15])
    "Temperature of the neighboring test cell (y[1] = X3A)"
  Modelica.Blocks.Sources.CombiTimeTable intGaiEle(
    table=[0,0,0,0; 86400,0,0,0], tableOnFile=false)
    "Internal gain heat flow for the electrical room"
  Modelica.Blocks.Sources.CombiTimeTable airConEle(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected electrical room (y[1] = m_flow, y[2] = T)"

  Modelica.Blocks.Sources.CombiTimeTable airConClo(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected closet (y[1] = m_flow, y[2] = T)"

  Buildings.Fluid.Sources.MassFlowSource_T airInEle(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for the electrical room"
  Buildings.Fluid.Sources.Boundary_pT airOutEle(nPorts=1, redeclare package
      Medium = Air) "Air outlet from the electrical room"
  Buildings.Fluid.Sources.MassFlowSource_T airInClo(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for the closet"
  Buildings.Fluid.Sources.Boundary_pT airOutClo(
    redeclare package Medium = Air, nPorts=1) "Air outlet from the closet"
  Modelica.Blocks.Sources.CombiTimeTable intGaiClo(
    table=[0,0,0,0; 86400,0,0,0], tableOnFile=false)
    "Internal gain heat flow for the closet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B2(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B3(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B3(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B4(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B4(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B4(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.65,
    disPip=sla4B4.A/sla4B4.length,
    length=48.77,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south section of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B4(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B3(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*0.91,
    disPip=sla4B3.A/sla4B3.length,
    length=37.49,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south-central section of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B3(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B2(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B2(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*1.51,
    length=45.11,
    disPip=sla4B2.A/sla4B2.length,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north-central section of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B2(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B1(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B1(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B1(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.09,
    disPip=sla4B1.A/sla4B1.length,
    length=38.71,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north side of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B1(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
equation
  connect(airCon.y[1],airIn. m_flow_in)
  connect(airCon.y[4],airIn. T_in)
  connect(airIn.ports[1],X3B. ports[1])
  connect(airOut.ports[1],X3B. ports[2])
  connect(TGro.y[1],preT. T)
  connect(weaDat.weaBus,X3B. weaBus)
  connect(shaPos.y,X3B. uSha)
  connect(weaDat.weaBus, ele.weaBus)
  connect(weaDat.weaBus,clo. weaBus)
  connect(airConEle.y[4], airInEle.T_in)
  connect(airInEle.ports[1], ele.ports[1])
  connect(ele.ports[2], airOutEle.ports[1])
  connect(ele.surf_surBou[2], clo.surf_conBou[1])
  connect(airInClo.ports[1],clo. ports[1])
  connect(airConClo.y[4], airInClo.T_in)
  connect(airConEle.y[3], airInEle.m_flow_in)
  connect(airConClo.y[2], airInClo.m_flow_in)
  connect(airOutClo.ports[1],clo. ports[2])
  connect(intGai.y,X3B. qGai_flow)
  connect(intGaiEle.y, ele.qGai_flow)
  connect(intGaiClo.y,clo. qGai_flow)
  connect(preT.port,clo.surf_conBou[3])
  connect(ele.surf_conBou[1], preT.port)
  connect(X3B.surf_conBou[2], clo.surf_surBou[1])
  connect(X3B.surf_conBou[3], clo.surf_surBou[2])
  connect(X3B.surf_conBou[4], ele.surf_surBou[1])
  connect(TNei.y[1], preT2.T)
  connect(preT2.port, X3B.surf_conBou[1])
  connect(preT2.port, clo.surf_conBou[2])
  connect(watCon4B2.y[1],watIn4B2. m_flow_in)
  connect(watCon4B2.y[2],watIn4B2. T_in)
  connect(watCon4B3.y[1],watIn4B3. m_flow_in)
  connect(watCon4B3.y[2],watIn4B3. T_in)
  connect(watCon4B4.y[1],watIn4B4. m_flow_in)
  connect(watCon4B4.y[2],watIn4B4. T_in)
  connect(watIn4B4.ports[1],sla4B4. port_a)
  connect(watIn4B3.ports[1],sla4B3. port_a)
  connect(sla4B4.port_b,watOut4B4. ports[1])
  connect(sla4B3.port_b,watOut4B3. ports[1])
  connect(watIn4B2.ports[1],sla4B2. port_a)
  connect(sla4B2.port_b,watOut4B2. ports[1])
  connect(watCon4B1.y[2],watIn4B1. T_in)
  connect(watIn4B1.ports[1],sla4B1. port_a)
  connect(sla4B1.port_b,watOut4B1. ports[1])
  connect(preT.port, sla4B1.surf_b)
  connect(preT.port, sla4B2.surf_b)
  connect(preT.port, sla4B3.surf_b)
  connect(preT.port, sla4B4.surf_b)
  connect(sla4B1.surf_a, X3B.surf_surBou[1])
  connect(sla4B2.surf_a, X3B.surf_surBou[2])
  connect(sla4B3.surf_a, X3B.surf_surBou[3])
  connect(sla4B4.surf_a, X3B.surf_surBou[4])
  connect(watCon4B1.y[1], watIn4B1.m_flow_in)
end X3BWithRadiantFloor;


within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.Examples;
model X3WithRadiantFloor
  "Example model of test cells X3A and X3B connected to form test bed X3"
  extends Modelica.Icons.Example;

  package Air = Buildings.Media.Air "Air model used in the example model";
  package Water = Buildings.Media.Water
    "Water model used in the radiant slab loop";

  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.TestCell X3B(redeclare
      package                                                                      Medium = Air,
      nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Test cell X3B"
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.Closet BClo(redeclare
      package                                                                     Medium = Air,
      nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Closet in test cell X3B"
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.Electrical BEle(redeclare
      package                                                                         Medium =
        Air, nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Electrical room in test cell X3B"
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.TestCellFullBed  X3A(redeclare
      package
      Medium = Air, nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Test cell X3A"
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.ClosetFullBed  AClo(redeclare
      package
      Medium = Air, nPorts=1,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Closet in test cell X3A"
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.Electrical AEle(redeclare
      package                                                                         Medium =
        Air, nPorts=2,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Electrical room in test cell X3A"
  Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
        Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"))
  Modelica.Blocks.Sources.CombiTimeTable intGaiCloB(table=[0,0,0,0; 86400,0,0,0],
      tableOnFile=false)
    "Internal gain heat flow for the closet in test cell X3B"
  Modelica.Blocks.Sources.CombiTimeTable intGaiCloA(
    table=[0,0,0,0; 86400,0,0,0], tableOnFile=false)
    "Internal gain heat flow for the closet in test cell X3A"
  Modelica.Blocks.Sources.CombiTimeTable intGaiEleA(table=[0,0,0,0; 86400,0,0,0],
      tableOnFile=false)
    "Internal gain heat flow for the electrical room in test cell X3A"
  Modelica.Blocks.Sources.CombiTimeTable intGaiEleB(table=[0,0,0,0; 86400,0,0,0],
      tableOnFile=false)
    "Internal gain heat flow for the electrical room in test cell X3B"
  Modelica.Blocks.Sources.CombiTimeTable shaPosA(table=[0,1; 86400,1],
      tableOnFile=false) "Position of the shade in test cell X3A"
  Modelica.Blocks.Sources.CombiTimeTable shaPosB(
                                                table=[0,1; 86400,1],
      tableOnFile=false) "Position of the shade in test cell X3B"
  Modelica.Blocks.Sources.CombiTimeTable intGaiA(table=[0,0,0,0; 86400,0,0,0],
      tableOnFile=false)
    "Internal gain heat flow in test cell X3A (Radiant = 1, Convective = 2, Latent = 3)"
  Modelica.Blocks.Sources.CombiTimeTable intGaiB(table=[0,0,0,0; 86400,0,0,0],
      tableOnFile=false)
    "Internal gain heat flow in test cell X3B (Radiant = 1, Convective = 2, Latent = 3)"
  Modelica.Blocks.Sources.CombiTimeTable airConCloA(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected closet of test cell X3A (y[1] = m_flow, y[2] = T)"

  Buildings.Fluid.Sources.MassFlowSource_T airInCloA(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for the closet of test cell X3A"
  Buildings.Fluid.Sources.Boundary_pT airOutCloA(redeclare package Medium = Air,
      nPorts=1) "Air outlet from the closet in test cell X3A"
  Modelica.Blocks.Sources.CombiTimeTable airConCloB(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected closet of test cell X3B (y[1] = m_flow, y[2] = T)"

  Buildings.Fluid.Sources.MassFlowSource_T airInCloB(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for the closet of test cell X3B"
  Buildings.Fluid.Sources.Boundary_pT airOutCloB(redeclare package Medium = Air,
      nPorts=1) "Air outlet from the closet in test cell X3B"
  Modelica.Blocks.Sources.CombiTimeTable airConA(
    table=[0,0.1,293.15; 86400,0.1,293.15],
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for test cell X3A (y[1] = m_flow, y[2] = T)"

  Buildings.Fluid.Sources.MassFlowSource_T airInA(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for X3A"
  Buildings.Fluid.Sources.Boundary_pT airOutA(nPorts=1, redeclare package
      Medium = Air) "Air outlet for X3A"
  Modelica.Blocks.Sources.CombiTimeTable airConB(
    table=[0,0.1,293.15; 86400,0.1,293.15],
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for test cell X3B (y[1] = m_flow, y[2] = T)"

  Buildings.Fluid.Sources.MassFlowSource_T airInB(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1) "Inlet air conditions (from AHU) for X3B"
  Buildings.Fluid.Sources.Boundary_pT airOutB(nPorts=1, redeclare package
      Medium = Air) "Air outlet for X3B"
  Modelica.Blocks.Sources.CombiTimeTable airConEleA(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected electrical room in test cell X3A (y[1] = m_flow, y[2] = T)"

  Buildings.Fluid.Sources.MassFlowSource_T airInEleA(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1)
    "Inlet air conditions (from AHU) for the electrical room in test cell X3A"
  Buildings.Fluid.Sources.Boundary_pT airOutEleA(redeclare package Medium = Air,
      nPorts=1) "Air outlet from the electrical room in test cell X3A"

  Buildings.HeatTransfer.Sources.PrescribedTemperature preT
    "Temperature of the ground"
  Modelica.Blocks.Sources.CombiTimeTable TGro(
    table=[0,288.15; 86400,288.15], tableOnFile=false)
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic
    slaCon(nLay=3, material={
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.1524,
        k=1.13,
        c=1000,
        d=1400,
        nSta=5),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.127,
        k=0.036,
        c=1200,
        d=40),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.2,
        k=1.8,
        c=1100,
        d=2400)}) "Construction of the slab"
  parameter Buildings.Fluid.Data.Pipes.PEX_RADTEST pipe(dIn=0.015875, dOut=0.01905)

  Modelica.Blocks.Sources.CombiTimeTable TNei(    tableOnFile=false, table=[0,293.15;
        86400,293.15]) "Temperature of the neighboring test cells (y[1] = X2B)"
  Buildings.HeatTransfer.Sources.PrescribedTemperature preT2
  Buildings.Fluid.Sources.Boundary_pT airOutEleB(redeclare package Medium = Air,
      nPorts=1) "Air outlet from the electrical room in test cell X3B"
  Buildings.Fluid.Sources.MassFlowSource_T airInEleB(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Air,
    nPorts=1)
    "Inlet air conditions (from AHU) for the electrical room in test cell X3B"
  Modelica.Blocks.Sources.CombiTimeTable airConEleB(
    tableOnFile=true,
    tableName="airCon",
    fileName=Modelica.Utilities.Files.loadResource(
       "modelica://Buildings/Resources/Data/ThermalZones/Detailed/FLEXLAB/Rooms/Examples/X3AWithRadiantFloor.txt"),
    columns=2:5)
    "Inlet air conditions for the connected electrical room in test cell X3B (y[1] = m_flow, y[2] = T)"

  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A1(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.09,
    length=32.92,
    disPip=sla4A1.A/sla4A1.length,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north side of cell X3A. Name is taken from drawing M3.02"
  Modelica.Blocks.Sources.CombiTimeTable watCon4A1(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A1(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Modelica.Blocks.Sources.CombiTimeTable watCon4A2(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A2(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A2(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*1.51,
    disPip=sla4A2.A/sla4A2.length,
    length=45.11,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north-central section of cell X3A. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4A2(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4A3(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A3(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A3(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*0.91,
    disPip=sla4A3.A/sla4A3.length,
    length=42.98,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south-central section of cell X3A. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4A3(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4A4(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4A4(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4A4(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.65,
    disPip=sla4A4.A/sla4A4.length,
    length=50.9,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south section of cell X3A. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4A4(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Buildings.Fluid.Sources.Boundary_pT watOut4A1(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B1(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B1(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B1(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.09,
    disPip=sla4B1.A/sla4B1.length,
    length=38.71,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north side of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B1(          redeclare package
      Medium = Water, nPorts=1) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B2(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B2(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B2(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*1.51,
    length=45.11,
    disPip=sla4B2.A/sla4B2.length,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the north-central section of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B2(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B3(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B3(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B3(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*0.91,
    disPip=sla4B3.A/sla4B3.length,
    length=37.49,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south-central section of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B3(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
  Modelica.Blocks.Sources.CombiTimeTable watCon4B4(tableOnFile=false, table=[0,
        0.504,293.15; 86400,0.504,293.15])
    "Inlet water conditions (y[1] = m_flow, y[2] =  T)"
  Buildings.Fluid.Sources.MassFlowSource_T watIn4B4(
    nPorts=1,
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = Water)
    "Inlet water conditions (from central plant)"
  Buildings.Fluid.HeatExchangers.RadiantSlabs.SingleCircuitSlab sla4B4(
    sysTyp=Buildings.Fluid.HeatExchangers.RadiantSlabs.Types.SystemType.Floor,
    iLayPip=1,
    redeclare package Medium = Water,
    pipe=pipe,
    layers=slaCon,
    m_flow_nominal=0.504,
    A=6.645*3.65,
    disPip=sla4B4.A/sla4B4.length,
    length=48.77,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    stateAtSurface_b=false)
    "Radiant slab serving the south section of cell X3B. Name is taken from drawing M3.02"
  Buildings.Fluid.Sources.Boundary_pT watOut4B4(nPorts=1, redeclare package
      Medium = Water) "Water outlet"
equation
  connect(X3B.surf_conBou[2], BClo.surf_surBou[1])
  connect(X3B.surf_conBou[3], BClo.surf_surBou[2])
  connect(X3B.surf_conBou[4], BEle.surf_surBou[1])

  connect(BClo.surf_conBou[1], BEle.surf_surBou[2])
  connect(X3A.surf_surBou[5], X3B.surf_conBou[1])
  connect(AClo.surf_surBou[3], BClo.surf_conBou[2])
  connect(X3A.surf_conBou[2], AClo.surf_surBou[1])

  connect(X3A.surf_conBou[3], AClo.surf_surBou[2])

  connect(AEle.surf_surBou[2], AClo.surf_conBou[1])
  connect(weaDat.weaBus, AEle.weaBus)
  connect(weaDat.weaBus, AClo.weaBus)
  connect(weaDat.weaBus, X3A.weaBus)
  connect(weaDat.weaBus, BClo.weaBus)
  connect(weaDat.weaBus, X3B.weaBus)
  connect(weaDat.weaBus, BEle.weaBus)
  connect(X3A.surf_conBou[4], AEle.surf_surBou[1])

  connect(intGaiCloB.y, BClo.qGai_flow)
  connect(intGaiCloA.y, AClo.qGai_flow)
  connect(intGaiEleA.y, AEle.qGai_flow)
  connect(intGaiEleB.y, BEle.qGai_flow)
  connect(shaPosA.y, X3A.uSha)
  connect(shaPosB.y, X3B.uSha)
  connect(intGaiA.y, X3A.qGai_flow)
  connect(intGaiB.y, X3B.qGai_flow)
  connect(airOutCloA.ports[1], AClo.ports[1])
  connect(airInCloA.ports[1], AClo.ports[1])
  connect(airConCloA.y[2], airInCloA.m_flow_in)
  connect(airConCloA.y[4], airInCloA.T_in)
  connect(airConCloB.y[2], airInCloB.m_flow_in)
  connect(airConCloB.y[4], airInCloB.T_in)
  connect(airOutCloB.ports[1], BClo.ports[1])
  connect(airInCloB.ports[1], BClo.ports[2])
  connect(airConA.y[1], airInA.m_flow_in)
  connect(airConA.y[4], airInA.T_in)
  connect(airInA.ports[1], X3A.ports[1])
  connect(airOutA.ports[1], X3A.ports[2])
  connect(airConB.y[1], airInB.m_flow_in)
  connect(airConB.y[4], airInB.T_in)
  connect(airInB.ports[1], X3B.ports[1])
  connect(airOutB.ports[1], X3B.ports[2])
  connect(airConEleA.y[3], airInEleA.m_flow_in)
  connect(airConEleA.y[4], airInEleA.T_in)
  connect(airOutEleA.ports[1], AEle.ports[1])
  connect(airInEleA.ports[1], AEle.ports[2])
  connect(TGro.y[1],preT. T)
  connect(TNei.y[1], preT2.T)
  connect(preT2.port, X3A.surf_conBou[1])
  connect(preT.port, BClo.surf_conBou[3])
  connect(preT.port, BEle.surf_conBou[1])
  connect(preT.port, AEle.surf_conBou[1])
  connect(preT.port, AClo.surf_conBou[2])
  connect(airConEleB.y[4], airInEleB.T_in)
  connect(airConEleB.y[3], airInEleB.m_flow_in)
  connect(airOutEleB.ports[1], BEle.ports[1])
  connect(airInEleB.ports[1], BEle.ports[2])
  connect(watIn4A1.ports[1],sla4A1. port_a)
  connect(watCon4A1.y[1],watIn4A1. m_flow_in)
  connect(watCon4A1.y[2],watIn4A1. T_in)
  connect(watCon4A2.y[1],watIn4A2. m_flow_in)
  connect(watCon4A2.y[2],watIn4A2. T_in)
  connect(watIn4A2.ports[1],sla4A2. port_a)
  connect(sla4A2.port_b,watOut4A2. ports[1])
  connect(watCon4A3.y[1],watIn4A3. m_flow_in)
  connect(watCon4A3.y[2],watIn4A3. T_in)
  connect(watIn4A3.ports[1],sla4A3. port_a)
  connect(sla4A3.port_b,watOut4A3. ports[1])
  connect(watCon4A4.y[1],watIn4A4. m_flow_in)
  connect(watCon4A4.y[2],watIn4A4. T_in)
  connect(watIn4A4.ports[1],sla4A4. port_a)
  connect(sla4A4.port_b,watOut4A4. ports[1])
  connect(sla4A1.port_b,watOut4A1. ports[1])
  connect(preT.port, sla4A1.surf_b)
  connect(sla4A1.surf_a, X3A.surf_surBou[1])
  connect(sla4A2.surf_a, X3A.surf_surBou[2])
  connect(preT.port, sla4A2.surf_b)

  connect(preT.port, sla4A3.surf_b)

  connect(sla4A3.surf_a, X3A.surf_surBou[3])
  connect(sla4A4.surf_a, X3A.surf_surBou[4])
  connect(preT.port, sla4A4.surf_b)
  connect(watIn4B1.ports[1],sla4B1. port_a)
  connect(sla4B1.port_b, watOut4B1.ports[1])
  connect(watCon4B1.y[2], watIn4B1.T_in)
  connect(watCon4B1.y[1], watIn4B1.m_flow_in)
  connect(preT.port, sla4B1.surf_b)
  connect(sla4B1.surf_a, X3B.surf_surBou[1])
  connect(sla4B2.port_b, watOut4B2.ports[1])
  connect(watIn4B2.ports[1], sla4B2.port_a)
  connect(watCon4B2.y[2], watIn4B2.T_in)
  connect(watCon4B2.y[1], watIn4B2.m_flow_in)
  connect(preT.port, sla4B2.surf_b)
  connect(sla4B2.surf_a, X3B.surf_surBou[2])
  connect(watOut4B3.ports[1], sla4B3.port_b)
  connect(sla4B3.port_a, watIn4B3.ports[1])
  connect(watCon4B3.y[2], watIn4B3.T_in)
  connect(watCon4B3.y[1], watIn4B3.m_flow_in)
  connect(preT.port, sla4B3.surf_b)
  connect(sla4B3.surf_a, X3B.surf_surBou[3])
  connect(watOut4B4.ports[1], sla4B4.port_b)
  connect(sla4B4.port_a, watIn4B4.ports[1])
  connect(watCon4B4.y[2], watIn4B4.T_in)
  connect(watCon4B4.y[1], watIn4B4.m_flow_in)
  connect(preT.port, sla4B4.surf_b)
  connect(sla4B4.surf_a, X3B.surf_surBou[4])
end X3WithRadiantFloor;


within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A;
model Closet "Model of the closet connected to test cell X3A"
  extends Buildings.ThermalZones.Detailed.MixedAir(
  hRoo = 3.6576,
  AFlo = 3.93,
  nConExt = 2,
  nConBou = 3,
  nSurBou = 2,
  nConExtWin = 0,
  nConPar = 0,
  surBou(
    A = {3.6576 * 2.886075 - 2.39*1.22, 2.39 * 1.22},
    each absIR = 0.9,
    each absSol = 0.9,
    each til=Buildings.Types.Tilt.Wall),
  datConExt(
    layers = {higIns, roo},
    A = {3.6576 * 1.667, AFlo},
    til = {Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Ceiling},
    azi = {Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N}),
  datConBou(
    layers = {higIns, celDiv, slaCon},
    A = {3.6576*1.524, 3.6576 * 1.524, 3.93},
    til = {Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Floor},
    azi = {Buildings.Types.Azimuth.W, Buildings.Types.Azimuth.E, Buildings.Types.Azimuth.N},
    stateAtSurface_a = {true, false, false}));

  replaceable parameter
    Data.Constructions.OpaqueConstructions.DividingWalls.CellAndElectricalDividingWall
                                                                      higIns
    "High insulation wall. Between X3A closet and exterior, X3A closet and electrical room"
  replaceable parameter
    Data.Constructions.OpaqueConstructions.DividingWalls.TestCellDividngWall
                                                                         celDiv
    "Wall dividing the X3A closet and the X3B closet"
  replaceable parameter Data.Constructions.OpaqueConstructions.Roofs.ASHRAE_901_2010Roof
                                                                   roo
    "Construction of the roof of the closet in X3A"

  parameter HeatTransfer.Data.OpaqueConstructions.Generic
    slaCon(nLay=3, material={
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.1524,
        k=1.13,
        c=1000,
        d=1400,
        nSta=5),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.127,
        k=0.036,
        c=1200,
        d=40),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.2,
        k=1.8,
        c=1100,
        d=2400)}) "Construction of the slab"
end Closet;


Model of the closet connected to test cell X3A intended to be connected to ThermalZones.Detailed.FLEXLAB.Rooms.X3B.Closet. This is a duplicate model of
    Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.Closet with the wall separating this model and

    Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.Closet removed. It is intended for use in simulations
    which include both room models to simulate the whole test bed. If the regular models are used
    the wall separating the closets will be modeled twice, so one model must have the wall removed.
    This documentation only describes the walls and connections which are different from

    Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.Closet. For information on the rest of the walls
    and connections see that documentation.

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A;
model ClosetFullBed
  "Model of the closet connected to test cell X3A intended to be connected to ThermalZones.Detailed.FLEXLAB.Rooms.X3B.Closet"
  extends Buildings.ThermalZones.Detailed.MixedAir(
  hRoo = 3.6576,
  AFlo = 3.93,
  nConExt = 2,
  nConBou = 2,
  nSurBou = 3,
  nConExtWin = 0,
  nConPar = 0,
  surBou(
    A = {3.6576 * 2.886075 - 2.39*1.22, 2.39 * 1.22, 3.6576 * 1.524},
    each absIR = 0.9,
    each absSol = 0.9,
    each til=Buildings.Types.Tilt.Wall),
  datConExt(
    layers = {higIns, roo},
    A = {3.6576 * 1.667, AFlo},
    til = {Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Ceiling},
    azi = {Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N}),
  datConBou(
    layers = {higIns, slaCon},
    A = {3.6576*1.524, 3.93},
    til = {Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Floor},
    azi = {Buildings.Types.Azimuth.W, Buildings.Types.Azimuth.N},
    stateAtSurface_a = {true, false}));

  replaceable parameter
    Data.Constructions.OpaqueConstructions.DividingWalls.CellAndElectricalDividingWall
                                                                      higIns
    "High insulation wall. Between X3A closet and exterior, X3A closet and electrical room"
  replaceable parameter
    Data.Constructions.OpaqueConstructions.DividingWalls.TestCellDividngWall
                                                                         celDiv
    "Wall dividing the X3A closet and the X3B closet"
  replaceable parameter Data.Constructions.OpaqueConstructions.Roofs.ASHRAE_901_2010Roof
                                                                   roo
    "Construction of the roof of the closet in X3A"

  parameter HeatTransfer.Data.OpaqueConstructions.Generic
    slaCon(nLay=3, material={
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.1524,
        k=1.13,
        c=1000,
        d=1400,
        nSta=5),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.127,
        k=0.036,
        c=1200,
        d=40),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.2,
        k=1.8,
        c=1100,
        d=2400)}) "Construction of the slab"
end ClosetFullBed;


Model of the electrical room attached to test cell X3A. This is a model for the electrical room connected to test cell 3A in the LBNL User Facility.
  Other models are provided for the main space of the test cell and the connected closet. This
  documentation describes the wall constructions used in the electrical room model. For
  documentation describing how the room models are to be connected to develop a model of the
  entire X3A test cell see

  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A;
model Electrical "Model of the electrical room attached to test cell X3A"
  extends Buildings.ThermalZones.Detailed.MixedAir(
  hRoo = 3.6576,
  AFlo = 2.39,
  nSurBou = 2,
  nConExt=4,
  nConExtWin=0,
  nConPar=0,
  nConBou=1,
  surBou(
    A = {3.6576 * 1.2641, 3.6576 * 1.524},
    each absIR = 0.9,
    each absSol = 0.9,
    each til = Buildings.Types.Tilt.Wall),
  datConExt(
    layers = {eleExt, eleExt, extDooUn, roo},
    A = {3.6576 * 1.26413, 3.6576 * 1.524 - 2.38658 * 1.524, 2.38658*1.524, 2.39},
    til = {Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Ceiling},
    azi = {Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.W, Buildings.Types.Azimuth.W, Buildings.Types.Azimuth.N}),
   datConBou(
     layers = {slaCon},
     A = {2.39},
     til = {Buildings.Types.Tilt.Floor},
     azi = {Buildings.Types.Azimuth.N},
     each stateAtSurface_a = false));

  replaceable parameter
    Data.Constructions.OpaqueConstructions.ExteriorConstructions.Construction3
    eleExt "Construction describing the exterior walls in the electrical room"
  replaceable parameter
    Data.Constructions.OpaqueConstructions.ExteriorConstructions.ExteriorDoorUninsulated
    extDooUn "Construction describing the door in the electrical room"
  replaceable parameter Data.Constructions.OpaqueConstructions.Roofs.ASHRAE_901_2010Roof
                                                                   roo
    "Construction describing the roof of the electrical room"
  parameter HeatTransfer.Data.OpaqueConstructions.Generic
    slaCon(nLay=3, material={
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.1524,
        k=1.13,
        c=1000,
        d=1400,
        nSta=5),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.127,
        k=0.036,
        c=1200,
        d=40),
      Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.2,
        k=1.8,
        c=1100,
        d=2400)}) "Construction of the slab"
end Electrical;


Models of rooms in test cell X3A

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms;
package X3A "Models of rooms in test cell X3A"
extends Modelica.Icons.Package;
end X3A;


Model of LBNL User Test Facility Cell X3A. This is a model for test cell 3A in the LBNL User Facility. This model is intended to represent
  the main space in test cell 3A. This documentation describes the wall constructions used to model
  test cell X3A. Documentation describing how it is to be combined to other room models to create
  a model of the full test cell can be found in
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A;
model TestCell "Model of LBNL User Test Facility Cell X3A"
  extends Buildings.ThermalZones.Detailed.MixedAir(AFlo=60.97,
      nSurBou=4,
      nConPar=0,
      nConBou=5,
      nConExt=4,
      nConExtWin=1,
      hRoo=3.6576,
      surBou(
        A = {6.645*3.09, 6.645*1.51, 6.645*0.91, 6.645*3.65},
        each absIR=0.9,
        each absSol=0.9,
        each til=Buildings.Types.Tilt.Floor),
      datConExt(
         layers={extDoo,
         R16p8Wal,
         R20Wal,
         bedDiv},
         A={1.3716 * 2.39, 3.6576*2.52-2.39*1.3716, 6.6675*9.144, 3.6576 * 1.524},
         til={Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Ceiling, Buildings.Types.Tilt.Wall},
         azi={Buildings.Types.Azimuth.N,Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.S, Buildings.Types.Azimuth.W}),
      datConBou(
         layers = {bedDiv,celDiv, parCon, parDoo, R52Wal},
         A = {3.6576 * 7.62, 3.6576 * 9.144, 3.6576*2.886075-2.39*1.22, 2.39*1.22, 3.6576*1.2614},
         til = {Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall, Buildings.Types.Tilt.Wall},
         azi = {Buildings.Types.Azimuth.W, Buildings.Types.Azimuth.E, Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N},
         stateAtSurface_a = {false, false, true, true, true}),
      datConExtWin(
        layers={R16p8Wal},
        A={6.6675*3.6576},
        glaSys={glaSys},
        hWin={1.8288},
        wWin={5.88},
        til={Buildings.Types.Tilt.Wall},
        azi={Buildings.Types.Azimuth.S}),
      intConMod=Buildings.HeatTransfer.Types.InteriorConvection.Temperature,
      extConMod=Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind);

  replaceable parameter
    Data.Constructions.OpaqueConstructions.ExteriorConstructions.Construction10and23
                                                                     R16p8Wal
  replaceable parameter
    Data.Constructions.OpaqueConstructions.DividingWalls.CellAndElectricalDividingWall
                                                                      R52Wal
  replaceable parameter Data.Constructions.OpaqueConstructions.Roofs.ASHRAE_901_2010Roof
                                                                   R20Wal
  replaceable parameter Data.Constructions.GlazingSystems.ASHRAE901Gla glaSys
  replaceable parameter
    Data.Constructions.OpaqueConstructions.PartitionConstructions.PartitionWall
    parCon

  replaceable parameter
    Data.Constructions.OpaqueConstructions.DividingWalls.TestCellDividngWall
                                                                         celDiv
    "Construction of wall connecting to cell UF90X3B"
  replaceable parameter
    Data.Constructions.OpaqueConstructions.DividingWalls.TestBedDividingWall
                                                                         bedDiv
    "Construction of wall connecting to cell UF90X2B"
  replaceable parameter
    Data.Constructions.OpaqueConstructions.PartitionConstructions.PartitionDoor
                                                                   parDoo
    "Door used in partition walls in FLEXLAB test cells"
  replaceable parameter
    Data.Constructions.OpaqueConstructions.ExteriorConstructions.ExteriorDoorInsulated
    extDoo "Construction of an exterior door"
end TestCell;