Package with control components for Buildings.Examples.ChillerPlant
Information
This package contains component models that are used to construct the control system in
Buildings.Examples.ChillerPlant.
Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).
Package Content
Controller for battery
Information
Block for a battery controller. The battery is charged during night if its charge is below
a threshold. It remains charging until it is full.
During day, it discharges provided that its charge is above a threshold. It remains
discharging until it is empty.
Extends from Modelica.Blocks.Interfaces.BlockIcon (This icon will be removed in future Modelica versions, use Modelica.Blocks.Icons.Block instead.).
Connectors
Type | Name | Description |
input RealInput | SOC | State of charge |
output RealOutput | y | Power charged or discharged from battery |
Modelica definition
model BatteryControl
"Controller for battery"
extends Modelica.Blocks.Interfaces.BlockIcon;
Modelica.Blocks.Interfaces.RealInput SOC
"State of charge";
Modelica.Blocks.Interfaces.RealOutput y
"Power charged or discharged from battery";
Modelica_StateGraph2.Step off(initialStep=true, nOut=2,
nIn=2,
use_activePort=true)
"Battery is disconnected";
Modelica_StateGraph2.Transition T1(
use_conditionPort=true,
delayedTransition=true,
waitTime=1);
Modelica_StateGraph2.Step charge(
nOut=1,
initialStep=false,
use_activePort=true,
nIn=1)
"Battery is being charged";
Modelica.Blocks.Logical.LessThreshold lessThreshold(threshold=0.5);
Modelica.Blocks.Logical.GreaterEqualThreshold greaterEqualThreshold(threshold=
0.99);
Modelica_StateGraph2.Transition T3(use_conditionPort=true, use_firePort=
false);
Modelica.Blocks.Sources.BooleanExpression isDay(y=
mod(time, 86400) > 7*3600
and mod(time, 86400) <= 19*3600)
"Outputs true if it is day time";
Modelica_StateGraph2.Step discharge(
nOut=1,
initialStep=false,
use_activePort=true,
nIn=1)
"Battery is being discharged";
Modelica.Blocks.Logical.Not not1;
Modelica.Blocks.Logical.And and1;
Modelica_StateGraph2.Transition T2(
use_conditionPort=true,
delayedTransition=true,
waitTime=1);
Modelica.Blocks.Logical.And and2;
Modelica.Blocks.Logical.GreaterThreshold greaterThreshold(threshold=0.8);
Modelica.Blocks.Logical.LessEqualThreshold lessEqualThreshold(threshold=
0.01);
Modelica_StateGraph2.Transition T4(use_conditionPort=true, use_firePort=
false);
Modelica.Blocks.Math.MultiSwitch multiSwitch1(nu=3, expr={0,200e3,-400e3});
equation
connect(lessThreshold.u, SOC);
connect(greaterEqualThreshold.y, T3.conditionPort);
connect(greaterEqualThreshold.u, SOC);
connect(charge.outPort[1], T3.inPort);
connect(not1.u, isDay.y);
connect(and1.u1, not1.y);
connect(lessThreshold.y, and1.u2);
connect(and1.y, T1.conditionPort);
connect(charge.inPort[1], T1.outPort);
connect(T2.outPort, discharge.inPort[1]);
connect(isDay.y, and2.u1);
connect(greaterThreshold.u, SOC);
connect(greaterThreshold.y, and2.u2);
connect(and2.y, T2.conditionPort);
connect(lessEqualThreshold.u, SOC);
connect(lessEqualThreshold.y, T4.conditionPort);
connect(discharge.outPort[1], T4.inPort);
connect(T3.outPort, off.inPort[1]);
connect(T4.outPort, off.inPort[2]);
connect(off.outPort[1], T1.inPort);
connect(off.outPort[2], T2.inPort);
connect(off.activePort, multiSwitch1.u[1]);
connect(charge.activePort, multiSwitch1.u[2]);
connect(discharge.activePort, multiSwitch1.u[3]);
connect(y, y);
connect(multiSwitch1.y, y);
end BatteryControl;
Control unit for enabling/disabling chiller
Information
The controls for enabling/disabling chiller are as follows:
where TChi_CHWST is chiller chilled water supply temperature, TChiSet is set temperature for chilled water leaving chiller, and TDeaBan is dead band to prevent short cycling.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
Temperature | deaBan | | Dead band of temperature to prevent chiller short cycling [K] |
Connectors
Type | Name | Description |
input RealInput | chiCHWST | Chiller chilled water supply temperature (water entering chiller) [K] |
output BooleanOutput | y | Control signal for chiller. 1: Enable, 0: Disable |
input RealInput | TSet | Set temperature of chiller [K] |
Modelica definition
block ChillerSwitch
"Control unit for enabling/disabling chiller"
extends Modelica.Blocks.Icons.Block;
Modelica.Blocks.Interfaces.RealInput chiCHWST(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="deg")
"Chiller chilled water supply temperature (water entering chiller)";
Modelica.Blocks.Interfaces.BooleanOutput y
"Control signal for chiller. 1: Enable, 0: Disable";
Modelica.Blocks.Interfaces.RealInput TSet(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="deg")
"Set temperature of chiller";
parameter Modelica.SIunits.Temperature deaBan
"Dead band of temperature to prevent chiller short cycling";
Modelica.Blocks.Logical.Hysteresis hysteresis(uLow=0, uHigh=deaBan);
Modelica.Blocks.Math.Add add(k1=+1, k2=-1);
equation
connect(hysteresis.y, y);
connect(chiCHWST, add.u1);
connect(TSet, add.u2);
connect(add.y, hysteresis.u);
end ChillerSwitch;
Output y=k-u
Information
This component computes the value of
y = k - u.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
Real | k | | Sum of u and y |
Connectors
Modelica definition
A two-pieces linear piecewise function
Information
This component calcuates the output according to two piecewise linear function as
u ∈ [x0, x1]: |
y1 = y10 + u (y11-y10)/(x1-x0)
y2 = y20 |
u ∈ (x1, x2]: |
y1 = y11
y2 = y20 + (u-x1)
(y21-y20)/(x2-x1) |
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
Real | x0 | | First interval [x0, x1] |
Real | x1 | | First interval [x0, x1] and second interval (x1, x2] |
Real | x2 | | Second interval (x1, x2] |
Real | y10 | | y[1] at u = x0 |
Real | y11 | | y[1] at u = x1 |
Real | y20 | | y[2] at u = x1 |
Real | y21 | | y[2] at u = x2 |
Connectors
Type | Name | Description |
input RealInput | u | Set point |
output RealOutput | y[2] | Connectors of Real output signal |
Modelica definition
block LinearPiecewiseTwo
"A two-pieces linear piecewise function"
extends Modelica.Blocks.Icons.Block;
parameter Real x0
"First interval [x0, x1]";
parameter Real x1
"First interval [x0, x1] and second interval (x1, x2]";
parameter Real x2
"Second interval (x1, x2]";
parameter Real y10
"y[1] at u = x0";
parameter Real y11
"y[1] at u = x1";
parameter Real y20
"y[2] at u = x1";
parameter Real y21
"y[2] at u = x2";
Modelica.Blocks.Interfaces.RealInput u
"Set point";
Modelica.Blocks.Interfaces.RealOutput y[2]
"Connectors of Real output signal";
Buildings.Controls.SetPoints.Table y1Tab(table=[x0, y10; x1, y11; x2, y11])
"Tabel for y[1]";
Buildings.Controls.SetPoints.Table y2Tab(table=[x0, y20; x1, y20; x2, y21])
"Tabel for y[2]";
equation
connect(u, y1Tab.u);
connect(u, y2Tab.u);
connect(y1Tab.y, y[1]);
connect(y2Tab.y, y[2]);
end LinearPiecewiseTwo;
Count the number of actuators that have request
Information
This model counts the number of requests sent by actuators. A request is triggerred when an input singal uAct[i]
is larger than uTri
.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
Integer | nAct | | Number of actuators |
Real | uTri | | Value to trigger a request from actuator |
Connectors
Type | Name | Description |
output IntegerOutput | nInc | Number of actuators requesting control signal increase |
input RealInput | uAct[nAct] | Input signal from actuators |
Modelica definition
block RequestCounter
"Count the number of actuators that have request"
extends Modelica.Blocks.Icons.Block;
parameter Integer nAct
"Number of actuators";
parameter Real uTri
"Value to trigger a request from actuator";
Modelica.Blocks.Interfaces.IntegerOutput nInc
"Number of actuators requesting control signal increase";
Modelica.Blocks.Interfaces.RealInput uAct[nAct]
"Input signal from actuators";
algorithm
nInc := 0;
for i
in 1:nAct
loop
if uAct[i] > uTri
then
nInc := nInc + 1;
end if;
end for;
end RequestCounter;
Trim and respond logic
Information
This model implements the trim and respond logic. The model samples the outputs of actuators every tSam
.
The control sequence is as follows:
- If
u ≥ 0
, then y = y + nActInc
,
- If
u < 0
, then y = y - yDec
.
Extends from Modelica.Blocks.Interfaces.DiscreteSISO (Single Input Single Output discrete control block).
Parameters
Type | Name | Default | Description |
Time | samplePeriod | | Sample period of component [s] |
Time | startTime | 0 | First sample time instant [s] |
Real | uTri | | Value to triggering the request for actuator |
Real | yEqu0 | | y setpoint when equipment starts |
Real | yDec | | y decrement (must be negative) |
Real | yInc | | y increment (must be positive) |
Connectors
Type | Name | Description |
input RealInput | u | Continuous input signal |
output RealOutput | y | Continuous output signal |
Modelica definition
block TrimAndRespond
"Trim and respond logic"
extends Modelica.Blocks.Interfaces.DiscreteSISO;
parameter Real uTri
"Value to triggering the request for actuator";
parameter Real yEqu0
"y setpoint when equipment starts";
parameter Real yDec(max=0)
"y decrement (must be negative)";
parameter Real yInc(min=0)
"y increment (must be positive)";
Modelica.Blocks.Logical.GreaterEqualThreshold
incY(threshold=0)
"Outputs true if y needs to be increased";
Modelica.Blocks.Logical.Switch swi;
Modelica.Blocks.Discrete.Sampler sam(samplePeriod=samplePeriod)
"Sampler";
Modelica.Blocks.Sources.Constant conYDec(k=yDec)
"y decrease";
Modelica.Blocks.Sources.Constant conYInc(k=yInc)
"y increase";
Modelica.Blocks.Discrete.UnitDelay uniDel1(
y_start=yEqu0,
samplePeriod=samplePeriod,
startTime=samplePeriod);
Modelica.Blocks.Math.Add add;
Modelica.Blocks.Nonlinear.Limiter lim(uMax=1, uMin=0)
"State limiter";
equation
connect(lim.y, y);
connect(add.y, lim.u);
connect(uniDel1.y, add.u2);
connect(incY.y, swi.u2);
connect(sam.y, incY.u);
connect(lim.y, uniDel1.u);
connect(swi.y, add.u1);
connect(swi.u3, conYDec.y);
connect(conYInc.y, swi.u1);
connect(sam.u, u);
end TrimAndRespond;
Trim and respond logic
Information
This model implements a continuous time approximation to the trim and respond
control algorithm.
Extends from Modelica.Blocks.Interfaces.SISO (Single Input Single Output continuous control block).
Connectors
Type | Name | Description |
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
Modelica definition
Control unit for WSE
Information
This component decides if the WSE is set to on or off.
The WSE is enabled when
- The WSE has been disabled for at least 20 minutes, and
-
TWSE_CHWST > 0.9 TWetBul + TTowApp + TWSEApp
The WSE is disabled when
- The WSE has been enabled for at least 20 minutes, and
-
TWSE_CHWRT < 1 + TWSE_CWST
where TWSE_CHWST is the chilled water supply temperature for the WSE,
TWetBul is the wet bulb temperature, TTowApp is the cooling tower approach, TWSEApp is the approach for the WSE, TWSE_CHWRT is the chilled water return temperature for the WSE, and TWSE_CWST is the condenser water return temperature for the WSE.
Parameters
Connectors
Type | Name | Description |
input RealInput | wseCHWST | WSE chilled water supply temperature (water entering WSE) [K] |
output RealOutput | y2 | Control signal for chiller shutoff valve |
input RealInput | TWetBul | Wet bulb temperature [K] |
input RealInput | towTApp | Cooling tower approach [K] |
input RealInput | wseCWST | WSE condenser water supply temperature (water entering WSE) [K] |
output RealOutput | y1 | Control signal for WSE shutoff valve |
Modelica definition
model WSEControl
"Control unit for WSE"
parameter Modelica.SIunits.TemperatureDifference dTOff = 1
"Temperature difference to switch WSE off";
parameter Modelica.SIunits.TemperatureDifference dTW = 1
"Temperature difference that is added to WSE on guard";
Modelica.Blocks.Interfaces.RealInput wseCHWST(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="deg")
"WSE chilled water supply temperature (water entering WSE)";
Modelica.Blocks.Interfaces.RealOutput y2
"Control signal for chiller shutoff valve";
Modelica.Blocks.Interfaces.RealInput TWetBul(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="deg")
"Wet bulb temperature";
Modelica.Blocks.Interfaces.RealInput towTApp(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="deg")
"Cooling tower approach";
Modelica.Blocks.Interfaces.RealInput wseCWST(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="deg")
"WSE condenser water supply temperature (water entering WSE)";
Modelica.Blocks.Math.BooleanToReal booToRea2;
Modelica.Blocks.Interfaces.RealOutput y1
"Control signal for WSE shutoff valve";
Modelica_StateGraph2.Step off(
use_activePort=true,
nOut=1,
nIn=1,
final initialStep=true);
Modelica_StateGraph2.Transition T1(delayedTransition=true, waitTime=1200,
use_conditionPort=false,
condition=wseCHWST > 0.9*TWetBul + towTApp + dTW);
Modelica_StateGraph2.Step on(nIn=1, nOut=1,
final initialStep=false);
Modelica_StateGraph2.Transition T2(delayedTransition=true, waitTime=1200,
use_conditionPort=false,
condition=wseCHWST < wseCWST + dTOff);
Modelica.Blocks.Math.BooleanToReal booToRea1(realTrue=0, realFalse=1);
equation
connect(booToRea2.y, y2);
connect(off.outPort[1], T1.inPort);
connect(T1.outPort, on.inPort[1]);
connect(on.outPort[1], T2.inPort);
connect(T2.outPort, off.inPort[1]);
connect(off.activePort, booToRea2.u);
connect(booToRea1.y, y1);
connect(booToRea1.u, off.activePort);
end WSEControl;
Automatically generated Mon Jul 13 14:31:45 2015.