Buildings.Experimental.DistrictHeatingCooling.Plants

Package with plant models

Information

This package contains component models for district heating and cooling plants.

Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).

Package Content

Name Description
Buildings.Experimental.DistrictHeatingCooling.Plants.HeatingCoolingCarnot_T HeatingCoolingCarnot_T Ideal heating and cooling plant with leaving temperature as set point and vapor compression engines that are approximated by Carnot cycles
Buildings.Experimental.DistrictHeatingCooling.Plants.Ideal_T Ideal_T Ideal heating and cooling plant with leaving temperature as set point
Buildings.Experimental.DistrictHeatingCooling.Plants.LakeWaterHeatExchanger_T LakeWaterHeatExchanger_T Heat exchanger with lake, ocean or river water
Buildings.Experimental.DistrictHeatingCooling.Plants.Validation Validation Collection of validation models

Buildings.Experimental.DistrictHeatingCooling.Plants.HeatingCoolingCarnot_T Buildings.Experimental.DistrictHeatingCooling.Plants.HeatingCoolingCarnot_T

Ideal heating and cooling plant with leaving temperature as set point and vapor compression engines that are approximated by Carnot cycles

Buildings.Experimental.DistrictHeatingCooling.Plants.HeatingCoolingCarnot_T

Information

Model of an ideal heating and cooling plant that takes as a parameter the set point for the leaving fluid temperature. The power consumptions are modeled using a vapor compression engine for heating and for cooling. The efficiency of these vapor compression engines varies using the Carnot cycle analogy.

Extends from Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model transporting fluid between two ports without storing mass or energy).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
TemperatureDifferencedTEva_nominal-10Temperature difference evaporator outlet-inlet of heat pump [K]
TemperatureDifferencedTCon_nominal10Temperature difference condenser outlet-inlet of chiller [K]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Design parameter
Pressuredp_nominal30000Pressure difference at nominal flow rate [Pa]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanlinearizeFlowResistancefalse= true, use linear relation between m_flow and dp for any flow rate
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)
input RealInputTSetHeaTemperature set point for heating [K]
input RealInputTSetCooTemperature set point for cooling [K]
input RealInputTSinkTemperature of heat sink [K]
output RealOutputPComHeaCompressor energy for heating [W]
output RealOutputPComCooCompressor energy for cooling [W]
output RealOutputQHea_flowHeat input into fluid [W]
output RealOutputQCoo_flowHeat extracted from fluid [W]
output RealOutputQAmbHea_flowHeat from ambient to heat pump evaporator [W]
output RealOutputQAmbChi_flowHeat from chiller condensor to ambient [W]

Modelica definition

