Model of LBNL User Test Facility Cell X3A intended for connection with ThermalZones.Detailed.FLEXLAB.Rooms.X3B.TestCell. This is a duplicate model of
  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A.TestCell with the wall separating X3A and X3B removed.
  It is designed for simulations where both X3A and X3B are used in the simulation to model the
  whole test bed. If a simulation is created using TestCell from both packages the dividing wall
  will be modeled twice, so one of the two models used must be created without the dividing wall
  in the model.

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3A;
model TestCellFullBed
  "Model of LBNL User Test Facility Cell X3A intended for connection with ThermalZones.Detailed.FLEXLAB.Rooms.X3B.TestCell"
  extends Buildings.ThermalZones.Detailed.MixedAir(AFlo=60.97,
      nSurBou=5,
      nConPar=0,
      nConBou=4,
      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, 3.6575 * 9.144},
        each absIR=0.9,
        each absSol=0.9,
        til={Buildings.Types.Tilt.Floor, Buildings.Types.Tilt.Floor, Buildings.Types.Tilt.Floor, Buildings.Types.Tilt.Floor, Buildings.Types.Tilt.Wall}),
      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, parCon, parDoo, R52Wal},
         A = {3.6576 * 7.62, 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},
         azi = {Buildings.Types.Azimuth.W, Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N},
         stateAtSurface_a = {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 TestCellFullBed;


within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B;
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, 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 Closet;


Model of the electrical room attached to test cell X3A. This is a model for the electrical room connected to test cell 3B 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 X3B test cell see

  Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B.

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B;
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.E, Buildings.Types.Azimuth.E, Buildings.Types.Azimuth.N}),
   datConBou(
     layers = {slaCon},
     A = {2.39},
     til = {Buildings.Types.Tilt.Floor},
     azi = {Buildings.Types.Azimuth.N},
     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 X3B

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


Model of LBNL User Test Facility Cell X3A. This is a model for test cell 3B in the LBNL User Facility. This model is intended to represent
  the main space in test cell 3B. This documentation describes the wall constructions used to model
  test cell X3B. 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.X3B.

within Buildings.ThermalZones.Detailed.FLEXLAB.Rooms.X3B;
model TestCell "Model of LBNL User Test Facility Cell X3A"
  extends Buildings.ThermalZones.Detailed.MixedAir(AFlo=60.97,
      nSurBou=4,
      nConPar=0,
      nConBou=4,
      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,
         EWal},
         A={1.3716 * 2.39, 3.6576*2.52-2.39*1.3716, 6.6675*9.144,3.6576*9.144},
         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.E}),
      datConBou(
         layers = {celDiv, parCon, parDoo, R52Wal},
         A = {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},
         azi = {Buildings.Types.Azimuth.W, Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N, Buildings.Types.Azimuth.N},
         stateAtSurface_a = {true, 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.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"
  parameter Data.Constructions.OpaqueConstructions.ExteriorConstructions.Construction1
    EWal
end TestCell;


Validation model for the room model with steady state boundary conditions. This model validates that the detailed room model
starts at and remains at exactly <i>20</i>°C room air temperature
if there is no solar radiation, constant outdoor conditions and no internal gains.

within Buildings.ThermalZones.Detailed.Validation;
model MixedAirFreeResponseSteadyState
  "Validation model for the room model with steady state boundary conditions"
  extends Examples.MixedAirFreeResponse(
  weaDat(
      pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      ceiHeiSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      totSkyCovSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      opaSkyCovSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      TDewPoiSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      TBlaSkySou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      TBlaSky=293.15,
      relHumSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      winSpeSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      winDirSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      HInfHorSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
      HSou=Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor));

  Buildings.Controls.OBC.CDL.Reals.Sources.Constant zer(k=0) "Zero input signal"
equation
  connect(zer.y, weaDat.HDifHor_in)
  connect(zer.y, weaDat.HGloHor_in)
end MixedAirFreeResponseSteadyState;


Collection of validation models

within Buildings.ThermalZones.Detailed;
package Validation "Collection of validation models"
extends Modelica.Icons.ExamplesPackage;
end Validation;


within Buildings.ThermalZones.Detailed.Validation;
model RoomCapacityMultiplier
  "Validation model for room capacity multiplier"
  extends Modelica.Icons.Example;
  package MediumA = Buildings.Media.Air "Medium model";

  model Room = Buildings.ThermalZones.Detailed.MixedAir (
    redeclare package Medium = MediumA,
    AFlo=6*4,
    hRoo=2.7,
    nConExt=0,
    nConExtWin=0,
    nConPar=0,
    nConBou=0,
    nSurBou=1,
    surBou(each A=6*2.7,
           each absIR=0.9,
           each absSol=0.9,
           each til=Buildings.Types.Tilt.Wall),
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    mSenFac=1,
    T_start=293.15) "Room model";

  Room roo1 "Room model"

  Room roo2(mSenFac=2) "Room model"

  Modelica.Blocks.Sources.Constant qConGai_flow(k=1) "Convective heat gain"
  Modelica.Blocks.Sources.Constant qRadGai_flow(k=0) "Radiative heat gain"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1 "Multiplex for internal gain"
  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"),
      computeWetBulbTemperature=false)

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(weaDat.weaBus, roo1.weaBus)
  connect(roo2.qGai_flow, multiplex3_1.y)
  connect(roo1.qGai_flow, multiplex3_1.y)
  connect(roo2.weaBus, weaDat.weaBus)
end RoomCapacityMultiplier;


within Buildings.ThermalZones.Detailed.Validation;
model SingleZoneFloorWithHeating
  "Validation model for SingleZoneFloor with heating and control"
  extends Modelica.Icons.Example;
  package Medium = Buildings.Media.Air "Buildings library air media package";

  parameter Modelica.Units.SI.Area AFloCor=flo.cor.AFlo "Floor area corridor";
  parameter Modelica.Units.SI.Area AFloSou=flo.sou.AFlo "Floor area south";
  parameter Modelica.Units.SI.Area AFloNor=flo.nor.AFlo "Floor area north";
  parameter Modelica.Units.SI.Area AFloEas=flo.eas.AFlo "Floor area east";
  parameter Modelica.Units.SI.Area AFloWes=flo.wes.AFlo "Floor area west";

  parameter Modelica.Units.SI.Volume VRooCor=AFloCor*flo.hRoo
    "Room volume corridor";
  parameter Modelica.Units.SI.Volume VRooSou=AFloSou*flo.hRoo
    "Room volume south";
  parameter Modelica.Units.SI.Volume VRooNor=AFloNor*flo.hRoo
    "Room volume north";
  parameter Modelica.Units.SI.Volume VRooEas=AFloEas*flo.hRoo
    "Room volume east";
  parameter Modelica.Units.SI.Volume VRooWes=AFloWes*flo.hRoo
    "Room volume west";
  parameter Modelica.Units.SI.Volume VRoo=VRooSou + VRooEas + VRooNor + VRooWes
       + VRooCor "Total floor volume";

  Buildings.Examples.VAVReheat.BaseClasses.Floor flo(
    redeclare package Medium = Medium,
    use_windPressure=false,
    gai(K=0*[0.4; 0.4; 0.2])) "Five-zone floor model"
  Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
    filNam=Modelica.Utilities.Files.loadResource(
      "modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"),
      computeWetBulbTemperature=false)
    "Weather data"
  Buildings.ThermalZones.Detailed.Validation.BaseClasses.SingleZoneFloor sinZonFlo(
    redeclare package Medium = Medium,
    use_windPressure=false,
    gai(K=0*[0.4; 0.4; 0.2]))
    "Single-zone floor model"
  Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetRoo(k=273.15 + 22,
      y(unit="K", displayUnit="degC")) "Setpoint for room air"
  Buildings.Controls.OBC.CDL.Reals.MultiSum EHeaFlo(nin=5)
    "Heating energy of the five-zone floor"
  Buildings.ThermalZones.Detailed.Validation.BaseClasses.SingleZoneFloorHeater heaAndCon(
    redeclare package Medium=Medium,
    m_flow_nominal=VRoo*3/3600*1.2,
    VRoo=VRoo) "Heater and controller for the singleZoneFloor"
  Buildings.ThermalZones.Detailed.Validation.BaseClasses.SingleZoneFloorHeater heaAndConNor(
    redeclare package Medium = Medium,
    m_flow_nominal=VRooNor*3/3600*1.2,
    VRoo=VRooNor) "Heater and controller for the north zone"
  Buildings.ThermalZones.Detailed.Validation.BaseClasses.SingleZoneFloorHeater heaAndConWes(
    redeclare package Medium = Medium,
    m_flow_nominal=VRooWes*3/3600*1.2,
    VRoo=VRooWes) "Heater and controller for the west zone"
  Buildings.ThermalZones.Detailed.Validation.BaseClasses.SingleZoneFloorHeater heaAndConCor(
    redeclare package Medium = Medium,
    m_flow_nominal=VRooCor*3/3600*1.2,
    VRoo=VRooCor) "Heater and controller for the core zone"
  Buildings.ThermalZones.Detailed.Validation.BaseClasses.SingleZoneFloorHeater heaAndConSou(
    redeclare package Medium = Medium,
    m_flow_nominal=VRooSou*6/3600*1.2,
    VRoo=VRooSou) "Heater and controller for the south zone"
  Buildings.ThermalZones.Detailed.Validation.BaseClasses.SingleZoneFloorHeater heaAndConEas(
    redeclare package Medium = Medium,
    m_flow_nominal=VRooEas*3/3600*1.2,
    VRoo=VRooEas) "Heater and controller for the east zone"
equation
  connect(weaDat.weaBus, flo.weaBus)
  connect(weaDat.weaBus, sinZonFlo.weaBus)
  connect(TSetRoo.y, heaAndCon.TSetRoo)
  connect(heaAndCon.port_a, sinZonFlo.ports[1])
  connect(heaAndCon.port_b, sinZonFlo.ports[2])
  connect(heaAndConNor.port_b, flo.portsNor[2])
  connect(heaAndConWes.port_a, flo.portsWes[1])
  connect(heaAndConWes.port_b, flo.portsWes[2])
  connect(heaAndConCor.port_a, flo.portsCor[1])
  connect(heaAndConCor.port_b, flo.portsCor[2])
  connect(heaAndConSou.port_a, flo.portsSou[1])
  connect(heaAndConSou.port_b, flo.portsSou[2])
  connect(heaAndConEas.port_a, flo.portsEas[1])
  connect(heaAndConEas.port_b, flo.portsEas[2])
  connect(TSetRoo.y, heaAndConNor.TSetRoo)
  connect(TSetRoo.y, heaAndConWes.TSetRoo)
  connect(TSetRoo.y, heaAndConCor.TSetRoo)
  connect(TSetRoo.y, heaAndConSou.TSetRoo)
  connect(TSetRoo.y, heaAndConEas.TSetRoo)
  connect(flo.TRooAir[3], heaAndConNor.TRooMea)
  connect(flo.TRooAir[4], heaAndConWes.TRooMea)
  connect(flo.TRooAir[5], heaAndConCor.TRooMea)
  connect(flo.TRooAir[1], heaAndConSou.TRooMea)
  connect(flo.TRooAir[2], heaAndConEas.TRooMea)
  connect(heaAndConNor.yEHea, EHeaFlo.u[1])
  connect(heaAndConWes.yEHea, EHeaFlo.u[2])
  connect(heaAndConCor.yEHea, EHeaFlo.u[3])
  connect(heaAndConSou.yEHea, EHeaFlo.u[4])
  connect(heaAndConEas.yEHea, EHeaFlo.u[5])
  connect(heaAndConNor.port_a, flo.portsNor[1])
  connect(sinZonFlo.TRooAir, heaAndCon.TRooMea)
