within AixLib.Systems.ModularAHU.Validation;
model AHU2_Cooler "Cooling register of ahu 2 in E.ON ERC testhall"
  extends Modelica.Icons.Example;
    package MediumWater = AixLib.Media.Water
  package MediumAir = AixLib.Media.Air

  AixLib.Systems.ModularAHU.Validation.MeasuredData.AHU2_Cooler_RampValve data "Measured data";
  Fluid.Sources.Boundary_pT boundaryWaterSource(
    redeclare package Medium = MediumWater,
    use_T_in=true,
    T=343.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT boundaryWaterSink(          redeclare package
      Medium = MediumWater, nPorts=1)
  Fluid.Sources.MassFlowSource_T
                            boundaryAirSource(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = MediumAir,
    T=283.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT boundaryAirSink(          redeclare package Medium =
        MediumAir, nPorts=1)
  Modelica.Blocks.Sources.CombiTimeTable combiTimeTable(table=data.AC_3000)
  Modelica.Blocks.Sources.RealExpression Simulation_VF_in_m3h(y=registerBus1.hydraulicBus.VFlowInMea
        *3600)
  Modelica.Blocks.Sources.RealExpression Simulation_VF_out_m3h(y=registerBus1.hydraulicBus.VFlowOutMea
        *3600)
  Modelica.Blocks.Math.Gain gain(k=0.01)
  Modelica.Thermal.HeatTransfer.Celsius.ToKelvin toKelvin
  Modelica.Thermal.HeatTransfer.Celsius.ToKelvin toKelvin1
  Modelica.Blocks.Math.Gain gain1(k=1.1839/3600)
  RegisterModule registerModule(
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare HydraulicModules.Admix hydraulicModule(
      pipeModel="PlugFlowPipe",
      parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_35x1_5(),
      parameterIso=AixLib.DataBase.Pipes.Insulation.Iso25pc(),
      length=1,
      Kv=10,
      T_start=294.75,
      valveCharacteristic=
          AixLib.Fluid.Actuators.Valves.Data.LinearEqualPercentage(a_ab=
          AixLib.Fluid.Actuators.Valves.Data.Generic(y={0,0.07,0.12,0.45,0.65,
          0.89,0.93,0.96,1}, phi={0,0.001,0.002,0.08,0.29,0.75,0.94,0.98,1}),
          b_ab=AixLib.Fluid.Actuators.Valves.Data.Generic(y={0,0.1,0.2,0.26,
          0.52,0.8,0.9,0.95,1}, phi={0,0.001,0.002,0.05,0.45,0.96,0.98,0.99,1})),
      valve(use_inputFilter=false),
      pipe1(
        T_start=283.15,
        parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_54x2(),
        length=4.5),
      pipe2(length=1.55),
      pipe3(length=0.9),
      pipe4(length=0.3),
      pipe5(length=2.95, fac=13),
      pipe6(parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_22x1_1(), length=
            0.5),
      redeclare
        AixLib.Systems.HydraulicModules.BaseClasses.PumpInterface_PumpSpeedControlled
        PumpInterface(pumpParam=
            AixLib.DataBase.Pumps.PumpPolynomialBased.Pump_DN32(),
          calculatePower=true)),
    redeclare package Medium1 = MediumAir,
    redeclare package Medium2 = MediumWater,
    m1_flow_nominal=3000/3600,
    m2_flow_nominal=8832/3600,
    T_start=293.65,
    tau=90,
    T_amb=296.65,
    dynamicHX(
      dp1_nominal(displayUnit="bar") = 138,
      dp2_nominal(displayUnit="bar") = 70600,
      nNodes=4,
      T1_start=305.15,
      dT_nom=22.16,
      Q_nom=53400))

  BaseClasses.RegisterBus registerBus1
  Modelica.Blocks.Math.Add add
  Modelica.Blocks.Sources.Constant const(k=-0.5)
  Modelica.Blocks.Sources.BooleanConstant pumpOn
equation
  connect(toKelvin.Kelvin, boundaryWaterSource.T_in)
  connect(toKelvin.Celsius, combiTimeTable.y[2])
  connect(toKelvin1.Celsius, combiTimeTable.y[5])
  connect(gain1.y, boundaryAirSource.m_flow_in)
  connect(gain1.u, combiTimeTable.y[7])
  connect(gain.u, combiTimeTable.y[12])
  connect(registerModule.registerBus, registerBus1)
  connect(combiTimeTable.y[13], registerBus1.hydraulicBus.pumpBus.rpmSet)
  connect(boundaryWaterSink.ports[1], registerModule.port_b2)
  connect(boundaryAirSource.ports[1], registerModule.port_a1)
  connect(registerModule.port_b1, boundaryAirSink.ports[1])
  connect(gain.y, registerBus1.hydraulicBus.valveSet)
  connect(boundaryWaterSource.ports[1], registerModule.port_a2)
  connect(toKelvin1.Kelvin, add.u1)
  connect(add.y, boundaryAirSource.T_in)
  connect(const.y, add.u2)
  connect(pumpOn.y, registerBus1.hydraulicBus.pumpBus.onSet)
end AHU2_Cooler;


within AixLib.Systems.ModularAHU.Validation;
model AHU2_Heater "Heating register of ahu 2 in E.ON ERC testhall"
  extends Modelica.Icons.Example;
    package MediumWater = AixLib.Media.Water
  package MediumAir = AixLib.Media.Air

  AixLib.Systems.ModularAHU.Validation.MeasuredData.AHU2_Reheater_RampValve data "Measured data";
  Fluid.Sources.Boundary_pT boundaryWaterSource(
    redeclare package Medium = MediumWater,
    use_T_in=true,
    T=343.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT boundaryWaterSink(          redeclare package
      Medium = MediumWater, nPorts=1)
  Fluid.Sources.MassFlowSource_T
                            boundaryAirSource(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = MediumAir,
    T=283.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT boundaryAirSink(          redeclare package Medium =
        MediumAir, nPorts=1)
  Modelica.Blocks.Sources.CombiTimeTable combiTimeTable(table=data.AC_3000)
  Modelica.Blocks.Sources.RealExpression Simulation_VF_in_m3h(y=registerBus1.hydraulicBus.VFlowInMea
        *3600)
  Modelica.Blocks.Sources.RealExpression Simulation_VF_out_m3h(y=registerBus1.hydraulicBus.VFlowOutMea
        *3600)
  Modelica.Blocks.Math.Gain gain(k=0.01)
  Modelica.Thermal.HeatTransfer.Celsius.ToKelvin toKelvin
  Modelica.Thermal.HeatTransfer.Celsius.ToKelvin toKelvin1
  Modelica.Blocks.Math.Gain gain1(k=1.1839/3600)
  RegisterModule registerModule(
    T_start=285.65,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare HydraulicModules.Admix hydraulicModule(
      pipeModel="PlugFlowPipe",
      parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_22x1(),
      parameterIso=AixLib.DataBase.Pipes.Insulation.Iso25pc(),
      length=1,
      Kv=6.3,
      valveCharacteristic=
          AixLib.Fluid.Actuators.Valves.Data.LinearEqualPercentage(a_ab=
          AixLib.Fluid.Actuators.Valves.Data.Generic(y={0.0,0.14,0.24,0.43,0.68,
          0.81,0.93,0.96,1.0}, phi={0.0,0.001,0.002,0.02,0.1,0.25,0.76,0.98,1.0}),
          b_ab=AixLib.Fluid.Actuators.Valves.Data.Generic(y={0.0,0.02,0.05,0.08,
          0.27,0.6,0.95,1.0}, phi={0.0,0.001,0.002,0.01,0.3,0.9,0.97,1.0})),
      valve(use_inputFilter=false),
      pipe1(length=2.8, fac=9),
      pipe2(length=0.63, parameterPipe=
            AixLib.DataBase.Pipes.Copper.Copper_35x1_5()),
      pipe3(parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_35x1_5(), length=1.85),
      pipe4(parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_35x1_5(), length=0.4),
      pipe5(length=3.2, fac=10),
      pipe6(parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_16x1(), length=0.82),
      redeclare
        AixLib.Systems.HydraulicModules.BaseClasses.PumpInterface_PumpSpeedControlled
        PumpInterface(pumpParam=
            AixLib.DataBase.Pumps.PumpPolynomialBased.Pump_DN25_H1_8_V5(),
          calculatePower=true)),
    redeclare package Medium1 = MediumAir,
    redeclare package Medium2 = MediumWater,
    m1_flow_nominal=3000/3600,
    m2_flow_nominal=1106/3600,
    tau=90,
    T_amb=293.15,
    dynamicHX(
      dp1_nominal=33,
      dp2_nominal=4500 + 55000,
      nNodes=4,
      dT_nom=40.1,
      Q_nom=22300))

  BaseClasses.RegisterBus registerBus1
  Modelica.Blocks.Math.Add add
  Modelica.Blocks.Sources.Constant const(k=1)
  Modelica.Blocks.Sources.BooleanConstant pumpOn
equation
  connect(toKelvin.Celsius, combiTimeTable.y[2])
  connect(toKelvin1.Celsius, combiTimeTable.y[5])
  connect(gain1.y, boundaryAirSource.m_flow_in)
  connect(gain1.u, combiTimeTable.y[7])
  connect(gain.u, combiTimeTable.y[10])
  connect(registerModule.registerBus, registerBus1)
  connect(combiTimeTable.y[11], registerBus1.hydraulicBus.pumpBus.rpmSet)
  connect(boundaryWaterSink.ports[1], registerModule.port_b2)
  connect(boundaryAirSource.ports[1], registerModule.port_a1)
  connect(registerModule.port_b1, boundaryAirSink.ports[1])
  connect(gain.y, registerBus1.hydraulicBus.valveSet)
  connect(boundaryWaterSource.ports[1], registerModule.port_a2)
  connect(toKelvin.Kelvin, boundaryWaterSource.T_in)
  connect(toKelvin1.Kelvin,add. u1)
  connect(add.y, boundaryAirSource.T_in)
  connect(const.y, add.u2)
  connect(pumpOn.y, registerBus1.hydraulicBus.pumpBus.onSet)
end AHU2_Heater;


within AixLib.Systems.ModularAHU.Validation;
model AHU2_Preheater "Heating register of ahu 2 in E.ON ERC testhall"
  extends Modelica.Icons.Example;
    package MediumWater = AixLib.Media.Water
  package MediumAir = AixLib.Media.Air

  AixLib.Systems.ModularAHU.Validation.MeasuredData.AHU2_Preheater_StepResponse data "Measured data";
  Fluid.Sources.Boundary_pT boundaryWaterSource(
    redeclare package Medium = MediumWater,
    use_T_in=true,
    T=343.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT boundaryWaterSink(          redeclare package
      Medium = MediumWater, nPorts=1)
  Fluid.Sources.MassFlowSource_T
                            boundaryAirSource(
    use_m_flow_in=true,
    use_T_in=true,
    redeclare package Medium = MediumAir,
    T=283.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT boundaryAirSink(          redeclare package Medium =
        MediumAir, nPorts=1)
  Modelica.Blocks.Sources.CombiTimeTable combiTimeTable(table=data.AC_3000)
  Modelica.Blocks.Sources.RealExpression Simulation_VF_in_m3h(y=registerBus1.hydraulicBus.VFlowInMea
        *3600)
  Modelica.Blocks.Sources.RealExpression Simulation_VF_out_m3h(y=registerBus1.hydraulicBus.VFlowOutMea
        *3600)
  Modelica.Blocks.Math.Gain gain(k=0.01)
  Modelica.Thermal.HeatTransfer.Celsius.ToKelvin toKelvin
  Modelica.Thermal.HeatTransfer.Celsius.ToKelvin toKelvin1
  Modelica.Blocks.Math.Gain gain1(k=1.1439/3600)
  RegisterModule registerModule(
    T_start=288.15,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare HydraulicModules.Admix hydraulicModule(
      pipeModel="PlugFlowPipe",
      parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_28x1_5(),
      parameterIso=AixLib.DataBase.Pipes.Insulation.Iso25pc(),
      length=1,
      Kv=10,
      valveCharacteristic=
          AixLib.Fluid.Actuators.Valves.Data.LinearEqualPercentage(a_ab=
          AixLib.Fluid.Actuators.Valves.Data.Generic(y={0,0.13,0.205,0.566,
          0.813,0.88,0.91,0.95,1}, phi={0,0.001,0.002,0.176,0.60,0.75,0.97,0.98,
          1}), b_ab=AixLib.Fluid.Actuators.Valves.Data.Generic(y={0,0.1,0.2,
          0.25,0.52,0.8,0.9,0.95,1}, phi={0,0.001,0.002,0.022,0.53,0.96,0.98,
          0.99,1})),
      valve(use_inputFilter=false),
      pipe1(length=1.53),
      pipe2(length=0.54),
      pipe3(length=1.06),
      pipe4(parameterPipe=AixLib.DataBase.Pipes.Copper.Copper_35x1_5(), length=
            0.48),
      pipe5(length=1.44, fac=16),
      pipe6(length=0.52),
      redeclare
        AixLib.Systems.HydraulicModules.BaseClasses.PumpInterface_PumpSpeedControlled
        PumpInterface(pumpParam=
            AixLib.DataBase.Pumps.PumpPolynomialBased.Pump_DN25_H1_8_V9(),
          calculatePower=true)),
    redeclare package Medium1 = MediumAir,
    redeclare package Medium2 = MediumWater,
    m1_flow_nominal=3000/3600*1.2,
    m2_flow_nominal=2866/3600,
    tau=90 + 70,
    T_amb=293.15,
    dynamicHX(
      dp1_nominal=66,
      dp2_nominal=6000 + 8000,
      nNodes=5,
      dT_nom=43.9,
      Q_nom=57700))

  BaseClasses.RegisterBus registerBus1
  Modelica.Blocks.Sources.BooleanConstant pumpOn
equation
  connect(toKelvin.Kelvin, boundaryWaterSource.T_in)
  connect(toKelvin.Celsius, combiTimeTable.y[2])
  connect(boundaryAirSource.T_in, toKelvin1.Kelvin)
  connect(toKelvin1.Celsius, combiTimeTable.y[5])
  connect(gain1.y, boundaryAirSource.m_flow_in)
  connect(gain1.u, combiTimeTable.y[7])
  connect(gain.u, combiTimeTable.y[12])
  connect(registerModule.registerBus, registerBus1)
  connect(combiTimeTable.y[13], registerBus1.hydraulicBus.pumpBus.rpmSet)
  connect(boundaryWaterSink.ports[1], registerModule.port_b2)
  connect(boundaryAirSource.ports[1], registerModule.port_a1)
  connect(registerModule.port_b1, boundaryAirSink.ports[1])
  connect(gain.y, registerBus1.hydraulicBus.valveSet)
  connect(boundaryWaterSource.ports[1], registerModule.port_a2)
  connect(pumpOn.y, registerBus1.hydraulicBus.pumpBus.onSet)
end AHU2_Preheater;


Validation of ahu modules

within AixLib.Systems.ModularAHU;
package Validation "Validation of ahu modules"
extends Modelica.Icons.ExamplesPackage;
end Validation;


Thermally Activated Building Systems

within AixLib.Systems;
package TABS "Thermally Activated Building Systems"
    extends Modelica.Icons.VariantsPackage;
end TABS;


Thermally Activated Building Systems

within AixLib.Systems.TABS;
model Tabs "Thermally Activated Building Systems"
  import      Modelica.Units.SI;
  replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
    "Medium in the system"
  parameter Boolean allowFlowReversal=true
    "= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1"
  parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=1
    "Nominal mass flow rate";
  parameter Modelica.Units.SI.Temperature T_start=293.15
    "Initial or guess value of output (= state)";
  parameter Modelica.Units.SI.Length length=100 "Pipe length"
  parameter DataBase.Pipes.PipeBaseDataDefinition parameterPipe=
      DataBase.Pipes.Copper.Copper_133x3()
    "Pipe type with representative length and diameter"

  parameter SI.Area area "Area of activated concrete"
  parameter SI.Length thickness "Thickness of activated concrete"
  parameter SI.SpecificHeatCapacity cp=1000
    "Specific heat capacity of concrete"
  parameter SI.Density rho=2100 "Density of activated concrete"
  parameter Real alpha=10 "Heat transfer coefficient concrete to air"
  parameter SI.PressureDifference dp_hx_nominal=1000 "Pressure difference"
  parameter SI.TemperatureDifference dT_nom_hx=1
    "Temperature difference at nominal conditions (used to calculate Gc)"
  parameter SI.HeatFlowRate Q_nom_hx=50000
    "Heat flow at nominal conditions (used to calculate Gc) of the heat exchangers"

  parameter Modelica.Units.SI.Length length_hyd=1
    "Pipe length of hydronic system"
  parameter DataBase.Pipes.PipeBaseDataDefinition parameterPipe_hyd=
      DataBase.Pipes.Copper.Copper_64x2()
    "Pipe type with representative length and diameter"

  // Dynamics
  parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
    "Type of energy balance: dynamic (3 initialization options) or steady state"
  parameter Modelica.Fluid.Types.Dynamics massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
    "Type of mass balance: dynamic (3 initialization options) or steady state"
  parameter SI.Temperature T_amb=293.15 "Ambient temperature for heat loss";

  Fluid.FixedResistances.GenericPipe pipe(
    redeclare package Medium = Medium,
    final pipeModel,
    final parameterPipe=parameterPipe,
    final withInsulation=false,
    final withConvection=false,
    final m_flow_nominal=m_flow_nominal,
    final allowFlowReversal=allowFlowReversal,
    final length=length,
    final energyDynamics=energyDynamics,
    final massDynamics=massDynamics,
    final T_start=T_start) "Pipe that goes through the concrete"

  HydraulicModules.Pump pumpSys(
    redeclare package Medium = Medium,
    parameterPipe=parameterPipe_hyd,
    final allowFlowReversal=allowFlowReversal,
    final T_amb=T_amb,
    final m_flow_nominal=m_flow_nominal,
    final T_start=T_start,
    length=length_hyd,
    final energyDynamics=energyDynamics,
    final massDynamics=massDynamics,
    redeclare HydraulicModules.BaseClasses.PumpInterface_SpeedControlledNrpm
      PumpInterface(pump(redeclare
          AixLib.Fluid.Movers.Data.Pumps.Wilo.Stratos32slash1to12 per)))
    "Hydraulic module with of the internal circuit that supplies the concrete"
  Modelica.Fluid.Interfaces.FluidPort_a port_a1(redeclare package Medium =
        Medium)
    "Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)"
  Modelica.Fluid.Interfaces.FluidPort_b port_b1(redeclare package Medium =
        Medium)
    "Fluid connector b1 (positive design flow direction is from port_a2 to port_b2)"
  Modelica.Fluid.Interfaces.FluidPort_a port_a2(redeclare package Medium =
        Medium)
    "Fluid connector a2 (positive design flow direction is from port_a1 to port_b1)"
  Modelica.Fluid.Interfaces.FluidPort_b port_b2(redeclare package Medium =
        Medium)
    "Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)"
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C=rho*
        area*thickness*cp, T(start=T_start, fixed=true))
  Modelica.Thermal.HeatTransfer.Components.Convection convection
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b heatPort
    "heat port for connection to room volume"

  BaseClasses.TabsBus tabsBus "Connector bus"

  Modelica.Blocks.Sources.Constant const(k=area*alpha)

  Fluid.HeatExchangers.DynamicHX dynamicHXCold(
    final allowFlowReversal1=true,
    final allowFlowReversal2=true,
    final energyDynamics=energyDynamics,
    final massDynamics=massDynamics,
    redeclare final package Medium1 = Medium,
    redeclare final package Medium2 = Medium,
    final m1_flow_nominal=m_flow_nominal,
    final m2_flow_nominal=m_flow_nominal,
    final dp1_nominal=dp_hx_nominal,
    final dp2_nominal=dp_hx_nominal,
    final tau1=10,
    final tau2=10,
    final T1_start=T_start,
    final T2_start=T_start,
    final tau_C=2,
    final dT_nom=dT_nom_hx,
    final Q_nom=Q_nom_hx)
  Fluid.HeatExchangers.DynamicHX dynamicHXHot(
    final allowFlowReversal1=true,
    final allowFlowReversal2=true,
    final energyDynamics=energyDynamics,
    final massDynamics=massDynamics,
    redeclare final package Medium1 = Medium,
    redeclare final package Medium2 = Medium,
    final m1_flow_nominal=m_flow_nominal,
    final m2_flow_nominal=m_flow_nominal,
    final dp1_nominal=dp_hx_nominal,
    final dp2_nominal=dp_hx_nominal,
    final tau1=10,
    final tau2=10,
    final T1_start=T_start,
    final T2_start=T_start,
    final tau_C=2,
    final dT_nom=dT_nom_hx,
    final Q_nom=Q_nom_hx)
  Fluid.Sources.Boundary_pT bou(redeclare package Medium = Medium, nPorts=1)
  HydraulicModules.ThrottlePump throttlePumpHot(
    final energyDynamics=energyDynamics,
    final massDynamics=massDynamics,
    redeclare package Medium = Medium,
    parameterPipe=parameterPipe_hyd,
    final allowFlowReversal=allowFlowReversal,
    final T_amb=T_amb,
    final m_flow_nominal=m_flow_nominal,
    final T_start=T_start,
    length=length_hyd,
    Kv=10,
    redeclare HydraulicModules.BaseClasses.PumpInterface_SpeedControlledNrpm
      PumpInterface(pump(redeclare
          AixLib.Fluid.Movers.Data.Pumps.Wilo.VeroLine80slash115dash2comma2slash2
          per))) "Hydraulic module with pump and valve for hot water supply"
  HydraulicModules.ThrottlePump throttlePumpCold(
    final energyDynamics=energyDynamics,
    final massDynamics=massDynamics,
    redeclare package Medium = Medium,
    parameterPipe=parameterPipe_hyd,
    final allowFlowReversal=allowFlowReversal,
    final T_amb=T_amb,
    final m_flow_nominal=m_flow_nominal,
    final T_start=T_start,
    length=length_hyd,
    Kv=10,
    redeclare HydraulicModules.BaseClasses.PumpInterface_SpeedControlledNrpm
      PumpInterface(pump(redeclare
          AixLib.Fluid.Movers.Data.Pumps.Wilo.VeroLine80slash115dash2comma2slash2
          per)))
    "Hydraulic module with pump and throttle valve for cold water supply"

equation

  connect(pumpSys.port_b1, pipe.port_a)
  connect(pipe.heatPort, heatCapacitor.port)
  connect(heatCapacitor.port, convection.solid)
  connect(convection.fluid, heatPort)
  connect(convection.Gc, const.y)
  connect(dynamicHXHot.port_a1, dynamicHXCold.port_b1)
  connect(dynamicHXCold.port_a1, pumpSys.port_b2)
  connect(dynamicHXHot.port_b1, pumpSys.port_a1)
  connect(bou.ports[1], dynamicHXHot.port_b1)
  connect(throttlePumpHot.port_b1, dynamicHXHot.port_a2)
  connect(throttlePumpHot.port_a2, dynamicHXHot.port_b2)
  connect(throttlePumpCold.port_b1, dynamicHXCold.port_a2)
  connect(throttlePumpCold.port_a2, dynamicHXCold.port_b2)
  connect(throttlePumpHot.port_a1, port_a1)
  connect(port_a2, throttlePumpCold.port_a1)
  connect(pumpSys.hydraulicBus, tabsBus.pumpBus)
  connect(throttlePumpHot.hydraulicBus, tabsBus.hotThrottleBus)
  connect(throttlePumpCold.hydraulicBus, tabsBus.coldThrottleBus)
  connect(pipe.port_b, pumpSys.port_a2)
  connect(throttlePumpCold.port_b2, port_b2)
  connect(throttlePumpHot.port_b2, port_b1)
  connect(pipe.heatPort, convection.solid)
end Tabs;


Base Class Package

within AixLib.Systems.TABS;
package BaseClasses "Base Class Package"
  extends Modelica.Icons.BasesPackage;

end BaseClasses;


Controller for concrete core activation. Simple controller for TABS. The temperature of the water that flows into the concrete is controlled.

within AixLib.Systems.TABS.Controller;
model CtrTabs "Controller for concrete core activation"
  parameter Boolean useExternalTset = false "If True, set temperature can be given externally";
  parameter Modelica.Units.SI.Temperature TflowSet=293.15
    "Flow temperature set point of consumer";

  parameter Real k_hot(min=0, unit="1") = 0.03 "Gain of controller for the hot throttle circuit"
  parameter Modelica.Units.SI.Time Ti_hot(min=Modelica.Constants.small) = 60
    "Time constant of Integrator block for the hot throttle circuit"
  parameter Real rpm_pump_hot(min=0, unit="1") = 3000 "Rpm of the pump of the hot throttle circuit"

  parameter Real k_cold(min=0, unit="1") = 0.03 "Gain of controller for the cold throttle circuit"
  parameter Modelica.Units.SI.Time Ti_cold(min=Modelica.Constants.small) = 60
    "Time constant of Integrator block the cold throttle circuit"
  parameter Real rpm_pump_cold(min=0, unit="1") = 3000 "Rpm of the pump of the cold throttle circuit"

  parameter Modelica.Units.NonSI.AngularVelocity_rpm rpm_pump_concrete=2500
    "Rpm of the Pump that supplies the concrete core"

  Modelica.Blocks.Sources.Constant constTflowSet(final k=TflowSet) if not useExternalTset
  Modelica.Blocks.Interfaces.RealInput Tset if useExternalTset
    "Connector of second Real input signal"
  TABS.BaseClasses.TabsBus tabsBus
  HydraulicModules.Controller.CtrThrottle ctrThrottleHot(
    final useExternalTset=true,
    final k=k_hot,
    final Ti=Ti_hot,
    final Td=0,
    final rpm_pump=rpm_pump_hot,
    initType=Modelica.Blocks.Types.Init.InitialState,
    final reverseAction=true)
  HydraulicModules.Controller.CtrThrottle ctrThrottleCold(
    final useExternalTset=true,
    final k=k_cold,
    final Ti=Ti_cold,
    final Td=0,
    rpm_pump=rpm_pump_cold,
    initType=Modelica.Blocks.Types.Init.InitialState,
    final reverseAction=false)
  HydraulicModules.Controller.CtrPump ctrPump(final rpm_pump=rpm_pump_concrete)
  Modelica.Blocks.Math.Add add(final k1=1, final k2=-1)
  Modelica.Blocks.Sources.Constant constTflowSet1(final k=0.15)
  Modelica.Blocks.Math.Add add1(final k1=1, final k2=+1)
  Modelica.Blocks.Sources.Constant constTflowSet2(final k=offset)

  parameter Real offset=0.1
    "Constant offset between cooling and heating setpoint to avoid oscillations and simultaneous cooling and heating.";
equation
  connect(ctrPump.hydraulicBus, tabsBus.pumpBus)
  connect(ctrThrottleHot.Tact, tabsBus.pumpBus.TFwrdOutMea)
  connect(ctrThrottleCold.Tact, tabsBus.pumpBus.TFwrdOutMea)
  connect(ctrThrottleCold.hydraulicBus, tabsBus.coldThrottleBus)
  connect(ctrThrottleHot.hydraulicBus, tabsBus.hotThrottleBus)
  connect(constTflowSet1.y, add.u2)
  connect(add.y, ctrThrottleHot.Tset)
  connect(constTflowSet2.y, add1.u2)
  connect(add1.y, ctrThrottleCold.Tset)
  connect(constTflowSet.y, add1.u1)
  connect(constTflowSet.y, add.u1)
  connect(Tset, add.u1)
  connect(Tset, add1.u1)
end CtrTabs;


Controller for TABS

within AixLib.Systems.TABS;
package Controller "Controller for TABS"
    extends Modelica.Icons.VariantsPackage;
end Controller;


Example Package

within AixLib.Systems.TABS;
package Examples "Example Package"
    extends Modelica.Icons.ExamplesPackage;
end Examples;


Test of Tabs

within AixLib.Systems.TABS.Examples;
model Tabs "Test of Tabs"
  extends Modelica.Icons.Example;
      package Medium = AixLib.Media.Water

  Fluid.Sources.Boundary_pT          boundary6(
    redeclare package Medium = Medium,
    T=293.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT          boundary1(
    redeclare package Medium = Medium,
    T=303.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT          boundary2(
    redeclare package Medium = Medium,
    T=288.15,
    nPorts=1)
  Fluid.Sources.Boundary_pT          boundary3(
    redeclare package Medium = Medium,
    T=293.15,
    nPorts=1)
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature
                                                         prescribedTemperature
  Modelica.Blocks.Sources.Ramp ramp(
    height=-10,
    duration(displayUnit="h") = 32400,
    offset=273.15 + 30,
    startTime=0)
  Controller.CtrTabs ctrTabs
  AixLib.Systems.TABS.Tabs tabs(
    redeclare package Medium = Medium,
    area=3000,
    thickness=0.03,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
    pumpSys(PumpInterface(speed_rpm_nominal=3580)),
    throttlePumpHot(PumpInterface(speed_rpm_nominal=2900)),
    throttlePumpCold(PumpInterface(speed_rpm_nominal=2900)))
equation
  connect(ramp.y, prescribedTemperature.T)
  connect(tabs.tabsBus, ctrTabs.tabsBus)
  connect(tabs.heatPort, prescribedTemperature.port)
  connect(tabs.port_a1, boundary1.ports[1])
  connect(tabs.port_b1, boundary6.ports[1])
  connect(tabs.port_a2, boundary2.ports[1])
  connect(tabs.port_b2, boundary3.ports[1])
end Tabs;


Examples for Building models

within AixLib.ThermalZones.HighOrder.Components;
package Examples "Examples for Building models"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


Simulation to test the dry air models.

within AixLib.ThermalZones.HighOrder.Components.Examples.DryAir;
model DryAir_test "Simulation to test the dry air models"
  import AixLib;
  extends Modelica.Icons.Example;
  AixLib.ThermalZones.HighOrder.Components.DryAir.DynamicVentilation
    dynamicVentilation(
    pITemp(triggeredTrapezoid(falling=1), TN=60),
    HeatingLimit=288.15,
    Max_VR=0.15,
    Tset=295.15)
  AixLib.ThermalZones.HighOrder.Components.DryAir.Airload airload(T0=303.15,
    V=100)
  AixLib.ThermalZones.HighOrder.Components.DryAir.Airload airload1(
    T0=289.15,
    V=48)
  AixLib.ThermalZones.HighOrder.Components.DryAir.VarAirExchange varAirExchange
  AixLib.ThermalZones.HighOrder.Components.DryAir.InfiltrationRate_DIN12831
    infiltrationRate_DIN12831
  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlow(Q_flow = 150)
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TempOutsideDaycurve
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature TempInside(T = 293.15)
  Modelica.Blocks.Sources.Sine sine(
    amplitude=7,
    offset=273.15 + 13,
    f=1/(3600*24))
  Modelica.Blocks.Sources.Sine sine1(
    amplitude=1,
    f=1/3600,
    offset=1.5)
  Modelica.Blocks.Interfaces.RealOutput realOut[4]
equation
  //Connecting the most relevant outputs
  realOut[1] = airload1.T;
  realOut[2] = varAirExchange.port_b.Q_flow;
  realOut[3] = infiltrationRate_DIN12831.port_b.Q_flow;
  realOut[4] = dynamicVentilation.port_inside.Q_flow;
  connect(dynamicVentilation.port_inside, airload.port)
  connect(fixedHeatFlow.port, airload1.port)
  connect(TempOutsideDaycurve.port, varAirExchange.port_a)
  connect(TempInside.port, varAirExchange.port_b)
  connect(TempOutsideDaycurve.port, infiltrationRate_DIN12831.port_a)
  connect(TempInside.port, infiltrationRate_DIN12831.port_b)
  connect(sine.y, TempOutsideDaycurve.T)
  connect(sine1.y, varAirExchange.ventRate)
  connect(TempOutsideDaycurve.port, dynamicVentilation.port_outside)
end DryAir_test;


Lsodar.

within AixLib.ThermalZones.HighOrder.Components.Examples.Walls;
model InsideWall
  extends Modelica.Icons.Example;
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside(T = 293.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside1(T = 293.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside2(T = 283.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside3(T = 283.15)
  AixLib.ThermalZones.HighOrder.Components.Walls.Wall wall_simple_new(
    outside=false,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare DataBase.Walls.WSchV1984.IW.IWsimple_WSchV1984_L_half wallPar,
    wall_length=5,
    wall_height=2,
    withWindow=false,
    redeclare model WindowModel =
        AixLib.ThermalZones.HighOrder.Components.WindowsDoors.WindowSimple,
    redeclare model CorrSolarGainWin =
        AixLib.ThermalZones.HighOrder.Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorGSimple,
    withDoor=true,
    T0=289.15,
    withSunblind=false,
    Blinding=0.2,
    LimitSolIrr=350,
    TOutAirLimit=273.15 + 17)
  AixLib.ThermalZones.HighOrder.Components.Walls.Wall wall_simple1_new(
    outside=false,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare DataBase.Walls.WSchV1984.IW.IWsimple_WSchV1984_L_half wallPar,
    wall_length=5,
    wall_height=2,
    withWindow=false,
    redeclare model WindowModel =
        AixLib.ThermalZones.HighOrder.Components.WindowsDoors.WindowSimple,
    redeclare model CorrSolarGainWin =
        AixLib.ThermalZones.HighOrder.Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorGSimple,
    withDoor=true,
    T0=287.15,
    withSunblind=false,
    Blinding=0.2,
    LimitSolIrr=350,
    TOutAirLimit=273.15 + 17)
  Modelica.Blocks.Sources.RealExpression UValue_new(y = -Tinside3.port.Q_flow / (Tinside3.T - Tinside.T) / (wall_simple_new.wall_length * wall_simple_new.wall_height))
  Utilities.Interfaces.Adaptors.ConvRadToCombPort thermStar_Demux
  Utilities.Interfaces.Adaptors.ConvRadToCombPort thermStar_Demux1
equation
  connect(wall_simple1_new.port_outside, wall_simple_new.port_outside)
  connect(thermStar_Demux.portConvRadComb, wall_simple1_new.thermStarComb_inside)
  connect(thermStar_Demux1.portConvRadComb, wall_simple_new.thermStarComb_inside)
  connect(Tinside2.port, thermStar_Demux.portRad)
  connect(Tinside3.port, thermStar_Demux.portConv)
  connect(Tinside1.port, thermStar_Demux1.portRad)
  connect(Tinside.port, thermStar_Demux1.portConv)
end InsideWall;


Lsodar.

within AixLib.ThermalZones.HighOrder.Components.Examples.Walls;
model OutsideWall
  extends Modelica.Icons.Example;
  AixLib.ThermalZones.HighOrder.Components.Walls.Wall outerWall(
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    use_shortWaveRadOut=true,
    redeclare model WindowModel =
        AixLib.ThermalZones.HighOrder.Components.WindowsDoors.Window_ASHRAE140
        (                                                                                redeclare AixLib.DataBase.WindowsDoors.ASHRAE140WithPanes.Default winPaneRec),
    redeclare AixLib.DataBase.Walls.WSchV1984.OW.OW_WSchV1984_S wallPar,
    wall_length=5,
    wall_height=2,
    withWindow=true,
    redeclare DataBase.WindowsDoors.Simple.WindowSimple_ASHRAE140 WindowType,
    redeclare model CorrSolarGainWin =
        AixLib.ThermalZones.HighOrder.Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorGSimple,
    withSunblind=true,
    outside=true,
    calcMethodOut=AixLib.ThermalZones.HighOrder.Components.Types.CalcMethodConvectiveHeatTransfer.ASHRAE_Fundamentals,
    Blinding=0.2,
    LimitSolIrr=100,
    TOutAirLimit=282.15,
    T0=289.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside1(T = 293.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside2(T = 293.15)
  Modelica.Blocks.Sources.RealExpression UValue(y = -Tinside2.port.Q_flow / (Tinside2.T - Toutside.T) / (outerWall.wall_length * outerWall.wall_height))
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Toutside(T = 283.15)
  Utilities.Sources.PrescribedSolarRad varRad
  Utilities.Interfaces.Adaptors.ConvRadToCombPort heatStarToComb
  Modelica.Blocks.Sources.Constant       WindSpeed(k=4)
  Modelica.Blocks.Sources.Constant Solarradiation(k=0)
equation
  connect(Tinside2.port, heatStarToComb.portRad)
  connect(Tinside1.port, heatStarToComb.portConv)
  connect(heatStarToComb.portConvRadComb, outerWall.thermStarComb_inside)
  connect(Toutside.port, outerWall.port_outside)
  connect(WindSpeed.y, outerWall.WindSpeedPort)
  connect(varRad.solarRad_out[1], outerWall.SolarRadiationPort)
  connect(Solarradiation.y, varRad.AOI[1])
  connect(Solarradiation.y, varRad.I_gr[1])
  connect(Solarradiation.y, varRad.I_diff[1])
  connect(Solarradiation.y, varRad.I_dir[1])
  connect(Solarradiation.y, varRad.I[1])
end OutsideWall;


Lsodar.

within AixLib.ThermalZones.HighOrder.Components.Examples.WindowsDoors;
model DoorSimple
  extends Modelica.Icons.Example;
  ThermalZones.HighOrder.Components.WindowsDoors.Door doorSimple(eps=1, door_area=10)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Toutside(T = 273.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside(T = 293.15)
  Modelica.Blocks.Sources.RealExpression UValue(y = doorSimple.port_b.Q_flow / (doorSimple.port_b.T - doorSimple.port_a.T) / doorSimple.door_area)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside1(T = 293.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Toutside1(T = 273.15)
equation
  connect(Toutside.port, doorSimple.port_a)
  connect(doorSimple.port_b, Tinside.port)
  connect(Tinside1.port, doorSimple.radPort)
  connect(Toutside1.port, doorSimple.radPort1)
end DoorSimple;


Lsodar.

within AixLib.ThermalZones.HighOrder.Components.Examples.WindowsDoors;
model WindowSimple
  extends Modelica.Icons.Example;
  ThermalZones.HighOrder.Components.WindowsDoors.WindowSimple windowSimple(
      windowarea=10,
    redeclare DataBase.WindowsDoors.Simple.WindowSimple_EnEV2002 WindowType,
    redeclare model CorrSolGain =
        AixLib.ThermalZones.HighOrder.Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorGSimple)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Toutside(T = 273.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside(T = 293.15)
  Modelica.Blocks.Sources.RealExpression UValue(y=windowSimple.port_inside.Q_flow/(1 - windowSimple.WindowType.frameFraction)/windowSimple.windowarea/(windowSimple.port_inside.T - windowSimple.port_outside.T))
  Utilities.Sources.PrescribedSolarRad varRad(           n = 1)
  Modelica.Blocks.Sources.Constant SolarRadiation(k = 100)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature Tinside1(T = 293.15)
equation
  connect(Toutside.port, windowSimple.port_outside)
  connect(windowSimple.port_inside, Tinside.port)
  connect(varRad.solarRad_out[1], windowSimple.solarRad_in)
  connect(SolarRadiation.y, varRad.I[1])
  connect(SolarRadiation.y, varRad.I_dir[1])
  connect(SolarRadiation.y, varRad.I_diff[1])
  connect(SolarRadiation.y, varRad.I_gr[1])
  connect(SolarRadiation.y, varRad.AOI[1])
  connect(Tinside1.port, windowSimple.radPort)
end WindowSimple;


Examples for shadow models

within AixLib.ThermalZones.HighOrder.Components.Shadow;
package Examples "Examples for shadow models"
extends Modelica.Icons.ExamplesPackage;
end Examples;


Test the modul ShadowEffect. Overview

within AixLib.ThermalZones.HighOrder.Components.Shadow.Examples;
model ShadowEffectTest "Test the modul ShadowEffect"
  extends Modelica.Icons.Example;
  BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
        ModelicaServices.ExternalReferences.loadResource(
        "modelica://AixLib/Resources/weatherdata/TRY2015_Jahr_City_Aachen.mos"))
  ShadowEffect shaEffDiffAll(calMod=AixLib.ThermalZones.HighOrder.Components.Shadow.Types.selectorShadowEffectMode.constRedDiffAllDir)
    "Shadow effect with constRedDiffAllDir"
  RadiationTransfer radiationTransfer
  ShadowEffect shaEffDiffPerp(calMod=AixLib.ThermalZones.HighOrder.Components.Shadow.Types.selectorShadowEffectMode.constRedDiffPerpDir)
    "Shadow effect with constRedDiffPerpDir"
  ShadowEffect shaEffAsDir(calMod=AixLib.ThermalZones.HighOrder.Components.Shadow.Types.selectorShadowEffectMode.varRedDiffAsDirRad)
    "Shadow effect with varRedDiffAsDirRad"
  ReducedOrder.Windows.BaseClasses.SelfShadowing                     selfShadowingAbove(
    final bRig={0},
    final n=1,
    final b={1},
    final h={1},
    final bLef={0},
    final dLef={0},
    final dRig={0},
    final bAbo={0.3},
    final bBel={0},
    final dAbo={0.1},
    final dBel={0},
    final azi={-0.94247779607694},
    final til={1.5707963267949})
    "Shadowing due to a projection above the window"
  ReducedOrder.Windows.Validation.BaseClasses.IncidenceAngleVDI6007 incAng(azi=-0.94247779607694,
      til=1.5707963267949) "Incidence angle for the window"
  BoundaryConditions.SolarGeometry.BaseClasses.AltitudeAngle        altAng
    "Altitude angle"
  BoundaryConditions.WeatherData.Bus        weaBus "Weather bus"
  BoundaryConditions.SolarGeometry.BaseClasses.SolarHourAngle
    solHouAng "Solar hour angle"
  BoundaryConditions.SolarGeometry.BaseClasses.ZenithAngle        zen
    "Zenith angle"
  BoundaryConditions.SolarGeometry.BaseClasses.Declination        decAng
    "Declination angle"
  BoundaryConditions.SolarGeometry.BaseClasses.SolarAzimuth        solAzi
    "Solar azimuth"
  Modelica.Blocks.Sources.RealExpression gShaDirEffDiffAll(y=shaEffDiffAll.gShaDir)
equation
  connect(weaDat.weaBus, shaEffDiffAll.weaBus)
  connect(weaDat.weaBus, radiationTransfer.weaBus)
  connect(radiationTransfer.solRadOut, shaEffDiffAll.solRadIn)
  connect(weaDat.weaBus, shaEffDiffPerp.weaBus)
  connect(radiationTransfer.solRadOut, shaEffDiffPerp.solRadIn)
  connect(weaDat.weaBus, shaEffAsDir.weaBus)
  connect(radiationTransfer.solRadOut, shaEffAsDir.solRadIn)
  connect(altAng.zen, weaBus.solZen)
  connect(weaDat.weaBus, weaBus)
  connect(incAng.incAng, selfShadowingAbove.incAng[1])
  connect(altAng.alt, incAng.alt)
  connect(altAng.alt, selfShadowingAbove.alt)
  connect(zen.zen,solAzi. zen)
  connect(decAng.decAng,solAzi. decAng)
  connect(decAng.decAng,zen. decAng)
  connect(solHouAng.solHouAng, zen.solHouAng)
  connect(weaBus.cloTim, decAng.nDay)
  connect(weaBus.solTim, solHouAng.solTim)
  connect(weaBus.lat, zen.lat)
  connect(weaBus.lat, solAzi.lat)
  connect(weaBus.solTim, solAzi.solTim)
  connect(solAzi.solAzi, selfShadowingAbove.solAzi)
  connect(solAzi.solAzi, incAng.solAzi)
end ShadowEffectTest;


Test the modul ShadowLength. Overview

within AixLib.ThermalZones.HighOrder.Components.Shadow.Examples;
model ShadowLengthTest "Test the modul ShadowLength"
  extends Modelica.Icons.Example;
  ShadowLength shaLen1(aziDeg=0, lenShie=0.3) "Azi=S, lenShie=0.3"
  BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
        ModelicaServices.ExternalReferences.loadResource(
        "modelica://AixLib/Resources/weatherdata/TRY2015_Jahr_City_Aachen.mos"))
  ShadowLength shaLen2(aziDeg=90, lenShie=0.3) "Azi=W, lenShie=0.3"
  ShadowLength shaLen3(aziDeg=90, lenShie=0.6) "Azi=W, lenShie=0.6"
equation
  connect(weaDat.weaBus, shaLen1.weaBus)
  connect(weaDat.weaBus, shaLen2.weaBus)
  connect(weaDat.weaBus, shaLen3.weaBus)
end ShadowLengthTest;


Types

within AixLib.ThermalZones.HighOrder.Components.Shadow;
package Types "Types"
  extends Modelica.Icons.Package;

end Types;


Types

within AixLib.ThermalZones.HighOrder.Components;
package Types "Types"
   extends Modelica.Icons.Package;

end Types;


Partial model to choose solar distribution fractions .

within AixLib.ThermalZones.HighOrder.Components.Types;
record PartialCoeffTable "Partial model to choose solar distribution fractions "

  extends Modelica.Icons.Record;

  parameter selectorCoefficients abs "Coefficients for interior solar absorptance of wall surface abs={0.6, 0.9, 0.1}";

  parameter Real coeffFloor(min=0, max=1)
                                         "Solar distribution fraction of the transmitted solar radiantion through the window on the Floor";
  parameter Real coeffCeiling(min=0, max=1)
                                           "Solar distribution fraction of the transmitted solar radiantion through the window on the Ceiling";
  parameter Real coeffOWEast(min=0, max=1)
                                          "Solar distribution fraction of the transmitted solar radiantion through the window on the OWEast";
  parameter Real coeffOWWest(min=0, max=1)
                                          "Solar distribution fraction of the transmitted solar radiantion through the window on the OWWest";
  parameter Real coeffOWNorth(min=0, max=1)
                                           "Solar distribution fraction of the transmitted solar radiantion through the window on the OWNorth";
  parameter Real coeffOWSouth(min=0, max=1)
                                           "Solar distribution fraction of the transmitted solar radiantion through the window on the OWSouth";
  parameter Real coeffWinLost(min=0, max=1)
                                           "Solar distribution fraction of the transmitted solar radiantion through the window on the window and transmitted (lost)";
  parameter Real coeffWinAbs(min=0, max=1) "Solar distribution fraction of the transmitted solar radiantion through the window on the window and absorped";

end PartialCoeffTable;


within AixLib.ThermalZones.HighOrder.Examples;
model OFDHeatLoad "Test environment to determine OFD's nominal heat load"
  extends Modelica.Icons.Example;

  parameter Integer nRooms = 11;
  parameter Integer nHeatedRooms = 10;

  parameter AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation TIR=AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.EnEV_2009 "Thermal Insulation Regulation"

  replaceable package MediumAir = AixLib.Media.Air "Medium within the room";

  Modelica.Blocks.Sources.Constant constRooms[nHeatedRooms](k={293.15,293.15,288.15,293.15,293.15,293.15,293.15,288.15,297.15,293.15}) "1: LivingRoom_GF, 2: Hobby_GF, 3: Corridor_GF, 4: WC_Storage_GF, 5: Kitchen_GF, 6: Bedroom_UF, 7: Child1_UF, 8: Corridor_UF, 9: Bath_UF, 10: Child2_UF, 11: Attic"
  Modelica.Blocks.Sources.Constant constAirEx[nRooms](k={0.5,0.5,0,0.5,0.5,0.5,0.5,0,0.5,0.5,0}) "1: LivingRoom_GF, 2: Hobby_GF, 3: Corridor_GF, 4: WC_Storage_GF, 5: Kitchen_GF, 6: Bedroom_UF, 7: Child1_UF, 8: Corridor_UF, 9: Bath_UF, 10: Child2_UF, 11: Attic"
  Modelica.Blocks.Sources.Constant constWind(k=0)
  Modelica.Blocks.Sources.Constant constAmb(k=261.15)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature groundTemp[5](T=fill(
        273.15 + 8.5, 5))
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature prescribedTemperature[nHeatedRooms]
  Utilities.Interfaces.Adaptors.ConvRadToCombPort heatStarToComb[nRooms]
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature prescribedAmbTemperature
  Utilities.Sources.PrescribedSolarRad        varRad(n=6)
  Modelica.Blocks.Sources.Constant constSun[6](k=fill(0, 6))
  Modelica.Blocks.Sources.RealExpression sumHeatLoads(y=-sum(prescribedTemperature[:].port.Q_flow))
  Modelica.Blocks.Sources.RealExpression heatLoads[nHeatedRooms](y=-(prescribedTemperature[:].port.Q_flow))
  Modelica.Blocks.Interfaces.RealOutput totalHeatLoad
  Modelica.Blocks.Interfaces.RealOutput roomHeatLoads[nHeatedRooms]
  House.OFD_MiddleInnerLoadWall.BuildingEnvelope.WholeHouseBuildingEnvelope wholeHouseBuildingEnvelope(
    redeclare DataBase.Walls.Collections.OFD.EnEV2009Heavy wallTypes,
    energyDynamicsWalls=Modelica.Fluid.Types.Dynamics.FixedInitial,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    T0_air=293.15,
    TWalls_start=292.15,
    redeclare model WindowModel = Components.WindowsDoors.WindowSimple,
    redeclare DataBase.WindowsDoors.Simple.WindowSimple_EnEV2009 Type_Win,
    redeclare model CorrSolarGainWin =
        Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorGSimple,
    use_infiltEN12831=true,
    n50=if TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.EnEV_2009 or TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.EnEV_2002 then 3 else if TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.WSchV_1995 then 4 else 6,
    redeclare package Medium = MediumAir,
    UValOutDoors=if TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.EnEV_2009 then 1.8 else 2.9,
    upperFloor_Building(Corridor(T0_air=288.15), Bath(T0_air=297.15)),
    groundFloor_Building(Corridor(T0_air=288.15)))
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlowRad[nRooms]
  Modelica.Blocks.Sources.Constant adiabaticRadRooms[nRooms](k=fill(0, nRooms)) "1: LivingRoom_GF, 2: Hobby_GF, 3: Corridor_GF, 4: WC_Storage_GF, 5: Kitchen_GF, 6: Bedroom_UF, 7: Child1_UF, 8: Corridor_UF, 9: Bath_UF, 10: Child2_UF, 11: Attic"
  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlowAttic[1](Q_flow={0})
equation
  connect(constRooms.y,prescribedTemperature. T)
  connect(constAmb.y, prescribedAmbTemperature.T)
  connect(constSun.y,varRad. I)
  connect(constSun.y,varRad. I_dir)
  connect(constSun.y,varRad. I_diff)
  connect(constSun.y,varRad. I_gr)
  connect(constSun.y,varRad. AOI)
  connect(sumHeatLoads.y,totalHeatLoad)
  connect(heatLoads.y,roomHeatLoads)
  connect(constWind.y, wholeHouseBuildingEnvelope.WindSpeedPort)
  connect(prescribedAmbTemperature.port, wholeHouseBuildingEnvelope.thermOutside)
  connect(groundTemp.port, wholeHouseBuildingEnvelope.groundTemp)
  connect(varRad.solarRad_out[1], wholeHouseBuildingEnvelope.North)
  connect(varRad.solarRad_out[2], wholeHouseBuildingEnvelope.East)
  connect(varRad.solarRad_out[3], wholeHouseBuildingEnvelope.South)
  connect(varRad.solarRad_out[4], wholeHouseBuildingEnvelope.West)
  connect(varRad.solarRad_out[5], wholeHouseBuildingEnvelope.SolarRadiationPort_RoofN)
  connect(varRad.solarRad_out[6], wholeHouseBuildingEnvelope.SolarRadiationPort_RoofS)
  connect(heatStarToComb.portConvRadComb, wholeHouseBuildingEnvelope.heatingToRooms)
  connect(constAirEx.y, wholeHouseBuildingEnvelope.AirExchangePort)
  connect(prescribedHeatFlowRad.port, heatStarToComb.portRad)
  connect(adiabaticRadRooms.y, prescribedHeatFlowRad.Q_flow)
  connect(wholeHouseBuildingEnvelope.uppFloDown, wholeHouseBuildingEnvelope.groFloUp)
  connect(wholeHouseBuildingEnvelope.groFloDown, wholeHouseBuildingEnvelope.groPlateUp)
  connect(prescribedTemperature[1:10].port, heatStarToComb[1:10].portConv)
  connect(fixedHeatFlowAttic[1].port, heatStarToComb[1].portConv)
end OFDHeatLoad;


OFD with TMC, TIR and TRY

within AixLib.ThermalZones.HighOrder.Examples;
model OFD_1Jan "OFD with TMC, TIR and TRY"

  extends Modelica.Icons.Example;

  parameter AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation TIR=AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.WSchV_1995 "Thermal Insulation Regulation"

  replaceable package MediumAir = AixLib.Media.Air "Medium within the room";

  parameter AixLib.DataBase.Weather.TRYWeatherBaseDataDefinition weatherDataDay = AixLib.DataBase.Weather.TRYWinterDay();
  parameter AixLib.DataBase.Profiles.ProfileBaseDataDefinition VentilationProfile = AixLib.DataBase.Profiles.Ventilation2perDayMean05perH();
  parameter AixLib.DataBase.Profiles.ProfileBaseDataDefinition TSetProfile = AixLib.DataBase.Profiles.SetTemperaturesVentilation2perDay();
  Modelica.Blocks.Sources.CombiTimeTable NaturalVentilation(
    columns={2,3,4,5,7},                                                               extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, tableOnFile = false, table = VentilationProfile.Profile)
  Modelica.Blocks.Sources.CombiTimeTable TSet(columns = {2, 3, 4, 5, 6, 7}, extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic, tableOnFile = false, table = TSetProfile.Profile)
  Modelica.Blocks.Interfaces.RealOutput TAirRooms[10](each unit = "degC")
  Modelica.Blocks.Interfaces.RealOutput Toutside(each unit = "degC")
  Modelica.Blocks.Interfaces.RealOutput SolarRadiation[6](each unit = "W/m2")
  Modelica.Blocks.Interfaces.RealOutput VentilationSchedule[4]
  Modelica.Blocks.Interfaces.RealOutput TsetValvesSchedule[5](each unit = "degC")
  AixLib.BoundaryConditions.WeatherData.Old.WeatherTRY.Weather Weather(
    Latitude=49.5,
    Longitude=8.5,
    GroundReflection=0.2,
    tableName="wetter",
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
    SOD=AixLib.DataBase.Weather.SurfaceOrientation.SurfaceOrientationData_N_E_S_W_RoofN_Roof_S(),
    Wind_dir=false,
    Wind_speed=true,
    Air_temp=true,
    fileName=
        "modelica://AixLib/Resources/WeatherData/TRY2010_12_Jahr_Modelica-Library.txt",
    WeatherData(tableOnFile=false, table=weatherDataDay.weatherData))

  AixLib.ThermalZones.HighOrder.House.OFD_MiddleInnerLoadWall.BuildingEnvelope.WholeHouseBuildingEnvelope OFD(
    redeclare DataBase.Walls.Collections.OFD.WSchV1995Heavy wallTypes,
    energyDynamicsWalls=Modelica.Fluid.Types.Dynamics.FixedInitial,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    T0_air=294.15,
    TWalls_start=292.15,
    redeclare model WindowModel = Components.WindowsDoors.WindowSimple,
    redeclare DataBase.WindowsDoors.Simple.WindowSimple_WSchV1995 Type_Win,
    redeclare model CorrSolarGainWin =
        Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorGSimple,
    use_infiltEN12831=true,
    n50=if TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.EnEV_2009 or TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.EnEV_2002 then 3 else if TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.WSchV_1995 then 4 else 6,
    withDynamicVentilation=true,
    redeclare package Medium = MediumAir,
    UValOutDoors=if TIR == AixLib.ThermalZones.HighOrder.Components.Types.ThermalInsulationRegulation.EnEV_2009 then 1.8 else 2.9)
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature tempOutside
  AixLib.ThermalZones.HighOrder.House.OFD_MiddleInnerLoadWall.EnergySystem.IdealHeaters.GroundFloor
    groundFloor
  AixLib.ThermalZones.HighOrder.House.OFD_MiddleInnerLoadWall.EnergySystem.IdealHeaters.UpperFloor
    upperFloor
  AixLib.Utilities.Interfaces.Adaptors.ConvRadToCombPort heatStarToCombHeaters[9]
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature tempGround[5](T=fill(273.15
         + 9, 5))
equation
  // Romm Temperatures
  TAirRooms[1] =Modelica.Units.Conversions.to_degC(OFD.groundFloor_Building.Livingroom.airload.heatPort.T);
  TAirRooms[2] =Modelica.Units.Conversions.to_degC(OFD.groundFloor_Building.Hobby.airload.heatPort.T);
  TAirRooms[3] =Modelica.Units.Conversions.to_degC(OFD.groundFloor_Building.Corridor.airload.heatPort.T);
  TAirRooms[4] =Modelica.Units.Conversions.to_degC(OFD.groundFloor_Building.WC_Storage.airload.heatPort.T);
  TAirRooms[5] =Modelica.Units.Conversions.to_degC(OFD.groundFloor_Building.Kitchen.airload.heatPort.T);
  TAirRooms[6] =Modelica.Units.Conversions.to_degC(OFD.upperFloor_Building.Bedroom.airload.heatPort.T);
  TAirRooms[7] =Modelica.Units.Conversions.to_degC(OFD.upperFloor_Building.Children1.airload.heatPort.T);
  TAirRooms[8] =Modelica.Units.Conversions.to_degC(OFD.upperFloor_Building.Corridor.airload.heatPort.T);
  TAirRooms[9] =Modelica.Units.Conversions.to_degC(OFD.upperFloor_Building.Bath.airload.heatPort.T);
  TAirRooms[10] =Modelica.Units.Conversions.to_degC(OFD.upperFloor_Building.Children2.airload.heatPort.T);
  //SimulationData
  VentilationSchedule[1] = NaturalVentilation.y[1];
  VentilationSchedule[2] = NaturalVentilation.y[2];
  VentilationSchedule[3] = NaturalVentilation.y[3];
  VentilationSchedule[4] = NaturalVentilation.y[4];
  TsetValvesSchedule[1] =Modelica.Units.Conversions.to_degC(TSet.y[1]);
  TsetValvesSchedule[2] =Modelica.Units.Conversions.to_degC(TSet.y[2]);
  TsetValvesSchedule[3] =Modelica.Units.Conversions.to_degC(TSet.y[3]);
  TsetValvesSchedule[4] =Modelica.Units.Conversions.to_degC(TSet.y[4]);
  TsetValvesSchedule[5] =Modelica.Units.Conversions.to_degC(TSet.y[5]);
  Toutside =Modelica.Units.Conversions.to_degC(Weather.AirTemp);
  //SolarRadiation
  SolarRadiation[1] = Weather.SolarRadiation_OrientedSurfaces[1].I;
  SolarRadiation[2] = Weather.SolarRadiation_OrientedSurfaces[2].I;
  SolarRadiation[3] = Weather.SolarRadiation_OrientedSurfaces[3].I;
  SolarRadiation[4] = Weather.SolarRadiation_OrientedSurfaces[4].I;
  SolarRadiation[5] = Weather.SolarRadiation_OrientedSurfaces[5].I;
  SolarRadiation[6] = Weather.SolarRadiation_OrientedSurfaces[6].I;
  connect(Weather.WindSpeed, OFD.WindSpeedPort)
  connect(tempOutside.port, OFD.thermOutside)
  connect(tempOutside.T, Weather.AirTemp)
  connect(Weather.SolarRadiation_OrientedSurfaces[1], OFD.North)
  connect(Weather.SolarRadiation_OrientedSurfaces[2], OFD.East)
  connect(Weather.SolarRadiation_OrientedSurfaces[3], OFD.South)
  connect(Weather.SolarRadiation_OrientedSurfaces[4], OFD.West)
  connect(Weather.SolarRadiation_OrientedSurfaces[5], OFD.SolarRadiationPort_RoofN)
  connect(Weather.SolarRadiation_OrientedSurfaces[6], OFD.SolarRadiationPort_RoofS)
  connect(NaturalVentilation.y[1], OFD.AirExchangePort[1])
  connect(NaturalVentilation.y[1], OFD.AirExchangePort[6])
  connect(NaturalVentilation.y[2], OFD.AirExchangePort[2])
  connect(NaturalVentilation.y[2], OFD.AirExchangePort[7])
  connect(NaturalVentilation.y[3], OFD.AirExchangePort[4])
  connect(NaturalVentilation.y[3], OFD.AirExchangePort[9])
  connect(NaturalVentilation.y[4], OFD.AirExchangePort[5])
  connect(NaturalVentilation.y[4], OFD.AirExchangePort[10])
  connect(NaturalVentilation.y[5], OFD.AirExchangePort[3])
  connect(NaturalVentilation.y[5], OFD.AirExchangePort[8])
  connect(NaturalVentilation.y[5], OFD.AirExchangePort[11])
  connect(groundFloor.Con_Livingroom, heatStarToCombHeaters[1].portConv)
  connect(groundFloor.Rad_Livingroom, heatStarToCombHeaters[1].portRad)
  connect(groundFloor.Con_Hobby, heatStarToCombHeaters[2].portConv)
  connect(groundFloor.Rad_Hobby, heatStarToCombHeaters[2].portRad)
  connect(groundFloor.Con_Corridor, heatStarToCombHeaters[3].portConv)
  connect(groundFloor.Rad_Corridor, heatStarToCombHeaters[3].portRad)
  connect(groundFloor.Con_Storage, heatStarToCombHeaters[4].portConv)
  connect(groundFloor.Rad_WC, heatStarToCombHeaters[4].portRad)
  connect(groundFloor.Con_Kitchen, heatStarToCombHeaters[5].portConv)
  connect(groundFloor.Rad_Kitchen, heatStarToCombHeaters[5].portRad)
  connect(upperFloor.Con_Bedroom, heatStarToCombHeaters[6].portConv)
  connect(upperFloor.Rad_Bedroom, heatStarToCombHeaters[6].portRad)
  connect(upperFloor.Con_Chidlren1, heatStarToCombHeaters[7].portConv)
  connect(upperFloor.Rad_Children1, heatStarToCombHeaters[7].portRad)
  connect(upperFloor.Con_Bath, heatStarToCombHeaters[8].portConv)
  connect(upperFloor.Rad_Bath, heatStarToCombHeaters[8].portRad)
  connect(upperFloor.Con_Children2, heatStarToCombHeaters[9].portConv)
  connect(upperFloor.Rad_Children2, heatStarToCombHeaters[9].portRad)
  connect(tempGround.port, OFD.groundTemp)
  connect(TSet.y[1], upperFloor.TSet_UF[1])
  connect(TSet.y[1], groundFloor.TSet_GF[1])
  connect(TSet.y[2], upperFloor.TSet_UF[2])
  connect(TSet.y[2], groundFloor.TSet_GF[2])
  connect(TSet.y[6], groundFloor.TSet_GF[3])
  connect(TSet.y[4], upperFloor.TSet_UF[3])
  connect(TSet.y[5], groundFloor.TSet_GF[4])
  connect(TSet.y[3], upperFloor.TSet_UF[4])
  connect(TSet.y[3], groundFloor.TSet_GF[5])
  connect(OFD.uppFloDown, OFD.groFloUp)
  connect(OFD.groFloDown, OFD.groPlateUp)
  connect(heatStarToCombHeaters[1].portConvRadComb, OFD.heatingToRooms[1])
  connect(heatStarToCombHeaters[2].portConvRadComb, OFD.heatingToRooms[2])
  connect(heatStarToCombHeaters[3].portConvRadComb, OFD.heatingToRooms[3])
  connect(heatStarToCombHeaters[4].portConvRadComb, OFD.heatingToRooms[4])
  connect(heatStarToCombHeaters[5].portConvRadComb, OFD.heatingToRooms[5])
  connect(heatStarToCombHeaters[6].portConvRadComb, OFD.heatingToRooms[6])
  connect(heatStarToCombHeaters[7].portConvRadComb, OFD.heatingToRooms[7])
  connect(heatStarToCombHeaters[8].portConvRadComb, OFD.heatingToRooms[9])
  connect(heatStarToCombHeaters[9].portConvRadComb, OFD.heatingToRooms[10])
end OFD_1Jan;


<span style=\

within AixLib.ThermalZones.HighOrder;
package Examples
  extends Modelica.Icons.ExamplesPackage;
end Examples;


within AixLib.ThermalZones.HighOrder.Examples;
model RoomGFOw2_DayNightMode
  "Room on groudn floor with 2 outer walls with day and night"

  extends Modelica.Icons.Example;

  parameter AixLib.DataBase.Weather.TRYWeatherBaseDataDefinition weatherDataDay = AixLib.DataBase.Weather.TRYWinterDay();

  replaceable package MediumAir = AixLib.Media.Air "Medium within the room";
  replaceable package Medium =
    AixLib.Media.Water "Medium in the component"

  Rooms.OFD.Ow2IwL1IwS1Gr1Uf1 room_GF_2OW(redeclare DataBase.Walls.Collections.OFD.EnEV2009Heavy wallTypes,
    energyDynamicsWalls=Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
    redeclare package Medium = MediumAir,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    TWalls_start=290.15,
    redeclare model WindowModel = Components.WindowsDoors.WindowSimple,
    redeclare DataBase.WindowsDoors.Simple.WindowSimple_EnEV2002 Type_Win,
    redeclare model CorrSolarGainWin =
        Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorGSimple,
    use_infiltEN12831=true,
    n50=3,                                withDoor1 = false, withDoor2 = false, withWindow1 = true, solar_absorptance_OW = 0.6, room_length = 5.87, room_width = 3.84, room_height = 2.6, windowarea_OW1 = 8.4, withWindow2 = true, windowarea_OW2 = 1.73,
    T0_air=294.15)
  AixLib.BoundaryConditions.WeatherData.Old.WeatherTRY.Weather combinedWeather(
    Latitude=49.5,
    Longitude=8.5,
    Cloud_cover=false,
    Wind_speed=true,
    Air_temp=true,
    fileName=
        "modelica://AixLib/Resources/WeatherData/TRY2010_12_Jahr_Modelica-Library.txt",
    WeatherData(tableOnFile=false, table=weatherDataDay.weatherData))

  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature varTemp
  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow adiabaticWalls[4](each Q_flow=0)
  Fluid.Actuators.Valves.TwoWayEqualPercentage    heatValve_new(
    redeclare package Medium = Medium,
    m_flow_nominal=1.5*m_flow_nominal,
    dpValve_nominal=0.5*dp_nominal)
  AixLib.Obsolete.Year2021.Fluid.Movers.Pump Pump(
    redeclare package Medium = Medium,
    m_flow_small=0.0001,
    MinMaxCharacteristics=DataBase.Pumps.Pump1()) "Pump in heating system"
  AixLib.Utilities.Sources.NightMode nightMode(dayEnd = 22, dayStart = 6)
  AixLib.Fluid.FixedResistances.PressureDrop res(
    redeclare package Medium = Medium,
    dp(start=100),
    m_flow_nominal=m_flow_nominal,
    dp_nominal=200) "Hydraulic resistance in supply"
  AixLib.Fluid.FixedResistances.PressureDrop res2(
    redeclare package Medium = Medium,
    dp(start=100),
    m_flow_nominal=m_flow_nominal,
    dp_nominal=200) "Hydraulic resistance in return"
  Modelica.Blocks.Sources.Constant Tset(k = 273.15 + 20)
  Modelica.Blocks.Sources.Constant AirExchange(k = 0.7)
  AixLib.Fluid.Sources.Boundary_ph
                                 tank(nPorts=1, redeclare package Medium =
        Medium)
  AixLib.Fluid.HeatExchangers.Radiators.Radiator radiator_ML_delta(
    redeclare package Medium = Medium,
    m_flow_nominal=m_flow_nominal,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    selectable=true,
    radiatorType=AixLib.DataBase.Radiators.Standard_MFD_WSchV1984_OneAppartment.Radiator_Livingroom(),
    initDynamicsWall=Modelica.Fluid.Types.Dynamics.SteadyStateInitial)
  Modelica.Blocks.Sources.Constant Tset_flowTemperature(k = 273.15 + 55)
  AixLib.Fluid.HeatExchangers.Heater_T       hea(
    redeclare package Medium = Medium,
    m_flow_nominal=m_flow_nominal,
    dp_nominal=0)
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor
  Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSenConv
  Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSenRad
  Fluid.Sensors.MassFlowRate senMasFlo(redeclare package Medium = Medium)
  Modelica.Blocks.Interfaces.RealOutput TRoom(unit="K", displayUnit="degC")
    "Absolute temperature as output signal"
  Modelica.Blocks.Interfaces.RealOutput Q_flowToRoomConv(unit="W") "Convective heat flow from radiator to room"
  Modelica.Blocks.Interfaces.RealOutput Q_flowToRoomRad(unit="W") "Radiant heat flow from radiator to room"
  Modelica.Blocks.Interfaces.RealOutput m_flowHC(unit="kg/s") "Mass flow rate in heating circuit (HC)"
  parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=0.5*max(Pump.m_flowsPump)
    "Nominal mass flow rate";
  parameter Modelica.Units.SI.PressureDifference dp_nominal=0.5*max(Pump.dpsPump)
    "Nominal pressure difference";

  Modelica.Blocks.Continuous.LimPID controlPIThermostat(
    controllerType=Modelica.Blocks.Types.SimpleController.P,
    k=1/2,
    Ti=1800,
    yMax=1,
    yMin=0,
    initType=Modelica.Blocks.Types.Init.SteadyState)
  Modelica.Blocks.Continuous.FirstOrder firstOrder(
    final k=1,
    final T=600,
    final initType=Modelica.Blocks.Types.Init.InitialOutput,
    final y_start=21 + 273.15)
equation
  connect(varTemp.port, room_GF_2OW.thermOutside)
  connect(res.port_b, heatValve_new.port_a)
  connect(hea.port_b, res.port_a)
  connect(heatValve_new.port_b, radiator_ML_delta.port_a)
  connect(room_GF_2OW.AirExchangePort, AirExchange.y)
  connect(combinedWeather.SolarRadiation_OrientedSurfaces[1], room_GF_2OW.SolarRadiationPort_OW2)
  connect(combinedWeather.SolarRadiation_OrientedSurfaces[2], room_GF_2OW.SolarRadiationPort_OW1)
  connect(combinedWeather.WindSpeed, room_GF_2OW.WindSpeedPort)
  connect(combinedWeather.AirTemp, varTemp.T)
  connect(Pump.port_a, res2.port_b)
  connect(nightMode.SwitchToNightMode,Pump. IsNight)
  connect(temperatureSensor.port, room_GF_2OW.thermRoom)
  connect(temperatureSensor.T, TRoom)
  connect(tank.ports[1],Pump. port_a)

  connect(Pump.port_b, hea.port_a)

  connect(Tset_flowTemperature.y, hea.TSet)
  connect(adiabaticWalls[1].port, room_GF_2OW.thermCeiling)
  connect(adiabaticWalls[2].port, room_GF_2OW.thermInsideWall1)
  connect(adiabaticWalls[3].port, room_GF_2OW.thermInsideWall2)
  connect(adiabaticWalls[4].port, room_GF_2OW.ground)
  connect(radiator_ML_delta.port_b, senMasFlo.port_a)
  connect(senMasFlo.port_b, res2.port_a)
  connect(senMasFlo.m_flow, m_flowHC)
  connect(radiator_ML_delta.ConvectiveHeat, heatFlowSenConv.port_a)
  connect(heatFlowSenConv.port_b, room_GF_2OW.thermRoom)
  connect(radiator_ML_delta.RadiativeHeat, heatFlowSenRad.port_a)
  connect(heatFlowSenRad.port_b, room_GF_2OW.starRoom)
  connect(heatFlowSenConv.Q_flow,Q_flowToRoomConv)
  connect(heatFlowSenRad.Q_flow, Q_flowToRoomRad)
  connect(controlPIThermostat.y, heatValve_new.y)
  connect(Tset.y, controlPIThermostat.u_s)
  connect(temperatureSensor.T, firstOrder.u)
  connect(firstOrder.y, controlPIThermostat.u_m)
end RoomGFOw2_DayNightMode;


Based on Case270 from validation package.

within AixLib.ThermalZones.HighOrder.Examples.ASHREA140;
model CompareDynamicAndStaticSolarFrac_Case270 "Based on Case270 from validation package"
  extends Validation.ASHRAE140.Case220(absInnerWallSurf=AixLib.ThermalZones.HighOrder.Components.Types.selectorCoefficients.abs09,
                                       Room(use_shortWaveRadIn=true,
                                            ceiling(use_shortWaveRadOut=false)));
  Modelica.Blocks.Sources.CombiTimeTable Solar_Radiation_dyn(
    tableOnFile=true,
    tableName="Table",
    columns={2,3},
    fileName=Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/weatherdata/Weatherdata_ASHARE140.txt"))
  Modelica.Blocks.Sources.CombiTimeTable Source_Weather_dyn(
    tableOnFile=true,
    tableName="Table",
    columns={4,5,6,7},
    fileName=Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/weatherdata/Weatherdata_ASHARE140.txt"))
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature outsideTemp_dyn
    "ambient temperature"
  Rooms.ASHRAE140.SouthFacingWindows Room_dyn(
    energyDynamicsWalls=Modelica.Fluid.Types.Dynamics.FixedInitial,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare model WindowModel = Components.WindowsDoors.Window_ASHRAE140,
    redeclare model CorrSolarGainWin =
        Components.WindowsDoors.BaseClasses.CorrectionSolarGain.CorG_ASHRAE140,
    solar_absorptance_OW=0.1,
    use_dynamicShortWaveRadMethod=true,
    redeclare Components.Types.CoeffTableSouthWindow coeffTableSolDistrFractions,
    use_shortWaveRadIn=true,
    ceiling(use_shortWaveRadOut=false))
  Modelica.Blocks.Sources.Constant AirExchangeRate_dyn(k=0)
  Modelica.Blocks.Sources.Constant Source_InternalGains_convective_dyn(k=0.4*0)
  Modelica.Blocks.Sources.Constant Source_InternalGains_radiative_dyn(k=0.6*0)
  Modelica.Blocks.Sources.Constant Source_TsetC_dyn(k=273.15 + 20.1)
  Modelica.Blocks.Sources.Constant Source_TsetH_dyn(k=273.15 + 20)
  Utilities.Sources.HeaterCooler.HeaterCoolerPI idealHeaterCooler_dyn(
    TN_heater=1,
    TN_cooler=1,
    h_heater=1e6,
    KR_heater=1000,
    l_cooler=-1e6,
    KR_cooler=1000,
    recOrSep=false)
  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow Ground_dyn(Q_flow=0)
    "adiabatic boundary"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow
    InternalGains_convective_dyn
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow
    InternalGains_radiative_dyn
equation
  connect(Source_Weather_dyn.y[1], outsideTemp_dyn.T)
  connect(Source_Weather_dyn.y[2], Room_dyn.WindSpeedPort)
  connect(Source_TsetC_dyn.y, idealHeaterCooler_dyn.setPointCool)
  connect(Source_TsetH_dyn.y, idealHeaterCooler_dyn.setPointHeat)
  connect(Room_dyn.thermRoom, idealHeaterCooler_dyn.heatCoolRoom)
  connect(Ground_dyn.port, Room_dyn.Therm_ground)
  connect(Source_InternalGains_radiative_dyn.y, InternalGains_radiative_dyn.Q_flow)
  connect(InternalGains_convective_dyn.port, Room_dyn.thermRoom)
  connect(InternalGains_radiative_dyn.port, Room_dyn.starRoom)
  connect(outsideTemp_dyn.port, Room_dyn.thermOutside)
  connect(Room_dyn.AirExchangePort, AirExchangeRate_dyn.y)
  connect(Source_InternalGains_convective_dyn.y, InternalGains_convective_dyn.Q_flow)
  connect(radOnTiltedSurf_Perez.OutTotalRadTilted, Room_dyn.SolarRadiationPort)
end CompareDynamicAndStaticSolarFrac_Case270;


within AixLib.ThermalZones.HighOrder.Examples;
package ASHREA140 "Package with examples for the models based on ASHREA 140"
  extends Modelica.Icons.ExamplesPackage;
end ASHREA140;


Illustrates the use of the 5R1C thermal zone in free-floating conditions. This model illustrates the use of
AixLib.ThermalZones.ISO13790.Zone5R1C.Zone in a free-floating case
(i.e. no heating or cooling)

within AixLib.ThermalZones.ISO13790.Examples;
model FreeFloating "Illustrates the use of the 5R1C thermal zone in free-floating conditions"
  extends Modelica.Icons.Example;

  AixLib.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
        Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos")) "weather data"
  Zone5R1C.Zone zon5R1C(
    airRat=0.5,
    AWin={0,0,3,0},
    UWin=1.8,
    AWal={12,12,9,12},
    ARoo=16,
    UWal=1.3,
    URoo=1.3,
    UFlo=1,
    AFlo=16,
    VRoo=16*3,
    redeclare replaceable AixLib.ThermalZones.ISO13790.Data.Light buiMas,
    nOrientations=4,
    surTil={1.5707963267949,1.5707963267949,1.5707963267949,1.5707963267949},
    surAzi={3.1415926535898,-1.5707963267949,0,1.5707963267949},
    gFac=0.5) "Thermal zone"
  Modelica.Blocks.Sources.Constant intGains(k=10) "internal heat gains in Watt"
equation
  connect(zon5R1C.weaBus, weaDat.weaBus)
  connect(zon5R1C.intSenGai, intGains.y)
end FreeFloating;


within AixLib.ThermalZones.ISO13790.Examples;
model FreeFloatingHVAC "Illustrates the use of the 5R1C HVAC thermal zone in free-floating conditions"
  extends Modelica.Icons.Example;
  AixLib.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
        Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos")) "weather data"
  Zone5R1C.ZoneHVAC zonHVAC(
    airRat=0.5,
    AWin={0,0,3,0},
    UWin=1.8,
    AWal={12,12,9,12},
    ARoo=16,
    UWal=1.3,
    URoo=1.3,
    UFlo=1,
    AFlo=16,
    VRoo=16*3,
    nOrientations=4,
    surTil={1.5707963267949,1.5707963267949,1.5707963267949,1.5707963267949},
    surAzi={3.1415926535898,-1.5707963267949,0,1.5707963267949},
    gFac=0.5,
    redeclare package Medium = AixLib.Media.Air,
    redeclare AixLib.ThermalZones.ISO13790.Data.Light buiMas) "Thermal zone"
  Modelica.Blocks.Sources.Constant intGains(k=10) "Internal heat gains"
  Modelica.Blocks.Sources.Constant latGains(k=0) "Latent gains"
equation
  connect(zonHVAC.weaBus, weaDat.weaBus)
  connect(latGains.y, zonHVAC.intLatGai)
  connect(intGains.y, zonHVAC.intSenGai)
end FreeFloatingHVAC;


Illustrates the use of the 5R1C thermal zone with heating and cooling. This model illustrates the use of
AixLib.ThermalZones.ISO13790.Zone5R1C.Zone with heating and cooling.

within AixLib.ThermalZones.ISO13790.Examples;
model HeatingCooling "Illustrates the use of the 5R1C thermal zone with heating and cooling"
  extends FreeFloating(zon5R1C(
      airRat=0.5,
      AWin={0,0,3,0},
      UWin=1.8,
      AWal={12,12,9,12},
      ARoo=16,
      UWal=1.3,
      URoo=1.3,
      AFlo=16,
      VRoo=16*3,
      redeclare AixLib.ThermalZones.ISO13790.Data.Light buiMas,
      gFac=0.5) "Thermal zone");
  Modelica.Blocks.Math.Sum sumHeaCoo(nin=2)
    "Sum of heating and cooling heat flow rate"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaCoo
    "Prescribed heat flow for heating and cooling"
  Modelica.Blocks.Math.Gain gaiHea(k=1E6) "Gain for heating"
  AixLib.Controls.Continuous.LimPID conHeaPID(
    Ti=300,
    k=0.1,
    reverseActing=true,
    strict=true) "Controller for heating"
  Modelica.Blocks.Sources.Constant TSetHea(k=273.15 + 20)
    "Set-point for heating"
  Modelica.Blocks.Sources.Constant TSetCoo(k=273.15 + 27)
    "Set-point for cooling"
  Modelica.Blocks.Routing.Multiplex2 multiplex2
  Modelica.Blocks.Math.Gain gaiCoo(k=-1E6) "Gain for cooling"
  AixLib.Controls.Continuous.LimPID conCooPID(
    Ti=300,
    k=0.1,
    reverseActing=false,
    strict=true) "Controller for cooling"
equation
  connect(sumHeaCoo.y, preHeaCoo.Q_flow)
  connect(conHeaPID.y, gaiHea.u)
  connect(TSetHea.y, conHeaPID.u_s)
  connect(multiplex2.y,sumHeaCoo. u)
  connect(conCooPID.u_s, TSetCoo.y)
  connect(conCooPID.y, gaiCoo.u)
  connect(conHeaPID.y, gaiHea.u)
  connect(gaiHea.y, multiplex2.u1[1])
  connect(gaiCoo.y, multiplex2.u2[1])
  connect(gaiCoo.u, conCooPID.y)
  connect(preHeaCoo.port, zon5R1C.heaPorAir)
  connect(zon5R1C.TAir, conCooPID.u_m)
  connect(zon5R1C.TAir, conHeaPID.u_m)
end HeatingCooling;


within AixLib.ThermalZones.ISO13790.Examples;
model HeatingCoolingHVAC "Illustrates the use of the 5R1C HVAC thermal zone connected to a ventilation system"
  extends FreeFloatingHVAC(zonHVAC(nPorts=2));

  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaCoo
    "Prescribed heat flow for heating and cooling"
  Modelica.Blocks.Math.Gain gaiHea(k=1E6) "Gain for heating"
  Controls.Continuous.LimPID conHeaPID(
    Ti=300,
    k=0.1,
    reverseActing=true,
    strict=true) "Controller for heating"
  Modelica.Blocks.Sources.Constant TSetHea(k=273.15 + 20) "Set-point for heating"
  Fluid.Sources.MassFlowSource_T sou(
    redeclare package Medium = AixLib.Media.Air,
    use_m_flow_in=true,
    T=280.15,
    nPorts=1) "source of air"
  Modelica.Blocks.Sources.Constant TSetCoo(k=273.15 + 27)
    "Set-point for cooling"
  Controls.Continuous.LimPID conCooPID(
    Ti=300,
    k=0.1,
    yMax=0.07,
    reverseActing=false,
    strict=true) "Controller for cooling"
  Modelica.Blocks.Math.Gain gaiCoo(k=1) "Gain for cooling"
  Fluid.Sources.Boundary_pT sin(
    redeclare package Medium = AixLib.Media.Air,
    nPorts=1) "sink"
equation
  connect(conHeaPID.y,gaiHea. u)
  connect(TSetHea.y,conHeaPID. u_s)
  connect(conHeaPID.y,gaiHea. u)
  connect(gaiHea.y, preHeaCoo.Q_flow)
  connect(conCooPID.u_s,TSetCoo. y)
  connect(gaiCoo.u,conCooPID. y)
  connect(sin.ports[1], zonHVAC.ports[1])
  connect(preHeaCoo.port, zonHVAC.heaPorAir)
  connect(sou.ports[1], zonHVAC.ports[2])
  connect(sou.m_flow_in, gaiCoo.y)
  connect(zonHVAC.TAir, conCooPID.u_m)
  connect(zonHVAC.TAir, conHeaPID.u_m)
end HeatingCoolingHVAC;


within AixLib.ThermalZones.ISO13790;
package Examples "Collection of models that illustrate model use and test models"
extends Modelica.Icons.ExamplesPackage;
end Examples;


within AixLib.ThermalZones.ReducedOrder.Examples;
model ComparisonThermalZoneMoistAndDryAir
  "Illustrates the difference between ThermalZone and ThermalZoneMoistAir"
  extends Modelica.Icons.Example;

  AixLib.ThermalZones.ReducedOrder.ThermalZone.ThermalZone thermalZoneMoistAir(
    use_moisture_balance=true,
    ROM(extWallRC(thermCapExt(each der_T(fixed=true))), intWallRC(thermCapInt(
            each der_T(fixed=true)))),
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare package Medium = Media.Air,
    internalGainsMode=3,
    nPorts=2,
    T_start=293.15,
    redeclare AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_OfficeNoHeaterCooler zoneParam)
    "Thermal zone"
  AixLib.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
    calTSky=AixLib.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
    computeWetBulbTemperature=false,
    filNam=Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"))
    "Weather data reader"
  Modelica.Blocks.Sources.CombiTimeTable internalGains(
    extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic,
    tableName = "UserProfiles",
    fileName = Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/LowOrder_ExampleData/UserProfiles_18599_SIA_Besprechung_Sitzung_Seminar.txt"),
    columns = {2, 3, 4},
    tableOnFile=false,
    table=[0,0,0.1,0,0; 3540,0,0.1,0,0; 3600,0,0.1,0,0; 7140,0,0.1,0,0; 7200,0,
        0.1,0,0; 10740,0,0.1,0,0; 10800,0,0.1,0,0; 14340,0,0.1,0,0; 14400,0,0.1,
        0,0; 17940,0,0.1,0,0; 18000,0,0.1,0,0; 21540,0,0.1,0,0; 21600,0,0.1,0,0;
        25140,0,0.1,0,0; 25200,0,0.1,0,0; 28740,0,0.1,0,0; 28800,0,0.1,0,0;
        32340,0,0.1,0,0; 32400,0.6,0.6,1,1; 35940,0.6,0.6,1,1; 36000,1,1,1,1;
        39540,1,1,1,1; 39600,0.4,0.4,1,1; 43140,0.4,0.4,1,1; 43200,0,0.1,0,0;
        46740,0,0.1,0,0; 46800,0,0.1,0,0; 50340,0,0.1,0,0; 50400,0.6,0.6,1,1;
        53940,0.6,0.6,1,1; 54000,1,1,1,1; 57540,1,1,1,1; 57600,0.4,0.4,1,1;
        61140,0.4,0.4,1,1; 61200,0,0.1,0,0; 64740,0,0.1,0,0; 64800,0,0.1,0,0;
        68340,0,0.1,0,0; 68400,0,0.1,0,0; 71940,0,0.1,0,0; 72000,0,0.1,0,0;
        75540,0,0.1,0,0; 75600,0,0.1,0,0; 79140,0,0.1,0,0; 79200,0,0.1,0,0;
        82740,0,0.1,0,0; 82800,0,0.1,0,0; 86340,0,0.1,0,0; 86400,0,0.1,0,0;
        89940,0,0.1,0,0; 90000,0,0.1,0,0; 93540,0,0.1,0,0; 93600,0,0.1,0,0;
        97140,0,0.1,0,0; 97200,0,0.1,0,0; 100740,0,0.1,0,0; 100800,0,0.1,0,0;
        104340,0,0.1,0,0; 104400,0,0.1,0,0; 107940,0,0.1,0,0; 108000,0,0.1,0,0;
        111540,0,0.1,0,0; 111600,0,0.1,0,0; 115140,0,0.1,0,0; 115200,0,0.1,0,0;
        118740,0,0.1,0,0; 118800,0.6,0.6,1,1; 122340,0.6,0.6,1,1; 122400,1,1,1,
        1; 125940,1,1,1,1; 126000,0.4,0.4,1,1; 129540,0.4,0.4,1,1; 129600,0,0.1,
        0,0; 133140,0,0.1,0,0; 133200,0,0.1,0,0; 136740,0,0.1,0,0; 136800,0.6,
        0.6,1,1; 140340,0.6,0.6,1,1; 140400,1,1,1,1; 143940,1,1,1,1; 144000,0.4,
        0.4,1,1; 147540,0.4,0.4,1,1; 147600,0,0.1,0,0; 151140,0,0.1,0,0; 151200,
        0,0.1,0,0; 154740,0,0.1,0,0; 154800,0,0.1,0,0; 158340,0,0.1,0,0; 158400,
        0,0.1,0,0; 161940,0,0.1,0,0; 162000,0,0.1,0,0; 165540,0,0.1,0,0; 165600,
        0,0.1,0,0; 169140,0,0.1,0,0; 169200,0,0.1,0,0; 172740,0,0.1,0,0; 172800,
        0,0.1,0,0; 176340,0,0.1,0,0; 176400,0,0.1,0,0; 179940,0,0.1,0,0; 180000,
        0,0.1,0,0; 183540,0,0.1,0,0; 183600,0,0.1,0,0; 187140,0,0.1,0,0; 187200,
        0,0.1,0,0; 190740,0,0.1,0,0; 190800,0,0.1,0,0; 194340,0,0.1,0,0; 194400,
        0,0.1,0,0; 197940,0,0.1,0,0; 198000,0,0.1,0,0; 201540,0,0.1,0,0; 201600,
        0,0.1,0,0; 205140,0,0.1,0,0; 205200,0.6,0.6,1,1; 208740,0.6,0.6,1,1;
        208800,1,1,1,1; 212340,1,1,1,1; 212400,0.4,0.4,1,1; 215940,0.4,0.4,1,1;
        216000,0,0.1,0,0; 219540,0,0.1,0,0; 219600,0,0.1,0,0; 223140,0,0.1,0,0;
        223200,0.6,0.6,1,1; 226740,0.6,0.6,1,1; 226800,1,1,1,1; 230340,1,1,1,1;
        230400,0.4,0.4,1,1; 233940,0.4,0.4,1,1; 234000,0,0.1,0,0; 237540,0,0.1,
        0,0; 237600,0,0.1,0,0; 241140,0,0.1,0,0; 241200,0,0.1,0,0; 244740,0,0.1,
        0,0; 244800,0,0.1,0,0; 248340,0,0.1,0,0; 248400,0,0.1,0,0; 251940,0,0.1,
        0,0; 252000,0,0.1,0,0; 255540,0,0.1,0,0; 255600,0,0.1,0,0; 259140,0,0.1,
        0,0; 259200,0,0.1,0,0; 262740,0,0.1,0,0; 262800,0,0.1,0,0; 266340,0,0.1,
        0,0; 266400,0,0.1,0,0; 269940,0,0.1,0,0; 270000,0,0.1,0,0; 273540,0,0.1,
        0,0; 273600,0,0.1,0,0; 277140,0,0.1,0,0; 277200,0,0.1,0,0; 280740,0,0.1,
        0,0; 280800,0,0.1,0,0; 284340,0,0.1,0,0; 284400,0,0.1,0,0; 287940,0,0.1,
        0,0; 288000,0,0.1,0,0; 291540,0,0.1,0,0; 291600,0.6,0.6,1,1; 295140,0.6,
        0.6,1,1; 295200,1,1,1,1; 298740,1,1,1,1; 298800,0.4,0.4,1,1; 302340,0.4,
        0.4,1,1; 302400,0,0.1,0,0; 305940,0,0.1,0,0; 306000,0,0.1,0,0; 309540,0,
        0.1,0,0; 309600,0.6,0.6,1,1; 313140,0.6,0.6,1,1; 313200,1,1,1,1; 316740,
        1,1,1,1; 316800,0.4,0.4,1,1; 320340,0.4,0.4,1,1; 320400,0,0.1,0,0;
        323940,0,0.1,0,0; 324000,0,0.1,0,0; 327540,0,0.1,0,0; 327600,0,0.1,0,0;
        331140,0,0.1,0,0; 331200,0,0.1,0,0; 334740,0,0.1,0,0; 334800,0,0.1,0,0;
        338340,0,0.1,0,0; 338400,0,0.1,0,0; 341940,0,0.1,0,0; 342000,0,0.1,0,0;
        345540,0,0.1,0,0; 345600,0,0.1,0,0; 349140,0,0.1,0,0; 349200,0,0.1,0,0;
        352740,0,0.1,0,0; 352800,0,0.1,0,0; 356340,0,0.1,0,0; 356400,0,0.1,0,0;
        359940,0,0.1,0,0; 360000,0,0.1,0,0; 363540,0,0.1,0,0; 363600,0,0.1,0,0;
        367140,0,0.1,0,0; 367200,0,0.1,0,0; 370740,0,0.1,0,0; 370800,0,0.1,0,0;
        374340,0,0.1,0,0; 374400,0,0.1,0,0; 377940,0,0.1,0,0; 378000,0.6,0.6,1,
        1; 381540,0.6,0.6,1,1; 381600,1,1,1,1; 385140,1,1,1,1; 385200,0.4,0.4,1,
        1; 388740,0.4,0.4,1,1; 388800,0,0.1,0,0; 392340,0,0.1,0,0; 392400,0,0.1,
        0,0; 395940,0,0.1,0,0; 396000,0.6,0.6,1,1; 399540,0.6,0.6,1,1; 399600,1,
        1,1,1; 403140,1,1,1,1; 403200,0.4,0.4,1,1; 406740,0.4,0.4,1,1; 406800,0,
        0.1,0,0; 410340,0,0.1,0,0; 410400,0,0.1,0,0; 413940,0,0.1,0,0; 414000,0,
        0.1,0,0; 417540,0,0.1,0,0; 417600,0,0.1,0,0; 421140,0,0.1,0,0; 421200,0,
        0.1,0,0; 424740,0,0.1,0,0; 424800,0,0.1,0,0; 428340,0,0.1,0,0; 428400,0,
        0.1,0,0; 431940,0,0.1,0,0; 432000,0,0,0,0; 435540,0,0,0,0; 435600,0,0,0,
        0; 439140,0,0,0,0; 439200,0,0,0,0; 442740,0,0,0,0; 442800,0,0,0,0;
        446340,0,0,0,0; 446400,0,0,0,0; 449940,0,0,0,0; 450000,0,0,0,0; 453540,
        0,0,0,0; 453600,0,0,0,0; 457140,0,0,0,0; 457200,0,0,0,0; 460740,0,0,0,0;
        460800,0,0,0,0; 464340,0,0,0,0; 464400,0,0,0,0; 467940,0,0,0,0; 468000,
        0,0,0,0; 471540,0,0,0,0; 471600,0,0,0,0; 475140,0,0,0,0; 475200,0,0,0,0;
        478740,0,0,0,0; 478800,0,0,0,0; 482340,0,0,0,0; 482400,0,0,0,0; 485940,
        0,0,0,0; 486000,0,0,0,0; 489540,0,0,0,0; 489600,0,0,0,0; 493140,0,0,0,0;
        493200,0,0,0,0; 496740,0,0,0,0; 496800,0,0,0,0; 500340,0,0,0,0; 500400,
        0,0,0,0; 503940,0,0,0,0; 504000,0,0,0,0; 507540,0,0,0,0; 507600,0,0,0,0;
        511140,0,0,0,0; 511200,0,0,0,0; 514740,0,0,0,0; 514800,0,0,0,0; 518340,
        0,0,0,0; 518400,0,0,0,0; 521940,0,0,0,0; 522000,0,0,0,0; 525540,0,0,0,0;
        525600,0,0,0,0; 529140,0,0,0,0; 529200,0,0,0,0; 532740,0,0,0,0; 532800,
        0,0,0,0; 536340,0,0,0,0; 536400,0,0,0,0; 539940,0,0,0,0; 540000,0,0,0,0;
        543540,0,0,0,0; 543600,0,0,0,0; 547140,0,0,0,0; 547200,0,0,0,0; 550740,
        0,0,0,0; 550800,0,0,0,0; 554340,0,0,0,0; 554400,0,0,0,0; 557940,0,0,0,0;
        558000,0,0,0,0; 561540,0,0,0,0; 561600,0,0,0,0; 565140,0,0,0,0; 565200,
        0,0,0,0; 568740,0,0,0,0; 568800,0,0,0,0; 572340,0,0,0,0; 572400,0,0,0,0;
        575940,0,0,0,0; 576000,0,0,0,0; 579540,0,0,0,0; 579600,0,0,0,0; 583140,
        0,0,0,0; 583200,0,0,0,0; 586740,0,0,0,0; 586800,0,0,0,0; 590340,0,0,0,0;
        590400,0,0,0,0; 593940,0,0,0,0; 594000,0,0,0,0; 597540,0,0,0,0; 597600,
        0,0,0,0; 601140,0,0,0,0; 601200,0,0,0,0; 604740,0,0,0,0])
    "Table with profiles for internal gains"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow
    "Radiative heat flow of additional internal gains"
  Modelica.Blocks.Sources.Sine sine(
    amplitude=500,
    f=1/86400,
    offset=500) "Sinusoidal excitation for additional internal gains"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow1
    "Convective heat flow of additional internal gains"
  Modelica.Blocks.Math.Gain gain(k=0.5)
    "Split additional internal gains into radiative an convective"
  Modelica.Blocks.Math.Gain gain1(k=0.5)
    "Split additional internal gains into radiative an convective"

  AixLib.Fluid.Sources.MassFlowSource_T sourcAir(
    redeclare package Medium = Media.Air,
    m_flow=3000/3600*1.17,
    X={0.004,1 - 0.004},
    T=283.15,
    nPorts=1) "mass flow rate of air into thermal zone"
  AixLib.Fluid.Sources.Boundary_pT sinAir(redeclare package Medium = Media.Air,
      nPorts=1) "sink of air"
  AixLib.ThermalZones.ReducedOrder.ThermalZone.ThermalZone thermalZone(
    ROM(extWallRC(thermCapExt(each der_T(fixed=true))), intWallRC(thermCapInt(
            each der_T(fixed=true)))),
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare package Medium = Media.Air,
    internalGainsMode=1,
    nPorts=2,
    redeclare AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_OfficeNoHeaterCooler zoneParam,
    T_start=293.15) "Thermal zone"

  Modelica.Blocks.Sources.CombiTimeTable internalGains1(
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
    tableName="UserProfiles",
    fileName=Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/LowOrder_ExampleData/UserProfiles_18599_SIA_Besprechung_Sitzung_Seminar.txt"),
    columns={2,3,4},
    tableOnFile=false,
    table=[0,0,0.1,0,0; 3540,0,0.1,0,0; 3600,0,0.1,0,0; 7140,0,0.1,0,0; 7200,0,0.1,
        0,0; 10740,0,0.1,0,0; 10800,0,0.1,0,0; 14340,0,0.1,0,0; 14400,0,0.1,0,0;
        17940,0,0.1,0,0; 18000,0,0.1,0,0; 21540,0,0.1,0,0; 21600,0,0.1,0,0; 25140,
        0,0.1,0,0; 25200,0,0.1,0,0; 28740,0,0.1,0,0; 28800,0,0.1,0,0; 32340,0,0.1,
        0,0; 32400,0.6,0.6,1,1; 35940,0.6,0.6,1,1; 36000,1,1,1,1; 39540,1,1,1,1;
        39600,0.4,0.4,1,1; 43140,0.4,0.4,1,1; 43200,0,0.1,0,0; 46740,0,0.1,0,0;
        46800,0,0.1,0,0; 50340,0,0.1,0,0; 50400,0.6,0.6,1,1; 53940,0.6,0.6,1,1;
        54000,1,1,1,1; 57540,1,1,1,1; 57600,0.4,0.4,1,1; 61140,0.4,0.4,1,1; 61200,
        0,0.1,0,0; 64740,0,0.1,0,0; 64800,0,0.1,0,0; 68340,0,0.1,0,0; 68400,0,0.1,
        0,0; 71940,0,0.1,0,0; 72000,0,0.1,0,0; 75540,0,0.1,0,0; 75600,0,0.1,0,0;
        79140,0,0.1,0,0; 79200,0,0.1,0,0; 82740,0,0.1,0,0; 82800,0,0.1,0,0; 86340,
        0,0.1,0,0; 86400,0,0.1,0,0; 89940,0,0.1,0,0; 90000,0,0.1,0,0; 93540,0,0.1,
        0,0; 93600,0,0.1,0,0; 97140,0,0.1,0,0; 97200,0,0.1,0,0; 100740,0,0.1,0,0;
        100800,0,0.1,0,0; 104340,0,0.1,0,0; 104400,0,0.1,0,0; 107940,0,0.1,0,0;
        108000,0,0.1,0,0; 111540,0,0.1,0,0; 111600,0,0.1,0,0; 115140,0,0.1,0,0;
        115200,0,0.1,0,0; 118740,0,0.1,0,0; 118800,0.6,0.6,1,1; 122340,0.6,0.6,1,
        1; 122400,1,1,1,1; 125940,1,1,1,1; 126000,0.4,0.4,1,1; 129540,0.4,0.4,1,
        1; 129600,0,0.1,0,0; 133140,0,0.1,0,0; 133200,0,0.1,0,0; 136740,0,0.1,0,
        0; 136800,0.6,0.6,1,1; 140340,0.6,0.6,1,1; 140400,1,1,1,1; 143940,1,1,1,
        1; 144000,0.4,0.4,1,1; 147540,0.4,0.4,1,1; 147600,0,0.1,0,0; 151140,0,0.1,
        0,0; 151200,0,0.1,0,0; 154740,0,0.1,0,0; 154800,0,0.1,0,0; 158340,0,0.1,
        0,0; 158400,0,0.1,0,0; 161940,0,0.1,0,0; 162000,0,0.1,0,0; 165540,0,0.1,
        0,0; 165600,0,0.1,0,0; 169140,0,0.1,0,0; 169200,0,0.1,0,0; 172740,0,0.1,
        0,0; 172800,0,0.1,0,0; 176340,0,0.1,0,0; 176400,0,0.1,0,0; 179940,0,0.1,
        0,0; 180000,0,0.1,0,0; 183540,0,0.1,0,0; 183600,0,0.1,0,0; 187140,0,0.1,
        0,0; 187200,0,0.1,0,0; 190740,0,0.1,0,0; 190800,0,0.1,0,0; 194340,0,0.1,
        0,0; 194400,0,0.1,0,0; 197940,0,0.1,0,0; 198000,0,0.1,0,0; 201540,0,0.1,
        0,0; 201600,0,0.1,0,0; 205140,0,0.1,0,0; 205200,0.6,0.6,1,1; 208740,0.6,
        0.6,1,1; 208800,1,1,1,1; 212340,1,1,1,1; 212400,0.4,0.4,1,1; 215940,0.4,
        0.4,1,1; 216000,0,0.1,0,0; 219540,0,0.1,0,0; 219600,0,0.1,0,0; 223140,0,
        0.1,0,0; 223200,0.6,0.6,1,1; 226740,0.6,0.6,1,1; 226800,1,1,1,1; 230340,
        1,1,1,1; 230400,0.4,0.4,1,1; 233940,0.4,0.4,1,1; 234000,0,0.1,0,0; 237540,
        0,0.1,0,0; 237600,0,0.1,0,0; 241140,0,0.1,0,0; 241200,0,0.1,0,0; 244740,
        0,0.1,0,0; 244800,0,0.1,0,0; 248340,0,0.1,0,0; 248400,0,0.1,0,0; 251940,
        0,0.1,0,0; 252000,0,0.1,0,0; 255540,0,0.1,0,0; 255600,0,0.1,0,0; 259140,
        0,0.1,0,0; 259200,0,0.1,0,0; 262740,0,0.1,0,0; 262800,0,0.1,0,0; 266340,
        0,0.1,0,0; 266400,0,0.1,0,0; 269940,0,0.1,0,0; 270000,0,0.1,0,0; 273540,
        0,0.1,0,0; 273600,0,0.1,0,0; 277140,0,0.1,0,0; 277200,0,0.1,0,0; 280740,
        0,0.1,0,0; 280800,0,0.1,0,0; 284340,0,0.1,0,0; 284400,0,0.1,0,0; 287940,
        0,0.1,0,0; 288000,0,0.1,0,0; 291540,0,0.1,0,0; 291600,0.6,0.6,1,1; 295140,
        0.6,0.6,1,1; 295200,1,1,1,1; 298740,1,1,1,1; 298800,0.4,0.4,1,1; 302340,
        0.4,0.4,1,1; 302400,0,0.1,0,0; 305940,0,0.1,0,0; 306000,0,0.1,0,0; 309540,
        0,0.1,0,0; 309600,0.6,0.6,1,1; 313140,0.6,0.6,1,1; 313200,1,1,1,1; 316740,
        1,1,1,1; 316800,0.4,0.4,1,1; 320340,0.4,0.4,1,1; 320400,0,0.1,0,0; 323940,
        0,0.1,0,0; 324000,0,0.1,0,0; 327540,0,0.1,0,0; 327600,0,0.1,0,0; 331140,
        0,0.1,0,0; 331200,0,0.1,0,0; 334740,0,0.1,0,0; 334800,0,0.1,0,0; 338340,
        0,0.1,0,0; 338400,0,0.1,0,0; 341940,0,0.1,0,0; 342000,0,0.1,0,0; 345540,
        0,0.1,0,0; 345600,0,0.1,0,0; 349140,0,0.1,0,0; 349200,0,0.1,0,0; 352740,
        0,0.1,0,0; 352800,0,0.1,0,0; 356340,0,0.1,0,0; 356400,0,0.1,0,0; 359940,
        0,0.1,0,0; 360000,0,0.1,0,0; 363540,0,0.1,0,0; 363600,0,0.1,0,0; 367140,
        0,0.1,0,0; 367200,0,0.1,0,0; 370740,0,0.1,0,0; 370800,0,0.1,0,0; 374340,
        0,0.1,0,0; 374400,0,0.1,0,0; 377940,0,0.1,0,0; 378000,0.6,0.6,1,1; 381540,
        0.6,0.6,1,1; 381600,1,1,1,1; 385140,1,1,1,1; 385200,0.4,0.4,1,1; 388740,
        0.4,0.4,1,1; 388800,0,0.1,0,0; 392340,0,0.1,0,0; 392400,0,0.1,0,0; 395940,
        0,0.1,0,0; 396000,0.6,0.6,1,1; 399540,0.6,0.6,1,1; 399600,1,1,1,1; 403140,
        1,1,1,1; 403200,0.4,0.4,1,1; 406740,0.4,0.4,1,1; 406800,0,0.1,0,0; 410340,
        0,0.1,0,0; 410400,0,0.1,0,0; 413940,0,0.1,0,0; 414000,0,0.1,0,0; 417540,
        0,0.1,0,0; 417600,0,0.1,0,0; 421140,0,0.1,0,0; 421200,0,0.1,0,0; 424740,
        0,0.1,0,0; 424800,0,0.1,0,0; 428340,0,0.1,0,0; 428400,0,0.1,0,0; 431940,
        0,0.1,0,0; 432000,0,0,0,0; 435540,0,0,0,0; 435600,0,0,0,0; 439140,0,0,0,
        0; 439200,0,0,0,0; 442740,0,0,0,0; 442800,0,0,0,0; 446340,0,0,0,0; 446400,
        0,0,0,0; 449940,0,0,0,0; 450000,0,0,0,0; 453540,0,0,0,0; 453600,0,0,0,0;
        457140,0,0,0,0; 457200,0,0,0,0; 460740,0,0,0,0; 460800,0,0,0,0; 464340,0,
        0,0,0; 464400,0,0,0,0; 467940,0,0,0,0; 468000,0,0,0,0; 471540,0,0,0,0; 471600,
        0,0,0,0; 475140,0,0,0,0; 475200,0,0,0,0; 478740,0,0,0,0; 478800,0,0,0,0;
        482340,0,0,0,0; 482400,0,0,0,0; 485940,0,0,0,0; 486000,0,0,0,0; 489540,0,
        0,0,0; 489600,0,0,0,0; 493140,0,0,0,0; 493200,0,0,0,0; 496740,0,0,0,0; 496800,
        0,0,0,0; 500340,0,0,0,0; 500400,0,0,0,0; 503940,0,0,0,0; 504000,0,0,0,0;
        507540,0,0,0,0; 507600,0,0,0,0; 511140,0,0,0,0; 511200,0,0,0,0; 514740,0,
        0,0,0; 514800,0,0,0,0; 518340,0,0,0,0; 518400,0,0,0,0; 521940,0,0,0,0; 522000,
        0,0,0,0; 525540,0,0,0,0; 525600,0,0,0,0; 529140,0,0,0,0; 529200,0,0,0,0;
        532740,0,0,0,0; 532800,0,0,0,0; 536340,0,0,0,0; 536400,0,0,0,0; 539940,0,
        0,0,0; 540000,0,0,0,0; 543540,0,0,0,0; 543600,0,0,0,0; 547140,0,0,0,0; 547200,
        0,0,0,0; 550740,0,0,0,0; 550800,0,0,0,0; 554340,0,0,0,0; 554400,0,0,0,0;
        557940,0,0,0,0; 558000,0,0,0,0; 561540,0,0,0,0; 561600,0,0,0,0; 565140,0,
        0,0,0; 565200,0,0,0,0; 568740,0,0,0,0; 568800,0,0,0,0; 572340,0,0,0,0; 572400,
        0,0,0,0; 575940,0,0,0,0; 576000,0,0,0,0; 579540,0,0,0,0; 579600,0,0,0,0;
        583140,0,0,0,0; 583200,0,0,0,0; 586740,0,0,0,0; 586800,0,0,0,0; 590340,0,
        0,0,0; 590400,0,0,0,0; 593940,0,0,0,0; 594000,0,0,0,0; 597540,0,0,0,0; 597600,
        0,0,0,0; 601140,0,0,0,0; 601200,0,0,0,0; 604740,0,0,0,0])
    "Table with profiles for internal gains"

  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow2
    "Radiative heat flow of additional internal gains"
  Modelica.Blocks.Sources.Sine sine1(
    amplitude=500,
    f=1/86400,
    offset=500) "Sinusoidal excitation for additional internal gains"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow3
    "Convective heat flow of additional internal gains"
  Modelica.Blocks.Math.Gain gain2(k=0.5)
    "Split additional internal gains into radiative an convective"
  Modelica.Blocks.Math.Gain gain3(k=0.5)
    "Split additional internal gains into radiative an convective"
  AixLib.Fluid.Sources.MassFlowSource_T sourcAir1(
    redeclare package Medium = Media.Air,
    m_flow=3000/3600*1.17,
    X={0.004,1 - 0.004},
    T=283.15,
    nPorts=1) "mass flow rate of air into thermal zone"
  AixLib.Fluid.Sources.Boundary_pT sinAir1(redeclare package Medium = Media.Air,
      nPorts=1) "sink of air"
equation
  connect(weaDat.weaBus, thermalZoneMoistAir.weaBus)
  connect(internalGains.y, thermalZoneMoistAir.intGains)
  connect(prescribedHeatFlow.port, thermalZoneMoistAir.intGainsRad)
  connect(prescribedHeatFlow1.port, thermalZoneMoistAir.intGainsConv)
  connect(gain1.y, prescribedHeatFlow1.Q_flow)
  connect(gain.y, prescribedHeatFlow.Q_flow)
  connect(sine.y, gain.u)
  connect(sine.y, gain1.u)
  connect(sourcAir.ports[1], thermalZoneMoistAir.ports[1])
  connect(thermalZoneMoistAir.ports[2], sinAir.ports[1])
  connect(internalGains1.y, thermalZone.intGains)
  connect(prescribedHeatFlow2.port, thermalZone.intGainsRad)
  connect(prescribedHeatFlow3.port, thermalZone.intGainsConv)
  connect(gain3.y,prescribedHeatFlow3. Q_flow)
  connect(gain2.y, prescribedHeatFlow2.Q_flow)
  connect(sine1.y, gain2.u)
  connect(sine1.y, gain3.u)
  connect(sourcAir1.ports[1], thermalZone.ports[1])
  connect(thermalZone.ports[2], sinAir1.ports[1])
  connect(weaDat.weaBus, thermalZone.weaBus)
end ComparisonThermalZoneMoistAndDryAir;


Illustrates the use of Multizone

within AixLib.ThermalZones.ReducedOrder.Examples;
model Multizone "Illustrates the use of Multizone"
  import AixLib;
  extends Modelica.Icons.Example;

  AixLib.ThermalZones.ReducedOrder.Multizone.Multizone multizone(
    buildingID=1,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    VAir=33500,
    ABuilding=8375,
    ASurTot=12744.27,
    numZones=5,
    zoneParam={AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office()},
    redeclare package Medium = Modelica.Media.Air.SimpleAir,
    T_start=293.15,
    zone(ROM(extWallRC(thermCapExt(each der_T(fixed=true))), intWallRC(
            thermCapInt(each der_T(fixed=true))))),
    internalGainsMode=1)
    "Multizone"
  AixLib.BoundaryConditions.WeatherData.ReaderTMY3
    weaDat(
    calTSky=AixLib.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
    computeWetBulbTemperature=false,
    filNam=Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"))
    "Weather data reader"
  AixLib.BoundaryConditions.WeatherData.Bus weaBus
    "Weather data bus"
  Modelica.Blocks.Routing.Replicator replicatorTemperatureVentilation(nout=5)
    "Replicates dry bulb air temperature for numZones"
  Modelica.Blocks.Sources.Constant const[5](each k=0.2) "Infiltration rate"
  Modelica.Blocks.Sources.CombiTimeTable tableInternalGains(
    tableOnFile=true,
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
    tableName="Internals",
    fileName=Modelica.Utilities.Files.loadResource(
        "modelica://AixLib/Resources/LowOrder_ExampleData/Internals_Input_6Zone_SIA.txt"),
    columns=2:16)
    "Profiles for internal gains"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow[5]
    "Radiative heat flow of additional internal gains"
  Modelica.Blocks.Sources.Sine sine(
    amplitude=500,
    f=1/86400,
    offset=500) "Sinusoidal excitation for additional internal gains"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow1[5]
    "Convective heat flow of additional internal gains"
  Modelica.Blocks.Math.Gain gain(k=0.5)
    "Split additional internal gains into radiative an convective"
  Modelica.Blocks.Math.Gain gain1(k=0.5)
    "Split additional internal gains into radiative an convective"
  Modelica.Blocks.Routing.Replicator replicator(nout=5)
    "Replicates sinusoidal excitation for numZones"
  Modelica.Blocks.Routing.Replicator replicator1(nout=5)
    "Replicates sinusoidal excitation for numZones"

  Modelica.Blocks.Sources.Constant TSet[5](each k=0)
    "Dummy for heater cooler (not existing in record)"
equation
  connect(weaDat.weaBus,weaBus)
  connect(weaDat.weaBus, multizone.weaBus)
  connect(weaBus.TDryBul, replicatorTemperatureVentilation.u)
  connect(replicatorTemperatureVentilation.y, multizone.ventTemp)
  connect(const.y, multizone.ventRate)
  connect(tableInternalGains.y, multizone.intGains)
  connect(gain.y, replicator.u)
  connect(sine.y, gain.u)
  connect(sine.y, gain1.u)
  connect(gain1.y, replicator1.u)
  connect(replicator1.y, prescribedHeatFlow1.Q_flow)
  connect(replicator.y, prescribedHeatFlow.Q_flow)
  connect(prescribedHeatFlow.port, multizone.intGainsRad)
  connect(prescribedHeatFlow1.port, multizone.intGainsConv)
  connect(TSet.y, multizone.TSetCool)
  connect(TSet.y, multizone.TSetHeat)
end Multizone;


within AixLib.ThermalZones.ReducedOrder.Examples;
model MultizoneEquipped "Illustrates the use of MultizoneEquipped"
  import AixLib;
  extends Modelica.Icons.Example;

  AixLib.ThermalZones.ReducedOrder.Multizone.MultizoneEquipped multizone(
    buildingID=1,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    VAir=33500,
    ABuilding=8375,
    ASurTot=12744.27,
    numZones=5,
    zoneParam={AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office(),
        AixLib.DataBase.ThermalZones.OfficePassiveHouse.OPH_1_Office()},
    internalGainsMode=1,
    heatAHU=true,
    coolAHU=true,
    dehuAHU=true,
    huAHU=true,
    BPFDehuAHU=0.2,
    HRS=false,
    sampleRateAHU=1800,
    effFanAHU_sup=0.7,
    effFanAHU_eta=0.7,
    effHRSAHU_enabled=0.8,
    effHRSAHU_disabled=0.2,
    redeclare package Medium = Modelica.Media.Air.SimpleAir,
    zone(ROM(extWallRC(thermCapExt(each der_T(fixed=true))), intWallRC(
            thermCapInt(each der_T(fixed=true))))),
    T_start=293.15,
    dpAHU_sup(displayUnit="Pa") = 800,
    dpAHU_eta(displayUnit="Pa") = 800)
    "Multizone"
  AixLib.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
    calTSky=AixLib.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
    computeWetBulbTemperature=false,
    filNam=Modelica.Utilities.Files.loadResource("modelica://AixLib/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"))
    "Weather data reader"
  Modelica.Blocks.Sources.CombiTimeTable tableInternalGains(
    tableOnFile=true,
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
    tableName="Internals",
    fileName=Modelica.Utilities.Files.loadResource(
        "modelica://AixLib/Resources/LowOrder_ExampleData/Internals_Input_6Zone_SIA.txt"),
    columns=2:16)
    "Profiles for internal gains"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow[5]
    "Radiative heat flow of additional internal gains"
  Modelica.Blocks.Sources.Sine sine(
    amplitude=500,
    f=1/86400,
    offset=500) "Sinusoidal excitation for additional internal gains"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow1[5]
    "Convective heat flow of additional internal gains"
  Modelica.Blocks.Math.Gain gain(k=0.5)
    "Split additional internal gains into radiative an convective"
  Modelica.Blocks.Math.Gain gain1(k=0.5)
    "Split additional internal gains into radiative an convective"
  Modelica.Blocks.Routing.Replicator replicator(nout=5)
    "Replicates sinusoidal excitation for numZones"
  Modelica.Blocks.Routing.Replicator replicator1(nout=5)
    "Replicates sinusoidal excitation for numZones"
  Modelica.Blocks.Sources.CombiTimeTable tableAHU(
    tableOnFile=true,
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
    tableName="AHU",
    columns=2:5,
    fileName=Modelica.Utilities.Files.loadResource(
        "modelica://AixLib/Resources/LowOrder_ExampleData/AHU_Input_6Zone_SIA_4Columns.txt"))
    "Boundary conditions for air handling unit"
  Modelica.Blocks.Sources.CombiTimeTable tableTSet(
    tableOnFile=true,
    tableName="Tset",
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
    fileName=Modelica.Utilities.Files.loadResource(
        "modelica://AixLib/Resources/LowOrder_ExampleData/Tset_6Zone.txt"),
    columns=2:6)
    "Set points for heater"
  Modelica.Blocks.Sources.Constant const[5](each k=0)
    "Set point for cooler"

equation
  connect(weaDat.weaBus, multizone.weaBus)
  connect(tableInternalGains.y, multizone.intGains)
  connect(gain.y, replicator.u)
  connect(sine.y, gain.u)
  connect(sine.y, gain1.u)
  connect(gain1.y, replicator1.u)
  connect(replicator1.y, prescribedHeatFlow1.Q_flow)
  connect(replicator.y, prescribedHeatFlow.Q_flow)
  connect(prescribedHeatFlow.port, multizone.intGainsRad)
  connect(prescribedHeatFlow1.port, multizone.intGainsConv)
  connect(tableAHU.y, multizone.AHU)
  connect(tableTSet.y, multizone.TSetHeat)
  connect(const.y, multizone.TSetCool)
end MultizoneEquipped;