model HeatingCoolingCarnot_T "Ideal heating and cooling plant with leaving temperature as set point and vapor compression engines that are approximated by Carnot cycles" extends Buildings.Fluid.Interfaces.PartialTwoPortInterface( final m_flow(start=0), final allowFlowReversal = true, final dp(start=0)); parameter Modelica.SIunits.TemperatureDifference dTEva_nominal=-10 "Temperature difference evaporator outlet-inlet of heat pump"; parameter Modelica.SIunits.TemperatureDifference dTCon_nominal=10 "Temperature difference condenser outlet-inlet of chiller"; parameter Modelica.SIunits.Pressure dp_nominal(displayUnit="Pa")=30000 "Pressure difference at nominal flow rate"; parameter Boolean linearizeFlowResistance=false "= true, use linear relation between m_flow and dp for any flow rate"; Modelica.Blocks.Interfaces.RealInput TSetHea(unit="K") "Temperature set point for heating"; Modelica.Blocks.Interfaces.RealInput TSetCoo(unit="K") "Temperature set point for cooling"; Modelica.Blocks.Interfaces.RealInput TSink(unit="K") "Temperature of heat sink"; Modelica.Blocks.Interfaces.RealOutput PComHea(unit="W") "Compressor energy for heating"; Modelica.Blocks.Interfaces.RealOutput PComCoo(unit="W") "Compressor energy for cooling"; Modelica.Blocks.Interfaces.RealOutput QHea_flow(unit="W") "Heat input into fluid"; Modelica.Blocks.Interfaces.RealOutput QCoo_flow(unit="W") "Heat extracted from fluid"; Modelica.Blocks.Interfaces.RealOutput QAmbHea_flow(unit="W") "Heat from ambient to heat pump evaporator"; Modelica.Blocks.Interfaces.RealOutput QAmbChi_flow(unit="W") "Heat from chiller condensor to ambient"; protected replaceable package MediumSin = Buildings.Media.Air "Medium model for the heat sink"; parameter Modelica.SIunits.TemperatureDifference dTSin = 2 "Temperature difference over heat source or sink"; final parameter Medium.ThermodynamicState staSin_default = Medium.setState_pTX( T=MediumSin.T_default, p=MediumSin.p_default, X=MediumSin.X_default[1:MediumSin.nXi]) "Medium state at default properties"; final parameter Modelica.SIunits.SpecificHeatCapacity cpSin_default= Medium.specificHeatCapacityCp(staSin_default) "Specific heat capacity of the fluid"; final parameter Medium.ThermodynamicState sta_default = Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default[1:Medium.nXi]) "Medium state at default properties"; final parameter Modelica.SIunits.SpecificHeatCapacity cp_default= Medium.specificHeatCapacityCp(sta_default) "Specific heat capacity of the fluid"; Buildings.Fluid.Chillers.Carnot_TEva coo( show_T=true, redeclare package Medium1 = MediumSin, redeclare package Medium2 = Medium, m2_flow_nominal=m_flow_nominal, QEva_flow_nominal=m_flow_nominal*cp_default*dTEva_nominal, use_eta_Carnot_nominal=true, etaCarnot_nominal=0.3, dp1_nominal=6000, dp2_nominal=0, dTEva_nominal=-dTSin, dTCon_nominal=dTCon_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, allowFlowReversal1=false) "Chiller"; Buildings.Fluid.HeatPumps.Carnot_TCon hea( redeclare package Medium1 = Medium, redeclare package Medium2 = MediumSin, show_T=true, m1_flow_nominal=m_flow_nominal, QCon_flow_nominal=m_flow_nominal*cp_default*dTCon_nominal, dp2_nominal=6000, use_eta_Carnot_nominal=true, etaCarnot_nominal=0.3, dTEva_nominal=dTEva_nominal, dTCon_nominal=dTSin, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, allowFlowReversal2=false, dp1_nominal=dp_nominal) "Heat pump for heating"; Buildings.Fluid.Sources.FixedBoundary sinHea( redeclare package Medium = MediumSin, nPorts=1) "Pressure source"; Buildings.Fluid.Sources.MassFlowSource_T souHea( redeclare package Medium = MediumSin, use_m_flow_in=true, use_T_in=true, nPorts=1) "Mass flow source"; Modelica.Blocks.Math.Gain mHeaSin_flow(k=1/(cpSin_default*dTSin)) "Mass flow rate for heat source"; Modelica.Blocks.Math.Add addHea(k2=-1) "Adder for energy balance"; Modelica.Blocks.Math.Add addCoo "Adder for energy balance"; Modelica.Blocks.Math.Gain mCooSin_flow(k=-1/(cpSin_default*dTSin)) "Mass flow rate for heat sink"; Buildings.Fluid.Sources.MassFlowSource_T sou2( redeclare package Medium = MediumSin, use_m_flow_in=true, use_T_in=true, nPorts=1) "Mass flow source"; Buildings.Fluid.Sources.FixedBoundary sinCoo( redeclare package Medium = MediumSin, nPorts=1) "Pressure source"; equation connect(hea.TSet, TSetHea); connect(port_a, hea.port_a1); connect(hea.QCon_flow, addHea.u1); connect(hea.P, addHea.u2); connect(mHeaSin_flow.u, addHea.y); connect(coo.P, addCoo.u2); connect(addCoo.y, mCooSin_flow.u); connect(sinHea.ports[1], hea.port_b2); connect(mHeaSin_flow.y, souHea.m_flow_in); connect(TSink, souHea.T_in); connect(souHea.ports[1], hea.port_a2); connect(mCooSin_flow.y, sou2.m_flow_in); connect(sou2.T_in, TSink); connect(hea.P, PComHea); connect(coo.P, PComCoo); connect(hea.QCon_flow, QHea_flow); connect(TSetCoo, coo.TSet); connect(sou2.ports[1], coo.port_a1); connect(coo.port_b1, sinCoo.ports[1]); connect(port_b, coo.port_a2); connect(addCoo.u1, coo.QEva_flow); connect(coo.QEva_flow, QCoo_flow); connect(hea.port_b1, coo.port_b2); connect(hea.QEva_flow, QAmbHea_flow); connect(coo.QCon_flow, QAmbChi_flow); end HeatingCoolingCarnot_T;