end SingleZoneFloorWithHeating;


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


within Buildings.ThermalZones.Detailed.Validation.BaseClasses;
model SingleZoneFloor "Model of a building floor as a single zone"
  replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
    "Medium model for air"
  parameter Modelica.Units.SI.Volume VRoo=4555.7 "Room volum";
  parameter Modelica.Units.SI.Height hRoo=2.74 "Room height";
  parameter Modelica.Units.SI.Length hWin=1.5 "Height of windows";
  parameter Real winWalRat(min=0.01,max=0.99) = 0.33
    "Window to wall ratio for exterior walls";

  parameter Buildings.HeatTransfer.Data.Solids.Plywood matWoo(
    x=0.01,
    k=0.11,
    d=544,
    nStaRef=1) "Wood for exterior construction"
  parameter Buildings.HeatTransfer.Data.Solids.Concrete matCon(
    x=0.1,
    k=1.311,
    c=836,
    nStaRef=5) "Concrete"
  parameter Buildings.HeatTransfer.Data.Solids.Generic matIns(
    x=0.087,
    k=0.049,
    c=836.8,
    d=265,
    nStaRef=5) "Steelframe construction with insulation"
  parameter Buildings.HeatTransfer.Data.Solids.GypsumBoard matGyp(
    x=0.0127,
    k=0.16,
    c=830,
    d=784,
    nStaRef=2) "Gypsum board"
  parameter Buildings.HeatTransfer.Data.Solids.GypsumBoard matGyp2(
    x=0.025,
    k=0.16,
    c=830,
    d=784,
    nStaRef=2) "Gypsum board"
  parameter Buildings.HeatTransfer.Data.Solids.Plywood matFur(x=0.15)
    "Material for furniture"
  parameter Buildings.HeatTransfer.Data.Resistances.Carpet matCar "Carpet"
  parameter Buildings.HeatTransfer.Data.GlazingSystems.DoubleClearAir13Clear glaSys(
    UFra=2,
    shade=Buildings.HeatTransfer.Data.Shades.Gray(),
    haveInteriorShade=false,
    haveExteriorShade=false) "Data record for the glazing system"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic conExtWal(
    final nLay=3,
    material={matWoo,matIns,matGyp}) "Exterior construction"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic conIntWal(
    final nLay=1,
    material={matGyp2}) "Interior wall construction"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic conFlo(
    final nLay=1,
    material={matCon}) "Floor construction (opa_a is carpet)"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic conFur(
    final nLay=1,
    material={matFur}) "Construction for internal mass of furniture"

  parameter Boolean use_windPressure=true
    "Set to true to enable wind pressure";

  Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[2](
    redeclare package Medium = Medium) "Fluid inlets and outlets"

  Modelica.Blocks.Interfaces.RealOutput TRooAir(
    unit="K",
    displayUnit="degC") "Room air temperature"
  Modelica.Blocks.Interfaces.RealOutput p_rel
    "Relative pressure signal of building static pressure"

  Buildings.ThermalZones.Detailed.MixedAir flo(
    redeclare package Medium = Medium,
    AFlo=AFlo,
    hRoo=hRoo,
    nConExt=0,
    nConExtWin=4,
    datConExtWin(
      layers={conExtWal,conExtWal,conExtWal,conExtWal},
      A={49.91*hRoo,49.91*hRoo,33.27*hRoo,33.27*hRoo},
      glaSys={glaSys,glaSys,glaSys,glaSys},
      wWin={winWalRat/hWin*49.91*hRoo,winWalRat/hWin*49.91*hRoo,winWalRat/hWin*33.27
          *hRoo,winWalRat/hWin*33.27*hRoo},
      each hWin=hWin,
      fFra={0.1,0.1,0.1,0.1},
      til={Z_,Z_,Z_,Z_},
      azi={N_,S_,W_,E_}),
    nConPar=3,
    datConPar(
      layers={conFlo,conFur,conIntWal},
      A={AFlo,AFlo*2,(6.47*2 + 40.76 + 24.13)*2*hRoo},
      til={F_,Z_,Z_}),
    nConBou=0,
    nSurBou=0,
    nPorts=7,
    intConMod=Buildings.HeatTransfer.Types.InteriorConvection.Temperature,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Floor"
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temAir
    "Air temperature sensor"
  Buildings.Fluid.Sensors.RelativePressure senRelPre(
    redeclare package Medium = Medium)
    "Building pressure measurement"
  Buildings.Fluid.Sources.Outside out(
    nPorts=1, redeclare package Medium = Medium) "Outdoor air"
  Buildings.BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"

  Buildings.Examples.VAVReheat.BaseClasses.RoomLeakage leaSou(
    redeclare package Medium = Medium,
    VRoo=568.77,
    s=49.91/33.27,
    azi=S_,
    final use_windPressure=use_windPressure)
    "Model for air infiltration through the envelope"
  Buildings.Examples.VAVReheat.BaseClasses.RoomLeakage leaEas(
    redeclare package Medium = Medium,
    VRoo=360.0785,
    s=33.27/49.91,
    azi=E_,
    final use_windPressure=use_windPressure)
    "Model for air infiltration through the envelope"
  Buildings.Examples.VAVReheat.BaseClasses.RoomLeakage leaNor(
    redeclare package Medium = Medium,
    VRoo=568.77,
    s=49.91/33.27,
    azi=N_,
    final use_windPressure=use_windPressure)
    "Model for air infiltration through the envelope"
  Buildings.Examples.VAVReheat.BaseClasses.RoomLeakage leaWes(
    redeclare package Medium = Medium,
    VRoo=360.0785,
    s=33.27/49.91,
    azi=W_,
    final use_windPressure=use_windPressure)
    "Model for air infiltration through the envelope"
  Modelica.Blocks.Sources.CombiTimeTable intGaiFra(
    table=[0,0.05; 8,0.05; 9,0.9; 12,0.9; 12,0.8; 13,0.8; 13,1; 17,1; 19,0.1;
        24,0.05],
    timeScale=3600,
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic)
    "Fraction of internal heat gain"
  Modelica.Blocks.Math.MatrixGain gai(K=10*[0.4; 0.4; 0.2])
    "Matrix gain to split up heat gain in radiant, convective and latent gain"
  Modelica.Blocks.Sources.Constant uSha(k=0)
    "Control signal for the shading device"
  Modelica.Blocks.Routing.Replicator replicator(nout=1)
    "Shading signals for all windows"

protected
  parameter Modelica.Units.SI.Angle S_=Buildings.Types.Azimuth.S
    "Azimuth for south walls";
  parameter Modelica.Units.SI.Angle E_=Buildings.Types.Azimuth.E
    "Azimuth for east walls";
  parameter Modelica.Units.SI.Angle W_=Buildings.Types.Azimuth.W
    "Azimuth for west walls";
  parameter Modelica.Units.SI.Angle N_=Buildings.Types.Azimuth.N
    "Azimuth for north walls";
  parameter Modelica.Units.SI.Angle F_=Buildings.Types.Tilt.Floor
    "Tilt for floor";
  parameter Modelica.Units.SI.Angle Z_=Buildings.Types.Tilt.Wall
    "Tilt for wall";
  parameter Modelica.Units.SI.Area AFlo=VRoo/hRoo "Floor area";

equation
  connect(flo.weaBus, weaBus)
  connect(flo.heaPorAir, temAir.port)
  connect(out.weaBus, weaBus)
  connect(out.ports[1], senRelPre.port_b)
  connect(temAir.T, TRooAir)
  connect(weaBus, leaSou.weaBus)
  connect(weaBus, leaEas.weaBus)
  connect(leaNor.weaBus, weaBus)
  connect(leaSou.port_b, flo.ports[1])
  connect(leaEas.port_b, flo.ports[2])
  connect(leaNor.port_b, flo.ports[3])
  connect(leaWes.port_b, flo.ports[4])
  connect(senRelPre.port_a, flo.ports[5])
  connect(weaBus, leaWes.weaBus)
  connect(senRelPre.p_rel, p_rel)
  connect(intGaiFra.y, gai.u)
  connect(gai.y, flo.qGai_flow)
  connect(uSha.y, replicator.u)
  connect(replicator.y, flo.uSha)
  connect(ports[1], flo.ports[6])
  connect(ports[2], flo.ports[7])
end SingleZoneFloor;


within Buildings.ThermalZones.Detailed.Validation.BaseClasses;
model SingleZoneFloorHeater
  "A model with an ideal heater, a fan, a PI controller and an integrator"
  extends Buildings.Fluid.Interfaces.PartialTwoPortInterface;

  replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
    "Medium model for air"
  parameter Modelica.Units.SI.Volume VRoo "Room air volume";
  parameter Modelica.Units.SI.MassFlowRate m_flow_nominal
    "Nominal mass flowrate";

  Buildings.Controls.OBC.CDL.Interfaces.RealInput TSetRoo(
    unit="K",
    displayUnit="degC")
    "Room setpoint temperature"
  Buildings.Controls.OBC.CDL.Interfaces.RealOutput yEHea(
    unit="J")
    "Heating energy"
  Buildings.Controls.OBC.CDL.Interfaces.RealInput TRooMea(
    unit="K",
    displayUnit="degC")
    "Measured room temperature"

  Buildings.Controls.OBC.CDL.Reals.PID conPID(
    controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
    Ti=900,
    u_s(unit="K", displayUnit="degC"),
    u_m(unit="K", displayUnit="degC")) "Controller for heater"
  Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gai(
    k=20)
    "Gain factor"
  Buildings.Controls.OBC.CDL.Reals.AddParameter addPar(
    p=273.15 + 10,
    y(unit="K", displayUnit="degC"))
    "Compute the leaving water setpoint temperature"
  Fluid.HeatExchangers.Heater_T hea(
    redeclare final package Medium = Medium,
    m_flow_nominal=m_flow_nominal,
    dp_nominal=200,
    show_T=true) "Ideal heater"
  Fluid.Movers.FlowControlled_m_flow fan(
    redeclare package Medium = Medium,
    energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
    m_flow_nominal=m_flow_nominal,
    inputType=Buildings.Fluid.Types.InputType.Constant,
    nominalValuesDefineDefaultPressureCurve=true) "Fan"
  Modelica.Blocks.Continuous.Integrator EHea "Heating energy"

equation
  connect(hea.Q_flow, EHea.u)
  connect(addPar.y, hea.TSet)
  connect(fan.port_b, hea.port_a)
  connect(TRooMea, conPID.u_m)
  connect(TSetRoo, conPID.u_s)
  connect(EHea.y, yEHea)
  connect(port_a, fan.port_a)
  connect(hea.port_b, port_b)
  connect(conPID.y, gai.u)
  connect(gai.y, addPar.u)
end SingleZoneFloorHeater;


within Buildings.ThermalZones.Detailed.Validation;
package BESTEST "Package with models for the BESTEST validation"
  extends Modelica.Icons.ExamplesPackage;

  constant Integer nStaRef = 18 "Number of states in a reference material";
end BESTEST;


User's Guide

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


Schedule that repeats every day. Time schedule that is used for set points.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.BaseClasses;
model DaySchedule "Schedule that repeats every day"
  extends Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable(
    final smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.LinearSegments,
    final extrapolation=Buildings.Controls.OBC.CDL.Types.Extrapolation.Periodic,
    final offset=fill(0, size(table, 2)-1));
end DaySchedule;


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


Case 600FF, but with dual-setpoint for heating and cooling. This model is used for the basic test case 600 of the BESTEST validation suite.
Case 600 is a light-weight building with room temperature control set to
20°C for heating and 27°C for cooling.
The room has no shade and a window that faces south.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case600 "Case 600FF, but with dual-setpoint for heating and cooling"
  extends Case600FF(
    redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResults staRes(
      annualHea(
        Min=3.993*3.6e9,
        Max=4.504*3.6e9,
        Mean=4.213*3.6e9),
      annualCoo(
        Min=-5.432*3.6e9,
        Max=-6.162*3.6e9,
        Mean=-5.856*3.6e9),
    peakHea(Min=3.020*1000, Max=3.359*1000, Mean=3.184*1000),
    peakCoo(Min=-5.422*1000, Max=-6.481*1000, Mean=-6.024*1000)));
  replaceable parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.CriteriaLimits
      heaCri(lowerLimit=3.75*3.6e9, upperLimit=4.98*3.6e9)
    "Annual heating load limits of the test acceptance criteria from ASHRAE/ANSI Standard 140"
  replaceable parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.CriteriaLimits
      cooCri(lowerLimit=-5*3.6e9, upperLimit=-6.83*3.6e9)
    "Annual cooling load limits of the test acceptance criteria from ASHRAE/ANSI Standard 140"
  Buildings.Controls.OBC.CDL.Reals.PID conHea(
    k=0.1,
    Ti=300,
    controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI)
    "Controller for heating"
  Buildings.Controls.OBC.CDL.Reals.PID conCoo(
    k=0.1,
    Ti=300,
    reverseActing=false,
    controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI)
    "Controller for cooling"
  Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gaiHea(k=1E6)
    "Gain for heating"
  Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gaiCoo(k=-1E6)
    "Gain for cooling"
  Modelica.Blocks.Math.Sum sumHeaCoo(nin=2)
    "Sum of heating and cooling heat flow rate"
  Modelica.Blocks.Routing.Multiplex2 multiplex2
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea
    "Prescribed heat flow for heating and cooling"
  Modelica.Blocks.Continuous.Integrator EHea(
    k=1,
    initType=Modelica.Blocks.Types.Init.InitialState,
    y_start=0,
    u(unit="W"),
    y(unit="J")) "Heating energy in Joules"
  Modelica.Blocks.Continuous.Integrator ECoo(
    k=1,
    initType=Modelica.Blocks.Types.Init.InitialState,
    y_start=0,
    u(unit="W"),
    y(unit="J")) "Cooling energy in Joules"
  replaceable BaseClasses.DaySchedule TSetHea(table=[0.0,273.15 + 20])
    "Heating setpoint"
  replaceable BaseClasses.DaySchedule TSetCoo(table=[0.0,273.15 + 27])
    "Cooling setpoint"
  Buildings.Controls.OBC.CDL.Reals.MovingAverage PHea(delta=3600)
    "Hourly averaged heating power"
  Buildings.Controls.OBC.CDL.Reals.MovingAverage PCoo(delta=3600)
    "Hourly averaged cooling power"
  Modelica.Blocks.Sources.RealExpression hGloHor(
    y(final unit="W/m2")=weaDat.weaBus.HGloHor)
    "Global horizontal solar irradiance"
  Modelica.Blocks.Continuous.Integrator gloHor(
    k=1,
    initType=Modelica.Blocks.Types.Init.InitialState,
    y_start=0,
    u(final unit="W/m2"),
    y(final unit="J/m2"))
    "Annual global horizontal solar irradiance"
  Modelica.Blocks.Continuous.Integrator gloSou(
    k=1,
    initType=Modelica.Blocks.Types.Init.InitialState,
    y_start=0,
    u(final unit="W/m2"),
    y(final unit="J/m2"))
    "Annual south global solar irradiance"
  Modelica.Blocks.Continuous.Integrator traSol(
    k=1,
    initType=Modelica.Blocks.Types.Init.InitialState,
    y_start=0,
    u(final unit="W"),
    y(final unit="J"))
    "Annual transmitted solar irradiance"
  Modelica.Blocks.Sources.RealExpression TSkyTem(
    y(final unit="K", displayUnit="degC")=weaDat.weaBus.TBlaSky)
    "Black body sky temperature"
  Buildings.Controls.OBC.CDL.Reals.MovingAverage TSkyTemHou(
    delta=3600,
    u(final unit="K", displayUnit="degC"),
    y(final unit="K", displayUnit="degC"))
    "Hourly averaged sky temperature"
  Buildings.Controls.OBC.CDL.Reals.MovingAverage TSkyTemAnn(
    delta=86400*365,
    u(final unit="K", displayUnit="degC"),
    y(final unit="K", displayUnit="degC"))
    "Annual averaged sky temperature"
equation
  connect(TRooAir.T,conHea. u_m)
  connect(conCoo.u_m, TRooAir.T)
  connect(conHea.y,gaiHea. u)
  connect(conCoo.y,gaiCoo. u)
  connect(gaiHea.y,multiplex2. u1[1])
  connect(gaiCoo.y,multiplex2. u2[1])
  connect(multiplex2.y, sumHeaCoo.u)
  connect(sumHeaCoo.y, preHea.Q_flow)
  connect(EHea.u,gaiHea. y)
  connect(ECoo.u,gaiCoo. y)
  connect(TSetHea.y[1],conHea. u_s)
  connect(TSetCoo.y[1],conCoo. u_s)
  connect(PCoo.u,gaiCoo. y)
  connect(PHea.u,gaiHea. y)
  connect(preHea.port, roo.heaPorAir)
  connect(hGloHor.y, gloHor.u)
  connect(TSkyTem.y, TSkyTemHou.u)
  connect(TSkyTem.y, TSkyTemAnn.u)
  connect(roo.QTraGlo[1], traSol.u)
  connect(roo.HGlo[1], gloSou.u)
end Case600;


within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case600FF
  "Basic test with light-weight construction and free floating temperature"
  extends Modelica.Icons.Example;

  package MediumA = Buildings.Media.Air "Medium model";
  parameter Modelica.Units.SI.Angle S_=Buildings.Types.Azimuth.S
    "Azimuth for south walls";
  parameter Modelica.Units.SI.Angle E_=Buildings.Types.Azimuth.E
    "Azimuth for east walls";
  parameter Modelica.Units.SI.Angle W_=Buildings.Types.Azimuth.W
    "Azimuth for west walls";
  parameter Modelica.Units.SI.Angle N_=Buildings.Types.Azimuth.N
    "Azimuth for north walls";
  parameter Modelica.Units.SI.Angle C_=Buildings.Types.Tilt.Ceiling
    "Tilt for ceiling";
  parameter Modelica.Units.SI.Angle F_=Buildings.Types.Tilt.Floor
    "Tilt for floor";
  parameter Modelica.Units.SI.Angle Z_=Buildings.Types.Tilt.Wall
    "Tilt for wall";
  parameter Integer nConExtWin = 1 "Number of constructions with a window";
  parameter Integer nConBou = 1
    "Number of surface that are connected to constructions that are modeled inside the room";
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matExtWal(
    nLay=3,
    absIR_a=0.9,
    absIR_b=0.9,
    absSol_a=0.6,
    absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.009,
        k=0.140,
        c=900,
        d=530,
        nStaRef=nStaRef),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.066,
        k=0.040,
        c=840,
        d=12,
        nStaRef=nStaRef),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.012,
        k=0.160,
        c=840,
        d=950,
        nStaRef=nStaRef)},
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough) "Exterior wall"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic
    matFlo(
      final nLay=2,
      absIR_a=0.9,
      absIR_b=0.9,
      absSol_a=0.6,
      absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=1.003,
        k=0.040,
        c=0,
        d=0,
        nStaRef=nStaRef),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.025,
        k=0.140,
        c=1200,
        d=650,
        nStaRef=nStaRef)},
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough)
    "Floor"

  Buildings.ThermalZones.Detailed.MixedAir roo(
    redeclare package Medium = MediumA,
    hRoo=2.7,
    nConExtWin=nConExtWin,
    nConBou=1,
    linearizeRadiation=false,
    nPorts=3,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    AFlo=48,
    datConBou(
      layers={matFlo},
      each A=48,
      each til=F_),
    datConExt(
      layers={roof,matExtWal,matExtWal,matExtWal},
      A={48,6*2.7,6*2.7,8*2.7},
      til={C_,Z_,Z_,Z_},
      azi={S_,W_,E_,N_}),
    nConExt=4,
    nConPar=0,
    nSurBou=0,
    datConExtWin(
      layers={matExtWal},
      A={8*2.7},
      glaSys={window600},
      wWin={2*3},
      hWin={2},
      fFra={1e-10},
      til={Z_},
      azi={S_})) "Room model"
  Modelica.Blocks.Sources.Constant qConGai_flow(k=80/48) "Convective heat gain"
  Modelica.Blocks.Sources.Constant qRadGai_flow(k=120/48) "Radiative heat gain"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1
    "Multiplex for internal gains"
  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_CO_Denver.Intl.AP.725650_TMY3.mos"),
      computeWetBulbTemperature=false,
    pAtmSou=Buildings.BoundaryConditions.Types.DataSource.File)
  Modelica.Blocks.Sources.Constant uSha(k=0)
    "Control signal for the shading device"
  Modelica.Blocks.Routing.Replicator replicator(nout=max(1,nConExtWin))
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic roof(
    nLay=3,
    absIR_a=0.9,
    absIR_b=0.9,
    absSol_a=0.6,
    absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.019,
        k=0.140,
        c=900,
        d=530,
        nStaRef=nStaRef),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.1118,
        k=0.040,
        c=840,
        d=12,
        nStaRef=nStaRef),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.010,
        k=0.160,
        c=840,
        d=950,
        nStaRef=nStaRef)},
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough) "Roof"
  replaceable parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.Win600 window600(
    haveExteriorShade=false,
    haveInteriorShade=false) "Window"
  Buildings.Fluid.Sources.MassFlowSource_T sinInf(
    redeclare package Medium = MediumA,
    use_m_flow_in=true,
    nPorts=1) "Sink model for air infiltration"
  Buildings.Fluid.Sources.Outside souInf(redeclare package Medium = MediumA,
      nPorts=1) "Source model for air infiltration"
  Modelica.Blocks.Sources.Constant InfiltrationRate(k=-48*2.7*0.414/3600)
    "0.414 ACH adjusted for the altitude (0.5 at sea level)"
  Modelica.Blocks.Math.Product product
    "Product to compute infiltration mass flow rate"
  Buildings.Fluid.Sensors.Density density(
    redeclare package Medium = MediumA,
    warnAboutOnePortConnection=false)
    "Air density inside the building"
  Buildings.BoundaryConditions.WeatherData.Bus weaBus
   "Weather data bus"
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TRooAir
    "Room air temperature"
  replaceable parameter
    Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResultsFreeFloating
      staRes(
        minT( Min=-13.8+273.15, Max=-9.9+273.15, Mean=-12.7+273.15),
        maxT( Min=62.4+273.15,  Max=68.4+273.15,  Mean=64.6+273.15),
        meanT(Min=24.3+273.15,  Max=26.1+273.15,  Mean=25.2+273.15))
          constrainedby Modelica.Icons.Record
    "Reference results from ASHRAE/ANSI Standard 140"
  Modelica.Blocks.Math.MultiSum multiSum(nu=1)
    "Multi sum for infiltration air flow rate"
  Controls.OBC.CDL.Reals.MovingAverage TRooHou(
    delta=3600,
    y(final unit="K",
      displayUnit="degC"))
    "Hourly averaged room air temperature"
  Controls.OBC.CDL.Reals.MovingAverage TRooAnn(
    delta=86400*365,
    y(final unit="K",
      displayUnit="degC"))
    "Annual averaged room air temperature"

  HeatTransfer.Convection.Exterior conOpa(
    A=48,
    roughness=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough,
    final til=Buildings.Types.Tilt.Floor,
    final azi=0,
    conMod=Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind)
    "Convection model for opaque part of the wall"
  Modelica.Blocks.Sources.Constant zerWin(k=0) "Zero wind speed"
  Modelica.Blocks.Sources.Constant zerDir(k=0) "Zero wind direction"
  Fluid.FixedResistances.PressureDrop res(
    redeclare package Medium = MediumA,
    m_flow_nominal=0.0147,
    from_dp=true,
    dp_nominal=5)
    "Flow resistance to decouple pressure from weather file from room pressure"
