All control blocks that form the control sequence of a system are instantiated
into one single class, a so-called control section.
This package contains such control sections for heat pump plant models.
The control sequence requires the following external input points in
addition to those already included in the HP plant template.
model AirToWater
extends Buildings.Templates.Plants.HeatPumps.Components.Interfaces.PartialController
(
final typ=Buildings.Templates.Plants.HeatPumps.Types.Controller.AirToWater);
final parameter Real staEqu[:, nHp](
each final max=1,
each final min=0,
each final unit="1")=dat.staEqu
;
final parameter Integer nSta(
final min=1)=
size(staEqu, 1)
;
final parameter Integer nEquAlt(
final min=0)=
max({
sum({(
if staEqu[i, j] > 0
and staEqu[i, j] < 1
then 1
else 0)
for j
in 1:nHp})
for i
in 1:nSta})
;
final parameter Integer idxEquAlt[nEquAlt]=
Modelica.Math.BooleanVectors.index(
{
Modelica.Math.BooleanVectors.anyTrue({staEqu[i,j] > 0
and staEqu[i,j] < 1
for i
in 1:nSta})
for j
in 1:nHp})
;
Buildings.Templates.Plants.Controls.HeatPumps.AirToWater ctl(
final TChiWatSupSet_max=dat.TChiWatSupSet_max,
final TChiWatSup_nominal=dat.TChiWatSup_nominal,
final THeaWatSupSet_min=dat.THeaWatSupSet_min,
final THeaWatSup_nominal=dat.THeaWatSup_nominal,
final TOutChiWatLck=dat.TOutChiWatLck,
final TOutHeaWatLck=dat.TOutHeaWatLck,
final VChiWatSec_flow_nominal=dat.VChiWatSec_flow_nominal,
final VHeaWatSec_flow_nominal=dat.VHeaWatSec_flow_nominal,
final capCooHp_nominal=
fill(dat.capCooHp_nominal, cfg.nHp),
final capHeaHp_nominal=
fill(dat.capHeaHp_nominal, cfg.nHp),
final cp_default=
if cfg.have_heaWat
then cfg.cpHeaWat_default
else cfg.cpChiWat_default,
final dpChiWatRemSet_max=dat.dpChiWatRemSet_max,
final dpChiWatRemSet_min=dat.dpChiWatRemSet_min,
final dpHeaWatRemSet_max=dat.dpHeaWatRemSet_max,
final dpHeaWatRemSet_min=dat.dpHeaWatRemSet_min,
final have_chiWat=cfg.have_chiWat,
final have_heaWat=cfg.have_heaWat,
final have_inpSch=have_inpSch,
final have_pumChiWatPriDed_select=cfg.have_pumChiWatPriDed,
final have_pumChiWatSec_select=cfg.typPumChiWatSec==Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized,
final have_pumHeaWatSec_select=cfg.typPumHeaWatSec==Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized,
final have_pumPriHdr=cfg.typArrPumPri==Buildings.Templates.Components.Types.PumpArrangement.Headered,
final have_pumHeaWatPriVar=cfg.have_pumHeaWatPriVar,
final have_pumChiWatPriVar=cfg.have_pumChiWatPriVar,
final have_senDpChiWatRemWir=cfg.have_senDpChiWatRemWir,
final have_senDpHeaWatRemWir=cfg.have_senDpHeaWatRemWir,
final have_senTChiWatPriRet_select=have_senTChiWatPriRet_select,
final have_senTChiWatSecRet=have_senTChiWatSecRet,
final have_senTHeaWatPriRet_select=have_senTHeaWatPriRet_select,
final have_senTHeaWatSecRet=have_senTHeaWatSecRet,
final have_senVChiWatPri_select=have_senVChiWatPri_select,
final have_senVHeaWatPri_select=have_senVHeaWatPri_select,
final have_valHpInlIso=cfg.have_valHpInlIso,
final have_valHpOutIso=cfg.have_valHpOutIso,
final idxEquAlt=idxEquAlt,
final nHp=cfg.nHp,
final nPumChiWatPri=cfg.nPumChiWatPri,
final nPumChiWatSec=cfg.nPumChiWatSec,
final nPumHeaWatPri=cfg.nPumHeaWatPri,
final nPumHeaWatSec=cfg.nPumHeaWatSec,
final nSenDpChiWatRem=nSenDpChiWatRem,
final nSenDpHeaWatRem=nSenDpHeaWatRem,
final plrSta=dat.plrSta,
final rho_default=
if cfg.have_heaWat
then cfg.rhoHeaWat_default
else cfg.rhoChiWat_default,
final schCoo=dat.schCoo,
final schHea=dat.schHea,
final staEqu=dat.staEqu,
final yPumChiWatPriSet=dat.yPumChiWatPriSet,
final yPumHeaWatPriSet=dat.yPumHeaWatPriSet)
;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqPlaHeaWatAirHan(
final nin=nAirHan)
if cfg.have_heaWat ;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqPlaHeaWatEquZon(
final nin=nEquZon)
if cfg.have_heaWat
;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqResHeaWatAirHan(nin=1)
if cfg.have_heaWat ;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqResHeaWatEquZon(
final nin=nEquZon)
if cfg.have_heaWat
;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqResChiWatAirHan(
final nin=
nAirHan)
if cfg.have_chiWat ;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqPlaChiWatEquZon(
final nin=
nEquZon)
if cfg.have_chiWat
;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqResChiWatEquZon(
final nin=
nEquZon)
if cfg.have_chiWat
;
Buildings.Controls.OBC.CDL.Integers.MultiSum reqPlaChiWatAirHan(
final nin=
nAirHan)
if cfg.have_chiWat ;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqPlaHeaWatAirHan(
final have_inp=cfg.have_heaWat,
final u_internal=0)
;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqPlaChiWatAirHan(
final
have_inp=cfg.have_chiWat,
final u_internal=0)
;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqResHeaWatAirHan(
final
have_inp=cfg.have_heaWat,
final u_internal=0)
;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqResChiWatAirHan(
final
have_inp=cfg.have_chiWat,
final u_internal=0)
;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqPlaHeaWatEquZon(
final
have_inp=cfg.have_heaWat,
final u_internal=0)
;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqPlaChiWatEquZon(
final
have_inp=cfg.have_chiWat,
final u_internal=0)
;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqResHeaWatEquZon(
final
have_inp=cfg.have_heaWat,
final u_internal=0)
;
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phReqResChiWatEquZon(
final
have_inp=cfg.have_chiWat,
final u_internal=0)
;
Buildings.Controls.OBC.CDL.Integers.Add reqPlaHeaWat
;
Buildings.Controls.OBC.CDL.Integers.Add reqPlaChiWat
;
Buildings.Controls.OBC.CDL.Integers.Add reqResHeaWat
;
Buildings.Controls.OBC.CDL.Integers.Add reqResChiWat
;
equation
connect(bus.TChiWatPriRet, ctl.TChiWatPriRet);
connect(bus.TChiWatPriSup, ctl.TChiWatPriSup);
connect(bus.TChiWatSecRet, ctl.TChiWatSecRet);
connect(bus.TChiWatSecSup, ctl.TChiWatSecSup);
connect(bus.THeaWatPriRet, ctl.THeaWatPriRet);
connect(bus.THeaWatPriSup, ctl.THeaWatPriSup);
connect(bus.THeaWatSecRet, ctl.THeaWatSecRet);
connect(bus.THeaWatSecSup, ctl.THeaWatSecSup);
connect(bus.TOut, ctl.TOut);
connect(bus.VChiWatPri_flow, ctl.VChiWatPri_flow);
connect(bus.VChiWatSec_flow, ctl.VChiWatSec_flow);
connect(bus.VHeaWatPri_flow, ctl.VHeaWatPri_flow);
connect(bus.VHeaWatSec_flow, ctl.VHeaWatSec_flow);
connect(bus.dpChiWatLoc, ctl.dpChiWatLoc);
connect(bus.dpChiWatLocSet, ctl.dpChiWatLocSet);
connect(bus.dpChiWatRem, ctl.dpChiWatRem);
connect(bus.dpHeaWatLoc, ctl.dpHeaWatLoc);
connect(bus.dpHeaWatLocSet, ctl.dpHeaWatLocSet);
connect(bus.dpHeaWatRem, ctl.dpHeaWatRem);
connect(busHp.y1_actual, ctl.u1Hp_actual);
connect(busPumChiWatPri.y1_actual, ctl.u1PumChiWatPri_actual);
connect(busPumChiWatSec.y1_actual, ctl.u1PumChiWatSec_actual);
connect(busPumHeaWatPri.y1_actual, ctl.u1PumHeaWatPri_actual);
connect(busPumHeaWatSec.y1_actual, ctl.u1PumHeaWatSec_actual);
connect(bus.u1SchCoo, ctl.u1SchCoo);
connect(bus.u1SchHea, ctl.u1SchHea);
connect(ctl.TSupSet, busHp.TSet);
connect(ctl.TChiWatSupSet, bus.TChiWatSupSet);
connect(ctl.THeaWatSupSet, bus.THeaWatSupSet);
connect(ctl.dpChiWatRemSet, bus.dpChiWatRemSet);
connect(ctl.dpHeaWatRemSet, bus.dpHeaWatRemSet);
connect(ctl.y1HeaHp, busHp.y1Hea);
connect(ctl.y1Hp, busHp.y1);
connect(ctl.y1PumChiWatPri, busPumChiWatPri.y1);
connect(ctl.y1PumChiWatSec, busPumChiWatSec.y1);
connect(ctl.y1PumHeaWatPri, busPumHeaWatPri.y1);
connect(ctl.y1PumHeaWatSec, busPumHeaWatSec.y1);
connect(ctl.y1ValChiWatHpInlIso, busValChiWatHpInlIso.y1);
connect(ctl.y1ValChiWatHpOutIso, busValChiWatHpOutIso.y1);
connect(ctl.y1ValHeaWatHpInlIso, busValHeaWatHpInlIso.y1);
connect(ctl.y1ValHeaWatHpOutIso, busValHeaWatHpOutIso.y1);
connect(ctl.yPumChiWatPriDed, busPumChiWatPri.y);
connect(ctl.yPumChiWatPriHdr, busPumChiWatPri.y);
connect(ctl.yPumChiWatSec, busPumChiWatSec.y);
connect(ctl.yPumHeaWatPriDed, busPumHeaWatPri.y);
connect(ctl.yPumHeaWatPriHdr, busPumHeaWatPri.y);
connect(ctl.yPumHeaWatSec, busPumHeaWatSec.y);
connect(busAirHan.reqResChiWat, reqResChiWatAirHan.u);
connect(busEquZon.reqPlaHeaWat, reqPlaHeaWatEquZon.u);
connect(busEquZon.reqResHeaWat, reqResHeaWatEquZon.u);
connect(busEquZon.reqPlaChiWat, reqPlaChiWatEquZon.u);
connect(busEquZon.reqResChiWat, reqResChiWatEquZon.u);
connect(busAirHan.reqPlaChiWat, reqPlaChiWatAirHan.u);
connect(busAirHan.reqPlaHeaWat, reqPlaHeaWatAirHan.u);
connect(busAirHan.reqResHeaWat, reqResHeaWatAirHan.u[1:1]);
connect(reqPlaHeaWatAirHan.y, phReqPlaHeaWatAirHan.u);
connect(reqPlaChiWatAirHan.y, phReqPlaChiWatAirHan.u);
connect(reqResHeaWatAirHan.y, phReqResHeaWatAirHan.u);
connect(reqResChiWatAirHan.y, phReqResChiWatAirHan.u);
connect(reqPlaHeaWatEquZon.y, phReqPlaHeaWatEquZon.u);
connect(reqPlaChiWatEquZon.y, phReqPlaChiWatEquZon.u);
connect(reqResChiWatEquZon.y, phReqResChiWatEquZon.u);
connect(reqResHeaWatEquZon.y, phReqResHeaWatEquZon.u);
connect(phReqPlaHeaWatAirHan.y, reqPlaHeaWat.u1);
connect(phReqPlaHeaWatEquZon.y, reqPlaHeaWat.u2);
connect(phReqPlaChiWatAirHan.y, reqPlaChiWat.u1);
connect(phReqPlaChiWatEquZon.y, reqPlaChiWat.u2);
connect(phReqResHeaWatAirHan.y, reqResHeaWat.u1);
connect(phReqResChiWatAirHan.y, reqResChiWat.u1);
connect(phReqResHeaWatEquZon.y, reqResHeaWat.u2);
connect(phReqResChiWatEquZon.y, reqResChiWat.u2);
connect(reqPlaHeaWat.y, ctl.nReqPlaHeaWat);
connect(reqPlaChiWat.y, ctl.nReqPlaChiWat);
connect(reqResHeaWat.y,ctl.nReqResHeaWat);
connect(reqResChiWat.y,ctl.nReqResChiWat);
end AirToWater;
block OpenLoop
extends Buildings.Templates.Plants.HeatPumps.Components.Interfaces.PartialController
(
final typ=Buildings.Templates.Plants.HeatPumps.Types.Controller.OpenLoop);
Buildings.Controls.OBC.CDL.Reals.Sources.Constant THeaWatSupSet[nHp](
y(
each final unit="K",
each displayUnit="degC"),
each k=Buildings.Templates.Data.Defaults.THeaWatSupMed)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TChiWatSupSet[nHp](
y(
each final unit="K",
each displayUnit="degC"),
each k=Buildings.Templates.Data.Defaults.TChiWatSup)
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1ValHeaWatHpInlIso[nHp](
each table=[
0, 0;
1, 1;
3, 0;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.have_heaWat
and cfg.have_valHpInlIso
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1ValHeaWatHpOutIso[nHp](
each table=[
0, 0;
1, 1;
3, 0;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.have_heaWat
and cfg.have_valHpOutIso
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1ValChiWatHpInlIso[nHp](
each table=[
0, 0;
3.1, 1;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.have_chiWat
and cfg.have_valHpInlIso
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1ValChiWatHpOutIso[nHp](
each table=[
0, 0;
3.1, 1;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.have_chiWat
and cfg.have_valHpOutIso
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1Hp[nHp](
each table=[
0, 0;
1, 0;
1, 1;
5, 1],
each timeScale=1000,
each period=5000)
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1HeaHp[nHp](
each table=[
0, 1;
3, 0;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.is_rev
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1PumHeaWatPri[cfg.nPumHeaWatPri](
each table=
if cfg.have_pumChiWatPriDed
or not cfg.have_chiWat
then
[
0, 0;
1, 1;
3, 0;
5, 0]
else
[
0, 0;
1, 1;
3, 0;
3.1, 1;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.have_heaWat
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1PumChiWatPri[cfg.nPumChiWatPri](
each table=[
0, 0;
3.1, 1;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.have_pumChiWatPriDed
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1PumHeaWatSec[cfg.nPumHeaWatSec](
each table=[
0, 0;
1, 1;
3, 0;
5, 0],
each timeScale=1000,
each period=5000)
if cfg.typPumHeaWatSec <> Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.None
;
Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable y1PumChiWatSec[cfg.nPumChiWatSec](
each table=[
0, 0;
3, 1;
5, 1],
each timeScale=1000,
each period=5000)
if cfg.typPumChiWatSec <> Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.None
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant yPumHeaWatSec(
k=1)
if cfg.typPumHeaWatSec <> Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.None
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant yPumChiWatSec(
k=1)
if cfg.typPumChiWatSec <> Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.None
;
Buildings.Controls.OBC.CDL.Reals.Switch TSet[nHp](
y(
each final unit="K",
each displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Logical.Sources.Constant tru[nHp](
each final k=true)
if not cfg.is_rev
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant yPumHeaWatPriHdr(k=1)
if cfg.have_heaWat
and cfg.have_pumHeaWatPriVar
and
cfg.typArrPumPri==Buildings.Templates.Components.Types.PumpArrangement.Headered
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant yPumChiWatPriHdr(k=1)
if cfg.have_chiWat
and cfg.have_pumHeaWatPriVar
and
cfg.typArrPumPri==Buildings.Templates.Components.Types.PumpArrangement.Headered
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant yPumHeaWatPriDed[cfg.nPumHeaWatPri](
each k=1)
if cfg.have_heaWat
and cfg.have_pumHeaWatPriVar
and
cfg.typArrPumPri==Buildings.Templates.Components.Types.PumpArrangement.Dedicated
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant yPumChiWatPriDed[cfg.nPumChiWatPri](
each k=1)
if cfg.have_pumChiWatPriDed
and cfg.have_pumHeaWatPriVar
;
equation
connect(y1PumHeaWatPri.y[1], busPumHeaWatPri.y1);
connect(yPumHeaWatPriHdr.y, busPumHeaWatPri.y);
connect(yPumHeaWatPriDed.y, busPumHeaWatPri.y);
connect(y1PumHeaWatSec.y[1], busPumHeaWatSec.y1);
connect(yPumHeaWatSec.y, busPumHeaWatSec.y);
connect(y1ValHeaWatHpInlIso.y[1], busValHeaWatHpInlIso.y1);
connect(y1ValHeaWatHpOutIso.y[1], busValHeaWatHpOutIso.y1);
connect(yPumChiWatSec.y, busPumChiWatSec.y);
connect(y1ValChiWatHpOutIso.y[1], busValChiWatHpOutIso.y1);
connect(y1PumChiWatPri.y[1], busPumChiWatPri.y1);
connect(yPumChiWatPriHdr.y, busPumChiWatPri.y);
connect(yPumChiWatPriDed.y, busPumChiWatPri.y);
connect(y1ValChiWatHpInlIso.y[1], busValChiWatHpInlIso.y1);
connect(y1PumChiWatSec.y[1], busPumChiWatSec.y1);
connect(y1Hp.y[1], busHp.y1);
connect(y1HeaHp.y[1], busHp.y1Hea);
connect(TSet.y, busHp.TSet);
connect(TChiWatSupSet.y, TSet.u3);
connect(THeaWatSupSet.y, TSet.u1);
connect(y1HeaHp.y[1], TSet.u2);
connect(tru.y, TSet.u2);
end OpenLoop;