Buildings.Experimental.DistrictHeatingCooling.Plants.Ideal_T Buildings.Experimental.DistrictHeatingCooling.Plants.Ideal_T

Ideal heating and cooling plant with leaving temperature as set point

Buildings.Experimental.DistrictHeatingCooling.Plants.Ideal_T

Information

Model of an ideal heating and cooling plant that takes as a parameter the set point for the leaving fluid temperature.

Extends from Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model transporting fluid between two ports without storing mass or energy).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Design parameter
Pressuredp_nominal30000Pressure difference at nominal flow rate [Pa]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanlinearizeFlowResistancefalse= true, use linear relation between m_flow and dp for any flow rate
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)
output RealOutputQHea_flowHeat input into fluid [W]
output RealOutputQCoo_flowHeat extracted from fluid [W]
input RealInputTSetHeaTemperature set point for heating [K]
input RealInputTSetCooTemperature set point for cooling [K]

Modelica definition

model Ideal_T "Ideal heating and cooling plant with leaving temperature as set point" extends Buildings.Fluid.Interfaces.PartialTwoPortInterface( final m_flow(start=0), final allowFlowReversal = true, final dp(start=0)); parameter Modelica.SIunits.Pressure dp_nominal(displayUnit="Pa")=30000 "Pressure difference at nominal flow rate"; parameter Boolean linearizeFlowResistance=false "= true, use linear relation between m_flow and dp for any flow rate"; Modelica.Blocks.Interfaces.RealOutput QHea_flow(unit="W") "Heat input into fluid"; Modelica.Blocks.Interfaces.RealOutput QCoo_flow(unit="W") "Heat extracted from fluid"; protected final parameter Medium.ThermodynamicState sta_default = Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default[1:Medium.nXi]) "Medium state at default properties"; final parameter Modelica.SIunits.SpecificHeatCapacity cp_default= Medium.specificHeatCapacityCp(sta_default) "Specific heat capacity of the fluid"; Buildings.Fluid.HeatExchangers.HeaterCooler_T coo( redeclare package Medium = Medium, allowFlowReversal=allowFlowReversal, m_flow_nominal=m_flow_nominal, show_T=true, Q_flow_maxHeat=0, dp_nominal=0, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, tau=60) "Cooling supply"; Buildings.Fluid.HeatExchangers.HeaterCooler_T hea( redeclare package Medium = Medium, allowFlowReversal=allowFlowReversal, m_flow_nominal=m_flow_nominal, from_dp=false, show_T=true, Q_flow_maxCool=0, dp_nominal=dp_nominal, linearizeFlowResistance=linearizeFlowResistance, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, tau=60) "Heat supply"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0) "Temperature sensor"; public Modelica.Blocks.Interfaces.RealInput TSetHea(unit="K") "Temperature set point for heating"; Modelica.Blocks.Interfaces.RealInput TSetCoo(unit="K") "Temperature set point for cooling"; equation connect(QHea_flow, hea.Q_flow); connect(coo.Q_flow, QCoo_flow); connect(port_a, hea.port_a); connect(coo.port_a, port_b); connect(hea.port_b, senTem.port_a); connect(senTem.port_b, coo.port_b); connect(hea.TSet, TSetHea); connect(TSetCoo, coo.TSet); end Ideal_T;