protected
  HeatTransfer.Sources.PrescribedTemperature TAirConExt
    "Outside air temperature for exterior constructions"
equation
  connect(qRadGai_flow.y,multiplex3_1. u1[1])
  connect(qLatGai_flow.y,multiplex3_1. u3[1])
  connect(multiplex3_1.y, roo.qGai_flow)
  connect(roo.uSha, replicator.y)
  connect(qConGai_flow.y, multiplex3_1.u2[1])
  connect(weaDat.weaBus, roo.weaBus)
  connect(uSha.y, replicator.u)
  connect(product.y, sinInf.m_flow_in)
  connect(density.port, roo.ports[1])
  connect(weaDat.weaBus, weaBus)
  connect(weaBus, souInf.weaBus)
  connect(roo.heaPorAir, TRooAir.port)
  connect(sinInf.ports[1], roo.ports[2])
  connect(multiSum.y, product.u1)
  connect(InfiltrationRate.y, multiSum.u[1])
  connect(TRooAir.T, TRooHou.u)
  connect(TRooAir.T, TRooAnn.u)
  connect(conOpa.fluid, TAirConExt.port)
  connect(weaBus.TDryBul, TAirConExt.T)
  connect(conOpa.solid, roo.surf_conBou[1])
  connect(zerWin.y, conOpa.v)
  connect(zerDir.y, conOpa.dir)
  connect(density.d, product.u2)
  connect(souInf.ports[1], res.port_a)
  connect(res.port_b, roo.ports[3])
