Buildings.Templates.Plants.Controls.Utilities.Validation

Collection of validation models

Information

This package contains validation models.

Package Content

Name Description
Buildings.Templates.Plants.Controls.Utilities.Validation.CountTrue CountTrue Validation model
Buildings.Templates.Plants.Controls.Utilities.Validation.FirstTrueIndex FirstTrueIndex Validation model
Buildings.Templates.Plants.Controls.Utilities.Validation.HoldReal HoldReal Validation model
Buildings.Templates.Plants.Controls.Utilities.Validation.LastTrueIndex LastTrueIndex Validation model
Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMaxInteger MultiMaxInteger  
Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMinInteger MultiMinInteger  
Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderInteger PlaceholderInteger Validation model
Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderLogical PlaceholderLogical Validation model
Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderReal PlaceholderReal Validation model
Buildings.Templates.Plants.Controls.Utilities.Validation.SortWithIndices SortWithIndices Validation model for the Sort block
Buildings.Templates.Plants.Controls.Utilities.Validation.StageIndex StageIndex  
Buildings.Templates.Plants.Controls.Utilities.Validation.TimerWithReset TimerWithReset Validation model for the Timer block
Buildings.Templates.Plants.Controls.Utilities.Validation.TrueArrayConditional TrueArrayConditional  

Buildings.Templates.Plants.Controls.Utilities.Validation.CountTrue Buildings.Templates.Plants.Controls.Utilities.Validation.CountTrue

Validation model

Buildings.Templates.Plants.Controls.Utilities.Validation.CountTrue

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.CountTrue.

Modelica definition

model CountTrue "Validation model" Utilities.FirstTrueIndex couTru(nin=6) "Return number of true elements"; Utilities.FirstTrueIndex couTruAllFal(nin=6) "Return number of true elements – All elements of input vector are false"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant conAllFal[6](k=fill(false, 6)) "Constant array"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con[6](k={false,true,false, false,true,false}) "Constant array"; equation connect(con.y, couTru.u1); connect(conAllFal.y, couTruAllFal.u1); end CountTrue;

Buildings.Templates.Plants.Controls.Utilities.Validation.FirstTrueIndex Buildings.Templates.Plants.Controls.Utilities.Validation.FirstTrueIndex

Validation model

Buildings.Templates.Plants.Controls.Utilities.Validation.FirstTrueIndex

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.FirstTrueIndex.

Modelica definition

model FirstTrueIndex "Validation model" Utilities.FirstTrueIndex idxFirTru( nin=6) "Return first true index"; Utilities.FirstTrueIndex idxFirTruAllFal(nin=6) "Return first true index – All elements of input vector are false"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant conAllFal[6](k=fill(false, 6)) "Constant array"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con[6](k={false,true, false,false,true,false}) "Constant array"; equation connect(con.y, idxFirTru.u1); connect(conAllFal.y, idxFirTruAllFal.u1); end FirstTrueIndex;

Buildings.Templates.Plants.Controls.Utilities.Validation.HoldReal Buildings.Templates.Plants.Controls.Utilities.Validation.HoldReal

Validation model

Buildings.Templates.Plants.Controls.Utilities.Validation.HoldReal

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.HoldValue.

Modelica definition

model HoldReal "Validation model" Buildings.Templates.Plants.Controls.Utilities.HoldReal hol(dtHol=0) "Hold signal – No minimum hold time"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul(width=0.2, period=30) "Source signal for hold trigger"; Buildings.Controls.OBC.CDL.Reals.Sources.Sin sin(freqHz=1/60) "Source signal for value to hold"; Buildings.Templates.Plants.Controls.Utilities.HoldReal holTim(dtHol=20) "Hold signal – With minimum hold time"; equation connect(booPul.y, hol.u1); connect(sin.y, hol.u); connect(booPul.y, holTim.u1); connect(sin.y, holTim.u); end HoldReal;

Buildings.Templates.Plants.Controls.Utilities.Validation.LastTrueIndex Buildings.Templates.Plants.Controls.Utilities.Validation.LastTrueIndex

Validation model

Buildings.Templates.Plants.Controls.Utilities.Validation.LastTrueIndex

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.FirstTrueIndex.

Modelica definition

