N-dimensional table with data for chiller. Basic models showing the concept of using n-dimensional table data
  for the innerCycle of the heat pump model. This model assumes one
  provides data for inverter controlled heat pumps or chillers.
  However, this basis structure can be used to create own models, where
  electrical power and condenser depend on other inputs, such as
  ambient temperature.

within AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData;
model LookUpTableND "N-dimensional table with data for chiller"
  extends
    AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData;
  parameter Real nConv=100
    "Gain value multiplied with relative compressor speed n to calculate matching value based on sdf tables";
  parameter SDF.Types.InterpolationMethod interpMethod=SDF.Types.InterpolationMethod.Linear
    "Interpolation method";
  parameter SDF.Types.ExtrapolationMethod extrapMethod=SDF.Types.ExtrapolationMethod.None
    "Extrapolation method";
  parameter String filename_Pel=
      "modelica://Resources/Data/Fluid/BaseClasses/PerformanceData/LookUpTableND/VZH088AG.sdf"
                                   "File name of sdf table data";All Files (*.*)", caption="Select SDF file")));
  parameter String dataset_Pel="/Pel"
                                  "Dataset name"
  parameter String dataUnit_Pel="W"
                                   "Data unit"
  parameter String scaleUnits_Pel[3]={"K","K",""}
                                                 "Scale units"
  parameter String filename_QCon=
      "modelica://Resources/Data/Fluid/BaseClasses/PerformanceData/LookUpTableND/VZH088AG.sdf"
                                    "File name of sdf table data";All Files (*.*)", caption="Select SDF file")));
  parameter String dataset_QCon="/QCon"
                                   "Dataset name"
  parameter String dataUnit_QCon="W"
                                    "Data unit"
  parameter String scaleUnits_QCon[3]={"K","K",""}
                                                  "Scale units"

  Modelica.Blocks.Math.Gain nConGain(final k=nConv)
    "Convert relative speed n to an absolute value for interpolation in sdf tables"
 Modelica.Blocks.Math.UnitConversions.To_degC t_Co_in
  Modelica.Blocks.Math.UnitConversions.To_degC t_Ev_ou
  Modelica.Blocks.Math.Add calcRedQCon
    "Calculates condenser heat flow with total energy balance"
  Utilities.Logical.SmoothSwitch switchPel
    "If HP is off, no heat will be exchanged"
  Utilities.Logical.SmoothSwitch switchQEva
    "If chiller is off, no heat will be exchanged"
  Modelica.Blocks.Sources.Constant constZero(final k=0)
    "Power if HP is turned off"
  SDF.NDTable nDTableQEva(
    final nin=3,
    final readFromFile=true,
    final filename=filename_QCon,
    final dataset=dataset_QCon,
    final dataUnit=dataUnit_QCon,
    final scaleUnits=scaleUnits_QCon,
    final interpMethod=interpMethod,
    final extrapMethod=extrapMethod)
    "SDF-Table data for evaporator heat flow"
  SDF.NDTable nDTablePel(
    final nin=3,
    final readFromFile=true,
    final filename=filename_Pel,
    final dataset=dataset_Pel,
    final dataUnit=dataUnit_Pel,
    final scaleUnits=scaleUnits_Pel,
    final interpMethod=interpMethod,
    final extrapMethod=extrapMethod) "SDF table data for electrical power"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1(
    final n1=1,
    final n2=1,
    final n3=1) "Concat all inputs into an array"

  Modelica.Blocks.Logical.GreaterThreshold greaterThreshold(final threshold=
        Modelica.Constants.eps)
  Modelica.Blocks.Math.Product scalingFacTimesQEva
  Modelica.Blocks.Math.Product scalingFacTimesPel
protected
  Modelica.Blocks.Sources.Constant realCorr(final k=scalingFactor)
    "Calculates correction of table output based on scaling factor"
equation
  connect(switchPel.y, Pel)

  connect(constZero.y,switchQEva. u3)
  connect(constZero.y, switchPel.u3)
  connect(multiplex3_1.y,nDTableQEva. u)
  connect(multiplex3_1.y, nDTablePel.u)
  connect(sigBus.TConInMea,t_Co_in. u)
  connect(sigBus.TEvaOutMea, t_Ev_ou.u)
  connect(sigBus.nSet, greaterThreshold.u)
  connect(greaterThreshold.y,switchQEva. u2)
  connect(greaterThreshold.y, switchPel.u2)
  connect(sigBus.nSet, nConGain.u)
  connect(nConGain.y, multiplex3_1.u3[1])
  connect(t_Ev_ou.y, multiplex3_1.u1[1])
  connect(t_Co_in.y, multiplex3_1.u2[1])
  connect(switchPel.y, calcRedQCon.u2)
  connect(switchQEva.y, calcRedQCon.u1)
  connect(calcRedQCon.y, QCon)
  connect(switchQEva.y, QEva)
  connect(realCorr.y, scalingFacTimesPel.u2)
  connect(realCorr.y, scalingFacTimesQEva.u1)
  connect(nDTablePel.y, scalingFacTimesPel.u1)
  connect(nDTableQEva.y, scalingFacTimesQEva.u2)
  connect(scalingFacTimesQEva.y, switchQEva.u1)
  connect(scalingFacTimesPel.y, switchPel.u1)
end LookUpTableND;


within AixLib.Obsolete.Year2024.DataBase.Chiller;
package PerformanceData "Different data models used for a black box chiller model"
end PerformanceData;


Calculating chiller data based on a polynomal approach. This model is used to calculate the three values based on a
  functional approach. The user can choose between several functions or
  use their own.

within AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData;
model PolynomalApproach
  "Calculating chiller data based on a polynomal approach"
  extends
    AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData;

  replaceable function PolyData =
      AixLib.Obsolete.Year2024.DataBase.HeatPump.Functions.Characteristics.PartialBaseFct
                                                                                "Function to calculate peformance Data"
protected
  Real Char[2];
equation
  Char =PolyData(
    sigBus.nSet,
    sigBus.TEvaOutMea,
    sigBus.TConInMea,
    sigBus.m_flowEvaMea,
    sigBus.m_flowConMea);
  if sigBus.nSet > Modelica.Constants.eps then
    //Get's the data from the signal Bus and calculates the power and heat flow based on the function one chooses.
    QEva = Char[2];
    Pel = Char[1];
  else //If heat pump is turned off, all values become zero.
    QCon = 0;
    Pel = 0;
  end if;
  QCon = -(QCon - Pel);
end PolynomalApproach;


Collection of HeatPump Database Records

within AixLib.Obsolete.Year2024.DataBase;
package HeatPump "Collection of HeatPump Database Records"
   extends Modelica.Icons.Package;
end HeatPump;


Functions for AixLib.Fluid.HeatPumps

within AixLib.Obsolete.Year2024.DataBase.HeatPump;
package Functions "Functions for AixLib.Fluid.HeatPumps"
extends Modelica.Icons.Package;
end Functions;


within AixLib.Obsolete.Year2024.DataBase.HeatPump.Functions;
package IcingFactor "Package with functions to calculate current icing factor on evaporator"
end IcingFactor;


To calculate the COP or EER of a device, this model ensures no integration failure will happen. This model is used to calculate the COP or the EER of a device. As
  the electrical power could get negative, a lower boundary is used to
  avoid division by zero. A moving average ensure a stable calculation
  of the COP or EER.

within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData;
model calcCOP
  "To calculate the COP or EER of a device, this model ensures no integration failure will happen"
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;

  parameter Modelica.Units.SI.Power lowBouPel
    "If P_el falls below this value, COP will not be calculated";
  parameter Modelica.Units.SI.Time aveTime=60 "Time span for average";

 Modelica.Blocks.Interfaces.RealInput Pel(final unit="W", final displayUnit=
        "kW")
    "Input for all electrical power consumed by the system"
  Modelica.Blocks.Interfaces.RealInput QHeat(final unit="W", final displayUnit=
        "kW")
    "Input for all heating power delivered to the system"
  Modelica.Blocks.Interfaces.RealOutput y_COP "Output for calculated COP value"
protected
  AixLib.Utilities.Math.MovingAverage movAve(final aveTime=aveTime)
    "To calculate the moving average of the output values";
equation
  //Check if any of the two sums are lower than the given threshold. If so, set COP to zero
  if Pel < lowBouPel or QHeat < Modelica.Constants.eps then
    movAve.u = 0;
  else
    movAve.u = QHeat/Pel;
  end if;
  connect(movAve.y, y_COP);
end calcCOP;


Block which decreases evaporator power by an icing factor. Model for calculation of the icing factor. The replaceable function
  uses the inputs to calculate the resulting icing factor.

within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData;
model IcingBlock
  "Block which decreases evaporator power by an icing factor"
  AixLib.Utilities.Time.CalendarTime calTim(zerTim=zerTim, yearRef=yearRef);
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;
  parameter Integer hourDay=16
                            "Hour of the day";
  parameter AixLib.Utilities.Time.Types.ZeroTime zerTim=AixLib.Utilities.Time.Types.ZeroTime.NY2016
    "Enumeration for choosing how reference time (time = 0) should be defined";
  parameter Integer yearRef=2016 "Year when time = 0, used if zerTim=Custom";
  replaceable function iceFunc =
      Obsolete.Year2024.DataBase.HeatPump.Functions.IcingFactor.BasicIcingApproach
                                                                                constrainedby
    AixLib.Obsolete.Year2024.DataBase.HeatPump.Functions.IcingFactor.PartialBaseFct                                                                     "Replaceable function to calculate current icing factor"
  Modelica.Blocks.Interfaces.RealInput T_flow_ev(unit="K", displayUnit="degC")
    "Temperature at evaporator inlet"

  Modelica.Blocks.Interfaces.RealInput T_ret_ev(unit="K", displayUnit="degC")
    "Temperature at evaporator outlet"
  Modelica.Blocks.Interfaces.RealInput T_oda(unit="K", displayUnit="degC") "Outdoor air temperature"
  Modelica.Blocks.Interfaces.RealInput m_flow_ev(unit="kg/s") "Mass flow rate at evaporator"
  Modelica.Blocks.Interfaces.RealOutput iceFac(min=0, max=1) "Efficiency factor (0..1) to estimate influence of icing. 0 means no heat is transferred through heat exchanger (fully frozen). 1 means no icing/frosting."
protected
  Real iceFac_internal "Calculated value of icing factor";
equation
  iceFac_internal = iceFunc(T_flow_ev,T_ret_ev,T_oda,m_flow_ev);
  iceFac = iceFac_internal;
end IcingBlock;


Performance data coming from manufacturer. This model uses the 2-dimensional table data given in the DIN EN
  14511 (formerly EN255) to calculate QCon and P_el. To
  model an inverter controlled heat pump, the relative compressor
  speed n is scaled linearly with the ouput of the tables.
  Furthermore, the design of a heat pump is modeled via a scaling
  factor. As a result, the equations follow below:

within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData;
model LookUpTable2D "Performance data coming from manufacturer"
  extends
    AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData;

  parameter Modelica.Blocks.Types.Smoothness smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments
    "Smoothness of table interpolation";
  parameter DataBase.HeatPump.HeatPumpBaseDataDefinition dataTable = AixLib.Obsolete.Year2024.DataBase.HeatPump.EN255.Vitocal350AWI114()
    "Data Table of HP"
  parameter Boolean extrapolation=true "False to hold last value";
  parameter Boolean printAsserts=false
    "WARNING: This will lead to a lot of state-events if extrapolation occurs frequently! If extrapolation is enabled, the user will get warnings when extrapolation occurs."

  Utilities.Tables.CombiTable2DExtra  Qdot_ConTable(
    final smoothness=smoothness,
    final u1(unit="degC"),
    final u2(unit="degC"),
    final y(unit="W", displayUnit="kW"),
    final extrapolation=extrapolation,
    final table=dataTable.tableQdot_con)
  Utilities.Tables.CombiTable2DExtra  P_eleTable(
    final smoothness=smoothness,
    extrapolation=extrapolation,
    final u1(unit="degC"),
    final u2(unit="degC"),
    final y(unit="W", displayUnit="kW"),
    final table=dataTable.tableP_ele)
                    "Electrical power table"

  Modelica.Blocks.Math.UnitConversions.To_degC t_Ev_in
  Modelica.Blocks.Math.UnitConversions.To_degC t_Co_ou
  Modelica.Blocks.Math.Product nTimesPel
  Modelica.Blocks.Math.Product nTimesQCon

  Modelica.Blocks.Math.Product nTimesSF
    "Create the product of the scaling factor and relative compressor speed"