end Case600FF;


Case 600 with south shading. This model is the case 610 of the BESTEST validation suite.
Case 610 differs from case 600 in that the window has an overhang.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case610 "Case 600 with south shading"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
  roo(
     datConExtWin(
      ove(
        wR={0.5},
        wL={0.5},
        dep={1},
        gap={0.5}))),
   staRes(
    annualHea(Min=4.066*3.6e9, Max=4.592*3.6e9, Mean=4.311*3.6e9),
    annualCoo(Min=-4.117*3.6e9, Max=-4.382*3.6e9, Mean=-4.256*3.6e9),
    peakHea(Min=3.021*1000, Max=3.360*1000, Mean=3.168*1000),
    peakCoo(Min=-5.331*1000, Max=-6.432*1000, Mean=-5.861*1000)),
   heaCri(lowerLimit=3.61*3.6e9, upperLimit=5.27*3.6e9),
   cooCri(lowerLimit=-2.74*3.6e9, upperLimit=-6.03*3.6e9));
end Case610;


Case 600, but with windows on East and West side walls. This model is the case 620 of the BESTEST validation suite.
Case 620 differs from case 600 in that the west and east facing walls
have a window, but there is no window in the south facing wall.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case620 "Case 600, but with windows on East and West side walls"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
  roo(
    nConExtWin=2,
    datConExtWin(
      layers={matExtWal, matExtWal},
      each A=6*2.7,
      glaSys={window600, window600},
      each wWin=3,
      each hWin=2,
      each fFra=0.001,
      each til=Z_,
      azi={W_,E_}),
    nConExt=3,
    datConExt(
      layers={roof,matExtWal,matExtWal},
      A={48,8*2.7,8*2.7},
      til={C_,Z_,Z_},
      azi={S_,S_,N_})),
   staRes(
    annualHea(Min=4.094*3.6e9, Max=4.719*3.6e9, Mean=4.413*3.6e9),
    annualCoo(Min=-3.841*3.6e9, Max=-4.404*3.6e9, Mean=-4.090*3.6e9),
    peakHea(Min=3.038*1000, Max=3.385*1000, Mean=3.186*1000),
    peakCoo(Min=-3.955*1000, Max=-4.797*1000, Mean=-4.527*1000)),
   heaCri(lowerLimit=3.67*3.6e9, upperLimit=5.38*3.6e9),
   cooCri(lowerLimit=-2.76*3.6e9, upperLimit=-5.19*3.6e9));

  Modelica.Blocks.Continuous.Integrator gloEas(
    k=1,
    initType=Modelica.Blocks.Types.Init.InitialState,
    y_start=0,
    u(final unit="W/m2"),
    y(final unit="J/m2"))
    "Annual east global solar irradiance"
equation
  connect(roo.HGlo[2], gloEas.u)
end Case620;


Case 620, but with added overhang and sidefins. This model is case 630 of the BESTEST validation suite.
Case 630 differs from case 620 in that the
windows on the west and east walls have an overhang and side fins.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case630 "Case 620, but with added overhang and sidefins"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case620(
  roo(
    datConExtWin(
      ove(
        each wR=0.0,
        each wL=0.0,
        each dep=1.0,
        each gap=0.5),
      sidFin(
        each h=0.5,
        each dep=1.0,
        each gap=0.0))),
   staRes(
    annualHea(Min=4.356*3.6e9, Max=5.139*3.6e9, Mean=4.821*3.6e9),
    annualCoo(Min=-2.573*3.6e9, Max=-3.074*3.6e9, Mean=-2.814*3.6e9),
    peakHea(Min=3.039*1000, Max=3.388*1000, Mean=3.203*1000),
    peakCoo(Min=-3.526*1000, Max=-4.212*1000, Mean=-3.963*1000)),
   heaCri(lowerLimit=3.69*3.6e9, upperLimit=6.12*3.6e9),
   cooCri(lowerLimit=-1.08*3.6e9, upperLimit=-4.42*3.6e9));
end Case630;


Case 600, but with heating schedule. This model is used for the basic test case 640 of the BESTEST validation suite.
Case640 is the same as Case600, but with the following modifications:


Case 600, but cooling based on schedule, night venting, and no heating. This model is used for the test case 650 of the BESTEST validation suite.
Case650 is the same as Case600, but with the following modifications:


Case 600, no heating, no cooling, and ventilation as in case 650. This model is used for the test case 650FF of the BESTEST validation suite.
Case 650FF is identical to case 650, except that there is no
heating and no cooling.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case650FF
  "Case 600, no heating, no cooling, and ventilation as in case 650"
  extends Case600FF(
  redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResultsFreeFloating staRes(
      minT( Min=-17.8+273.15, Max=-16.7+273.15, Mean=-17.3+273.15),
      maxT( Min=61.1+273.15, Max=66.8+273.15, Mean=63.1+273.15),
      meanT(Min=17.6+273.15, Max=18.9+273.15, Mean=18.3+273.15)),
  multiSum(nu=2));
  BaseClasses.DaySchedule vent(table=[      0, -1409/3600;
                                       7*3600, -1409/3600;
                                       7*3600,             0;
                                      18*3600,             0;
                                      18*3600, -1409/3600;
                                      24*3600, -1409/3600])
    "Ventilation air flow rate"
equation
  connect(multiSum.u[2],vent.y[1])
end Case650FF;


Case 600, but with low-emissivity windows with Argon gas. This model is the case 660 of the BESTEST validation suite. Case 660 differs from
case 600 in that it has low-emissivity windwos with Argon gas.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case660
  "Case 600, but with low-emissivity windows with Argon gas"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
   redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.Win660 window600(
     UFra=3,
     haveExteriorShade=false,
     haveInteriorShade=false),
    staRes(
     annualHea(Min=3.574*3.6e9, Max=3.821*3.6e9, Mean=3.713*3.6e9),
     annualCoo(Min=-2.966*3.6e9, Max=-3.340*3.6e9, Mean=-3.172*3.6e9),
     peakHea(Min=2.620*1000, Max=2.955*1000, Mean=2.801*1000),
     peakCoo(Min=-3.343*1000, Max=-3.933*1000, Mean=-3.565*1000)),
   heaCri(lowerLimit=4.68*3.6e9, upperLimit=4.82*3.6e9),
   cooCri(lowerLimit=-1.91*3.6e9, upperLimit=-4.33*3.6e9));
end Case660;


Case 600, but has single pane window with clear glass. This model is the case 670 of the BESTEST validation suite. Case 670 differs from
case 600 in that it has single pane window with clear glass.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case670 "Case 600, but has single pane window with clear glass"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
   redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.Win670 window600(
     UFra=3,
     haveExteriorShade=false,
     haveInteriorShade=false),
    staRes(
     annualHea(Min=5.300*3.6e9, Max=6.140*3.6e9, Mean=5.681*3.6e9),
     annualCoo(Min=-5.954*3.6e9, Max=-6.623*3.6e9, Mean=-6.402*3.6e9),
     peakHea(Min=3.655*1000, Max=4.221*1000, Mean=3.943*1000),
     peakCoo(Min=-5.839*1000, Max=-6.925*1000, Mean=-6.445*1000)),
   heaCri(lowerLimit=4*3.6e9, upperLimit=7.96*3.6e9),
   cooCri(lowerLimit=-5.05*3.6e9, upperLimit=-7.67*3.6e9));
end Case670;