Buildings.Experimental.DistrictHeatingCooling.Plants.LakeWaterHeatExchanger_T Buildings.Experimental.DistrictHeatingCooling.Plants.LakeWaterHeatExchanger_T

Heat exchanger with lake, ocean or river water

Buildings.Experimental.DistrictHeatingCooling.Plants.LakeWaterHeatExchanger_T

Information

Model for a heat exchanger that uses water such as from a lake, the ocean or a river, or the ambient air to either provide heating or cooling. The model has built-in controls in order to exchange heat, up to a maximum approach temperature difference set by TApp.

There are three input signals for the heat or cold source:

The parameters TLooMin and TLooMax are used to avoid that the water of the district heating/cooling is below or above a maximum threshold.

Implementation

The pressure drop of the heat exchanger is implemented in the valve instances valCoo and valHea.

Extends from Buildings.Fluid.Interfaces.PartialFourPortInterface (Partial model transporting fluid between two ports without storing mass or energy).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
BooleandisableHeatExchangerfalseSet to true to disable the heat exchanger
TemperatureDifferenceTApp0.5Approach temperature difference [K]
Nominal condition
MassFlowRatem1_flow_nominalm_flow_nominalNominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalm_flow_nominalNominal mass flow rate [kg/s]
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
PressureDifferencedpValve_nominal1000Nominal pressure drop of fully open valve [Pa]
PressureDifferencedpHex_nominal Pressure drop of heat exchanger pipe and other resistances in the heat exchanger flow leg that are in series with the valve [Pa]
Assumptions
BooleanallowFlowReversal1true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
Advanced
MassFlowRatem1_flow_small1E-4*abs(m1_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
MassFlowRatem2_flow_small1E-4*abs(m2_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Flow resistance
Booleanfrom_dpfalse= true, use m_flow = f(dp) else dp = f(m_flow)
BooleanlinearizeFlowResistancefalse= true, use linear relation between m_flow and dp for any flow rate
RealdeltaM0.1Fraction of nominal flow rate where flow transitions to laminar

Connectors

TypeNameDescription
replaceable package Medium1Medium 1 in the component
replaceable package Medium2Medium 2 in the component
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)
replaceable package MediumMedium in the component
input RealInputTSouWatTemperature of ocean, lake or river [K]
input RealInputTSouHeaSource temperature to add heat the loop water (such as outdoor drybulb temperature) [K]
input RealInputTSouCooSource temperature to reject heat, such as outdoor wet bulb, outdoor drybulb, or else TSouWat [K]
input RealInputTSetHeaTemperature set point for heating [K]
input RealInputTSetCooTemperature set point for cooling [K]
output RealOutputQWat_flowHeat exchanged with water reservoir (positive if added to reservoir) [W]

Modelica definition

model LakeWaterHeatExchanger_T "Heat exchanger with lake, ocean or river water" extends Buildings.Fluid.Interfaces.PartialFourPortInterface( redeclare final package Medium1 = Medium, redeclare final package Medium2 = Medium, final allowFlowReversal1 = true, final allowFlowReversal2 = true, final m1_flow_nominal = m_flow_nominal, final m2_flow_nominal = m_flow_nominal); replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Boolean disableHeatExchanger = false "Set to true to disable the heat exchanger"; parameter Modelica.SIunits.TemperatureDifference TApp( min=0, displayUnit="K") = 0.5 "Approach temperature difference"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal "Nominal mass flow rate"; parameter Modelica.SIunits.PressureDifference dpValve_nominal( displayUnit="Pa", min=0) = 1000 "Nominal pressure drop of fully open valve"; parameter Modelica.SIunits.PressureDifference dpHex_nominal( displayUnit="Pa", min=0) "Pressure drop of heat exchanger pipe and other resistances in the heat exchanger flow leg that are in series with the valve"; parameter Boolean from_dp = false "= true, use m_flow = f(dp) else dp = f(m_flow)"; parameter Boolean linearizeFlowResistance = false "= true, use linear relation between m_flow and dp for any flow rate"; parameter Real deltaM = 0.1 "Fraction of nominal flow rate where flow transitions to laminar"; Modelica.Blocks.Interfaces.RealInput TSouWat( unit="K", displayUnit="degC") "Temperature of ocean, lake or river"; Modelica.Blocks.Interfaces.RealInput TSouHea( unit="K", displayUnit="degC") "Source temperature to add heat the loop water (such as outdoor drybulb temperature)"; Modelica.Blocks.Interfaces.RealInput TSouCoo( unit="K", displayUnit="degC") "Source temperature to reject heat, such as outdoor wet bulb, outdoor drybulb, or else TSouWat"; Modelica.Blocks.Interfaces.RealInput TSetHea(unit="K") "Temperature set point for heating"; Modelica.Blocks.Interfaces.RealInput TSetCoo(unit="K") "Temperature set point for cooling"; Modelica.Blocks.Interfaces.RealOutput QWat_flow(unit="W") "Heat exchanged with water reservoir (positive if added to reservoir)"; Buildings.Fluid.Actuators.Valves.ThreeWayLinear valCoo( redeclare final package Medium = Medium, final m_flow_nominal=m_flow_nominal, dpValve_nominal=1000, use_inputFilter=false, final energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial, final dpFixed_nominal={if disableHeatExchanger then 0 else dpHex_nominal,0}) "Switching valve for cooling"; Buildings.Fluid.Actuators.Valves.ThreeWayLinear valHea( redeclare final package Medium = Medium, final m_flow_nominal=m_flow_nominal, dpValve_nominal=1000, use_inputFilter=false, final energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial, final dpFixed_nominal={if disableHeatExchanger then 0 else dpHex_nominal,0}) "Switching valve for heating"; protected Buildings.Fluid.HeatExchangers.HeaterCooler_T coo( redeclare final package Medium = Medium, final m_flow_nominal=m_flow_nominal, final dp_nominal=0, final Q_flow_maxHeat=0, final allowFlowReversal=true, final show_T=false, final from_dp=from_dp, final linearizeFlowResistance=linearizeFlowResistance, final deltaM=deltaM, final energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, Q_flow_maxCool=if disableHeatExchanger then 0 else -Modelica.Constants.inf) "Heat exchanger effect for mode in which water is cooled"; Modelica.Blocks.Sources.RealExpression TWarIn(y= Medium.temperature_phX( p=port_b1.p, h=inStream(port_b1.h_outflow), X=cat(1,inStream(port_b1.Xi_outflow), {1-sum(inStream(port_b1.Xi_outflow))}))) "Warm water inlet temperature"; Buildings.Fluid.HeatExchangers.HeaterCooler_T hea( redeclare final package Medium = Medium, final m_flow_nominal=m_flow_nominal, final dp_nominal=0, final allowFlowReversal=true, final show_T=false, final from_dp=from_dp, final linearizeFlowResistance=linearizeFlowResistance, final deltaM=deltaM, final energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, Q_flow_maxCool=0, Q_flow_maxHeat=if disableHeatExchanger then 0 else Modelica.Constants.inf) "Heat exchanger effect for mode in which water is heated"; Modelica.Blocks.Sources.RealExpression TColIn(y= Medium.temperature_phX( p=port_a2.p, h=inStream(port_a2.h_outflow), X=cat(1, inStream(port_a2.Xi_outflow), {1-sum(inStream(port_a2.Xi_outflow))}))) "Cold water inlet temperature"; Utilities.Math.SmoothMax maxHeaLea(deltaX=0.1) "Maximum leaving temperature"; Utilities.Math.SmoothMin minHeaLvg(deltaX=0.1) "Minimum leaving temperature"; Utilities.Math.SmoothMax maxCooLea(deltaX=0.1) "Maximum leaving temperature"; Utilities.Math.SmoothMin minCooLvg(deltaX=0.1) "Minimum leaving temperature"; Modelica.Blocks.Sources.Constant TAppHex(k=TApp) "Approach temperature difference"; Modelica.Blocks.Math.Add TWatHea(k2=-1) "Heat exchanger outlet, taking into account approach"; Modelica.Blocks.Math.Add TWatCoo "Heat exchanger outlet, taking into account approach"; Modelica.Blocks.Math.Add QExc_flow(k1=-1) "Heat added to water reservoir"; Utilities.Math.SmoothMax smoothMax(deltaX=0.1); Utilities.Math.SmoothMin smoothMin(deltaX=0.1); Controller conCoo(final m_flow_nominal=m_flow_nominal) "Controller for hex for cooling"; Buildings.Fluid.Sensors.MassFlowRate senMasFloCoo(redeclare package Medium = Medium) "Mass flow sensor used for cooling control"; Buildings.Fluid.Sensors.MassFlowRate senMasFloHea(redeclare package Medium = Medium) "Mass flow sensor used for heating control"; Controller conHea(final m_flow_nominal=m_flow_nominal) "Controller for hex for heating"; equation connect(TColIn.y, maxHeaLea.u2); connect(maxHeaLea.y, minHeaLvg.u2); connect(minHeaLvg.y, hea.TSet); connect(TWarIn.y, minCooLvg.u1); connect(minCooLvg.y, maxCooLea.u2); connect(maxCooLea.y, coo.TSet); connect(TAppHex.y, TWatHea.u2); connect(TAppHex.y, TWatCoo.u2); connect(TWatCoo.y, minCooLvg.u2); connect(TWatHea.y, maxHeaLea.u1); connect(coo.Q_flow, QExc_flow.u1); connect(hea.Q_flow, QExc_flow.u2); connect(QExc_flow.y, QWat_flow); connect(smoothMax.y, TWatHea.u1); connect(smoothMin.y, TWatCoo.u1); connect(TSetCoo, maxCooLea.u1); connect(valCoo.port_2, port_b1); connect(conCoo.y, valCoo.y); protected model Controller "Controller for bay water heat exchanger" parameter Modelica.SIunits.MassFlowRate m_flow_nominal "Nominal mass flow rate"; Modelica.Blocks.Nonlinear.Limiter limTem( uMax=1, uMin=0, limitsAtInit=false, strict=true) "Signal limiter for switching valve"; Modelica.Blocks.Math.Gain gaiTem(k=4) "Control gain for dT"; Modelica.Blocks.Math.Feedback feeBac "Control error"; Modelica.Blocks.Interfaces.RealInput u1; Modelica.Blocks.Interfaces.RealInput u2; Modelica.Blocks.Interfaces.RealOutput y "Control signal (0: bypass hex, 1: use hex)"; Modelica.Blocks.Interfaces.RealInput m_flow "Mass flow rate"; Modelica.Blocks.Math.Gain norFlo(final k=1/m_flow_nominal) "Normalized flow rate"; Modelica.Blocks.Nonlinear.Limiter limFlo( uMax=1, uMin=0, limitsAtInit=false, strict=true) "Signal limiter for switching valve"; Modelica.Blocks.Math.Gain gaiFlo(k=100) "Control gain for flow rate"; Modelica.Blocks.Math.Product product; equation connect(feeBac.y, gaiTem.u); connect(gaiTem.y, limTem.u); connect(u1, feeBac.u1); connect(u2, feeBac.u2); connect(m_flow, norFlo.u); connect(norFlo.y, gaiFlo.u); connect(gaiFlo.y, limFlo.u); connect(limFlo.y, product.u1); connect(limTem.y, product.u2); connect(product.y, y); end Controller; equation connect(valCoo.port_1, coo.port_a); connect(senMasFloCoo.m_flow, conCoo.m_flow); connect(senMasFloCoo.port_b, port_a1); connect(port_b2, senMasFloHea.port_b); connect(conHea.m_flow, senMasFloHea.m_flow); connect(valHea.port_2, port_a2); connect(valHea.port_1, hea.port_a); connect(conHea.y, valHea.y); connect(TColIn.y, conHea.u2); connect(conHea.u1, minHeaLvg.y); connect(TWarIn.y, conCoo.u1); connect(maxCooLea.y, conCoo.u2); connect(coo.port_b, senMasFloCoo.port_a); connect(valCoo.port_3, senMasFloCoo.port_a); connect(senMasFloHea.port_a, hea.port_b); connect(senMasFloHea.port_a, valHea.port_3); connect(smoothMin.u2, TSouWat); connect(smoothMax.u2, TSouWat); connect(smoothMax.u1, TSouHea); connect(smoothMin.u1, TSouCoo); connect(minHeaLvg.u1, TSetHea); end LakeWaterHeatExchanger_T;

Buildings.Experimental.DistrictHeatingCooling.Plants.LakeWaterHeatExchanger_T.Controller Buildings.Experimental.DistrictHeatingCooling.Plants.LakeWaterHeatExchanger_T.Controller

Controller for bay water heat exchanger

Buildings.Experimental.DistrictHeatingCooling.Plants.LakeWaterHeatExchanger_T.Controller

Parameters

TypeNameDefaultDescription
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]