protected
  parameter Real minSou = min(dataTable.tableP_ele[1,2:end]);
  parameter Real minSup = min(dataTable.tableP_ele[2:end,1]);
  parameter Real maxSou = max(dataTable.tableP_ele[1,2:end]);
  parameter Real maxSup = max(dataTable.tableP_ele[2:end,1]);
  Modelica.Blocks.Sources.Constant realCorr(final k=scalingFactor)
    "Calculates correction of table output based on scaling factor"

equation
  if printAsserts then
    assert(
        minSou + 273.15 <sigBus.TEvaInMea,
        "Current T_flow_ev is too low. Extrapolation of data will result in unrealistic results",
        level=AssertionLevel.warning);
    assert(
        maxSou + 273.15 >sigBus.TEvaInMea,
        "Current T_flow_ev is too high. Extrapolation of data will result in unrealistic results",
        level=AssertionLevel.warning);
    assert(
      minSup + 273.15 < sigBus.TConOutMea,
      "Current T_ret_co is too low. Extrapolation of data will result in unrealistic results",
      level=AssertionLevel.warning);
    assert(
      maxSup + 273.15 > sigBus.TConOutMea,
      "Current T_ret_co is too high. Extrapolation of data will result in unrealistic results",
      level=AssertionLevel.warning);
  else
  end if;
  connect(t_Ev_in.y, Qdot_ConTable.u2)
  connect(t_Ev_in.y, P_eleTable.u2)
  connect(t_Co_ou.y, P_eleTable.u1)
  connect(t_Co_ou.y, Qdot_ConTable.u1)
  connect(sigBus.TConOutMea, t_Co_ou.u)
  connect(sigBus.TEvaInMea, t_Ev_in.u)
  connect(P_eleTable.y, nTimesPel.u2)
  connect(Qdot_ConTable.y, nTimesQCon.u1)
  connect(nTimesPel.y, Pel)
  connect(realCorr.y, nTimesSF.u2)
  connect(sigBus.nSet, nTimesSF.u1)
  connect(nTimesSF.y, nTimesPel.u1)
  connect(nTimesSF.y, nTimesQCon.u2)
  connect(nTimesPel.y, calcRedQCon.u2)
  connect(nTimesPel.y, feedbackHeatFlowEvaporator.u2)
  connect(nTimesQCon.y, feedbackHeatFlowEvaporator.u1)
end LookUpTable2D;


N-dimensional table with data for heat pump. Basic models showing the concept of using n-dimensional table data
  for the innerCycle of the heat pump model. This model assumes one
  provides data for inverter controlled heat pumps or chillers.
  However, this basis structure can be used to create own models, where
  electrical power and condenser depend on other inputs, such as
  ambient temperature.

within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData;
model LookUpTableND "N-dimensional table with data for heat pump"
  extends
    AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData;
  parameter Real nConv=100
    "Gain value multiplied with relative compressor speed n to calculate matching value based on sdf tables";
  parameter SDF.Types.InterpolationMethod interpMethod=SDF.Types.InterpolationMethod.Linear
    "Interpolation method";
  parameter SDF.Types.ExtrapolationMethod extrapMethod=SDF.Types.ExtrapolationMethod.None
    "Extrapolation method";
  parameter String filename_Pel=
      "modelica://Resources/Data/Fluid/BaseClasses/PerformanceData/LookUpTableND/VZH088AG.sdf"
                                   "File name of sdf table data";All Files (*.*)", caption="Select SDF file")));
  parameter String dataset_Pel="/Pel"
                                  "Dataset name"
  parameter String dataUnit_Pel="W"
                                   "Data unit"
  parameter String scaleUnits_Pel[3]={"K","K",""}
                                                 "Scale units"
  parameter String filename_QCon=
      "modelica://Resources/Data/Fluid/BaseClasses/PerformanceData/LookUpTableND/VZH088AG.sdf"
                                    "File name of sdf table data";All Files (*.*)", caption="Select SDF file")));
  parameter String dataset_QCon="/QCon"
                                   "Dataset name"
  parameter String dataUnit_QCon="W"
                                    "Data unit"
  parameter String scaleUnits_QCon[3]={"K","K",""}
                                                  "Scale units"

  Modelica.Blocks.Math.Gain nConGain(final k=nConv)
    "Convert relative speed n to an absolute value for interpolation in sdf tables"
 Modelica.Blocks.Math.UnitConversions.To_degC t_Ev_in
  Modelica.Blocks.Math.UnitConversions.To_degC t_Co_ou
  Utilities.Logical.SmoothSwitch switchPel
    "If HP is off, no heat will be exchanged"
  Utilities.Logical.SmoothSwitch switchQCon
    "If HP is off, no heat will be exchanged"
  Modelica.Blocks.Sources.Constant constZero(final k=0)
    "Power if HP is turned off"
  SDF.NDTable nDTableQCon(
    final nin=3,
    final readFromFile=true,
    final filename=filename_QCon,
    final dataset=dataset_QCon,
    final dataUnit=dataUnit_QCon,
    final scaleUnits=scaleUnits_QCon,
    final interpMethod=interpMethod,
    final extrapMethod=extrapMethod) "SDF-Table data for condenser heat flow"
  SDF.NDTable nDTablePel(
    final nin=3,
    final readFromFile=true,
    final filename=filename_Pel,
    final dataset=dataset_Pel,
    final dataUnit=dataUnit_Pel,
    final scaleUnits=scaleUnits_Pel,
    final interpMethod=interpMethod,
    final extrapMethod=extrapMethod) "SDF table data for electrical power"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1(
    final n1=1,
    final n2=1,
    final n3=1) "Concat all inputs into an array"

  Modelica.Blocks.Math.Product scalingFacTimesQCon
  Modelica.Blocks.Math.Product scalingFacTimesPel
protected
  Modelica.Blocks.Sources.Constant realCorr(final k=scalingFactor)
    "Calculates correction of table output based on scaling factor"
equation

  connect(constZero.y, switchQCon.u3)
  connect(constZero.y, switchPel.u3)
  connect(multiplex3_1.y, nDTableQCon.u)
  connect(multiplex3_1.y, nDTablePel.u)
  connect(sigBus.TEvaInMea, t_Ev_in.u)
  connect(sigBus.TConOutMea, t_Co_ou.u)
  connect(sigBus.nSet, nConGain.u)
  connect(nConGain.y, multiplex3_1.u3[1])
  connect(t_Co_ou.y, multiplex3_1.u1[1])
  connect(t_Ev_in.y, multiplex3_1.u2[1])
  connect(realCorr.y, scalingFacTimesQCon.u1)
  connect(nDTableQCon.y, scalingFacTimesQCon.u2)
  connect(scalingFacTimesQCon.y, switchQCon.u1)
  connect(realCorr.y, scalingFacTimesPel.u2)
  connect(nDTablePel.y, scalingFacTimesPel.u1)
  connect(scalingFacTimesPel.y, switchPel.u1)
  connect(switchPel.y, calcRedQCon.u2)
  connect(switchPel.y, Pel)
  connect(switchQCon.y, feedbackHeatFlowEvaporator.u1)
  connect(switchPel.y, feedbackHeatFlowEvaporator.u2)
  connect(switchQCon.u2, sigBus.onOffMea)
  connect(switchPel.u2, sigBus.onOffMea)
end LookUpTableND;


within AixLib.Obsolete.Year2024.DataBase.HeatPump;
package PerformanceData "Different models used for a black box heat pump model"
end PerformanceData;


Calculating heat pump data based on a polynomal approach. This model is used to calculate the three values based on a
  functional approach. The user can choose between several functions or
  use their own.

within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData;
model PolynomalApproach
  "Calculating heat pump data based on a polynomal approach"
  extends
    AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData;

  replaceable function PolyData =
      AixLib.Obsolete.Year2024.DataBase.HeatPump.Functions.Characteristics.PartialBaseFct
                                                                                "Function to calculate peformance Data"
  Modelica.Blocks.Sources.RealExpression internal_Pel(final y=Char[1]*
        scalingFactor)
  Modelica.Blocks.Sources.RealExpression internal_QCon(final y=Char[2]*
        scalingFactor)
  Utilities.Logical.SmoothSwitch switchPel
    "If HP is off, no heat will be exchanged"
  Utilities.Logical.SmoothSwitch switchQCon
    "If HP is off, no heat will be exchanged"
  Modelica.Blocks.Sources.Constant constZero(final k=0)
protected
  Real Char[2];
equation
  Char =PolyData(
    sigBus.nSet,
    sigBus.TConOutMea,
    sigBus.TEvaInMea,
    sigBus.m_flowConMea,
    sigBus.m_flowEvaMea);
  connect(switchQCon.u3, constZero.y)
  connect(switchQCon.y, feedbackHeatFlowEvaporator.u1)
  connect(switchQCon.u1, internal_QCon.y)
  connect(constZero.y, switchPel.u3)
  connect(switchPel.y, calcRedQCon.u2)
  connect(switchPel.y, Pel)
  connect(switchPel.u1, internal_Pel.y)
  connect(switchPel.y, feedbackHeatFlowEvaporator.u2)
  connect(switchPel.u2, sigBus.onOffMea)
  connect(switchQCon.u2, sigBus.onOffMea)
end PolynomalApproach;


Multi-dimensional performance map encompasing choices of fluid and flowsheet based on steady state calculations using the Vapour Compression Library. This model uses tables generated by the Vapour Compression Library to
  calculate the relevant outputs of the inner refrigeration cycle.

within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData;
model VCLibMap
  "Multi-dimensional performance map encompasing choices of fluid and flowsheet based on steady state calculations using the Vapour Compression Library"
  extends BaseClasses.PartialPerformanceData;
  // Parameters Heat pump operation
  parameter Modelica.Units.SI.Power QCon_flow_nominal=5000
    "Nominal heating power of heat pump"
  parameter String refrigerant="R410A" "Identifier for the refrigerant"
  parameter String flowsheet="StandardFlowsheet" "Identifier for the flowsheet"
  parameter SDF.Types.InterpolationMethod interpMethod=SDF.Types.InterpolationMethod.Linear
    "Interpolation method"
  parameter SDF.Types.ExtrapolationMethod extrapMethod=SDF.Types.ExtrapolationMethod.Hold
    "Extrapolation method"
    // Strings
  parameter String filename="modelica://AixLib/Resources/Data/Fluid/BaseClasses/PerformanceData/VCLibMap/VCLibMap.sdf"
    "Path to the sdf file"
  parameter String tableName_COP="COP" "String identifier in sdf table for COP"
  parameter String tableName_QCon="Q_con" "String identifier in sdf table for QCon"
  parameter String tableName_QConNominal="Q_flow_con_nominal" "String identifier in sdf table for QConNominal"
  parameter String tableName_mFlowEvaNominal="m_flow_eva" "String identifier in sdf table for mFlow_evaNominal"
  parameter String tableName_mFlowConNominal="m_flow_con" "String identifier in sdf table for mFlow_conNominal"
  parameter Modelica.Units.SI.Power Q_flowTableNom=
      SDF.Functions.readDatasetDouble(
      fileref,
      dataset_QflowNom,
      "W") "Nominal heat flow in map. Doesn't need to be changed."
  parameter Real minCOP=0.1
    "Minimal possible COP value. Used to avoid division by zero error. Should never occur anyways if performance map is correctly created"
  Utilities.Logical.SmoothSwitch switchPel
    "If HP is off, no heat will be exchanged"
  Utilities.Logical.SmoothSwitch switchQCon
    "If HP is off, no heat will be exchanged"
  Modelica.Blocks.Sources.Constant constZero(final k=0)
  Modelica.Blocks.Sources.Constant       QScaling(k=scalingFactor)
    "Scaling for heat pump power "
  Modelica.Blocks.Math.Product product_scaling
    "Multiply nominal output power with scaling factor"
  SDF.NDTable Table_QCon(
    final readFromFile=true,
    final dataUnit="W",
    final scaleUnits={"-","K","K"},
    final nin=3,
    final interpMethod=interpMethod,
    final extrapMethod=extrapMethod,
    final filename=fileref,
    final dataset=dataset_QCon) "nD table with performance map of heat pump"
  SDF.NDTable Table_COP(
    final readFromFile=true,
    final dataUnit="-",
    final scaleUnits={"-","K","K"},
    final nin=3,
    final interpMethod=interpMethod,
    final extrapMethod=extrapMethod,
    final filename=fileref,
    final dataset=dataset_COP) "nD table with performance map of heat pump"
  Modelica.Blocks.Routing.Multiplex3 multiplex3_1
  Modelica.Blocks.Math.Division divisionPel "Divide QCon by COP to obtain Pel"
  Modelica.Blocks.Math.Max max
    "Use max of lower COP value to avoid division by zero error"
  Modelica.Blocks.Sources.Constant const_minCOP(k=minCOP)
    "Minimal possible COP. Used to avoid division by zero error. Should never occur anyways if performance map is correctly created"