Case 600, but with increased exterior wall and roof insulation. This model is the case 680 of the BESTEST validation suite. Case 680 differs from
case 600 in that it has increased exterior wall and roof insulation.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case680
  "Case 600, but with increased exterior wall and roof insulation"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
    matExtWal = extWalCase680,
    roof =    roofCase680,
    staRes(
     annualHea(Min=1.732*3.6e9, Max=2.286*3.6e9, Mean=2.056*3.6e9),
     annualCoo(Min=-5.932*3.6e9, Max=-6.529*3.6e9, Mean=-6.264*3.6e9),
     peakHea(Min=1.778*1000, Max=2.126*1000, Mean=1.984*1000),
     peakCoo(Min=-5.761*1000, Max=-7.051*1000, Mean=-6.446*1000)),
   heaCri(lowerLimit=1.21*3.6e9, upperLimit=3.08*3.6e9),
   cooCri(lowerLimit=-5.13*3.6e9, upperLimit=-7.7*3.6e9));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase680 extWalCase680
    "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.RoofCase680 roofCase680
    "Roof"
end Case680;


Case 600FF, but with increased exterior wall and roof insulation. This model is used for the test case 680FF of the BESTEST validation suite.
Case 680FF is a light-weight building with increased exterior wall and roof insulation.
The room temperature is free floating.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case680FF
  "Case 600FF, but with increased exterior wall and roof insulation"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600FF(
    matExtWal = extWalCase680,
    roof =    roofCase680,
    redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResultsFreeFloating staRes(
      minT( Min=-8.1+273.15, Max=-5.7+273.15, Mean=-6.9+273.15),
      maxT( Min=69.8+273.15, Max=78.5+273.15, Mean=73.0+273.15),
      meanT(Min=30.2+273.15, Max=33.3+273.15, Mean=31.8+273.15)));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase680 extWalCase680(
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough)
    "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.RoofCase680 roofCase680(
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough)
    "Roof"
end Case680FF;


Case 600, but with single setpoint for heating and cooling. This model is the case 685 of the BESTEST validation suite. Case 685 differs from
case 600 in that it has single heating and cooling setpoint.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case685
  "Case 600, but with single setpoint for heating and cooling"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
   redeclare BaseClasses.DaySchedule TSetCoo(table=[0.0,273.15 + 20.1]),
   redeclare BaseClasses.DaySchedule TSetHea(table=[0.0,273.15 + 19.9]),
    staRes(
     annualHea(Min=4.532*3.6e9, Max=5.042*3.6e9, Mean=4.763*3.6e9),
     annualCoo(Min=-8.238*3.6e9, Max=-9.130*3.6e9, Mean=-8.886*3.6e9),
     peakHea(Min=3.032*1000, Max=3.374*1000, Mean=3.183*1000),
     peakCoo(Min=-6.071*1000, Max=-7.159*1000, Mean=-6.743*1000)),
   heaCri(lowerLimit=4.08*3.6e9, upperLimit=5.75*3.6e9),
   cooCri(lowerLimit=-7.7*3.6e9, upperLimit=-10.14*3.6e9));
end Case685;


Case 600, but with increased exterior wall and roof insulation and single cooling and heating setpoint. This model is the case 695 of the BESTEST validation suite. Case 695 differs from
case 600 in that it has increased exterior wall and roof insulation and it has
single heating and cooling setpoint.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx;
model Case695
  "Case 600, but with increased exterior wall and roof insulation and single cooling and heating setpoint"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
    redeclare BaseClasses.DaySchedule TSetCoo(table=[0.0,273.15 + 20.1]),
    redeclare BaseClasses.DaySchedule TSetHea(table=[0.0,273.15 + 19.9]),
    matExtWal = extWalCase680,
    roof =    roofCase680,
    staRes(
     annualHea(Min=2.385*3.6e9, Max=2.892*3.6e9, Mean=2.656*3.6e9),
     annualCoo(Min=-8.386*3.6e9, Max=-9.172*3.6e9, Mean=-8.912*3.6e9),
     peakHea(Min=1.795*1000, Max=2.138*1000, Mean=2.000*1000),
     peakCoo(Min=-6.232*1000, Max=-7.541*1000, Mean=-6.979*1000)),
   heaCri(lowerLimit=1.7*3.6e9, upperLimit=3.81*3.6e9),
   cooCri(lowerLimit=-7.49*3.6e9, upperLimit=-10.58*3.6e9));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase680 extWalCase680
    "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.RoofCase680 roofCase680
    "Roof"
end Case695;


600 series of ANSI/ASHRAE BESTEST

within Buildings.ThermalZones.Detailed.Validation.BESTEST;
package Cases6xx "600 series of ANSI/ASHRAE BESTEST"
  extends Modelica.Icons.ExamplesPackage;
end Cases6xx;


Case 600, but with high thermal mass. This model is used for the basic test case 900 of the BESTEST validation suite.
Case 900 is a heavy-weight building with room temperature control set to
20°C for heating and 27°C for cooling.
The room has no shade and a window that faces south.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case900 "Case 600, but with high thermal mass"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
   matExtWal = extWalCase900,
   matFlo =    floorCase900,
   staRes(
    annualHea(Min=1.379*3.6e9, Max=1.814*3.6e9, Mean=1.626*3.6e9),
    annualCoo(Min=-2.267*3.6e9, Max=-2.714*3.6e9, Mean=-2.467*3.6e9),
    peakHea(Min=2.443*1000, Max=2.778*1000, Mean=2.591*1000),
    peakCoo(Min=-2.556*1000, Max=-3.376*1000, Mean=-2.975*1000)),
   heaCri(lowerLimit=1.04*3.6e9, upperLimit=2.28*3.6e9),
   cooCri(lowerLimit=-2.35*3.6e9, upperLimit=-2.6*3.6e9));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase900
     extWalCase900
    "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.FloorCase900
    floorCase900
    "Floor"
end Case900;


Case 600FF, but with high thermal mass. This model is used for the test case 900FF of the BESTEST validation suite.
Case 900FF is a heavy-weight building.
The room temperature is free floating.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case900FF "Case 600FF, but with high thermal mass"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600FF(
    matExtWal = extWalCase900,
    matFlo =    floorCase900,
    redeclare Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.StandardResultsFreeFloating staRes(
      minT( Min=0.6+273.15, Max=2.2+273.15, Mean=1.3+273.15),
      maxT( Min=43.3+273.15, Max=46.0+273.15, Mean=44.6+273.15),
      meanT(Min=24.5+273.15, Max=25.7+273.15, Mean=25.2+273.15)));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase900
     extWalCase900 "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.FloorCase900
    floorCase900 "Floor"
end Case900FF;


Case 900, but the window has an overhang. This model is the case 910 of the BESTEST validation suite.
Case 910 differs from case 900 in that the window has an overhang.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case910 "Case 900, but the window has an overhang"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx.Case900(
  roo(
     datConExtWin(
      ove(
        wR={0.5},
        wL={0.5},
        dep={1},
        gap={0.5}))),
   staRes(
    annualHea(Min=1.648*3.6e9, Max=2.163*3.6e9, Mean=1.971*3.6e9),
    annualCoo(Min=-1.191*3.6e9, Max=-1.490*3.6e9, Mean=-1.374*3.6e9),
    peakHea(Min=2.469*1000, Max=2.799*1000, Mean=2.648*1000),
    peakCoo(Min=-2.081*1000, Max=-2.722*1000, Mean=-2.306*1000)),
   heaCri(lowerLimit=1.56*3.6e9, upperLimit=2.3*3.6e9),
   cooCri(lowerLimit=-2*3.6e9, upperLimit=-0.86*3.6e9));
end Case910;


Case 900, but with windows on East and West side walls. This model is the case 920 of the BESTEST validation suite.
Case 920 differs from case 900 in that the west and east facing walls
have a window, but there is no window in the south facing wall.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case920 "Case 900, but with windows on East and West side walls"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx.Case900(
  roo(
    nConExtWin=2,
    datConExtWin(
      layers={matExtWal, matExtWal},
      each A=6*2.7,
      glaSys={window600, window600},
      each wWin=3,
      each hWin=2,
      each fFra=0.001,
      each til=Z_,
      azi={W_,E_}),
    nConExt=3,
    datConExt(
      layers={roof,matExtWal,matExtWal},
      A={48,8*2.7,8*2.7},
      til={C_,Z_,Z_},
      azi={S_,S_,N_})),
   staRes(
    annualHea(Min=2.956*3.6e9, Max=3.607*3.6e9, Mean=3.326*3.6e9),
    annualCoo(Min=-2.549*3.6e9, Max=-3.128*3.6e9, Mean=-2.786*3.6e9),
    peakHea(Min=2.512*1000, Max=2.895*1000, Mean=2.710*1000),
    peakCoo(Min=-2.710*1000, Max=-3.481*1000, Mean=-3.127*1000)),
   heaCri(lowerLimit=2.55*3.6e9, upperLimit=4.2*3.6e9),
   cooCri(lowerLimit=-2.43*3.6e9, upperLimit=-3.08*3.6e9));
end Case920;


Case 920, but with added overhang and sidefins. This model is case 930 of the BESTEST validation suite.
Case 930 differs from case 920 in that the
windows on the west and east walls have an overhang and side fins.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case930 "Case 920, but with added overhang and sidefins"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx.Case920(
  roo(
    datConExtWin(
      ove(
        each wR=0.0,
        each wL=0.0,
        each dep=1.0,
        each gap=0.5),
      sidFin(
        each h=0.5,
        each dep=1.0,
        each gap=0.0))),
   staRes(
    annualHea(Min=3.524*3.6e9, Max=4.384*3.6e9, Mean=4.064*3.6e9),
    annualCoo(Min=-1.654*3.6e9, Max=-2.161*3.6e9, Mean=-1.898*3.6e9),
    peakHea(Min=2.537*1000, Max=2.968*1000, Mean=2.751*1000),
    peakCoo(Min=-2.335*1000, Max=-3.052*1000, Mean=-2.656*1000)),
   heaCri(lowerLimit=2.75*3.6e9, upperLimit=5.35*3.6e9),
   cooCri(lowerLimit=-1.24*3.6e9, upperLimit=-2.64*3.6e9));
end Case930;


Case 900, but with heating schedule. This model is used for the basic test case 940 of the BESTEST validation suite.
Case940 is the same as Case900, but with the following modifications:


Case 900, but cooling based on schedule, night venting, and no heating. This model is used for the test case 950 of the BESTEST validation suite.
Case950 is the same as Case900, but with the following modifications:


Case 900, but no heating, no cooling, and ventilation as in case 650. This model is used for the test case 950FF of the BESTEST validation suite.
Case 950FF is identical to case 950, except that there is no
heating and no cooling.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case950FF
  "Case 900, but no heating, no cooling, and ventilation as in case 650"
  extends Case900FF(
  staRes(
      minT( Min=-13.4+273.15, Max=-12.5+273.15, Mean=-13.0+273.15),
      maxT( Min=36.1+273.15, Max=37.1+273.15, Mean=36.6+273.15),
      meanT(Min=14.4+273.15, Max=15.0+273.15, Mean=14.7+273.15)),
  multiSum(nu=2));

  BaseClasses.DaySchedule vent(table=[      0, -1409/3600;
                                       7*3600, -1409/3600;
                                       7*3600,             0;
                                      18*3600,             0;
                                      18*3600, -1409/3600;
                                      24*3600, -1409/3600])
    "Ventilation air flow rate"