Connectors

TypeNameDescription
input RealInputu1 
input RealInputu2 
output RealOutputyControl signal (0: bypass hex, 1: use hex)
input RealInputm_flowMass flow rate

Modelica definition

model Controller "Controller for bay water heat exchanger" parameter Modelica.SIunits.MassFlowRate m_flow_nominal "Nominal mass flow rate"; Modelica.Blocks.Nonlinear.Limiter limTem( uMax=1, uMin=0, limitsAtInit=false, strict=true) "Signal limiter for switching valve"; Modelica.Blocks.Math.Gain gaiTem(k=4) "Control gain for dT"; Modelica.Blocks.Math.Feedback feeBac "Control error"; Modelica.Blocks.Interfaces.RealInput u1; Modelica.Blocks.Interfaces.RealInput u2; Modelica.Blocks.Interfaces.RealOutput y "Control signal (0: bypass hex, 1: use hex)"; Modelica.Blocks.Interfaces.RealInput m_flow "Mass flow rate"; Modelica.Blocks.Math.Gain norFlo(final k=1/m_flow_nominal) "Normalized flow rate"; Modelica.Blocks.Nonlinear.Limiter limFlo( uMax=1, uMin=0, limitsAtInit=false, strict=true) "Signal limiter for switching valve"; Modelica.Blocks.Math.Gain gaiFlo(k=100) "Control gain for flow rate"; Modelica.Blocks.Math.Product product; equation connect(feeBac.y, gaiTem.u); connect(gaiTem.y, limTem.u); connect(u1, feeBac.u1); connect(u2, feeBac.u2); connect(m_flow, norFlo.u); connect(norFlo.y, gaiFlo.u); connect(gaiFlo.y, limFlo.u); connect(limFlo.y, product.u1); connect(limTem.y, product.u2); connect(product.y, y); end Controller;