model LastTrueIndex "Validation model" Buildings.Templates.Plants.Controls.Utilities.LastTrueIndex idxLasTru( nin=6) "Return last true index"; Buildings.Templates.Plants.Controls.Utilities.LastTrueIndex idxLasTruAllFal(nin=6) "Return last true index – All elements of input vector are false"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant conAllFal[6](k=fill(false, 6)) "Constant array"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con[6](k={false,true, false,false,true,false}) "Constant array"; equation connect(con.y, idxLasTru.u1); connect(conAllFal.y, idxLasTruAllFal.u1); end LastTrueIndex;

Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMaxInteger Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMaxInteger


Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMaxInteger

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.MultiMaxInteger.

Modelica definition

model MultiMaxInteger Buildings.Templates.Plants.Controls.Utilities.MultiMaxInteger mulMax(nin=5) "Block that outputs the maximum element of the input vector"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant con[5]( k={1, 2, 3, 4, 5}) "Constant vector"; equation connect(con.y,mulMax. u); end MultiMaxInteger;

Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMinInteger Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMinInteger


Buildings.Templates.Plants.Controls.Utilities.Validation.MultiMinInteger

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.MultiMinInteger.

Modelica definition

model MultiMinInteger Buildings.Templates.Plants.Controls.Utilities.MultiMinInteger mulMin(nin=5) "Block that outputs the minimum element of the input vector"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant con[5]( k={1, 2, 3, 4, 5}) "Constant vector"; equation connect(con.y, mulMin.u); end MultiMinInteger;

Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderInteger Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderInteger

Validation model

Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderInteger

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger.

Modelica definition

model PlaceholderInteger "Validation model" Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phPar( have_inp=false, have_inpPh=false, u_internal=1) "Placeholder parameter"; Buildings.Controls.OBC.CDL.Integers.Sources.Pulse pul(period=1) "Source signal for value to replace"; Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phInp(have_inp= false, have_inpPh=true) "Placeholder signal"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant con(k=2) "Constant"; Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger phNo( have_inp=true, have_inpPh=false, u_internal=3) "No placeholder: use input signal"; equation connect(pul.y, phNo.u); connect(con.y, phInp.uPh); connect(pul.y, phPar.u); connect(pul.y, phInp.u); end PlaceholderInteger;

Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderLogical Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderLogical

Validation model

Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderLogical

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.PlaceholderLogical.

Modelica definition

model PlaceholderLogical "Validation model" Buildings.Templates.Plants.Controls.Utilities.PlaceholderLogical phPar( have_inp=false, have_inpPh=false, u_internal=false) "Placeholder parameter"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse pul(period=1) "Source signal for value to replace"; Buildings.Templates.Plants.Controls.Utilities.PlaceholderLogical phInp(have_inp=false, have_inpPh=true) "Placeholder signal"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con(k=true) "Constant"; Buildings.Templates.Plants.Controls.Utilities.PlaceholderLogical phNo( have_inp=true, have_inpPh=false, u_internal=false) "No placeholder: use input signal"; equation connect(pul.y, phPar.u); connect(pul.y, phInp.u); connect(pul.y, phNo.u); connect(con.y, phInp.uPh); end PlaceholderLogical;

Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderReal Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderReal

Validation model

Buildings.Templates.Plants.Controls.Utilities.Validation.PlaceholderReal

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.PlaceholderReal.

Modelica definition

model PlaceholderReal "Validation model" Buildings.Templates.Plants.Controls.Utilities.PlaceholderReal phPar( have_inp=false, have_inpPh=false, u_internal=1) "Placeholder parameter"; Buildings.Controls.OBC.CDL.Reals.Sources.Pulse pul(period=1) "Source signal for value to replace"; Buildings.Templates.Plants.Controls.Utilities.PlaceholderReal phInp(have_inp=false, have_inpPh=true) "Placeholder signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant con(k=2) "Constant"; Buildings.Templates.Plants.Controls.Utilities.PlaceholderReal phNo( have_inp=true, have_inpPh=false, u_internal=1) "No placeholder: use input signal"; equation connect(pul.y, phNo.u); connect(pul.y, phPar.u); connect(pul.y, phInp.u); connect(con.y, phInp.uPh); end PlaceholderReal;

Buildings.Templates.Plants.Controls.Utilities.Validation.SortWithIndices Buildings.Templates.Plants.Controls.Utilities.Validation.SortWithIndices

Validation model for the Sort block