equation
  connect(multiSum.u[2],vent.y[1])
end Case950FF;


within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case960 "Case 900, but with an unconditioned sun-space"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases6xx.Case600(
    roo(
    nConExt=4,
    datConExt(
      layers={roof,matExtWal,matExtWal,matExtWal},
      A={48,6*2.7,6*2.7,8*2.7},
      til={C_,Z_,Z_,Z_},
      azi={S_,W_,E_,N_}),
    nConExtWin=0,
      datConExtWin(A={0}, hWin={0}, wWin={0}),
    nSurBou=1,
    surBou(
      each A=8*2.7,
      each absIR=0.9,
      each absSol=0.6,
      each til=Buildings.Types.Tilt.Wall)),
    souInf(nPorts=2),
    staRes(
      annualHea(Min=2.522*3.6e9, Max=2.860*3.6e9, Mean=2.693*3.6e9),
      annualCoo(Min=-0.789*3.6e9, Max=-0.950*3.6e9, Mean=-0.896*3.6e9),
      peakHea(Min=2.085*1000, Max=2.300*1000, Mean=2.196*1000),
      peakCoo(Min=-1.338*1000, Max=-1.480*1000, Mean=-1.393*1000)),
   heaCri(lowerLimit=2*3.6e9, upperLimit=3.4*3.6e9),
   cooCri(lowerLimit=-0.62*3.6e9, upperLimit=-1.81*3.6e9));

  Buildings.HeatTransfer.Conduction.MultiLayer
    parWal(layers=matLayPar, A=8*2.7,
    stateAtSurface_a=true,
    stateAtSurface_b=true)
    "Partition wall between the two rooms"

  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Brick120
    matLayPar(material={
        Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.2,
        k=0.510,
        c=1000,
        d=1400)}) "Construction material for partition walls"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase900
     extWalCase900 "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.FloorCase900
    floorCase900 "Floor"

  Buildings.ThermalZones.Detailed.MixedAir sunSpa(
    redeclare package Medium = MediumA,
    hRoo=2.7,
    nPorts=3,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    intConMod=Buildings.HeatTransfer.Types.InteriorConvection.Temperature,
    extConMod=Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind,
    nConPar=0,
    nConExt=3,
    datConExt(
      layers={roof,extWalCase900,extWalCase900},
      A={8*2,2*2.7,2*2.7},
      til={C_,Z_,Z_},
      azi={S_,W_,E_}),
    nSurBou=1,
    surBou(
      each A=8*2.7,
      each absIR=0.9,
      each absSol=0.6,
      each til=Buildings.Types.Tilt.Wall),
    nConExtWin=1,
    datConExtWin(
      layers={extWalCase900},
      A={8*2.7},
      glaSys={window600},
      wWin={2*3},
      hWin={2},
      fFra={0.001},
      til={Z_},
      azi={S_}),
    nConBou=1,
    datConBou(
      layers={floorCase900},
      each A=2*8,
      each til=F_),
    AFlo=16) "Room model for sun-space"
  Modelica.Blocks.Sources.Constant qConGai_flow1(k=0) "Convective heat gain"
  Modelica.Blocks.Sources.Constant qRadGai_flow1(k=0) "Radiative heat gain"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_2
  Modelica.Blocks.Sources.Constant qLatGai_flow1(k=0) "Latent heat gain"
  Buildings.Fluid.Sources.MassFlowSource_T sinInf2(
    redeclare package Medium = MediumA,
    m_flow=1,
    use_m_flow_in=true,
    use_T_in=false,
    use_X_in=false,
    use_C_in=false,
    nPorts=1) "Sink model for sunspace infiltration"
  Modelica.Blocks.Sources.Constant InfiltrationRate1(k=-16*2.7*0.414/3600)
    "0.414 ACH adjusted for the altitude (0.5 at sea level)"
  Modelica.Blocks.Math.Product product1
  Buildings.Fluid.Sensors.Density density1(redeclare package Medium = MediumA,
      warnAboutOnePortConnection=false)
    "Air density inside the building"
  Buildings.Fluid.FixedResistances.PressureDrop heaCoo1(
    redeclare package Medium = MediumA,
    m_flow_nominal=48*2.7*0.41/3600*1.2,
    dp_nominal=1,
    linearized=true,
    from_dp=true) "Heater and cooler"
  Buildings.HeatTransfer.Convection.Exterior conOpa1(
    A=16,
    hFixed=0.8,
    roughness=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough,
    final til=Buildings.Types.Tilt.Floor,
    final azi=0,
    conMod=Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind)
    "Convection model for opaque part of the wall"
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TSunSpaAir
    "Sun space room air temperature"
  Buildings.Controls.OBC.CDL.Reals.MovingAverage TSunSpaHou(delta=3600)
    "Hourly averaged room air temperature"
  Buildings.Controls.OBC.CDL.Reals.MovingAverage TSunSpaAnn(delta=86400*365)
    "Annual averaged room air temperature"
equation
  connect(sunSpa.uSha, replicator.y)
  connect(parWal.port_a, roo.surf_surBou[1])
  connect(parWal.port_b, sunSpa.surf_surBou[1])
  connect(weaDat.weaBus, sunSpa.weaBus)
  connect(qRadGai_flow1.y, multiplex3_2.u1[1])
  connect(qConGai_flow1.y, multiplex3_2.u2[1])
  connect(qLatGai_flow1.y, multiplex3_2.u3[1])
  connect(multiplex3_2.y, sunSpa.qGai_flow)
  connect(InfiltrationRate1.y, product1.u1)
  connect(density1.d, product1.u2)
  connect(product1.y, sinInf2.m_flow_in)
  connect(heaCoo1.port_b, sunSpa.ports[1])
  connect(sinInf2.ports[1], sunSpa.ports[2])
  connect(density1.port, sunSpa.ports[3])
  connect(souInf.ports[2], heaCoo1.port_a)
  connect(zerWin.y, conOpa1.v)
  connect(zerDir.y, conOpa1.dir)
  connect(TAirConExt.port, conOpa1.fluid)
  connect(conOpa1.solid, sunSpa.surf_conBou[1])
  connect(TSunSpaAir.port, sunSpa.heaPorAir)
  connect(TSunSpaAir.T, TSunSpaHou.u)
  connect(TSunSpaAir.T, TSunSpaAnn.u)
end Case960;


Case 900, but with increased exterior wall and roof insulation. This model is the case 980 of the BESTEST validation suite. Case 980 differs from
case 900 in that it has increased exterior wall and roof insulation.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case980
  "Case 900, but with increased exterior wall and roof insulation"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx.Case900(
    matExtWal = extWalCase980,
    roof =    roofCase680,
    staRes(
     annualHea(Min=0.246*3.6e9, Max=0.720*3.6e9, Mean=0.407*3.6e9),
     annualCoo(Min=-3.501*3.6e9, Max=-3.995*3.6e9, Mean=-3.710*3.6e9),
     peakHea(Min=1.254*1000, Max=1.693*1000, Mean=1.489*1000),
     peakCoo(Min=-2.930*1000, Max=-3.668*1000, Mean=-3.348*1000)),
   heaCri(lowerLimit=-0.61*3.6e9, upperLimit=1.28*3.6e9),
   cooCri(lowerLimit=-3.52*3.6e9, upperLimit=-4.49*3.6e9));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase980 extWalCase980(
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough)
    "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.RoofCase680 roofCase680
    "Roof"
end Case980;


Case 900FF, but with increased exterior wall and roof insulation. This model is used for the test case 980FF of the BESTEST validation suite.
Case 980FF is a heavy-weight building with increased exterior wall and roof insulation.
The room temperature is free floating.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case980FF
  "Case 900FF, but with increased exterior wall and roof insulation"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx.Case900FF(
    matExtWal = extWalCase980,
    roof =    roofCase680,
    staRes(
      minT( Min=7.3+273.15, Max=12.5+273.15, Mean=10.4+273.15),
      maxT( Min=48.5+273.15, Max=52.8+273.15, Mean=50.5+273.15),
      meanT(Min=30.5+273.15, Max=33.3+273.15, Mean=31.8+273.15)));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase980 extWalCase980
    "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.RoofCase680 roofCase680
    "Roof"
end Case980FF;


Case 900, but with single heating and cooling setpoint. This model is the case 985 of the BESTEST validation suite. Case 985 differs from
case 900 in that it has single heating and cooling setpoint.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case985
  "Case 900, but with single heating and cooling setpoint"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx.Case900(
    redeclare BaseClasses.DaySchedule TSetCoo(table=[0.0,273.15 + 20.1]),
    redeclare BaseClasses.DaySchedule TSetHea(table=[0.0,273.15 + 19.9]),
    staRes(
     annualHea(Min=2.120*3.6e9, Max=2.801*3.6e9, Mean=2.398*3.6e9),
     annualCoo(Min=-5.880*3.6e9, Max=-7.273*3.6e9, Mean=-6.351*3.6e9),
     peakHea(Min=2.452*1000, Max=2.785*1000, Mean=2.631*1000),
     peakCoo(Min=-3.208*1000, Max=-4.225*1000, Mean=-3.824*1000)),
   heaCri(lowerLimit=1.68*3.6e9, upperLimit=3.09*3.6e9),
   cooCri(lowerLimit=-5.95*3.6e9, upperLimit=-7.26*3.6e9));
end Case985;


Case 900, but with single heating and cooling setpoint and increased exterior wall and roof insulation. This model is the case 995 of the BESTEST validation suite. Case 995 differs from
case 900 in that it has single heating and cooling setpoint and increased exterior wall
and roof insulation.

within Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx;
model Case995
  "Case 900, but with single heating and cooling setpoint and increased exterior wall and roof insulation"
  extends Buildings.ThermalZones.Detailed.Validation.BESTEST.Cases9xx.Case900(
    redeclare BaseClasses.DaySchedule TSetCoo(table=[0.0,273.15 + 20.1]),
    redeclare BaseClasses.DaySchedule TSetHea(table=[0.0,273.15 + 19.9]),
    matExtWal = extWalCase980,
    roof =    roofCase680,
    staRes(
     annualHea(Min=0.755*3.6e9, Max=1.330*3.6e9, Mean=0.974*3.6e9),
     annualCoo(Min=-6.771*3.6e9, Max=-7.482*3.6e9, Mean=-7.145*3.6e9),
     peakHea(Min=1.370*1000, Max=1.711*1000, Mean=1.564*1000),
     peakCoo(Min=-3.315*1000, Max=-4.224*1000, Mean=-3.986*1000)),
   heaCri(lowerLimit=-0.15*3.6e9, upperLimit=2.02*3.6e9),
   cooCri(lowerLimit=-6.58*3.6e9, upperLimit=-8.41*3.6e9));

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.ExteriorWallCase980 extWalCase980(
    roughness_a=Buildings.HeatTransfer.Types.SurfaceRoughness.Rough)
    "Exterior wall"

  parameter Buildings.ThermalZones.Detailed.Validation.BESTEST.Data.RoofCase680 roofCase680
    "Roof"
