Buildings.Controls.OBC.CDL.Integers.Validation

Collection of models that validate the integer blocks of the CDL

Information

This package contains models that validate the blocks in Buildings.Controls.OBC.CDL.Integers.

The examples plot various outputs, which have been verified against analytical solutions. These model outputs are stored as reference data to allow continuous validation whenever models in the library change.

Package Content

Name Description
Buildings.Controls.OBC.CDL.Integers.Validation.Abs Abs Validation model for the absolute block
Buildings.Controls.OBC.CDL.Integers.Validation.Add Add Validation model for the Add block
Buildings.Controls.OBC.CDL.Integers.Validation.AddParameter AddParameter Validation model for the AddParameter block
Buildings.Controls.OBC.CDL.Integers.Validation.Change Change Validation model for the Change block
Buildings.Controls.OBC.CDL.Integers.Validation.Equal Equal Validation model for the Equal block
Buildings.Controls.OBC.CDL.Integers.Validation.Greater Greater Validation model for the Greater block
Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqual GreaterEqual Validation model for the GreaterEqual block
Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqualThreshold GreaterEqualThreshold Validation model for the GreaterEqualThreshold block
Buildings.Controls.OBC.CDL.Integers.Validation.GreaterThreshold GreaterThreshold Validation model for the GreaterThreshold block
Buildings.Controls.OBC.CDL.Integers.Validation.Less Less Validation model for the Less block
Buildings.Controls.OBC.CDL.Integers.Validation.LessEqual LessEqual Validation model for the LessEqual block
Buildings.Controls.OBC.CDL.Integers.Validation.LessEqualThreshold LessEqualThreshold Validation model for the LessEqualThreshold block
Buildings.Controls.OBC.CDL.Integers.Validation.LessThreshold LessThreshold Validation model for the LessThreshold block
Buildings.Controls.OBC.CDL.Integers.Validation.Max Max Validation model for the Max block
Buildings.Controls.OBC.CDL.Integers.Validation.Min Min Validation model for the Min block
Buildings.Controls.OBC.CDL.Integers.Validation.MultiSum MultiSum Validation model for the block to find sum of multiple inputs
Buildings.Controls.OBC.CDL.Integers.Validation.Multiply Multiply Validation model for the Multiply block
Buildings.Controls.OBC.CDL.Integers.Validation.OnCounter OnCounter Validation model for the OnCounter block
Buildings.Controls.OBC.CDL.Integers.Validation.Stage Stage Validation model for the block to find the total number of enabled stages
Buildings.Controls.OBC.CDL.Integers.Validation.Subtract Subtract Validation model for the Subtract block
Buildings.Controls.OBC.CDL.Integers.Validation.Switch Switch Validation model for the Switch block

Buildings.Controls.OBC.CDL.Integers.Validation.Abs Buildings.Controls.OBC.CDL.Integers.Validation.Abs

Validation model for the absolute block

Buildings.Controls.OBC.CDL.Integers.Validation.Abs

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Abs.

Modelica definition

model Abs "Validation model for the absolute block" Buildings.Controls.OBC.CDL.Integers.Abs abs1 "Block that outputs the absolute value of the input"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,abs1.u); end Abs;

Buildings.Controls.OBC.CDL.Integers.Validation.Add Buildings.Controls.OBC.CDL.Integers.Validation.Add

Validation model for the Add block

Buildings.Controls.OBC.CDL.Integers.Validation.Add

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Add.

Modelica definition