Buildings.Templates.Plants.Controls.Utilities.Validation.SortWithIndices

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.SortWithIndices.

The input u1 varies from -2 to +2, input u2 varies from -1 to +2, input u3 varies from +2 to -2, input u4 varies from +3 to +2, input u5 varies from 0 to +4,

Modelica definition

model SortWithIndices "Validation model for the Sort block" Buildings.Templates.Plants.Controls.Utilities.SortWithIndices sorAsc( nin=5) "Block that sorts signals in ascending order"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-1, height=3) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp3( duration=1, offset=2, height=-4) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp4( duration=1, offset=3, height=-1) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp5( duration=1, offset=0, height=4) "Block that generates ramp signal"; Buildings.Templates.Plants.Controls.Utilities.SortWithIndices sorDes( nin=5, ascending=false) "Block that sorts signals in descending order"; equation connect(ramp1.y,sorAsc.u[1]); connect(ramp2.y,sorAsc.u[2]); connect(ramp3.y,sorAsc.u[3]); connect(ramp4.y,sorAsc.u[4]); connect(ramp5.y,sorAsc.u[5]); connect(ramp1.y,sorDes.u[1]); connect(ramp2.y,sorDes.u[2]); connect(ramp3.y,sorDes.u[3]); connect(ramp4.y,sorDes.u[4]); connect(ramp5.y,sorDes.u[5]); end SortWithIndices;

Buildings.Templates.Plants.Controls.Utilities.Validation.StageIndex Buildings.Templates.Plants.Controls.Utilities.Validation.StageIndex


Buildings.Templates.Plants.Controls.Utilities.Validation.StageIndex

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.StageIndex.

Parameters

TypeNameDefaultDescription
IntegernSta4Number of stages

Modelica definition

model StageIndex parameter Integer nSta=4 "Number of stages"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse ena( width=0.9, period=160, shift=10) "Enable signal"; Buildings.Templates.Plants.Controls.Utilities.StageIndex idxSta( have_inpAva=false, final nSta=nSta) "Compute stage index - No minimum runtime, all stages available"; Buildings.Controls.OBC.CDL.Logical.Sources.SampleTrigger upPul( period=20) "Stage up command pulse"; Buildings.Controls.OBC.CDL.Logical.Sources.SampleTrigger dowPul( period=20) "Stage down command pulse"; Buildings.Templates.Plants.Controls.Utilities.StageIndex idxStaUna( final nSta=nSta) "Compute stage index - No minimum runtime, some unavailable stages"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant u1AvaSta[nSta]( k={false, false, true, true}) "Stage available signal"; Buildings.Templates.Plants.Controls.Utilities.StageIndex idxStaRun( have_inpAva=false, final nSta=nSta, dtRun=25) "Compute stage index - Minimum runtime, all stages available"; Buildings.Templates.Plants.Controls.Utilities.StageIndex idxStaRunUna( final nSta=nSta, dtRun=25) "Compute stage index - Minimum runtime, some unavailable stages"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable booTimTab( table=[ 0, 0, 0; 10, 1, 0; 70, 0, 1], period=160) "Signal to inhibit up and down commands"; Buildings.Controls.OBC.CDL.Logical.And u1Up "Stage up command"; Buildings.Controls.OBC.CDL.Logical.And u1Dow "Stage down command"; Buildings.Controls.OBC.CDL.Logical.TrueHold u1UpHol(duration=0.1) "Hold stage up command for plotting"; Buildings.Controls.OBC.CDL.Logical.TrueHold u1DowHol(duration=0.1) "Hold stage down command for plotting"; equation connect(ena.y, idxSta.u1Lea); connect(ena.y, idxStaUna.u1Lea); connect(ena.y, idxStaRun.u1Lea); connect(u1AvaSta.y, idxStaUna.u1AvaSta); connect(ena.y, idxStaRunUna.u1Lea); connect(u1AvaSta.y, idxStaRunUna.u1AvaSta); connect(upPul.y, u1Up.u2); connect(dowPul.y, u1Dow.u2); connect(booTimTab.y[2], u1Dow.u1); connect(u1Up.y, idxSta.u1Up); connect(u1Dow.y, idxSta.u1Dow); connect(u1Up.y, idxStaUna.u1Up); connect(u1Dow.y, idxStaUna.u1Dow); connect(u1Dow.y, idxStaRun.u1Dow); connect(u1Dow.y, idxStaRunUna.u1Dow); connect(u1Up.y, idxStaRun.u1Up); connect(u1Up.y, idxStaRunUna.u1Up); connect(booTimTab.y[1], u1Up.u1); connect(u1Up.y, u1UpHol.u); connect(u1Dow.y, u1DowHol.u); end StageIndex;