end Case995;


900 series of ANSI/ASHRAE BESTEST

within Buildings.ThermalZones.Detailed.Validation.BESTEST;
package Cases9xx "900 series of ANSI/ASHRAE BESTEST"
  extends Modelica.Icons.ExamplesPackage;
end Cases9xx;


within Buildings.ThermalZones.Detailed.Validation.BESTEST;
package Data "This package contains the data for the BESTEST validation"
  extends Modelica.Icons.MaterialPropertiesPackage;
end Data;


within Buildings.ThermalZones.Detailed.Validation.Initialization;
model MixedAir
  "Validation model for the correct initialization of the mixed air model"
  extends Modelica.Icons.Example;
  package MediumA = Buildings.Media.Air "Medium model";

  parameter Modelica.Units.SI.Temperature T_start=273.15 - 15 "Initial value";

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

  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Brick120 matLayPar
    "Construction material for partition walls"

  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matLayRoo(
        material={
          HeatTransfer.Data.Solids.InsulationBoard(x=0.2),
          HeatTransfer.Data.Solids.Concrete(x=0.2)},
        final nLay=2) "Construction material for roof"

  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matLayFlo(
        material={
          HeatTransfer.Data.Solids.Concrete(x=0.2),
          HeatTransfer.Data.Solids.InsulationBoard(x=0.15),
          HeatTransfer.Data.Solids.Concrete(x=0.05)},
        final nLay=3) "Construction material for floor"

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

  parameter Integer nConExtWin = 1 "Number of constructions with a window";
  parameter Integer nConBou = 1
    "Number of surface that are connected to constructions that are modeled inside the room";
  parameter Integer nSurBou = 1
    "Number of surface that are connected to the room air volume";

  Buildings.ThermalZones.Detailed.MixedAir roo(
    redeclare package Medium = MediumA,
    AFlo=6*4,
    hRoo=2.7,
    nConExt=2,
    datConExt(layers={matLayRoo, matLayExt},
           A={6*4, 6*3},
           til={Buildings.Types.Tilt.Ceiling, Buildings.Types.Tilt.Wall},
           azi={Buildings.Types.Azimuth.S, Buildings.Types.Azimuth.W}),
    nConExtWin=nConExtWin,
    datConExtWin(
              layers={matLayExt},
              each A=4*3,
              glaSys={glaSys},
              each hWin=2,
              each wWin=4,
              ove(wR={0},wL={0}, gap={0.1}, dep={1}),
              each fFra=0.1,
              each til=Buildings.Types.Tilt.Wall,
              azi={Buildings.Types.Azimuth.S}),
    nConPar=1,
    datConPar(layers={matLayPar}, each A=10,
           each til=Buildings.Types.Tilt.Wall),
    nConBou=1,
    datConBou(layers={matLayFlo}, each A=6*4,
           each til=Buildings.Types.Tilt.Floor),
    nSurBou=1,
    surBou(each A=6*3,
           each absIR=0.9,
           each absSol=0.9,
           each til=Buildings.Types.Tilt.Wall),
    linearizeRadiation = false,
    nPorts=1,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    T_start=T_start) "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"),
    HInfHorSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
    HSou=Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor,
    TDewPoiSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
    calTSky=Buildings.BoundaryConditions.Types.SkyTemperatureCalculation.TemperaturesAndSkyCover,
    relHumSou=Buildings.BoundaryConditions.Types.DataSource.Parameter,
    relHum=0,
    TDewPoi(displayUnit="K") = T_start,
    TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.Input,
    TBlaSkySou=Buildings.BoundaryConditions.Types.DataSource.Input)

  Modelica.Blocks.Sources.Constant uSha(k=0)
    "Control signal for the shading device"
  Modelica.Blocks.Routing.Replicator replicator(nout=max(1,nConExtWin))
  Buildings.HeatTransfer.Sources.FixedTemperature TSoi[nConBou](each T=T_start)
    "Boundary condition for construction"
  Buildings.HeatTransfer.Sources.FixedTemperature TBou[nSurBou](each T=T_start)
    "Boundary condition for construction"
  HeatTransfer.Conduction.MultiLayer conOut[nSurBou](
    each A=6*4,
    each layers=matLayPar,
    each steadyStateInitial=true)
    "Construction that is modeled outside of room"

  Buildings.Fluid.Sources.Boundary_pT boundary(
    nPorts=1,
    redeclare package Medium = MediumA,
    T=T_start) "Boundary condition"

  Modelica.Blocks.Sources.Constant HSol(k=0) "Solar irradition"
  Modelica.Blocks.Sources.Constant T(k=T_start)
    "Dry bulb and black body sky temperature"
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(uSha.y, replicator.u)
  connect(TSoi.port, roo.surf_conBou)
  connect(TBou.port,conOut. port_b)
  connect(roo.surf_surBou, conOut.port_a)
  connect(roo.uSha, replicator.y)
  connect(roo.ports[1], boundary.ports[1])
  connect(HSol.y, weaDat.HGloHor_in)
  connect(HSol.y, weaDat.HDifHor_in)
  connect(T.y, weaDat.TDryBul_in)
  connect(weaDat.TBlaSky_in, T.y)
end MixedAir;


within Buildings.ThermalZones.Detailed.Validation;
package Initialization "Package with models that validate the initialization"
  extends Modelica.Icons.ExamplesPackage;
end Initialization;


Validation models for LBNL 71T

within Buildings.ThermalZones.Detailed.Validation;
package LBNL_71T "Validation models for LBNL 71T"
  extends Modelica.Icons.ExamplesPackage;
end LBNL_71T;


within Buildings.ThermalZones.Detailed.Validation.LBNL_71T.RoomB;
model ElectroChromicWindow
  "Validation model for the correct implementation of Electrochromic Window"
  extends Modelica.Icons.Example;
  package MediumA = Buildings.Media.Air "Medium model";

  parameter Modelica.Units.SI.Temperature T_start=273.15 + 24 "Initial value";

  parameter Integer nConExtWin=1 "Number of constructions with a window";
  parameter Integer nConExt=0 "Number of constructions without a window";
  parameter Integer nConBou=5
    "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 nConPar=0 "Number of surface that are partitions";

  MixedAir roo(
    redeclare package Medium = MediumA,
    nConExt=nConExt,
    nConExtWin=nConExtWin,
    nConPar=nConPar,
    nConBou=nConBou,
    nSurBou=nSurBou,
    T_start=T_start,
    datConExtWin(
      layers={matExtWal},
      each A=10.22,
      glaSys={glaSys},
      each hWin=3.13,
      each wWin=2.782751,
      each fFra=0.000001,
      each til=Buildings.Types.Tilt.Wall,
      azi={Buildings.Types.Azimuth.S}),
    datConBou(
      layers={matFlo,matCeil,matEWWal,matNWal,matEWWal},
      A={13.94,13.94,15.33,10.22,15.33},
      til={Buildings.Types.Tilt.Floor,Buildings.Types.Tilt.Ceiling,Buildings.Types.Tilt.Wall,
          Buildings.Types.Tilt.Wall,Buildings.Types.Tilt.Wall}),
    AFlo=13.94,
    hRoo=3.37,
    intConMod=Buildings.HeatTransfer.Types.InteriorConvection.Temperature,
    extConMod=Buildings.HeatTransfer.Types.ExteriorConvection.TemperatureWind,
    conBou(opa(T(each start = T_start))),
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
                                               "Room model"
  BoundaryConditions.WeatherData.ReaderTMY3 weaDat1(
    relHum=0,
    TDewPoi(displayUnit="K"),
    filNam=
        Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"),
    pAtmSou=Buildings.BoundaryConditions.Types.DataSource.File,
    calTSky=Buildings.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
    computeWetBulbTemperature=false)

  Modelica.Blocks.Sources.Constant uSha(k=0)
    "Control signal for the shading device"
  Modelica.Blocks.Routing.Replicator replicator(nout=max(1, nConExtWin))
    "Signal replicator"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matExtWal(
    nLay=3,
    absIR_a=0.9,
    absIR_b=0.9,
    absSol_a=0.6,
    absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.000701,
        k=45.345,
        c=502.416,
        d=7833.028),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.0127,
        k=0.12,
        c=1210,
        d=540),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.133,
        k=0.047,
        c=1006,
        d=93.84)}) "71T: South Wall"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matCeil(
    nLay=3,
    absIR_a=0.9,
    absIR_b=0.9,
    absSol_a=0.6,
    absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.009525,
        k=0.12,
        c=1210,
        d=540),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.133,
        k=0.047,
        c=1006,
        d=93.84),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.015875,
        k=0.17,
        c=1090,
        d=800)}) "71T: Ceiling"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matFlo(
    final nLay=4,
    absIR_a=0.9,
    absIR_b=0.9,
    absSol_a=0.6,
    absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=5.28,
        k=1,
        c=0,
        d=0),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.01905,
        k=0.15,
        c=1630,
        d=608),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.01905,
        k=0.12,
        c=1210,
        d=540),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.22,
        k=1,
        c=0,
        d=0)}) "71T: Floor"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matEWWal(
    final nLay=2,
    absIR_a=0.9,
    absIR_b=0.9,
    absSol_a=0.6,
    absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.133,
        k=0.047,
        c=1006,
        d=93.84),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.015875,
        k=0.17,
        c=1090,
        d=800)}) "71T: East West Wall"
  parameter Buildings.HeatTransfer.Data.OpaqueConstructions.Generic matNWal(
    final nLay=4,
    absIR_a=0.9,
    absIR_b=0.9,
    absSol_a=0.6,
    absSol_b=0.6,
    material={Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.015875,
        k=0.17,
        c=1090,
        d=800),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.009525,
        k=0.12,
        c=1210,
        d=540),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.133,
        k=0.047,
        c=1006,
        d=93.84),Buildings.HeatTransfer.Data.Solids.Generic(
        x=0.015875,
        k=0.17,
        c=1090,
        d=800)}) "71T: North Wall"

  parameter HeatTransfer.Data.GlazingSystems.DoubleElectrochromicAir13Clear glaSys(
    UFra=2,
    haveInteriorShade=false,
    haveExteriorShade=false) "Data record for the glazing system"
  BoundaryConditions.WeatherData.Bus weaBus
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1 "Multiplex"
  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.Sources.Constant uWin(k=1)
    "Control signal for electrochromic window"
  Modelica.Blocks.Sources.CombiTimeTable refRes(
    tableOnFile=true,
    tableName="EnergyPlus",
    fileName=Modelica.Utilities.Files.loadResource(
        "modelica://Buildings/Resources/Data/ThermalZones/Detailed/Validation/LBNL_71T/RoomB/EnergyPlusHeatingCoolingPower.txt"),
    columns=2:2)
    "Data reader with heating and cooling power from EnergyPlus. The output should be compared to roo.heaPorAir.Q_flow."

  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea
    "Prescribed heat flow for heating and cooling"
  Controls.Continuous.LimPID conHea(
    Td=60,
    initType=Modelica.Blocks.Types.Init.InitialState,
    yMin=-1,
    k=5,
    Ti=30) "Controller for heating"
  Modelica.Blocks.Math.Gain gaiHea(k=1E4) "Gain for heating"
  Modelica.Blocks.Sources.Constant TRooSet(k=297.15) "Set point for room air"
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TRooAir
    "Room air temperature"