protected
  parameter String fileref = Modelica.Utilities.Files.loadResource(filename);
  parameter Modelica.Units.SI.MassFlowRate mFlow_evaNominal=
      SDF.Functions.readDatasetDouble(
      fileref,
      dataset_mFlowEvaNominal,
      "kg/s") "Nominal mass flow rate";

  parameter Modelica.Units.SI.MassFlowRate mFlow_conNominal=
      SDF.Functions.readDatasetDouble(
      fileref,
      dataset_mFlowConNominal,
      "kg/s") "Nominal mass flow rate";
  parameter String dataset_COP="/" + flowsheet + "/" + refrigerant + "/" +
      tableName_COP "Path within sdf file to COP dataset"
  parameter String dataset_QCon="/" + flowsheet + "/" + refrigerant + "/" +
      tableName_QCon "Path within sdf file to QCon dataset"
  parameter String dataset_QflowNom="/" + flowsheet + "/" + refrigerant + "/" +
      tableName_QConNominal;
  parameter String dataset_mFlowConNominal="/" + flowsheet + "/" + refrigerant + "/"
       + tableName_mFlowConNominal;
  parameter String dataset_mFlowEvaNominal="/" + flowsheet + "/" + refrigerant + "/"
       + tableName_mFlowEvaNominal;
equation
  connect(constZero.y,switchPel. u3)
  connect(switchPel.y, calcRedQCon.u2)
  connect(switchPel.y, Pel)
  connect(switchQCon.y, feedbackHeatFlowEvaporator.u1)
  connect(switchPel.y, feedbackHeatFlowEvaporator.u2)
  connect(constZero.y, switchQCon.u3)
  connect(multiplex3_1.y, Table_QCon.u)
  connect(multiplex3_1.y, Table_COP.u)
  connect(QScaling.y, product_scaling.u1)
  connect(Table_QCon.y, product_scaling.u2)
  connect(product_scaling.y, switchQCon.u1)
  connect(product_scaling.y, divisionPel.u1)
  connect(divisionPel.y, switchPel.u1)
  connect(divisionPel.u2, max.y)
  connect(max.u1, Table_COP.y)
  connect(const_minCOP.y, max.u2)
  connect(multiplex3_1.u1[1], sigBus.nSet)
  connect(multiplex3_1.u2[1],sigBus.TConInMea)
  connect(multiplex3_1.u3[1],sigBus.TEvaInMea)
  connect(switchPel.u2, sigBus.onOffMea)
  connect(switchQCon.u2, sigBus.onOffMea)
end VCLibMap;


within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData;
package BaseClasses "Package with partial classes of Performance Data"
end BaseClasses;


Model with a replaceable for different methods of data aggregation. Partial model for calculation of P_el, QCon and QEva based on the values in the
  sigBusHP.

within AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses;
partial model PartialPerformanceData
  "Model with a replaceable for different methods of data aggregation"
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;

  Modelica.Blocks.Interfaces.RealOutput Pel(final unit="W", final displayUnit="kW")
                                                      "Electrical Power consumed by HP"
  Modelica.Blocks.Interfaces.RealOutput QCon(final unit="W", final displayUnit="kW")
    "Heat flow rate through Condenser"
  AixLib.Obsolete.Year2024.Controls.Interfaces.VapourCompressionMachineControlBus sigBus
    "Bus-connector used in a heat pump"
  Modelica.Blocks.Interfaces.RealOutput QEva(final unit="W", final displayUnit="kW")
                                                                         "Heat flow rate through Evaporator"
  Modelica.Blocks.Math.Add calcRedQCon
    "Based on redcued heat flow to the evaporator, the heat flow to the condenser is also reduced"
  Modelica.Blocks.Math.Product proRedQEva
    "Based on the icing factor, the heat flow to the evaporator is reduced"
protected
  parameter Real scalingFactor=1 "Scaling factor of heat pump";
  Modelica.Blocks.Math.Feedback feedbackHeatFlowEvaporator
    "Calculates evaporator heat flow with total energy balance"
equation
  connect(proRedQEva.u1, sigBus.iceFacMea)
  connect(proRedQEva.y, QEva)
  connect(proRedQEva.y, calcRedQCon.u1)
  connect(calcRedQCon.y, QCon)
  connect(proRedQEva.u2, feedbackHeatFlowEvaporator.y)
end PartialPerformanceData;


within AixLib.Obsolete.Year2024.Fluid;
package BaseClasses "Package with base classes for AixLib.Obsolete.Year2024.Fluid"
  extends Modelica.Icons.BasesPackage;
end BaseClasses;


Blackbox model of refrigerant cycle of a vapour compression machine (heat pump or chiller). This black box model represents the refrigerant cycle of a vapour
  compression machine. Used in AixLib.Obsolete.Year2024.Fluid.HeatPumps.HeatPump and
  AixLib.Fluid.Chiller.Chiller, this model serves the simulation of a
  reversible vapour compression machine. Thus, data both of chillers
  and heat pumps can be used to calculate the three relevant values
  P_el, QCon and QEva. The mode of the machine is used to
  switch between the performance data of the chiller and the heat pump.

within AixLib.Obsolete.Year2024.Fluid.BaseClasses;
partial model PartialInnerCycle
  "Blackbox model of refrigerant cycle of a vapour compression machine (heat pump or chiller)"

  parameter Boolean use_rev=true "True if the vapour compression machine is reversible";
  parameter Real scalingFactor=1 "Scaling factor of vapour compression machine";

  AixLib.Obsolete.Year2024.Controls.Interfaces.VapourCompressionMachineControlBus
    sigBus
  Modelica.Blocks.Sources.Constant constZero(final k=0) if not use_rev
    "If no heating is used, the switches may still be connected"
  Modelica.Blocks.Interfaces.RealOutput QCon(unit="W", displayUnit="kW") "Heat Flow to condenser"
  Modelica.Blocks.Interfaces.RealOutput QEva(unit="W", displayUnit="kW") "Heat flow from evaporator"
  Utilities.Logical.SmoothSwitch switchQEva(
    u1(unit="W", displayUnit="kW"),
    u3(unit="W", displayUnit="kW"),
    y(unit="W", displayUnit="kW"))
    "If mode is false, Condenser becomes Evaporator and vice versa"
  Utilities.Logical.SmoothSwitch switchQCon(
    y(unit="W",displayUnit="kW"),
    u1(unit="W", displayUnit="kW"),
    u3(unit="W", displayUnit="kW"))
    "If mode is false, Condenser becomes Evaporator and vice versa"
  Modelica.Blocks.Interfaces.RealOutput Pel(unit="W", displayUnit="kW")
    "Electrical power consumed by compressor"

  AixLib.Utilities.Logical.SmoothSwitch switchPel(
    u1(unit="W", displayUnit="kW"),
    u3(unit="W", displayUnit="kW"),
    y(unit="W", displayUnit="kW"))
    "Whether to use cooling or heating power consumption"

equation
  assert(
    use_rev or (use_rev == false and sigBus.modeSet == true),
    "Can't turn to reversible operation mode on irreversible vapour compression machine",
    level=AssertionLevel.error);

  connect(switchQEva.y, QEva)
  connect(switchPel.y, Pel)
  connect(sigBus.modeSet, switchPel.u2)

  connect(switchQCon.y, QCon)
  connect(sigBus.modeSet, switchQEva.u2)
  connect(sigBus.modeSet, switchQCon.u2)
end PartialInnerCycle;


within AixLib.Obsolete.Year2024.Fluid.BaseClasses;
partial model PartialReversibleVapourCompressionMachine
  "Grey-box model for reversible heat pumps and chillers using a black-box to simulate the refrigeration cycle"
  extends AixLib.Fluid.Interfaces.PartialFourPortInterface(
    redeclare final package Medium1 = Medium_con,
    redeclare final package Medium2 = Medium_eva,
    final m1_flow_nominal=mFlow_conNominal_final,
    final m2_flow_nominal=mFlow_evaNominal_final,
    final allowFlowReversal1=allowFlowReversalCon,
    final allowFlowReversal2=allowFlowReversalEva,
    final m1_flow_small=1E-4*abs(mFlow_conNominal_final),
    final m2_flow_small=1E-4*abs(mFlow_evaNominal_final),
    final show_T=show_TPort);

//General
  replaceable package Medium_con =
    Modelica.Media.Interfaces.PartialMedium "Medium at sink side"
  replaceable package Medium_eva =
    Modelica.Media.Interfaces.PartialMedium "Medium at source side"
  replaceable AixLib.Obsolete.Year2024.Fluid.BaseClasses.PartialInnerCycle innerCycle constrainedby
    AixLib.Obsolete.Year2024.Fluid.BaseClasses.PartialInnerCycle  "Blackbox model of refrigerant cycle of a vapour compression machine"

  parameter Boolean use_rev=true "Is the vapour compression machine reversible?"
  parameter Boolean use_autoCalc=false
    "Enable automatic estimation of volumes and mass flows?"
  parameter Modelica.Units.SI.Power Q_useNominal=0
    "Nominal usable heat flow of the vapour compression machine (HP: Heating; Chiller: Cooling)"
  parameter Real scalingFactor=1 "Scaling-factor of vapour compression machine";
  parameter Boolean use_refIne=true
    "Consider the inertia of the refrigerant cycle"
  parameter Modelica.Units.SI.Frequency refIneFre_constant
    "Cut off frequency for inertia of refrigerant cycle"
  parameter Integer nthOrder=3 "Order of refrigerant cycle interia"
  parameter Boolean useBusConnectorOnly = false "Set true to use bus connector for modeSet, nSet and iceFac input"

//Condenser
  parameter Modelica.Units.SI.MassFlowRate mFlow_conNominal
    "Manual input of the nominal mass flow rate (if not automatically calculated)"
  parameter Modelica.Units.SI.Volume VCon
    "Manual input of the condenser volume (if not automatically calculated)"
  parameter Modelica.Units.SI.PressureDifference dpCon_nominal
    "Pressure drop at nominal mass flow rate"
  parameter Real deltaM_con=0.1
    "Fraction of nominal mass flow rate where transition to turbulent occurs"
  parameter Boolean use_conCap=true
    "If heat losses at capacitor side are considered or not"
  parameter Modelica.Units.SI.HeatCapacity CCon
    "Heat capacity of Condenser (= cp*m). If you want to neglace the dry mass of the condenser, you can set this value to zero"
  parameter Modelica.Units.SI.ThermalConductance GConOut=0
    "Constant parameter for heat transfer to the ambient. Represents a sum of thermal resistances such as conductance, insulation and natural convection. If you want to simulate a condenser with additional dry mass but without external heat losses, set the value to zero"
  parameter Modelica.Units.SI.ThermalConductance GConIns=0
    "Constant parameter for heat transfer to heat exchangers capacity. Represents a sum of thermal resistances such as forced convection and conduction inside of the capacity"
