Description: "Test of components"

- Home > Modelica

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples

Test of components

### Information

This package contains examples for the use of models that can be found in Buildings.Examples.ChillerPlant.BaseClasses.Controls.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

### Package Content

Name | Description
--- | ---
BatteryControl | Test model for battery control
ChillerSetPointControl | Test model for chiller setpoint control using TrimAndResponse and LinearPieceWiseTwo
ChillerSwitch | Test model for ChillerSwitch
KMinusU | Test model for KMinusU
LinearPiecewiseTwo | Test model for LinearPiecewiseTwo
RequestCounter | Test model for RequestCounter
TrimAndRespond | Test model for TrimAndRespond
WSEControl | Test model for WSEControl

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.BatteryControl

Test model for battery control

### Information

This model simulates a battery block controller.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Modelica definition

model BatteryControl "Test model for battery control" extends Modelica.Icons.Example; Buildings.Examples.ChillerPlant.BaseClasses.Controls.BatteryControl con "Battery control"; Modelica.Blocks.Sources.Sine SOC( freqHz=1/86400, offset=0.5, amplitude=0.6) "State of charge"; equation connect(SOC.y, con.SOC); end BatteryControl;

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.ChillerSetPointControl

Test model for chiller setpoint control using TrimAndResponse and LinearPieceWiseTwo

### Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
MassFlowRate | mAir_flow_nominal | 61.6*2 | Nominal mass flow rate at fan [kg/s]
Real | COPc_nominal | 3 | Chiller COP
MassFlowRate | mCHW_flow_nominal | 15.2 | Nominal mass flow rate at chilled water [kg/s]
MassFlowRate | mCW_flow_nominal | mCHW_flow_nominal/COPc_nomin... | Nominal mass flow rate at condenser water [kg/s]
Real | QRoo | 100 |

### Modelica definition