model Add "Validation model for the Add block" Buildings.Controls.OBC.CDL.Integers.Add add1 "Block that outputs the sum of the two inputs"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-0.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round2( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(ramp2.y,round2.u); connect(round2.y,reaToInt1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,add1.u1); connect(reaToInt1.y,add1.u2); end Add;

Buildings.Controls.OBC.CDL.Integers.Validation.AddParameter Buildings.Controls.OBC.CDL.Integers.Validation.AddParameter

Validation model for the AddParameter block

Buildings.Controls.OBC.CDL.Integers.Validation.AddParameter

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.AddParameter.

Modelica definition

model AddParameter "Validation model for the AddParameter block" Buildings.Controls.OBC.CDL.Integers.AddParameter addPar(p=5) "Block that outputs the sum of an input plus a parameter"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Round round1(n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y, addPar.u); end AddParameter;

Buildings.Controls.OBC.CDL.Integers.Validation.Change Buildings.Controls.OBC.CDL.Integers.Validation.Change

Validation model for the Change block

Buildings.Controls.OBC.CDL.Integers.Validation.Change

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Change.

Modelica definition

model Change "Validation model for the Change block" Buildings.Controls.OBC.CDL.Integers.Change cha "Check if the integer input changes value"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( offset=0, height=20, duration=1) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler changeSampler "Triggered sampler"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,-1; 0.3,0.5; 0.5,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler increaseSampler "Increase sampler"; Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler decreaseSampler "Decrease sampler"; equation connect(ramp2.y,changeSampler.u); connect(timTabLin.y[1],reaToInt.u); connect(reaToInt.y,cha.u); connect(ramp2.y,increaseSampler.u); connect(ramp2.y,decreaseSampler.u); connect(cha.up,increaseSampler.trigger); connect(cha.y,changeSampler.trigger); connect(cha.down,decreaseSampler.trigger); end Change;

Buildings.Controls.OBC.CDL.Integers.Validation.Equal Buildings.Controls.OBC.CDL.Integers.Validation.Equal

Validation model for the Equal block

Buildings.Controls.OBC.CDL.Integers.Validation.Equal

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Equal.

Modelica definition

model Equal "Validation model for the Equal block" Buildings.Controls.OBC.CDL.Integers.Equal intEqu "Block output true if input 1 is equal to input 2"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,0; 0.3,1; 0.5,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin1( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,0; 0.35,1; 0.55,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; equation connect(reaToInt.y,intEqu.u1); connect(reaToInt1.y,intEqu.u2); connect(timTabLin.y[1],reaToInt.u); connect(timTabLin1.y[1],reaToInt1.u); end Equal;

Buildings.Controls.OBC.CDL.Integers.Validation.Greater Buildings.Controls.OBC.CDL.Integers.Validation.Greater

Validation model for the Greater block

Buildings.Controls.OBC.CDL.Integers.Validation.Greater

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Greater.

Modelica definition

model Greater "Validation model for the Greater block" Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-1.5, height=5.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Integers.Greater intGre "Block output true if input 1 is greater than input 2"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round2( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(ramp2.y,round2.u); connect(round1.y,reaToInt.u); connect(round2.y,reaToInt1.u); connect(reaToInt.y,intGre.u1); connect(reaToInt1.y,intGre.u2); end Greater;

Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqual Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqual

Validation model for the GreaterEqual block

Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqual

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.GreaterEqual.

Modelica definition

model GreaterEqual "Validation model for the GreaterEqual block" Buildings.Controls.OBC.CDL.Integers.GreaterEqual intGreEqu "Block output true if input 1 is greater or equal to input 2"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,-1; 0.3,0.5; 0.5,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin1( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,0; 0.35,1; 0.55,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; equation connect(reaToInt.y,intGreEqu.u1); connect(reaToInt1.y,intGreEqu.u2); connect(timTabLin.y[1],reaToInt.u); connect(timTabLin1.y[1],reaToInt1.u); end GreaterEqual;

Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqualThreshold Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqualThreshold

Validation model for the GreaterEqualThreshold block

Buildings.Controls.OBC.CDL.Integers.Validation.GreaterEqualThreshold

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold.

Modelica definition

model GreaterEqualThreshold "Validation model for the GreaterEqualThreshold block" Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold intGreEquThr( t=2) "Block output true if input is greater or equal to threshold value"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,intGreEquThr.u); end GreaterEqualThreshold;

Buildings.Controls.OBC.CDL.Integers.Validation.GreaterThreshold Buildings.Controls.OBC.CDL.Integers.Validation.GreaterThreshold

Validation model for the GreaterThreshold block

Buildings.Controls.OBC.CDL.Integers.Validation.GreaterThreshold

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.GreaterThreshold.

Modelica definition

model GreaterThreshold "Validation model for the GreaterThreshold block" Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Integers.GreaterThreshold intGreThr( t=2) "Block output true if input is greater than threshold value"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,intGreThr.u); end GreaterThreshold;

Buildings.Controls.OBC.CDL.Integers.Validation.Less Buildings.Controls.OBC.CDL.Integers.Validation.Less

Validation model for the Less block

Buildings.Controls.OBC.CDL.Integers.Validation.Less

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Less.

Modelica definition

model Less "Validation model for the Less block" Buildings.Controls.OBC.CDL.Integers.Less intLes "Block output true if input 1 is less than input 2"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,-1; 0.3,0.5; 0.5,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin1( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,0; 0.35,1; 0.55,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; equation connect(reaToInt1.y,intLes.u2); connect(reaToInt.y,intLes.u1); connect(timTabLin.y[1],reaToInt.u); connect(timTabLin1.y[1],reaToInt1.u); end Less;

Buildings.Controls.OBC.CDL.Integers.Validation.LessEqual Buildings.Controls.OBC.CDL.Integers.Validation.LessEqual

Validation model for the LessEqual block

Buildings.Controls.OBC.CDL.Integers.Validation.LessEqual

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.LessEqual.

Modelica definition

model LessEqual "Validation model for the LessEqual block" Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-1.5, height=5.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Integers.LessEqual intLesEqu "Block output true if input 1 is less or equal to input 2"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round2( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(ramp2.y,round2.u); connect(round1.y,reaToInt.u); connect(round2.y,reaToInt1.u); connect(reaToInt1.y,intLesEqu.u2); connect(reaToInt.y,intLesEqu.u1); end LessEqual;

Buildings.Controls.OBC.CDL.Integers.Validation.LessEqualThreshold Buildings.Controls.OBC.CDL.Integers.Validation.LessEqualThreshold

Validation model for the LessEqualThreshold block

Buildings.Controls.OBC.CDL.Integers.Validation.LessEqualThreshold

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.LessEqualThreshold.

Modelica definition

model LessEqualThreshold "Validation model for the LessEqualThreshold block" Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Integers.LessEqualThreshold intLesEquThr( t=2) "Block output true if input is less or equal to threshold value"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,intLesEquThr.u); end LessEqualThreshold;

Buildings.Controls.OBC.CDL.Integers.Validation.LessThreshold Buildings.Controls.OBC.CDL.Integers.Validation.LessThreshold

Validation model for the LessThreshold block

Buildings.Controls.OBC.CDL.Integers.Validation.LessThreshold

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.LessThreshold.

Modelica definition

model LessThreshold "Validation model for the LessThreshold block" Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Integers.LessThreshold intLesThr( t=2) "Block output true if input is less than threshold value"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,intLesThr.u); end LessThreshold;

Buildings.Controls.OBC.CDL.Integers.Validation.Max Buildings.Controls.OBC.CDL.Integers.Validation.Max

Validation model for the Max block

Buildings.Controls.OBC.CDL.Integers.Validation.Max

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Max.

Modelica definition

model Max "Validation model for the Max block" Buildings.Controls.OBC.CDL.Integers.Max max1 "Block that outputs the largest inputs"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-1.5, height=5.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round2( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(ramp2.y,round2.u); connect(round2.y,reaToInt1.u); connect(reaToInt1.y,max1.u2); connect(reaToInt.y,max1.u1); end Max;

Buildings.Controls.OBC.CDL.Integers.Validation.Min Buildings.Controls.OBC.CDL.Integers.Validation.Min

Validation model for the Min block

Buildings.Controls.OBC.CDL.Integers.Validation.Min

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Min.

Modelica definition

model Min "Validation model for the Min block" Buildings.Controls.OBC.CDL.Integers.Min min1 "Block that outputs the smallest inputs"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=10.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-1.5, height=5.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round2( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,min1.u1); connect(ramp2.y,round2.u); connect(round2.y,reaToInt1.u); connect(reaToInt1.y,min1.u2); end Min;

Buildings.Controls.OBC.CDL.Integers.Validation.MultiSum Buildings.Controls.OBC.CDL.Integers.Validation.MultiSum

Validation model for the block to find sum of multiple inputs

Buildings.Controls.OBC.CDL.Integers.Validation.MultiSum

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.MultiSum.

Modelica definition

model MultiSum "Validation model for the block to find sum of multiple inputs" Buildings.Controls.OBC.CDL.Integers.MultiSum add1( nin=3) "Block that outputs the sum of the inputs"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-0.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp3( duration=1, height=7.0, offset=-1.5) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round2( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round3( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt2 "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(ramp2.y,round2.u); connect(ramp3.y,round3.u); connect(round3.y,reaToInt2.u); connect(round2.y,reaToInt1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y,add1.u[1]); connect(reaToInt1.y,add1.u[2]); connect(reaToInt2.y,add1.u[3]); end MultiSum;

Buildings.Controls.OBC.CDL.Integers.Validation.Multiply Buildings.Controls.OBC.CDL.Integers.Validation.Multiply

Validation model for the Multiply block

Buildings.Controls.OBC.CDL.Integers.Validation.Multiply

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Multiply.

Modelica definition

model Multiply "Validation model for the Multiply block" Buildings.Controls.OBC.CDL.Integers.Multiply product "Block that outputs the product of the two inputs"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt2 "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,-1; 0.3,0.5; 0.5,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable timTabLin1( smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, table=[ 0,0; 0.35,1; 0.55,0; 0.7,1; 1,0]) "Time table with smoothness method of constant segments"; equation connect(reaToInt1.y,product.u1); connect(reaToInt2.y,product.u2); connect(timTabLin.y[1],reaToInt1.u); connect(timTabLin1.y[1],reaToInt2.u); end Multiply;

Buildings.Controls.OBC.CDL.Integers.Validation.OnCounter Buildings.Controls.OBC.CDL.Integers.Validation.OnCounter

Validation model for the OnCounter block

Buildings.Controls.OBC.CDL.Integers.Validation.OnCounter

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.OnCounter.

Modelica definition

model OnCounter "Validation model for the OnCounter block" Buildings.Controls.OBC.CDL.Integers.OnCounter onCounter "Block that outputs increment if the input switches to true"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul( width=0.5, period=0.1) "Block that outputs cyclic on and off"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse reset( width=0.5, period=1.0) "Block that outputs cyclic on and off"; equation connect(reset.y,onCounter.reset); connect(booPul.y,onCounter.trigger); end OnCounter;

Buildings.Controls.OBC.CDL.Integers.Validation.Stage Buildings.Controls.OBC.CDL.Integers.Validation.Stage

Validation model for the block to find the total number of enabled stages

Buildings.Controls.OBC.CDL.Integers.Validation.Stage

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Stage.

The instances use different values for the duration time during which the output is held constant.

Modelica definition

model Stage "Validation model for the block to find the total number of enabled stages" Buildings.Controls.OBC.CDL.Integers.Stage sta( final n=4, final holdDuration=5) "Total number of enabled stages, with a hold duration of 5 seconds"; Buildings.Controls.OBC.CDL.Integers.Stage zerHolTim( final n=4, final holdDuration=0) "Total number of enabled stages, without any hold duration"; Buildings.Controls.OBC.CDL.Integers.Stage sta1( final n=4, final holdDuration=2) "Total number of enabled stages, with a hold duration of 2 seconds"; Buildings.Controls.OBC.CDL.Integers.Stage lesHolTim( final n=4, final holdDuration=1) "Total number of enabled stages, with a hold duration of 1 second"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( final duration=10, final height=1, final startTime=1) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Sin sin( final amplitude=0.5, final freqHz=1/5, final offset=0.5) "Block that generates sine signal"; equation connect(ramp1.y, sta.u); connect(ramp1.y,zerHolTim. u); connect(sin.y, sta1.u); connect(sin.y, lesHolTim.u); end Stage;

Buildings.Controls.OBC.CDL.Integers.Validation.Subtract Buildings.Controls.OBC.CDL.Integers.Validation.Subtract

Validation model for the Subtract block

Buildings.Controls.OBC.CDL.Integers.Validation.Subtract

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Subtract.

Modelica definition

model Subtract "Validation model for the Subtract block" Buildings.Controls.OBC.CDL.Integers.Subtract sub "Block that outputs the difference of the two inputs"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=-3.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp2( duration=1, offset=-0.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Round round1(n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt "Convert real to integer"; Buildings.Controls.OBC.CDL.Reals.Round round2(n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1 "Convert real to integer"; equation connect(ramp1.y,round1.u); connect(ramp2.y,round2.u); connect(round2.y,reaToInt1.u); connect(round1.y,reaToInt.u); connect(reaToInt.y, sub.u1); connect(reaToInt1.y, sub.u2); end Subtract;

Buildings.Controls.OBC.CDL.Integers.Validation.Switch Buildings.Controls.OBC.CDL.Integers.Validation.Switch

Validation model for the Switch block

Buildings.Controls.OBC.CDL.Integers.Validation.Switch

Information

Validation test for the block Buildings.Controls.OBC.CDL.Integers.Switch.

The input u2 is the switch input: If u2 = true, then output y = u1; else output y = u3.

Modelica definition

model Switch "Validation model for the Switch block" Buildings.Controls.OBC.CDL.Integers.Switch integerSwitch "Integer switch"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul1( width=0.7, period=1.5) "Block that outputs cyclic on and off"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul2( width=0.5, period=3) "Block that outputs cyclic on and off: switch between u1 and u3"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul3( width=0.5, period=5) "Block that outputs cyclic on and off"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt( k=5) "Integer constant"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt1( k=2) "Integer constant"; protected Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt "Type converter"; Buildings.Controls.OBC.CDL.Integers.Multiply proInt "Product"; Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt1 "Type converter"; Buildings.Controls.OBC.CDL.Integers.Multiply proInt1 "Product"; equation connect(booPul2.y,integerSwitch.u2); connect(booPul1.y,booToInt.u); connect(booPul3.y,booToInt1.u); connect(conInt.y,proInt.u1); connect(booToInt.y,proInt.u2); connect(conInt1.y,proInt1.u1); connect(booToInt1.y,proInt1.u2); connect(proInt.y,integerSwitch.u1); connect(proInt1.y,integerSwitch.u3); end Switch;