//Evaporator
  parameter Modelica.Units.SI.MassFlowRate mFlow_evaNominal
    "Manual input of the nominal mass flow rate (if not automatically calculated)"
  parameter Modelica.Units.SI.Volume VEva
    "Manual input of the evaporator volume (if not automatically calculated)"
  parameter Modelica.Units.SI.PressureDifference dpEva_nominal
    "Pressure drop at nominal mass flow rate"
  parameter Real deltaM_eva=0.1
    "Fraction of nominal mass flow rate where transition to turbulent occurs"
  parameter Boolean use_evaCap=true
    "If heat losses at capacitor side are considered or not"
  parameter Modelica.Units.SI.HeatCapacity CEva
    "Heat capacity of Evaporator (= cp*m). If you want to neglace the dry mass of the evaporator, you can set this value to zero"
  parameter Modelica.Units.SI.ThermalConductance GEvaOut=0
    "Constant parameter for heat transfer to the ambient. Represents a sum of thermal resistances such as conductance, insulation and natural convection. If you want to simulate a evaporator with additional dry mass but without external heat losses, set the value to zero"
  parameter Modelica.Units.SI.ThermalConductance GEvaIns=0
    "Constant parameter for heat transfer to heat exchangers capacity. Represents a sum of thermal resistances such as forced convection and conduction inside of the capacity"
//Assumptions
  parameter Modelica.Units.SI.Time tauSenT=1
    "Time constant at nominal flow rate (use tau=0 for steady-state sensor, but see user guide for potential problems)"
  parameter Boolean transferHeat=true
    "If true, temperature T converges towards TAmb when no flow"
  parameter Boolean allowFlowReversalEva=true
    "= false to simplify equations, assuming, but not enforcing, no flow reversal"
  parameter Boolean allowFlowReversalCon=true
    "= false to simplify equations, assuming, but not enforcing, no flow reversal"
  parameter Modelica.Units.SI.Time tauHeaTraEva=1200
    "Time constant for heat transfer in temperature sensors in evaporator, default 20 minutes"
  parameter Modelica.Units.SI.Temperature TAmbEva_nominal=273.15
    "Fixed ambient temperature for heat transfer of sensors at the evaporator side"
  parameter Modelica.Units.SI.Time tauHeaTraCon=1200
    "Time constant for heat transfer in temperature sensors in condenser, default 20 minutes"
  parameter Modelica.Units.SI.Temperature TAmbCon_nominal=291.15
    "Fixed ambient temperature for heat transfer of sensors at the condenser side"

//Initialization
  parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.InitialState
    "Type of initialization (InitialState and InitialOutput are identical)"
  parameter Modelica.Media.Interfaces.Types.AbsolutePressure pCon_start=
      Medium_con.p_default "Start value of pressure"
  parameter Modelica.Media.Interfaces.Types.Temperature TCon_start=Medium_con.T_default
    "Start value of temperature"
  parameter Modelica.Units.SI.Temperature TConCap_start=Medium_con.T_default
    "Initial temperature of heat capacity of condenser"
  parameter Modelica.Media.Interfaces.Types.MassFraction XCon_start[Medium_con.nX]=
     Medium_con.X_default "Start value of mass fractions m_i/m"
  parameter Modelica.Media.Interfaces.Types.AbsolutePressure pEva_start=
      Medium_eva.p_default "Start value of pressure"
  parameter Modelica.Media.Interfaces.Types.Temperature TEva_start=Medium_eva.T_default
    "Start value of temperature"
  parameter Modelica.Units.SI.Temperature TEvaCap_start=Medium_eva.T_default
    "Initial temperature of heat capacity at evaporator"
  parameter Modelica.Media.Interfaces.Types.MassFraction XEva_start[Medium_eva.nX]=
     Medium_eva.X_default "Start value of mass fractions m_i/m"
  parameter Real x_start[nthOrder]=zeros(nthOrder)
    "Initial or guess values of states"
  parameter Real yRefIne_start=0 "Initial or guess value of output (= state)"
//Dynamics
  parameter Modelica.Fluid.Types.Dynamics massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
    "Type of mass balance: dynamic (3 initialization options) or steady state (only affects fluid-models)"
  parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
    "Type of energy balance: dynamic (3 initialization options) or steady state (only affects fluid-models)"
//Advanced
  parameter Boolean machineType "=true if heat pump; =false if chiller"
  parameter Boolean show_TPort=false
    "= true, if actual temperature at port is computed"
  parameter Boolean from_dp=false
    "= true, use m_flow = f(dp) else dp = f(m_flow)"
  constant Boolean homotopyInitialization=false "= true, use homotopy method"
  parameter Boolean linearized=false
    "= true, use linear relation between m_flow and dp for any flow rate"

  AixLib.Obsolete.Year2024.Fluid.HeatExchangers.EvaporatorCondenserWithCapacity con(
    redeclare final package Medium = Medium_con,
    final allowFlowReversal=allowFlowReversalCon,
    final m_flow_small=1E-4*abs(mFlow_conNominal_final),
    final show_T=show_TPort,
    final deltaM=deltaM_con,
    final T_start=TCon_start,
    final p_start=pCon_start,
    final use_cap=use_conCap,
    final X_start=XCon_start,
    final from_dp=from_dp,
    final homotopyInitialization=homotopyInitialization,
    final energyDynamics=energyDynamics,
    final is_con=true,
    final V=VCon_final*scalingFactor,
    final C=CCon*scalingFactor,
    final TCap_start=TConCap_start,
    final GOut=GConOut*scalingFactor,
    final m_flow_nominal=mFlow_conNominal_final*scalingFactor,
    final dp_nominal=dpCon_nominal*scalingFactor,
    final GInn=GConIns*scalingFactor) "Heat exchanger model for the condenser"
  AixLib.Obsolete.Year2024.Fluid.HeatExchangers.EvaporatorCondenserWithCapacity eva(
    redeclare final package Medium = Medium_eva,
    final deltaM=deltaM_eva,
    final use_cap=use_evaCap,
    final allowFlowReversal=allowFlowReversalEva,
    final m_flow_small=1E-4*abs(mFlow_evaNominal_final),
    final show_T=show_TPort,
    final T_start=TEva_start,
    final p_start=pEva_start,
    final X_start=XEva_start,
    final from_dp=from_dp,
    final homotopyInitialization=homotopyInitialization,
    final energyDynamics=energyDynamics,
    final is_con=false,
    final V=VEva_final*scalingFactor,
    final C=CEva*scalingFactor,
    final m_flow_nominal=mFlow_evaNominal_final*scalingFactor,
    final dp_nominal=dpEva_nominal*scalingFactor,
    final TCap_start=TEvaCap_start,
    final GOut=GEvaOut*scalingFactor,
    final GInn=GEvaIns*scalingFactor) "Heat exchanger model for the evaporator"
  Modelica.Blocks.Continuous.CriticalDamping heatFlowIneEva(
    final initType=initType,
    final normalized=true,
    final n=nthOrder,
    final f=refIneFre_constant,
    final x_start=x_start,
    final y_start=yRefIne_start)
                                if use_refIne
    "This n-th order block represents the inertia of the refrigerant cycle and delays the heat flow"
  Modelica.Blocks.Routing.RealPassThrough realPassThroughnSetCon
                                                              if not use_refIne
    "Use default nSet value"
  Modelica.Blocks.Continuous.CriticalDamping heatFlowIneCon(
    final initType=initType,
    final normalized=true,
    final n=nthOrder,
    final f=refIneFre_constant,
    final x_start=x_start,
    final y_start=yRefIne_start)
                                if use_refIne
    "This n-th order block represents the inertia of the refrigerant cycle and delays the heat flow"
  Modelica.Blocks.Routing.RealPassThrough realPassThroughnSetEva if not use_refIne
    "Use default nSet value"
  Modelica.Blocks.Interfaces.RealInput iceFac_in if not useBusConnectorOnly
    "Input signal for icing factor"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature varTempOutEva
 if use_evaCap "Foreces heat losses according to ambient temperature"
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature varTempOutCon
 if use_conCap "Foreces heat losses according to ambient temperature"

  Modelica.Blocks.Interfaces.RealInput nSet if not useBusConnectorOnly
    "Input signal speed for compressor relative between 0 and 1"
  AixLib.Obsolete.Year2024.Controls.Interfaces.VapourCompressionMachineControlBus sigBus

  Modelica.Blocks.Interfaces.RealInput T_amb_eva(final unit="K", final
      displayUnit="degC") if use_evaCap and not useBusConnectorOnly
    "Ambient temperature on the evaporator side"
  Modelica.Blocks.Interfaces.RealInput T_amb_con(final unit="K", final
      displayUnit="degC") if use_conCap and not useBusConnectorOnly
    "Ambient temperature on the condenser side"

  Modelica.Blocks.Interfaces.BooleanInput modeSet if not useBusConnectorOnly
     and use_rev
    "Set value of operation mode"

  AixLib.Fluid.Sensors.TemperatureTwoPort senT_a2(
    redeclare final package Medium = Medium_eva,
    final allowFlowReversal=allowFlowReversalEva,
    final m_flow_small=1E-4*mFlow_evaNominal_final,
    final initType=initType,
    final T_start=TEva_start,
    final transferHeat=transferHeat,
    final TAmb=TAmbEva_nominal,
    final tauHeaTra=tauHeaTraEva,
    final tau=tauSenT,
    final m_flow_nominal=mFlow_evaNominal_final*scalingFactor)
    "Temperature at sink inlet"
  AixLib.Fluid.Sensors.TemperatureTwoPort senT_b2(
    redeclare final package Medium = Medium_eva,
    final allowFlowReversal=allowFlowReversalEva,
    final m_flow_small=1E-4*mFlow_evaNominal_final,
    final initType=initType,
    final T_start=TEva_start,
    final transferHeat=transferHeat,
    final TAmb=TAmbEva_nominal,
    final tauHeaTra=tauHeaTraEva,
    final tau=tauSenT,
    final m_flow_nominal=mFlow_evaNominal_final*scalingFactor)
    "Temperature at sink outlet"
  AixLib.Fluid.Sensors.MassFlowRate mFlow_eva(redeclare final package Medium = Medium_eva,
      final allowFlowReversal=allowFlowReversalEva)
    "Mass flow sensor at the evaporator"
  AixLib.Fluid.Sensors.TemperatureTwoPort senT_b1(
    final initType=initType,
    final transferHeat=transferHeat,
    final TAmb=TAmbCon_nominal,
    redeclare final package Medium = Medium_con,
    final allowFlowReversal=allowFlowReversalCon,
    final m_flow_small=1E-4*mFlow_conNominal_final,
    final T_start=TCon_start,
    final tau=tauSenT,
    final tauHeaTra=tauHeaTraCon,
    final m_flow_nominal=mFlow_conNominal_final*scalingFactor)
    "Temperature at sink outlet"
  AixLib.Fluid.Sensors.TemperatureTwoPort senT_a1(
    final initType=initType,
    final transferHeat=transferHeat,
    redeclare final package Medium = Medium_con,
    final allowFlowReversal=allowFlowReversalCon,
    final m_flow_small=1E-4*mFlow_conNominal_final,
    final T_start=TCon_start,
    final TAmb=TAmbCon_nominal,
    final tau=tauSenT,
    final m_flow_nominal=mFlow_conNominal_final*scalingFactor,
    final tauHeaTra=tauHeaTraCon) "Temperature at sink inlet"
  AixLib.Fluid.Sensors.MassFlowRate mFlow_con(final allowFlowReversal=allowFlowReversalEva,
      redeclare final package Medium = Medium_con)
    "Mass flow sensor at the evaporator"

  //Automatic calculation of mass flow rates and volumes of the evaporator and condenser using linear regressions from data sheets of heat pumps and chillers (water to water)

  Modelica.Blocks.Logical.GreaterThreshold greaterThreshold(final threshold=
        Modelica.Constants.eps)
    "Use default nSet value"
