Buildings.Experimental.DHC.Loads.BaseClasses.Controls
Package of control sequences for DHC systems
Information
This package contains control sequences used in district heating and cooling systems.
Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).
Package Content
Name | Description |
---|---|
MixingValveControl | Mixing valve controller |
Validation | Collection of validation models |
Buildings.Experimental.DHC.Loads.BaseClasses.Controls.MixingValveControl
Mixing valve controller
Information
This model implements a generic controller for a three-way mixing valve. Three operating modes are supported:
- Heating: the controller tracks a minimum supply temperature.
- Cooling: the controller tracks a maximum supply temperature.
-
Change-over: the controller tracks either a minimum or a maximum
supplied temperature depending on the actual value of the integer input
modChaOve
(1 for heating, 2 for cooling). The model instantiates only one PI block to limit the number of state variables in large models. Therefore the PI gain is independent from the change-over mode: the reverse action is modeled by taking the opposite value of the PI block output. Eventually the integral part is reset whenever the change-over mode is switched.
See Buildings.Experimental.DHC.Loads.BaseClasses.Controls.Validation.MixingValveControl for a simulation with change-over.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
---|---|---|---|
DistributionType | typDis | Type_dis.HeatingWater | Type of distribution system |
Real | k | 0.1 | Gain of controller [1] |
Time | Ti | 10 | Time constant of integrator block [s] |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | TSupSet | Supply temperature set point [K] |
input IntegerInput | modChaOve | Operating mode in change-over (1 for heating, 2 for cooling) |
input RealInput | TSupMes | Supply temperature (measured) [K] |
output RealOutput | yVal | Valve control signal [1] |
Modelica definition
block MixingValveControl
"Mixing valve controller"
extends Modelica.Blocks.Icons.Block;
import Type_dis=Buildings.Experimental.DHC.Loads.BaseClasses.Types.DistributionType
"Types of distribution system";
parameter Type_dis typDis=Type_dis.HeatingWater
"Type of distribution system";
parameter Real k(
final min=0,
final unit="1")=0.1
"Gain of controller";
parameter Modelica.Units.SI.Time Ti(final min=Modelica.Constants.small) = 10
"Time constant of integrator block";
// IO CONNECTORS
Modelica.Blocks.Interfaces.RealInput TSupSet(
final unit="K",
displayUnit="degC")
"Supply temperature set point";
Modelica.Blocks.Interfaces.IntegerInput modChaOve if typDis == Type_dis.ChangeOver
"Operating mode in change-over (1 for heating, 2 for cooling)";
Modelica.Blocks.Interfaces.RealInput TSupMes(
final unit="K",
displayUnit="degC")
"Supply temperature (measured)";
Modelica.Blocks.Interfaces.RealOutput yVal(
final unit="1")
"Valve control signal";
// COMPONENTS
Buildings.Controls.OBC.CDL.Reals.Sources.Constant zer(
k=0)
"Zero constant";
Modelica.Blocks.Math.IntegerToBoolean toBoo(
threshold=2) if typDis == Type_dis.ChangeOver
"Conversion to boolean (true if cooling mode)";
Buildings.Controls.OBC.CDL.Reals.PIDWithReset resConTSup(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
final k=k,
final Ti=Ti,
final yMax=1,
final yMin=-1,
final reverseActing=true,
final y_reset=0) if typDis == Type_dis.ChangeOver
"PI controller tracking supply temperature";
Buildings.Controls.OBC.CDL.Reals.PID conTSup(
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
final k=k,
final Ti=Ti,
final yMax=1,
final yMin=-1,
final reverseActing=true) if typDis <> Type_dis.ChangeOver
"PI controller tracking supply temperature";
Buildings.Controls.OBC.CDL.Reals.Min negPar
"Negative part of control signal";
Buildings.Controls.OBC.CDL.Reals.Max posPar
"Positive part of control signal";
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter opp(k=-1)
"Opposite value";
Buildings.Controls.OBC.CDL.Reals.Switch swi
"Logical switch";
Modelica.Blocks.Sources.BooleanExpression fixMod(
final y=typDis == Type_dis.ChilledWater) if typDis <> Type_dis.ChangeOver
"Fixed operating mode";
Buildings.Controls.OBC.CDL.Integers.Change cha if typDis == Type_dis.ChangeOver
"Evaluate the integer input u to check if its value changes";
equation
connect(modChaOve,toBoo.u);
connect(toBoo.y,swi.u2);
connect(fixMod.y,swi.u2);
connect(resConTSup.y,posPar.u2);
connect(zer.y,posPar.u1);
connect(zer.y,negPar.u1);
connect(resConTSup.y,negPar.u2);
connect(negPar.y,opp.u);
connect(resConTSup.u_s,TSupSet);
connect(TSupMes,resConTSup.u_m);
connect(swi.y,yVal);
connect(modChaOve,cha.u);
connect(cha.y,resConTSup.trigger);
connect(opp.y,swi.u1);
connect(posPar.y,swi.u3);
connect(TSupSet,conTSup.u_s);
connect(TSupMes,conTSup.u_m);
connect(conTSup.y,negPar.u2);
connect(conTSup.y,posPar.u2);
end MixingValveControl;