Buildings.Templates.Plants.Controls.Utilities.Validation.TimerWithReset Buildings.Templates.Plants.Controls.Utilities.Validation.TimerWithReset

Validation model for the Timer block

Buildings.Templates.Plants.Controls.Utilities.Validation.TimerWithReset

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.TimerWithReset.

Modelica definition

model TimerWithReset "Validation model for the Timer block" Buildings.Templates.Plants.Controls.Utilities.TimerWithReset noThr "Timer that do not compare threshold – No Reset"; Buildings.Templates.Plants.Controls.Utilities.TimerWithReset thrTim( final t=0.3) "Timer that compares threshold – No Reset"; Buildings.Templates.Plants.Controls.Utilities.TimerWithReset thrTim1( final t=0.3) "Timer that compares threshold – No Reset"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul( final width=0.7, final period=2) "Block that outputs cyclic on and off"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul1( final width=0.7, final period=2, final shift=-1) "Block that outputs cyclic on and off"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant con(k=false) "Constant"; Buildings.Templates.Plants.Controls.Utilities.TimerWithReset noThrRes "Timer that do not compare threshold – With Reset"; Buildings.Templates.Plants.Controls.Utilities.TimerWithReset thrTimRes(final t= 0.3) "Timer that compares threshold – With Reset"; Buildings.Templates.Plants.Controls.Utilities.TimerWithReset thrTim1Res(final t= 0.3) "Timer that compares threshold – With Reset"; Buildings.Controls.OBC.CDL.Logical.Sources.SampleTrigger samTri(final period=1.5, shift=1.2) "Block that generates periodic reset signal"; Buildings.Controls.OBC.CDL.Logical.TrueFalseHold res(trueHoldDuration=0.01, falseHoldDuration=0) "Hold signal for plotting"; equation connect(booPul.y,noThr.u); connect(booPul.y,thrTim.u); connect(booPul1.y,thrTim1.u); connect(con.y, noThr.reset); connect(con.y, thrTim.reset); connect(con.y, thrTim1.reset); connect(samTri.y, noThrRes.reset); connect(booPul.y, noThrRes.u); connect(booPul.y, thrTimRes.u); connect(samTri.y, thrTimRes.reset); connect(samTri.y, thrTim1Res.reset); connect(booPul1.y, thrTim1Res.u); connect(samTri.y, res.u); end TimerWithReset;

Buildings.Templates.Plants.Controls.Utilities.Validation.TrueArrayConditional Buildings.Templates.Plants.Controls.Utilities.Validation.TrueArrayConditional


Buildings.Templates.Plants.Controls.Utilities.Validation.TrueArrayConditional

Information

Validation model for the block Buildings.Templates.Plants.Controls.Utilities.TrueArrayConditional.

Modelica definition

model TrueArrayConditional Buildings.Templates.Plants.Controls.Utilities.TrueArrayConditional truArrConSam(nin=2) "Array with true elements and same size as input vector"; Buildings.Controls.OBC.CDL.Integers.Sources.Pulse uIdx1( amplitude=1, period=4, shift=1.5) "Source signal for index of first true element"; Buildings.Controls.OBC.CDL.Integers.Sources.Pulse uIdx2( amplitude=1, period=2.5, offset=2) "Source signal for index of second true element"; Buildings.Controls.OBC.CDL.Integers.Sources.TimeTable uTru(table=[0,0; 1,1; 2, 2], period=4) "Source signal for number of true elements"; Buildings.Templates.Plants.Controls.Utilities.TrueArrayConditional truArrConGre(nout=4, nin=2) "Array with true elements and size greater than input vector"; equation connect(uTru.y[1], truArrConSam.u); connect(uIdx1.y, truArrConSam.uIdx[1]); connect(uTru.y[1], truArrConGre.u); connect(uIdx1.y, truArrConGre.uIdx[1]); connect(uIdx2.y, truArrConSam.uIdx[2]); connect(uIdx2.y, truArrConGre.uIdx[2]); end TrueArrayConditional;