protected
  parameter Modelica.Units.SI.MassFlowRate autoCalc_mFlow_min=0.3
    "Realistic mass flow minimum for simulation plausibility";
  parameter Modelica.Units.SI.Volume autoCalc_Vmin=0.003
    "Realistic volume minimum for simulation plausibility";

  parameter Modelica.Units.SI.MassFlowRate autoCalc_mFlow_eva=if machineType
       then max(0.00004*Q_useNominal - 0.3177, autoCalc_mFlow_min) else max(
      0.00005*Q_useNominal - 0.5662, autoCalc_mFlow_min);
  parameter Modelica.Units.SI.MassFlowRate autoCalc_mFlow_con=if machineType
       then max(0.00004*Q_useNominal - 0.6162, autoCalc_mFlow_min) else max(
      0.00005*Q_useNominal + 0.3161, autoCalc_mFlow_min);
  parameter Modelica.Units.SI.MassFlowRate mFlow_evaNominal_final=if
      use_autoCalc then autoCalc_mFlow_eva else mFlow_evaNominal;
  parameter Modelica.Units.SI.MassFlowRate mFlow_conNominal_final=if
      use_autoCalc then autoCalc_mFlow_con else mFlow_conNominal;
  parameter Modelica.Units.SI.Volume autoCalc_VEva=if machineType then max(
      0.0000001*Q_useNominal - 0.0075, autoCalc_Vmin) else max(0.0000001*
      Q_useNominal - 0.0066, autoCalc_Vmin);
  parameter Modelica.Units.SI.Volume autoCalc_VCon=if machineType then max(
      0.0000001*Q_useNominal - 0.0094, autoCalc_Vmin) else max(0.0000002*
      Q_useNominal - 0.0084, autoCalc_Vmin);
  parameter Modelica.Units.SI.Volume VEva_final=if use_autoCalc then
      autoCalc_VEva else VEva;
  parameter Modelica.Units.SI.Volume VCon_final=if use_autoCalc then
      autoCalc_VCon else VCon;
  Modelica.Blocks.Sources.BooleanConstant modeSetTrue(k=true)
    if not useBusConnectorOnly and not use_rev "Used if use_rev=false)";

equation
  //Control and feedback for the auto-calculation of condenser and evaporator data
  assert(not use_autoCalc or (use_autoCalc and Q_useNominal>0), "Can't auto-calculate evaporator and condenser data without a given nominal power flow (Q_useNominal)!",
  level = AssertionLevel.error);
  assert(not use_autoCalc or (autoCalc_mFlow_eva>autoCalc_mFlow_min and autoCalc_mFlow_eva<90),
  "Given nominal power (Q_useNominal) for auto-calculation of evaporator and condenser data is outside the range of data sheets considered. Please control the auto-calculated mass flows!",
  level = AssertionLevel.warning);
  assert(not use_autoCalc or (autoCalc_VEva>autoCalc_Vmin and autoCalc_VEva<0.43),
  "Given nominal power (Q_useNominal) for auto-calculation of evaporator and condenser data is outside the range of data sheets considered. Please control the auto-calculated volumes!",
  level = AssertionLevel.warning);

  connect(senT_a1.T, sigBus.TConInMea)
  connect(senT_b1.T, sigBus.TConOutMea)
  connect(senT_a2.T, sigBus.TEvaInMea)
  connect(senT_b2.T, sigBus.TEvaOutMea)
  connect(mFlow_eva.m_flow, sigBus.m_flowEvaMea)
  connect(mFlow_con.m_flow, sigBus.m_flowConMea)

  connect(innerCycle.QEva, realPassThroughnSetEva.u)
  connect(innerCycle.QEva, heatFlowIneEva.u)
  connect(innerCycle.QCon, heatFlowIneCon.u)
  connect(innerCycle.QCon, realPassThroughnSetCon.u)
  connect(innerCycle.sigBus, sigBus)
  connect(innerCycle.Pel, sigBus.PelMea)
  connect(modeSetTrue.y, sigBus.modeSet);
  connect(modeSet, sigBus.modeSet)
  connect(nSet,sigBus.nSet)
  connect(iceFac_in, sigBus.iceFacMea)
  connect(T_amb_con, varTempOutCon.T)
  connect(varTempOutCon.port, con.port_out)
  connect(T_amb_eva, varTempOutEva.T)
  connect(eva.port_out, varTempOutEva.port)
  connect(port_b2, port_b2)
  connect(realPassThroughnSetCon.y, con.QFlow_in)
  connect(heatFlowIneCon.y, con.QFlow_in)
  connect(realPassThroughnSetEva.y, eva.QFlow_in)
  connect(heatFlowIneEva.y, eva.QFlow_in)
  connect(senT_a2.port_b, eva.port_a)
  connect(senT_b2.port_a, eva.port_b)
  connect(senT_b2.port_b, port_b2)
  connect(mFlow_eva.port_a, port_a2)
  connect(mFlow_eva.port_b, senT_a2.port_a)
  connect(con.port_a, senT_a1.port_b)
  connect(senT_a1.port_a, mFlow_con.port_b)
  connect(port_a1, mFlow_con.port_a)
  connect(con.port_b, senT_b1.port_a)
  connect(port_b1, senT_b1.port_b)
  connect(greaterThreshold.y, sigBus.onOffMea)
  connect(varTempOutCon.T, sigBus.TConAmbMea)
  connect(varTempOutEva.T, sigBus.TEvaAmbMea)
  connect(greaterThreshold.u, sigBus.nSet)
end PartialReversibleVapourCompressionMachine;


Grey-box model for reversible chillers using a black-box to simulate the refrigeration cycle.

within AixLib.Obsolete.Year2024.Fluid.Chillers;
model Chiller
  "Grey-box model for reversible chillers using a black-box to simulate the refrigeration cycle"
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;
  extends AixLib.Obsolete.Year2024.Fluid.BaseClasses.PartialReversibleVapourCompressionMachine(
  use_rev=true,
  final machineType = false,
  redeclare AixLib.Obsolete.Year2024.Fluid.Chillers.BaseClasses.InnerCycle_Chiller innerCycle(
      final use_rev=use_rev,
      final scalingFactor=scalingFactor,
      redeclare model PerDataMainChi = PerDataMainChi,
      redeclare model PerDataRevChi = PerDataRevChi));

  replaceable model PerDataMainChi =
      AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData
  "Performance data of a chiller in main operation mode"
  replaceable model PerDataRevChi =
      AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData
  "Performance data of a chiller in reversible operation mode"
end Chiller;


fixme: add brief description

within AixLib.Obsolete.Year2024.Fluid;
package Chillers "fixme: add brief description"
  extends Modelica.Icons.Package;
end Chillers;


Blackbox model of refrigerant cycle of a chiller. This black box model represents the refrigerant cycle of a chiller.
  Used in AixLib.Obsolete.Year2024.Fluid.Chillers.Chiller, this model serves the
  simulation of a reversible chiller. Thus, data both of chillers and
  heat pumps can be used to calculate the three relevant values
  P_el, QCon and QEva. The mode of the chiller is used to
  switch between the performance data of the chiller and the heat pump.

within AixLib.Obsolete.Year2024.Fluid.Chillers.BaseClasses;
model InnerCycle_Chiller "Blackbox model of refrigerant cycle of a chiller"
  extends AixLib.Obsolete.Year2024.Fluid.BaseClasses.PartialInnerCycle;
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;

  replaceable model PerDataMainChi =
      AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData
    constrainedby AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData(
     final scalingFactor = scalingFactor)
    "Replaceable model for performance data of a chiller in main operation mode"

  replaceable model PerDataRevChi =
      AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData
    constrainedby AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData(
     final scalingFactor = scalingFactor)
    "Replaceable model for performance data of a chiller in reversible operation mode"

  PerDataMainChi PerformanceDataChillerCooling
  PerDataRevChi PerformanceDataChillerHeating if use_rev

  Modelica.Blocks.Math.Gain gainEva(final k=-1)
    "Negate QEva to match definition of heat flow direction"
  Modelica.Blocks.Math.Gain gainCon(final k=-1) if use_rev
    "Negate QCon to match definition of heat flow direction"
equation

  connect(PerformanceDataChillerCooling.Pel, switchPel.u1)
  connect(PerformanceDataChillerHeating.Pel, switchPel.u3)
  connect(constZero.y, switchPel.u3)
  connect(constZero.y, switchQEva.u3)
  connect(constZero.y, switchQCon.u3)
  connect(sigBus, PerformanceDataChillerHeating.sigBus)
  connect(sigBus, PerformanceDataChillerCooling.sigBus)

  connect(PerformanceDataChillerCooling.QEva, gainEva.u)
  connect(gainEva.y, switchQEva.u1)
  connect(PerformanceDataChillerHeating.QEva, switchQEva.u3)
  connect(PerformanceDataChillerHeating.QCon, gainCon.u)
  connect(gainCon.y, switchQCon.u3)
  connect(PerformanceDataChillerCooling.QCon, switchQCon.u1)
end InnerCycle_Chiller;


within AixLib.Obsolete.Year2024.Fluid.Chillers;
package BaseClasses "Package with base classes for AixLib.Obsolete.Year2024.Fluid.Chillers"
  extends Modelica.Icons.BasesPackage;
end BaseClasses;


within AixLib.Obsolete.Year2024.Fluid.Chillers.Examples;
model Chiller "Example for the reversible chiller model."
 extends Modelica.Icons.Example;
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;

  replaceable package Medium_sin = AixLib.Media.Water
    constrainedby Modelica.Media.Interfaces.PartialMedium
  replaceable package Medium_sou = AixLib.Media.Water
    constrainedby Modelica.Media.Interfaces.PartialMedium
  AixLib.Fluid.Sources.MassFlowSource_T sinkSideMassFlowSource(
    use_T_in=true,
    m_flow=1,
    redeclare package Medium = Medium_sin,
    T=275.15,
    nPorts=1) "Ideal mass flow source at the inlet of the sink side"

  AixLib.Fluid.Sources.Boundary_pT                sinkSideFixedBoundary(          redeclare
      package                                                                          Medium =
                       Medium_sin, nPorts=1)
    "Fixed boundary at the outlet of the sink side"
  Modelica.Blocks.Sources.Ramp TsuSinkRamp(
    duration=500,
    startTime=500,
    height=25,
    offset=278)
    "Ramp signal for the temperature input of the sink side's ideal mass flow source"
  AixLib.Obsolete.Year2024.Fluid.Chillers.Chiller chiller(
    refIneFre_constant=1,
    CEva=100,
    GEvaOut=5,
    CCon=100,
    GConOut=5,
    dpEva_nominal=0,
    dpCon_nominal=0,
    mFlow_conNominal=0.5,
    mFlow_evaNominal=0.5,
    use_conCap=false,
    use_evaCap=false,
    redeclare package Medium_con = Medium_sin,
    redeclare package Medium_eva = Medium_sou,
    use_refIne=false,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare model PerDataMainChi =
        AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.LookUpTable2D
        ( dataTable=
            AixLib.Obsolete.Year2024.DataBase.Chiller.EN14511.Vitocal200AWO201()),
    redeclare model PerDataRevChi =
        AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.LookUpTable2D
        (smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments, dataTable=
            AixLib.Obsolete.Year2024.DataBase.HeatPump.EN14511.Vitocal200AWO201()),
    use_rev=true,
    use_autoCalc=false,
    VEva=0.4,
    VCon=0.04,
    TAmbEva_nominal=288.15,
    TAmbCon_nominal=273.15,
    TEva_start=303.15)

  AixLib.Fluid.Sensors.TemperatureTwoPort senTAct(
    final m_flow_nominal=chiller.m2_flow_nominal,
    final tau=1,
    final initType=Modelica.Blocks.Types.Init.InitialState,
    final tauHeaTra=1200,
    final allowFlowReversal=chiller.allowFlowReversalCon,
    final transferHeat=false,
    redeclare final package Medium = Medium_sou,
    T_start=303.15,
    final TAmb=291.15) "Temperature at source outlet"
  Modelica.Blocks.Sources.Sine sine(
    f=1/3600,
    amplitude=500,
    offset=500,
    phase=3.1415926535898)
  AixLib.Fluid.Movers.SpeedControlled_y                                   pumSou(
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    redeclare final AixLib.Fluid.Movers.Data.Pumps.Wilo.Stratos25slash1to8 per,
    final allowFlowReversal=true,
    final addPowerToMedium=false,
    redeclare final package Medium = Medium_sou)
    "Fan or pump at source side of HP"

  AixLib.Fluid.MixingVolumes.MixingVolume Room(
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    nPorts=2,
    final use_C_flow=false,
    final m_flow_nominal=chiller.m2_flow_nominal,
    final V=5,
    final allowFlowReversal=true,
    redeclare package Medium = Medium_sou) "Volume of Condenser"

  Modelica.Blocks.Sources.Constant nIn(k=100/3040)
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow heatFlowRateEva
    "Heat flow rate of the evaporator"
  Modelica.Blocks.Math.Gain gain(k=1)
  AixLib.Fluid.Sources.Boundary_pT                sourceSideFixedBoundary(nPorts=1,
      redeclare package Medium = Medium_sou)
    "Fixed boundary at the outlet of the source side"
  Modelica.Blocks.Sources.Constant iceFac(final k=1)
    "Fixed value for icing factor. 1 means no icing/frosting (full heat transfer in heat exchanger)"
  Modelica.Blocks.Math.BooleanToReal booleanToReal
  Modelica.Blocks.Logical.Hysteresis hysCooling(
    pre_y_start=false,
    uHigh=273.15 + 17,
    uLow=273.15 + 14)
  Modelica.Blocks.Sources.BooleanStep     booleanStep(
      startValue=true, startTime=1800)
  Modelica.Blocks.Logical.Not not2 "Negate output of hysteresis"
  Modelica.Blocks.Logical.Hysteresis hysHeating(
    pre_y_start=true,
    uLow=273.15 + 25,
    uHigh=273.15 + 30)
  Modelica.Blocks.Logical.LogicalSwitch logicalSwitch