model ChillerSetPointControl "Test model for chiller setpoint control using TrimAndResponse and LinearPieceWiseTwo" extends Modelica.Icons.Example; package Medium1 = Buildings.Media.Water; package Medium2 = Buildings.Media.Water; package MediumAir = Buildings.Media.Air "Medium model"; parameter Modelica.SIunits.MassFlowRate mAir_flow_nominal=61.6*2 "Nominal mass flow rate at fan"; parameter Real COPc_nominal=3 "Chiller COP"; parameter Modelica.SIunits.MassFlowRate mCHW_flow_nominal=15.2 "Nominal mass flow rate at chilled water"; parameter Modelica.SIunits.MassFlowRate mCW_flow_nominal=mCHW_flow_nominal/ COPc_nominal*(COPc_nominal + 1) "Nominal mass flow rate at condenser water"; parameter Real QRoo=100; Buildings.Examples.ChillerPlant.BaseClasses.Controls.TrimAndRespond triAndRes( yEqu0=0.1, uTri=0.8, yDec=-0.03, yInc=0.03, samplePeriod=120); Buildings.Examples.ChillerPlant.BaseClasses.Controls.LinearPiecewiseTwo linPieTwo( x0=0, x2=1, y20=273.15 + 12.78, y21=273.15 + 7.22, x1=0.5, y10=0.1, y11=1); Buildings.Fluid.Chillers.ElectricEIR chi( redeclare package Medium1 = Medium1, redeclare package Medium2 = Medium2, m1_flow_nominal=mCW_flow_nominal, m2_flow_nominal=mCHW_flow_nominal, dp1_nominal=6000, dp2_nominal=3000, per=Buildings.Fluid.Chillers.Data.ElectricEIR.ElectricEIRChiller_York_YK_1881kW_6_53COP_Vanes(), energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Chiller"; Buildings.Fluid.HeatExchangers.ConstantEffectiveness coi( redeclare package Medium1 = Medium2, m1_flow_nominal=mCHW_flow_nominal, dp1_nominal=3000, dp2_nominal=3000, redeclare package Medium2 = MediumAir, m2_flow_nominal=mAir_flow_nominal, eps=1.0) "Cooling coil"; Buildings.Fluid.Sources.FixedBoundary sin1(redeclare package Medium = Medium1, nPorts=1); Buildings.Fluid.Sources.MassFlowSource_T sou1( redeclare package Medium = Medium1, nPorts=1, use_T_in=false, m_flow=mCW_flow_nominal, T=283.15); Modelica.Blocks.Sources.Constant const(k=273.15 + 20); Buildings.Controls.Continuous.LimPID limPID( reverseAction=true, y_start=1, yMin=0, k=10, Ti=0.01, Td=10, initType=Modelica.Blocks.Types.InitPID.SteadyState); Buildings.Fluid.Sensors.TemperatureTwoPort TRet(redeclare package Medium = MediumAir, m_flow_nominal=999); Buildings.Fluid.Movers.FlowControlled_m_flow pum( m_flow_nominal=1.2*mCHW_flow_nominal, dp(start=40474), redeclare package Medium = Medium2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, init=Modelica.Blocks.Types.Init.InitialState) "Chilled water pump"; Buildings.Fluid.Storage.ExpansionVessel expVesChi( V_start=1, redeclare package Medium = Medium2); Modelica.Blocks.Sources.BooleanConstant booleanConstant1(k=true); Modelica.Blocks.Math.Gain gain(k=mCHW_flow_nominal); Buildings.Fluid.Sources.MassFlowSource_T sou2( use_T_in=true, redeclare package Medium = MediumAir, m_flow=mAir_flow_nominal, T=291.15, nPorts=1); Buildings.Fluid.Sources.FixedBoundary sin2(redeclare package Medium = MediumAir, nPorts=1); Modelica.Blocks.Sources.Sine sine( amplitude=5, offset=273.15 + 25, freqHz=1/20000); Modelica.Blocks.Continuous.FirstOrder firstOrder1(y_start=273.15 + 10, T=chi.tau1 /2, initType=Modelica.Blocks.Types.Init.InitialState); Buildings.Fluid.Sensors.TemperatureTwoPort TSup(redeclare package Medium = MediumAir, m_flow_nominal=999); equation connect(sou1.ports[1], chi.port_a1); connect(coi.port_a1, chi.port_b2); connect(TRet.T, limPID.u_m); connect(chi.port_a2, pum.port_b); connect(pum.port_a, coi.port_b1); connect(chi.port_a2, expVesChi.port_a); connect(booleanConstant1.y, chi.on); connect(gain.y, pum.m_flow_in); connect(sou2.T_in, sine.y); connect(chi.port_b1, sin1.ports[1]); connect(const.y, limPID.u_s); connect(TRet.port_b, coi.port_b2); connect(TRet.port_a, sin2.ports[1]); connect(linPieTwo.y[2], firstOrder1.u); connect(firstOrder1.y, chi.TSet); connect(coi.port_a2, TSup.port_a); connect(TSup.port_b, sou2.ports[1]); connect(limPID.y, triAndRes.u); connect(triAndRes.y, linPieTwo.u); connect(gain.u, linPieTwo.y[1]); end ChillerSetPointControl;

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.ChillerSwitch

Test model for ChillerSwitch

### Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Modelica definition

model ChillerSwitch "Test model for ChillerSwitch" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine TSet( freqHz=0.0002, offset=12, amplitude=8); Modelica.Blocks.Sources.Sine CHWST( freqHz=0.0001, amplitude=5, offset=15); Buildings.Examples.ChillerPlant.BaseClasses.Controls.ChillerSwitch chiSwi( deaBan(displayUnit="K") = 3); equation connect(TSet.y, chiSwi.TSet); connect(CHWST.y, chiSwi.chiCHWST); end ChillerSwitch;

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.KMinusU

Test model for KMinusU

### Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Modelica definition

model KMinusU "Test model for KMinusU" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine pulse( freqHz=0.001, amplitude=0.5, offset=0.5, phase=-1.5707963267949); Buildings.Examples.ChillerPlant.BaseClasses.Controls.KMinusU kMinU(k=1); equation connect(pulse.y, kMinU.u); end KMinusU;

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.LinearPiecewiseTwo

Test model for LinearPiecewiseTwo

### Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Modelica definition

model LinearPiecewiseTwo "Test model for LinearPiecewiseTwo" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine pulse( freqHz=0.001, amplitude=0.5, offset=0.5, phase=-1.5707963267949); Buildings.Examples.ChillerPlant.BaseClasses.Controls.LinearPiecewiseTwo linPieTwo( x0=0, x1=0.5, x2=1, y10=5, y11=15, y20=55, y21=42); equation connect(pulse.y, linPieTwo.u); end LinearPiecewiseTwo;

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.RequestCounter

Test model for RequestCounter

### Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Modelica definition

model RequestCounter "Test model for RequestCounter" extends Modelica.Icons.Example; Buildings.Examples.ChillerPlant.BaseClasses.Controls.RequestCounter reqCou( nAct=3, uTri=0.8); Modelica.Blocks.Sources.Constant act3(k=0.95); Modelica.Blocks.Sources.Pulse act1(period=10); Modelica.Blocks.Sources.Sine act2(freqHz=0.3, offset=1); equation connect(act1.y, reqCou.uAct[1]); connect(act2.y, reqCou.uAct[2]); connect(act3.y, reqCou.uAct[3]); end RequestCounter;

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.TrimAndRespond

Test model for TrimAndRespond

### Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Modelica definition

model TrimAndRespond "Test model for TrimAndRespond" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine act3(freqHz=0.002, offset=0.2); Modelica.Blocks.Sources.Pulse act1(period=500); Modelica.Blocks.Sources.Sine act2(freqHz=0.001, offset=0.3); Buildings.Examples.ChillerPlant.BaseClasses.Controls.TrimAndRespond triAndRes[3]( each uTri=0.9, each yEqu0=0.1, each yDec=-0.01, each yInc=0.02, each samplePeriod=20); equation connect(act1.y, triAndRes[1].u); connect(act2.y, triAndRes[2].u); connect(act3.y, triAndRes[3].u); end TrimAndRespond;

## Buildings.Examples.ChillerPlant.BaseClasses.Controls.Examples.WSEControl

Test model for WSEControl

### Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Modelica definition

model WSEControl "Test model for WSEControl" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Pulse wseCHWST( period=300, amplitude=15, offset=273.15 + 5) "WSE chilled water supply temperature"; Modelica.Blocks.Sources.Constant wseCWST(k=273.15 + 10) "WSE condenser water supply temperature"; Buildings.Examples.ChillerPlant.BaseClasses.Controls.WSEControl wseCon "Controller for the water-side economizer"; Modelica.Blocks.Sources.Constant TWetBub(k=273.15 + 5) "Wet bulb temperature"; Modelica.Blocks.Sources.Constant TTowApp(k=5) "Cooling tower approach"; equation connect(TWetBub.y, wseCon.TWetBul); connect(TTowApp.y, wseCon.towTApp); connect(wseCHWST.y, wseCon.wseCHWST); connect(wseCWST.y, wseCon.wseCWST); end WSEControl;