equation

  connect(uSha.y, replicator.u)
  connect(roo.uSha, replicator.y)

  connect(weaBus, roo.weaBus)
  connect(weaBus, weaDat1.weaBus)
  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(uWin.y, roo.uWin[1])
  connect(preHea.port, roo.heaPorAir)
  connect(gaiHea.y, preHea.Q_flow)
  connect(conHea.y, gaiHea.u)
  connect(TRooSet.y, conHea.u_s)
  connect(preHea.port, TRooAir.port)
  connect(TRooAir.T, conHea.u_m)
end ElectroChromicWindow;


Validation models for LBNL 71T

within Buildings.ThermalZones.Detailed.Validation.LBNL_71T;
package RoomB "Validation models for LBNL 71T"
  extends Modelica.Icons.ExamplesPackage;
end RoomB;


Test model for room model. This model tests
Buildings.ThermalZones.Detailed.MixedAir
for the case of having only one construction whose other surface boundary condition
is exposed by the room model.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions;
model OnlyConstructionBoundary "Test model for room model"
  extends Modelica.Icons.Example;
  extends BaseClasses.PartialTestModel(
   nConExt=0,
   nConExtWin=0,
   nConPar=0,
   nConBou=1,
   nSurBou=0,
   roo(
    datConBou(layers={matLayPar},
              each A=12,
              each til=Buildings.Types.Tilt.Floor,
              each azi=Buildings.Types.Azimuth.W,
              each stateAtSurface_a = false)));
  Buildings.HeatTransfer.Sources.FixedTemperature TBou1[nConBou](each T=288.15)
    "Boundary condition for construction"
equation
  connect(TBou1.port, roo.surf_conBou)
end OnlyConstructionBoundary;


Test model for room model. This model tests
Buildings.ThermalZones.Detailed.MixedAir
for the case of having only one exterior construction with no window.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions;
model OnlyExteriorWallNoWindow "Test model for room model"
  extends Modelica.Icons.Example;
  extends BaseClasses.PartialTestModel(
   nConExt=1,
   nConExtWin=0,
   nConPar=0,
   nConBou=0,
   nSurBou=0,
   roo(
    datConExt(layers={matLayExt}, each A=10,
           each til=Buildings.Types.Tilt.Floor, each azi=Buildings.Types.Azimuth.W)));
end OnlyExteriorWallNoWindow;


Test model for room model. This model tests
Buildings.ThermalZones.Detailed.MixedAir
for the case of having only one exterior construction with window.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions;
model OnlyExteriorWallWithWindow "Test model for room model"
  extends Modelica.Icons.Example;
  extends BaseClasses.PartialTestModel(
   nConExt=0,
   nConExtWin=2,
   nConPar=0,
   nConBou=0,
   nSurBou=0,
   roo(
    datConExtWin(layers={matLayExt, matLayExt},
                 each A=10,
                 glaSys={glaSys, glaSys},
                 each wWin=2,
                 each hWin=2,
                 each fFra=0.1,
                 til={Buildings.Types.Tilt.Floor, Buildings.Types.Tilt.Ceiling},
                 each azi=Buildings.Types.Azimuth.W)));
end OnlyExteriorWallWithWindow;


Test model for room model. This model tests
Buildings.ThermalZones.Detailed.MixedAir
for the case of having only one exterior construction with window
and exterior shade.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions;
model OnlyExteriorWallWithWindowExteriorShade "Test model for room model"
  extends Modelica.Icons.Example;
  extends BaseClasses.PartialTestModel(
   nConExt=0,
   nConExtWin=2,
   nConPar=0,
   nConBou=0,
   nSurBou=0,
   roo(
    datConExtWin(
      layers={matLayExt, matLayExt},
      each A=10,
      glaSys={glaSys, glaSys},
      each wWin=2,
      each hWin=2,
      each fFra=0.1,
      til={Buildings.Types.Tilt.Floor, Buildings.Types.Tilt.Ceiling},
      each azi=Buildings.Types.Azimuth.W)),
    glaSys(haveExteriorShade=true));
  Modelica.Blocks.Sources.Constant uSha(k=0.5)
    "Control signal for the shading device"
  Modelica.Blocks.Routing.Replicator replicator(nout=max(1,nConExtWin))
equation
  connect(uSha.y,replicator. u)
  connect(roo.uSha,replicator. y)
end OnlyExteriorWallWithWindowExteriorShade;


Test model for room model. This model tests
Buildings.ThermalZones.Detailed.MixedAir
for the case of having only one exterior construction with window
and interior shade.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions;
model OnlyExteriorWallWithWindowInteriorShade "Test model for room model"
  extends Modelica.Icons.Example;
  extends BaseClasses.PartialTestModel(
   nConExt=0,
   nConExtWin=2,
   nConPar=0,
   nConBou=0,
   nSurBou=0,
   roo(
    datConExtWin(layers={matLayExt, matLayExt}, each A=10,
                 glaSys={glaSys, glaSys},
                 each wWin=2,
                 each hWin=2,
                 each fFra=0.1,
                 til={Buildings.Types.Tilt.Floor, Buildings.Types.Tilt.Ceiling},
                 each azi=Buildings.Types.Azimuth.W)),
    glaSys(haveInteriorShade=true));
  Modelica.Blocks.Sources.Constant uSha(k=0.5)
    "Control signal for the shading device"
  Modelica.Blocks.Routing.Replicator replicator(nout=max(1,nConExtWin))
equation
  connect(uSha.y,replicator. u)
  connect(roo.uSha,replicator. y)
end OnlyExteriorWallWithWindowInteriorShade;


Test model for room model. This model tests
Buildings.ThermalZones.Detailed.MixedAir
for the case of having only one partition construction.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions;
model OnlyPartition "Test model for room model"
  extends Modelica.Icons.Example;
  extends BaseClasses.PartialTestModel(
   nConExt=0,
   nConExtWin=0,
   nConPar=1,
   nConBou=0,
   nSurBou=0,
   roo(
    datConPar(layers={matLayPar}, each A=10,
    each til=Buildings.Types.Tilt.Floor,
    each azi=Buildings.Types.Azimuth.W)));
end OnlyPartition;


Test model for room model. This model tests
Buildings.ThermalZones.Detailed.MixedAir
for the case of having only one surface with specified boundary conditions.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions;
model OnlySurfaceBoundary "Test model for room model"
  extends Modelica.Icons.Example;
  extends BaseClasses.PartialTestModel(
   nConExt=0,
   nConExtWin=0,
   nConPar=0,
   nConBou=0,
   nSurBou=1,
   roo(
    surBou(each A=15, each absIR=0.9, each absSol=0.9, each til=Buildings.Types.Tilt.Floor)));
  Buildings.HeatTransfer.Sources.FixedTemperature TBou[nSurBou](each T=288.15)
    "Boundary condition for construction"
  HeatTransfer.Conduction.MultiLayer conOut[nSurBou](
    each A=15,
    each layers = matLayPar,
    each stateAtSurface_b=false)  "Construction that is modeled outside of room"
equation
  connect(TBou.port, conOut.port_b)
  connect(roo.surf_surBou, conOut.port_a)
end OnlySurfaceBoundary;


within Buildings.ThermalZones.Detailed.Validation;
package TestConditionalConstructions "Package with models that verify whether constructions can be conditionally removed"
  extends Modelica.Icons.ExamplesPackage;
end TestConditionalConstructions;


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


within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.BaseClasses;
partial model PartialTestModel
  "Partial model that is used to build the test cases"
  package MediumA = Buildings.Media.Air "Medium model";
  parameter Integer nConExt
    "Number of exterior constructions that do not have a window";
  parameter Integer nConExtWin
    "Number of exterior constructions that do have a window";
  parameter Integer nConPar "Number of partition constructions";
  parameter Integer nConBou
    "Number of surface that are connected to constructions that are modeled inside the room";
  parameter Integer nSurBou
    "Number of surface that are connected to the room air volume";
  MixedAir roo(
    redeclare package Medium = MediumA,
    final nConExt=nConExt,
    final nConExtWin=nConExtWin,
    final nConPar=nConPar,
    final nConBou=nConBou,
    final nSurBou=nSurBou,
    AFlo=20,
    hRoo=2.7,
    linearizeRadiation = true,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Room model"

  parameter HeatTransfer.Data.OpaqueConstructions.Insulation100Concrete200 matLayExt
    "Construction material for exterior walls"
  parameter HeatTransfer.Data.OpaqueConstructions.Brick120 matLayPar
    "Construction material for partition walls"
  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"
  BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"),
      computeWetBulbTemperature=false)
  parameter HeatTransfer.Data.GlazingSystems.DoubleClearAir13Clear glaSys(UFra=2,
    shade=Buildings.HeatTransfer.Data.Shades.Gray(),
    haveExteriorShade=false,
    haveInteriorShade=false) "Data record for the glazing system"
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 PartialTestModel;


Test model with sampleModel = true. This model is identical to

Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyConstructionBoundary,
except that it sets sampleModel=true.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.SampledModel;
model OnlyConstructionBoundary "Test model with sampleModel = true"
  extends Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyConstructionBoundary(
    roo(sampleModel=true));
end OnlyConstructionBoundary;


Test model with sampleModel = true. This model is identical to

Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallNoWindow,
except that it sets sampleModel=true.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.SampledModel;
model OnlyExteriorWallNoWindow "Test model with sampleModel = true"
  extends Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallNoWindow(
    roo(sampleModel=true));
end OnlyExteriorWallNoWindow;


Test model with sampleModel = true. This model is identical to

Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallWithWindow,
except that it sets sampleModel=true.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.SampledModel;
model OnlyExteriorWallWithWindow "Test model with sampleModel = true"
  extends Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallWithWindow(
    roo(sampleModel=true));
end OnlyExteriorWallWithWindow;


Test model with sampleModel = true. This model is identical to

Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallWithWindowExteriorShade,
except that it sets sampleModel=true.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.SampledModel;
model OnlyExteriorWallWithWindowExteriorShade "Test model with sampleModel = true"
  extends Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallWithWindowExteriorShade(
    roo(sampleModel=true));
end OnlyExteriorWallWithWindowExteriorShade;


Test model with sampleModel = true. This model is identical to

Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallWithWindowInteriorShade,
except that it sets sampleModel=true.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.SampledModel;
model OnlyExteriorWallWithWindowInteriorShade "Test model with sampleModel = true"
  extends Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyExteriorWallWithWindowInteriorShade(
    roo(sampleModel=true));
end OnlyExteriorWallWithWindowInteriorShade;


Test model with sampleModel = true. This model is identical to

Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyPartition,
except that it sets sampleModel=true.

within Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.SampledModel;
model OnlyPartition "Test model with sampleModel = true"
  extends Buildings.ThermalZones.Detailed.Validation.TestConditionalConstructions.OnlyPartition(
    roo(sampleModel=true));
end OnlyPartition;