equation

  connect(Room.heatPort,heatFlowRateEva. port)
  connect(sine.y, gain.u)
  connect(heatFlowRateEva.Q_flow, gain.y)
  connect(Room.ports[1], pumSou.port_a)
  connect(senTAct.port_b, sourceSideFixedBoundary.ports[1])
  connect(senTAct.port_b, Room.ports[2])
  connect(chiller.nSet, booleanToReal.y)
          connect(sinkSideMassFlowSource.ports[1], chiller.port_a1)
  connect(sinkSideFixedBoundary.ports[1], chiller.port_b1)
  connect(pumSou.port_b, chiller.port_a2)
  connect(chiller.port_b2, senTAct.port_a)
  connect(chiller.iceFac_in, iceFac.y)
  connect(TsuSinkRamp.y, sinkSideMassFlowSource.T_in)
  connect(hysHeating.y, not2.u)
  connect(senTAct.T, hysHeating.u)
  connect(hysCooling.u, senTAct.T)
  connect(booleanStep.y, chiller.modeSet)
  connect(logicalSwitch.y, booleanToReal.u)
  connect(not2.y, logicalSwitch.u3)
  connect(hysCooling.y, logicalSwitch.u1)
  connect(booleanStep.y, logicalSwitch.u2)
  connect(nIn.y, pumSou.y)
end Chiller;


within AixLib.Obsolete.Year2024.Fluid.Chillers;
package Examples "Collection of models that illustrate model use and test models"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


Type of heat exchanger.

within AixLib.Obsolete.Year2024.Fluid.HeatExchangers;
model EvaporatorCondenserWithCapacity
  extends AixLib.Fluid.Interfaces.TwoPortHeatMassExchanger(
    redeclare final AixLib.Fluid.MixingVolumes.MixingVolume vol(
    final prescribedHeatFlowRate=true,
    final V=V),
    final tau=30);

  parameter Boolean is_con "Type of heat exchanger"
  parameter Modelica.Units.SI.Volume V "Volume in condenser";
  parameter Boolean use_cap=true "False if capacity and heat losses are neglected"
  parameter Modelica.Units.SI.HeatCapacity C
    "Capacity of heat exchanger. If you want to neglace the dry mass of the heat exchanger, you can set this value to zero"
  parameter Modelica.Units.SI.Temperature TCap_start=Medium.T_default
    "Initial temperature of heat capacity"
  Modelica.Units.SI.ThermalConductance GOut
    "Formular for calculation of heat transfer coefficient on the outside. If you want to simulate a heat exchanger with additional dry mass but without external heat losses, set the value to zero"
  Modelica.Blocks.Interfaces.RealOutput GInn
    "Formular for calculation of heat transfer coefficient on the inside"
  Modelica.Thermal.HeatTransfer.Components.Convection conIns if use_cap
    "Convection between fluid and solid"
  Modelica.Thermal.HeatTransfer.Components.Convection conOut if use_cap
    "Convection and conduction between solid and ambient air"
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCap(
    final C=C,
    final T(
      final fixed=(energyDynamics == Modelica.Fluid.Types.Dynamics.FixedInitial),
      final start=TCap_start),
    final der_T(final fixed=(energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyStateInitial),
        start=0)) if use_cap "Heat Capacity"
  Modelica.Blocks.Sources.RealExpression heatLossIns(final y=GInn) if use_cap
    "Nominal heat loss coefficient to the inside"
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_out if use_cap
    "Temperature and heat flow to the ambient"
  Modelica.Blocks.Sources.RealExpression heatLossOut(final y=GOut) if use_cap
    "Nominal heat loss coefficient to the inside"

  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea(final alpha=0,
      final T_ref=293.15) "Heat flow rate of the condenser"
  Modelica.Blocks.Interfaces.RealInput QFlow_in "Heat flow rate to the medium"

equation
  connect(conIns.fluid, heatCap.port)
  connect(heatCap.port, conOut.solid)
  connect(conIns.Gc, heatLossIns.y)
  connect(conOut.fluid, port_out)
  connect(conOut.Gc, heatLossOut.y)
  connect(vol.heatPort, conIns.solid)
  connect(vol.heatPort, preHea.port)
  connect(preHea.Q_flow, QFlow_in)
end EvaporatorCondenserWithCapacity;


fixme: add brief description

within AixLib.Obsolete.Year2024.Fluid;
package HeatExchangers "fixme: add brief description"
  extends Modelica.Icons.Package;
end HeatExchangers;


Grey-box model for reversible heat pumps using a black-box to simulate the refrigeration cycle.

within AixLib.Obsolete.Year2024.Fluid.HeatPumps;
model HeatPump
  "Grey-box model for reversible heat pumps using a black-box to simulate the refrigeration cycle"
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;
  extends AixLib.Obsolete.Year2024.Fluid.BaseClasses.PartialReversibleVapourCompressionMachine(
  use_rev=true,
  final machineType = true,
  redeclare AixLib.Obsolete.Year2024.Fluid.HeatPumps.BaseClasses.InnerCycle_HeatPump innerCycle(
      final use_rev=use_rev,
      final scalingFactor=scalingFactor,
      redeclare model PerDataMainHP = PerDataMainHP,
      redeclare model PerDataRevHP = PerDataRevHP));

  replaceable model PerDataMainHP =
      AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData
  "Performance data of a heat pump in main operation mode"
  replaceable model PerDataRevHP =
      AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData
  "Performance data of a heat pump in reversible operation mode"
end HeatPump;


fixme: add brief description

within AixLib.Obsolete.Year2024.Fluid;
package HeatPumps "fixme: add brief description"
  extends Modelica.Icons.Package;
end HeatPumps;


Blackbox model of refrigerant cycle of a heat pump. This black box model represents the refrigerant cycle of a heat pump.
  Used in AixLib.Obsolete.Year2024.Fluid.HeatPumps.HeatPump, this model serves the
  simulation of a reversible heat pump. Thus, data both of chillers and
  heat pumps can be used to calculate the three relevant values
  P_el, QCon and QEva. The mode of the heat pump is used to
  switch between the performance data of the chiller and the heat pump.

within AixLib.Obsolete.Year2024.Fluid.HeatPumps.BaseClasses;
model InnerCycle_HeatPump
  "Blackbox model of refrigerant cycle of a heat pump"
  extends AixLib.Obsolete.Year2024.Fluid.BaseClasses.PartialInnerCycle;
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;

  replaceable model PerDataMainHP =
      AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData
    constrainedby AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData(
     final scalingFactor = scalingFactor)
    "Replaceable model for performance data of a heat pump in main operation mode"

  replaceable model PerDataRevHP =
      AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData
    constrainedby AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData(
     final scalingFactor = scalingFactor)
    "Replaceable model for performance data of a heat pump in reversible operation mode"

  PerDataMainHP PerformanceDataHPHeating
  PerDataRevHP PerformanceDataHPCooling if use_rev
  Modelica.Blocks.Math.Gain gainEva(final k=-1)
    "Negate QEva to match definition of heat flow direction"
  Modelica.Blocks.Math.Gain gainCon(final k=-1) if use_rev
    "Negate QCon to match definition of heat flow direction"

equation

  connect(PerformanceDataHPHeating.QCon, switchQCon.u1)
  connect(PerformanceDataHPHeating.Pel, switchPel.u1)
  connect(PerformanceDataHPCooling.Pel, switchPel.u3)
  connect(PerformanceDataHPCooling.QEva, switchQEva.u3)
  connect(constZero.y, switchPel.u3)
  connect(constZero.y, switchQEva.u3)
  connect(constZero.y, switchQCon.u3)
  connect(gainEva.y, switchQEva.u1)
  connect(switchQCon.u3, gainCon.y)
  connect(PerformanceDataHPCooling.QCon, gainCon.u)
  connect(PerformanceDataHPHeating.QEva, gainEva.u)
  connect(sigBus, PerformanceDataHPCooling.sigBus)
  connect(sigBus, PerformanceDataHPHeating.sigBus)
end InnerCycle_HeatPump;


within AixLib.Obsolete.Year2024.Fluid.HeatPumps;
package BaseClasses "Package with base classes for AixLib.Obsolete.Year2024.Fluid.HeatPumps"
  extends Modelica.Icons.BasesPackage;
end BaseClasses;


within AixLib.Obsolete.Year2024.Fluid.HeatPumps.Examples;
model HeatPump "Example for the reversible heat pump model."
 extends Modelica.Icons.Example;
  extends AixLib.Obsolete.BaseClasses.ObsoleteModel;

  replaceable package Medium_sin = AixLib.Media.Water
    constrainedby Modelica.Media.Interfaces.PartialMedium
  replaceable package Medium_sou = AixLib.Media.Water
    constrainedby Modelica.Media.Interfaces.PartialMedium
  AixLib.Fluid.Sources.MassFlowSource_T                sourceSideMassFlowSource(
    use_T_in=true,
    m_flow=1,
    nPorts=1,
    redeclare package Medium = Medium_sou,
    T=275.15) "Ideal mass flow source at the inlet of the source side"

  AixLib.Fluid.Sources.Boundary_pT                  sourceSideFixedBoundary(
                                                                         nPorts=
       1, redeclare package Medium = Medium_sou)
          "Fixed boundary at the outlet of the source side"
  Modelica.Blocks.Sources.Ramp TsuSourceRamp(
    duration=500,
    startTime=500,
    height=25,
    offset=278)
    "Ramp signal for the temperature input of the source side's ideal mass flow source"
  Modelica.Blocks.Sources.Constant T_amb_internal(k=291.15)
  AixLib.Obsolete.Year2024.Fluid.HeatPumps.HeatPump heatPump(
    refIneFre_constant=1,
    useBusConnectorOnly=true,
    CEva=100,
    GEvaOut=5,
    CCon=100,
    GConOut=5,
    dpEva_nominal=0,
    dpCon_nominal=0,
    VCon=0.4,
    use_conCap=false,
    redeclare package Medium_con = Medium_sin,
    redeclare package Medium_eva = Medium_sou,
    use_refIne=false,
    use_rev=true,
    redeclare model PerDataMainHP =
        AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.LookUpTable2D
        (dataTable=
            AixLib.Obsolete.Year2024.DataBase.HeatPump.EN14511.Vitocal200AWO201()),
    redeclare model PerDataRevHP =
        AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.LookUpTable2D
        ( smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments, dataTable=
           AixLib.Obsolete.Year2024.DataBase.Chiller.EN14511.Vitocal200AWO201()),
    VEva=0.04,
    use_evaCap=false,
    scalingFactor=1,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    mFlow_conNominal=0.5,
    mFlow_evaNominal=0.5,
    use_autoCalc=false,
    TAmbEva_nominal=273.15,
    TAmbCon_nominal=288.15,
    TCon_start=303.15)

  Modelica.Blocks.Sources.BooleanStep     booleanStep(startTime=1800,
      startValue=true)

  AixLib.Fluid.Sensors.TemperatureTwoPort senTAct(
    final m_flow_nominal=heatPump.m1_flow_nominal,
    final tau=1,
    final initType=Modelica.Blocks.Types.Init.InitialState,
    final tauHeaTra=1200,
    final allowFlowReversal=heatPump.allowFlowReversalCon,
    final transferHeat=false,
    redeclare final package Medium = Medium_sin,
    final T_start=303.15,
    final TAmb=291.15) "Temperature at sink inlet"
  Modelica.Blocks.Logical.Hysteresis hysHeating(
    pre_y_start=true,
    uLow=273.15 + 30,
    uHigh=273.15 + 35)
  Modelica.Blocks.Math.BooleanToReal booleanToReal
  Modelica.Blocks.Sources.Sine sine(
    f=1/3600,
    amplitude=3000,
    offset=3000)
  AixLib.Fluid.Movers.SpeedControlled_y                                   pumSou(
    redeclare final AixLib.Fluid.Movers.Data.Pumps.Wilo.Stratos25slash1to8 per,
    final allowFlowReversal=true,
    final addPowerToMedium=false,
    redeclare final package Medium = Medium_sin,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Fan or pump at source side of HP"

  AixLib.Fluid.MixingVolumes.MixingVolume Room(
    nPorts=2,
    final use_C_flow=false,
    final m_flow_nominal=heatPump.m1_flow_nominal,
    final V=5,
    final allowFlowReversal=true,
    redeclare package Medium = Medium_sin,
    energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
    "Volume of Condenser"

  Modelica.Blocks.Sources.Constant nIn(k=100/3040)
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow heatFlowRateCon
    "Heat flow rate of the condenser"
  Modelica.Blocks.Math.Gain gain(k=-1)
  Modelica.Blocks.Logical.Not not2 "Negate output of hysteresis"
  AixLib.Fluid.Sources.Boundary_pT   sinkSideFixedBoundary(      nPorts=1,
      redeclare package Medium = Medium_sin)
    "Fixed boundary at the outlet of the sink side"
  Modelica.Blocks.Sources.Constant iceFac(final k=1)
    "Fixed value for icing factor. 1 means no icing/frosting (full heat transfer in heat exchanger)"
  Modelica.Blocks.Logical.LogicalSwitch logicalSwitch
  Modelica.Blocks.Logical.Hysteresis hysCooling(
    pre_y_start=false,
    uLow=273.15 + 15,
    uHigh=273.15 + 19)
  Controls.Interfaces.VapourCompressionMachineControlBus sigBus1
equation

  connect(sourceSideMassFlowSource.ports[1], heatPump.port_a2)
  connect(Room.heatPort, heatFlowRateCon.port)
  connect(sine.y, gain.u)
  connect(heatFlowRateCon.Q_flow, gain.y)
  connect(heatPump.port_b2, sourceSideFixedBoundary.ports[1])
  connect(heatPump.port_b1, senTAct.port_a)
  connect(Room.ports[1], pumSou.port_a)
  connect(pumSou.port_b, heatPump.port_a1)
  connect(senTAct.T, hysHeating.u)
  connect(hysHeating.y, not2.u)
  connect(senTAct.port_b, sinkSideFixedBoundary.ports[1])
  connect(senTAct.port_b, Room.ports[2])
  connect(TsuSourceRamp.y, sourceSideMassFlowSource.T_in)
  connect(logicalSwitch.u1, not2.y)
  connect(hysCooling.y, logicalSwitch.u3)
  connect(senTAct.T, hysCooling.u)
  connect(booleanStep.y, logicalSwitch.u2)
  connect(logicalSwitch.y, booleanToReal.u)
  connect(booleanStep.y, sigBus1.modeSet)
  connect(iceFac.y, sigBus1.iceFacMea)
  connect(booleanToReal.y, sigBus1.nSet)
  connect(sigBus1, heatPump.sigBus)
  connect(pumSou.y, nIn.y)
end HeatPump;


within AixLib.Obsolete.Year2024.Fluid.HeatPumps;
package Examples "Collection of models that illustrate model use and test models"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


Fan or pump with ideally controlled speed Nrpm as input signal. This model describes a fan or pump with prescribed speed in revolutions per minute.
 The head is computed based on the performance curve that take as an argument
 the actual volume flow rate divided by the maximum flow rate and the relative
 speed of the fan.
 The efficiency of the device is computed based
 on the efficiency curves that take as an argument
 the actual volume flow rate divided by the maximum possible volume flow rate, or
 based on the motor performance curves.

within AixLib.Obsolete.Year2024.Fluid.Movers;
model SpeedControlled_Nrpm
  "Fan or pump with ideally controlled speed Nrpm as input signal"
  extends AixLib.Fluid.Movers.BaseClasses.PartialFlowMachine(
    final preVar=AixLib.Fluid.Movers.BaseClasses.Types.PrescribedVariable.Speed,
    final nominalValuesDefineDefaultPressureCurve=false,
    final computePowerUsingSimilarityLaws=true,
    final stageInputs(each final unit="1") = per.speeds,
    final constInput(final unit="1") =       per.constantSpeed,
    filter(
      final y_start=y_start,
      u(final unit="1"),
      y(final unit="1")),
    eff(
      per(final pressure = per.pressure)));
 extends AixLib.Obsolete.BaseClasses.ObsoleteModel;
  parameter Modelica.Units.NonSI.AngularVelocity_rpm speed_rpm_nominal=1500 "Nominal rotational speed";
  parameter Real y_start(min=0, max=1, unit="1")=0 "Initial value of speed"

  Modelica.Blocks.Interfaces.RealInput Nrpm(final unit="rev/min")
 if inputType == AixLib.Fluid.Types.InputType.Continuous
    "Prescribed rotational speed"

protected
  Modelica.Blocks.Math.Gain gain(final k=-1) "Pressure gain"
protected
  Modelica.Blocks.Math.Gain gaiSpe(final k=1/speed_rpm_nominal) "Pressure gain"
initial equation
  assert(per.havePressureCurve,
   "SpeedControlled_Nrpm model requires to set the pressure vs. flow rate curve in record 'per'.");

equation
  connect(Nrpm, gaiSpe.u)
  connect(gaiSpe.y, inputSwitch.u)
  connect(eff.dp, gain.u)
  connect(gain.y, preSou.dp_in)
  if use_inputFilter then
    connect(filter.y, eff.y_in)
  else
    connect(inputSwitch.y, eff.y_in)
  end if;
end SpeedControlled_Nrpm;


fixme: add brief description

within AixLib.Obsolete.Year2024;
package Systems "fixme: add brief description"
  extends Modelica.Icons.Package;
end Systems;


Performance data of HP in heating mode

within AixLib.Obsolete.Year2024.Systems.HeatPumpSystems;
model HeatPumpSystem
  extends AixLib.Obsolete.Year2024.Systems.HeatPumpSystems.BaseClasses.PartialHeatPumpSystem(
    addPowerToMediumEva=false,
    transferHeat=true,
    mFlow_conNominal=QCon_nominal/(cpCon*dTCon),
    mFlow_evaNominal=QEva_nominal/(cpEva*dTEva),
    redeclare AixLib.Obsolete.Year2024.Fluid.HeatPumps.HeatPump heatPump(
      final use_autoCalc=false,
      final Q_useNominal=0,
      final mFlow_evaNominal=mFlow_evaNominal,
      final VEva=VEva,
      redeclare final model PerDataMainHP = PerDataHea,
      redeclare final model PerDataRevHP = PerDataChi,
      redeclare final package Medium_con = Medium_con,
      redeclare final package Medium_eva = Medium_eva,
      final use_rev=use_revHP,
      final scalingFactor=scalingFactor,
      final use_refIne=use_refIne,
      final refIneFre_constant=refIneFre_constant,
      final nthOrder=nthOrder,
      final useBusConnectorOnly=true,
      final mFlow_conNominal=mFlow_conNominal,
      final VCon=VCon,
      final dpCon_nominal=dpCon_nominal,
      final deltaM_con=deltaM_con,
      final use_conCap=use_conCap,
      final CCon=CCon,
      final GConOut=GConOut,
      final GConIns=GConIns,
      final dpEva_nominal=dpEva_nominal,
      final deltaM_eva=deltaM_eva,
      final use_evaCap=use_evaCap,
      final CEva=CEva,
      final GEvaOut=GEvaOut,
      final GEvaIns=GEvaIns,
      final tauSenT=tauSenT,
      final transferHeat=transferHeat,
      final allowFlowReversalEva=allowFlowReversalEva,
      final allowFlowReversalCon=allowFlowReversalCon,
      final tauHeaTraEva=tauHeaTraEva,
      final tauHeaTraCon=tauHeaTraCon,
      final TAmbCon_nominal=TAmbCon_nominal,
      final TAmbEva_nominal=TAmbEva_nominal,
      final initType=initType,
      final pCon_start=pCon_start,
      final TCon_start=TCon_start,
      final XCon_start=XCon_start,
      final pEva_start=pEva_start,
      final TEva_start=TEva_start,
      final XEva_start=XEva_start,
      final x_start=x_start,
      final yRefIne_start=yRefIne_start,
      final massDynamics=massDynamics,
      final energyDynamics=energyDynamics));

//Heat Pump

  replaceable model PerDataHea =
      AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.LookUpTable2D              constrainedby
    AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.BaseClasses.PartialPerformanceData
  "Performance data of HP in heating mode"

  replaceable model PerDataChi =
      AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.LookUpTable2D              constrainedby
    AixLib.Obsolete.Year2024.DataBase.Chiller.PerformanceData.BaseClasses.PartialPerformanceData
  "Performance data of HP in chilling mode"

  parameter Boolean use_revHP=true "True if the HP is reversible"
  parameter Real scalingFactor=1 "Scaling-factor of HP"
  parameter Boolean use_refIne=true  "Consider the inertia of the refrigerant cycle"
  constant Modelica.Units.SI.Frequency refIneFre_constant
    "Cut off frequency representing inertia of refrigerant cycle"
  parameter Integer nthOrder=3 "Order of refrigerant cycle interia"
//Condenser/Evaporator
  parameter Modelica.Units.SI.Volume VCon(displayUnit="l")
    "Volume in condenser. Typical values range from 1 to 20 l, depending on the size of the heat pump and the mass flow rate."
  parameter Modelica.Units.SI.Volume VEva(displayUnit="l")
    "Volume in evaporator. Typical values range from 1 to 20 l, depending on the size of the heat pump and the mass flow rate."
  parameter Modelica.Units.SI.PressureDifference dpEva_nominal(displayUnit=
        "kPa")
    "Pressure drop at nominal mass flow rate. Only relevant if a mover is used. Try to select values to match the nominal mass flow rate."
  parameter Modelica.Units.SI.PressureDifference dpCon_nominal(displayUnit=
        "kPa")
    "Pressure drop at nominal mass flow rate. Only relevant if a mover is used. Try to select values to match the nominal mass flow rate."
  parameter Real deltaM_con=0.1
    "Fraction of nominal mass flow rate where transition to turbulent occurs"
  parameter Real deltaM_eva=0.1
    "Fraction of nominal mass flow rate where transition to turbulent occurs"

  parameter Boolean use_conCap=true
    "If heat losses at capacitor side are considered or not"
  parameter Boolean use_evaCap=true
    "If heat losses at capacitor side are considered or not"
  parameter Modelica.Units.SI.HeatCapacity CEva
    "Heat capacity of Evaporator (= cp*m). If you want to neglace the dry mass of the evaporator, you can set this value to zero"
  parameter Modelica.Units.SI.ThermalConductance GEvaOut=percHeatLoss*
      QEva_nominal/(TEva_nominal - TAmbEva_nominal)
    "Constant parameter for heat transfer to the ambient. Represents a sum of thermal resistances such as conductance, insulation and natural convection. If you want to simulate a evaporator with additional dry mass but without external heat losses, set the value to zero"
  parameter Modelica.Units.SI.ThermalConductance GEvaIns=QEva_nominal/
      dTPinchEva
    "Constant parameter for heat transfer to heat exchangers capacity. Represents a sum of thermal resistances such as forced convection and conduction inside of the capacity"
  parameter Modelica.Units.SI.HeatCapacity CCon
    "Heat capacity of Condenser (= cp*m). If you want to neglace the dry mass of the condenser, you can set this value to zero"
  parameter Modelica.Units.SI.ThermalConductance GConOut=percHeatLoss*
      QCon_nominal/(TCon_nominal - TAmbCon_nominal)
    "Constant parameter for heat transfer to the ambient. Represents a sum of thermal resistances such as conductance, insulation and natural convection. If you want to simulate a condenser with additional dry mass but without external heat losses, set the value to zero"
  parameter Modelica.Units.SI.ThermalConductance GConIns=QCon_nominal/
      dTPinchCon
    "Constant parameter for heat transfer to heat exchangers capacity. Represents a sum of thermal resistances such as forced convection and conduction inside of the capacity"
//Dynamics
  parameter Real x_start[nthOrder]=zeros(nthOrder)
    "Initial or guess values of states"
  parameter Real yRefIne_start=0 "Initial or guess value of output (= state)"
//Initialization
  parameter Modelica.Units.SI.Temperature TConCap_start=Medium_con.T_default
    "Initial temperature of heat capacity of condenser"
  parameter Modelica.Units.SI.Temperature TEvaCap_start=Medium_eva.T_default
    "Initial temperature of heat capacity at evaporator"
equation

  connect(port_a1, port_a1)
  connect(heatPump.sigBus, hPSystemController.sigBusHP)
end HeatPumpSystem;


within AixLib.Obsolete.Year2024.Systems;
package HeatPumpSystems "Package with models for a heat pump system"
end HeatPumpSystems;


Model including both safety and HP controller. This system controller aggregates the heat pump controller and
  relevant safety controls from AixLib.Controls.HeatPump to
  control the heat pump based on an ambient temperature and the current
  supply temperature.

within AixLib.Obsolete.Year2024.Systems.HeatPumpSystems.BaseClasses;
model HPSystemController
  "Model including both safety and HP controller"
  parameter Boolean use_secHeaGen=true "True if a bivalent setup is required"

//HeatPump Control
  replaceable model TSetToNSet = AixLib.Controls.HeatPump.TwoPointControlledHP
    constrainedby AixLib.Controls.HeatPump.BaseClasses.PartialTSetToNSet

  parameter Boolean use_tableData=true
    "Choose between tables or function to calculate TSet"
  replaceable function HeatingCurveFunction =
      AixLib.Controls.SetPoints.Functions.HeatingCurveFunction

  parameter
    AixLib.DataBase.Boiler.DayNightMode.HeatingCurvesDayNightBaseDataDefinition
    heatingCurveRecord=
      AixLib.DataBase.Boiler.DayNightMode.HeatingCurves_Vitotronic_Day25_Night10()
         "Record with information about heating curve data"
  parameter Real declination=2 "Declination of heating curve"
  parameter Real day_hour=6 "Hour of day at which day mode is enabled"
  parameter Real night_hour=22 "Hour of day at which night mode is enabled"
  parameter AixLib.Utilities.Time.Types.ZeroTime zerTim=AixLib.Utilities.Time.Types.ZeroTime.NY2017
    "Enumeration for choosing how reference time (time = 0) should be defined. Used for heating curve and antilegionella"
  parameter Boolean use_antLeg=true
    "True if Anti-Legionella control is considered"
  parameter Modelica.Units.SI.ThermodynamicTemperature TLegMin=333.15
    "Temperature at which the legionella in DWH dies"
  parameter Modelica.Units.SI.Time minTimeAntLeg
    "Minimal duration of antilegionella control"
  parameter Boolean weekly=true
    "Switch between a daily or weekly trigger approach"
  parameter Integer trigWeekDay=5
    "Day of the week at which control is triggered"
  parameter Integer trigHour=3 "Hour of the day at which control is triggered"
//Safety Control
  parameter Boolean use_sec=true
    "False if the Safety block should be disabled"

  parameter Boolean use_minRunTime=false
    "False if minimal runtime of HP is not considered"
  parameter Modelica.Units.SI.Time minRunTime=300
    "Minimum runtime of heat pump"
  parameter Boolean use_minLocTime=false
    "False if minimal locktime of HP is not considered"
  parameter Modelica.Units.SI.Time minLocTime=300
    "Minimum lock time of heat pump"
  parameter Boolean use_runPerHou=false
    "False if maximal runs per hour of HP are not considered"
  parameter Integer maxRunPerHou=3
                              "Maximal number of on/off cycles in one hour"
  parameter Boolean pre_n_start=false
                                     "Start value of pre(n) at initial time"
  parameter Boolean use_opeEnv=true
    "False to allow HP to run out of operational envelope"
  parameter Boolean use_opeEnvFroRec=true
    "Use a the operational envelope given in the datasheet"
  parameter Obsolete.Year2024.DataBase.HeatPump.HeatPumpBaseDataDefinition
    dataTable "Data Table of HP"
  parameter Real tableUpp[:,2] "Table matrix (grid = first column; e.g., table=[0,2])"
  parameter Modelica.Units.SI.TemperatureDifference dTHystOperEnv=5
    "Temperature difference used for both upper and lower hysteresis in the operational envelope."
  parameter Boolean use_deFro=true "False if defrost in not considered"
  parameter Real minIceFac "Minimal value above which no defrost is necessary"
  parameter Real deltaIceFac = 0.1 "Bandwitdth for hystereses. If the icing factor is based on the duration of defrost, this value is necessary to avoid state-events."
  parameter Boolean use_chiller=false
    "True if defrost operates by changing mode to cooling. False to use an electrical heater"
  parameter Modelica.Units.SI.Power calcPel_deFro
    "Calculate how much eletrical energy is used to melt ice"
  parameter Boolean use_antFre=false
    "True if anti freeze control is part of safety control"
  parameter Modelica.Units.SI.ThermodynamicTemperature TantFre=276.15
    "Limit temperature for anti freeze control"
  AixLib.Obsolete.Year2024.Controls.HeatPump.SafetyControls.SafetyControl safetyControl(
    final use_minRunTime=use_minRunTime,
    final minRunTime(displayUnit="min") = minRunTime,
    final minLocTime(displayUnit="min") = minLocTime,
    final use_runPerHou=use_runPerHou,
    final maxRunPerHou=maxRunPerHou,
    final use_opeEnv=use_opeEnv,
    final use_minLocTime=use_minLocTime,
    final dTHystOperEnv=dTHystOperEnv,
    pre_n_start=pre_n_start,
    final use_deFro=use_deFro,
    final minIceFac=minIceFac,
    final deltaIceFac=deltaIceFac,
    final use_chiller=use_chiller,
    final calcPel_deFro=calcPel_deFro,
    final use_antFre=use_antFre,
    final TantFre=TantFre,
    final tableUpp=tableUpp,
    final use_opeEnvFroRec=use_opeEnvFroRec,
    final dataTable=dataTable)         if use_sec
  AixLib.Controls.HeatPump.HPControl hPControls(
    final use_antLeg=use_antLeg,
    final use_secHeaGen=use_secHeaGen,
    redeclare final model TSetToNSet = TSetToNSet,
    final heatingCurveRecord=heatingCurveRecord,
    final declination=declination,
    final day_hour=day_hour,
    final night_hour=night_hour,
    final zerTim=zerTim,
    final TLegMin=TLegMin,
    final minTimeAntLeg=minTimeAntLeg,
    final trigWeekDay=trigWeekDay,
    final trigHour=trigHour,
    final use_tableData=use_tableData,
    redeclare final function HeatingCurveFunction = HeatingCurveFunction)
  AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.calcCOP calcCOP(
      final lowBouPel=200)
  AixLib.Utilities.HeatTransfer.CalcQFlow       calcQHeat(final cp=cp_con)
    "Calculates the heat flow added to the source medium"
  Modelica.Blocks.Routing.RealPassThrough realPasThrSec if not use_sec
                                                                      "No 1. Layer"
  Modelica.Blocks.Interfaces.RealInput T_oda "Outdoor air temperature"
  AixLib.Obsolete.Year2024.Controls.Interfaces.VapourCompressionMachineControlBus
                           sigBusHP
  Modelica.Blocks.Interfaces.RealInput TSup "Supply temperature of HP system"
  Modelica.Blocks.Interfaces.RealOutput y_sin
  Modelica.Blocks.Interfaces.RealOutput ySecHeaGen if use_secHeaGen
                                                   "Relative power of second heat generator, from 0 to 1"
  Modelica.Blocks.Interfaces.RealOutput y_sou
  Modelica.Blocks.Math.MultiSum multiSum(k=fill(1, if not use_chiller and use_deFro then 2 else 1), nu=if not use_chiller and use_deFro then 2 else 1)
  AixLib.Obsolete.Year2024.DataBase.HeatPump.PerformanceData.IcingBlock
    icingBlock(redeclare final function iceFunc =
        Obsolete.Year2024.DataBase.HeatPump.Functions.IcingFactor.BasicIcingApproach)
    if use_deFro
  Modelica.Blocks.Sources.Constant const(final k=1) if not use_deFro

  Modelica.Blocks.Routing.BooleanPassThrough booleanPassThroughMode if not
    use_sec "Pass through for mode signal"

  parameter Modelica.Units.SI.SpecificHeatCapacity cp_con=4180
    "specific heat capacity of condenser medium";
  Modelica.Blocks.Sources.Constant constTAmb(final k=273.15 + 20)
equation
  connect(T_oda,hPControls.T_oda)
  connect(hPControls.yOut,safetyControl. nSet)
  connect(hPControls.yOut,realPasThrSec. u)
  connect(hPControls.hea,safetyControl. modeSet)
  connect(sigBusHP,hPControls. sigBusHP)
  connect(sigBusHP,safetyControl. sigBusHP)
  connect(TSup, hPControls.TSup)
  connect(y_sou, y_sou)
  connect(hPControls.ySecHeaGen, ySecHeaGen)
  connect(hPControls.y_sin, y_sin)
  connect(hPControls.y_sou, y_sou)
  connect(multiSum.y, calcCOP.Pel)
  connect(safetyControl.Pel_deFro, multiSum.u[2])
  connect(sigBusHP.PelMea, multiSum.u[1])
  connect(calcCOP.y_COP, sigBusHP.CoPMea)
  connect(sigBusHP.TOdaMea, icingBlock.T_oda)
  connect(sigBusHP.TEvaInMea, icingBlock.T_flow_ev)
  connect(sigBusHP.TEvaOutMea, icingBlock.T_ret_ev)
  connect(sigBusHP.m_flowEvaMea, icingBlock.m_flow_ev)
  connect(hPControls.hea, booleanPassThroughMode.u)
  connect(calcQHeat.Q_flow, calcCOP.QHeat)
  connect(sigBusHP.m_flowConMea, calcQHeat.m_flow)
  connect(sigBusHP.TConOutMea, calcQHeat.T_a)
  connect(sigBusHP.TConInMea, calcQHeat.T_b)
  connect(safetyControl.modeOut, sigBusHP.modeSet)
  connect(booleanPassThroughMode.y, sigBusHP.modeSet)
  connect(safetyControl.nOut, sigBusHP.nSet)
  connect(realPasThrSec.y, sigBusHP.nSet)
  connect(icingBlock.iceFac, sigBusHP.iceFacMea)
  connect(const.y, sigBusHP.iceFacMea)
  connect(constTAmb.y, sigBusHP.TConAmbMea)
  connect(T_oda, sigBusHP.TEvaAmbMea)
end HPSystemController;


BaseClasses for heat pump systems

within AixLib.Obsolete.Year2024.Systems.HeatPumpSystems;
package BaseClasses "BaseClasses for heat pump systems"
end BaseClasses;