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 |
Abs
|
Validation model for the absolute block |
Add
|
Validation model for the Add block |
Change
|
Validation model for the Change block |
Equal
|
Validation model for the Equal block |
Greater
|
Validation model for the Greater block |
GreaterEqual
|
Validation model for the GreaterEqual block |
GreaterEqualThreshold
|
Validation model for the GreaterEqualThreshold block |
GreaterThreshold
|
Validation model for the GreaterThreshold block |
Less
|
Validation model for the Less block |
LessEqual
|
Validation model for the LessEqual block |
LessEqualThreshold
|
Validation model for the LessEqualThreshold block |
LessThreshold
|
Validation model for the LessThreshold block |
Max
|
Validation model for the Max block |
Min
|
Validation model for the Min block |
MultiSum
|
Validation model for the block to find sum of multiple inputs |
OnCounter
|
Validation model for the OnCounter block |
Product
|
Validation model for the Product block |
Validation model for the absolute block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Abs.
Modelica definition
Validation model for the Add block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Add.
Modelica definition
model Add
Buildings.Controls.OBC.CDL.Integers.Add add1
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1(
duration=1,
offset=-3.5,
height=7.0)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2(
duration=1,
offset=-0.5,
height=7.0)
;
Buildings.Controls.OBC.CDL.Continuous.Round round1(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Continuous.Round round2(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
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;
Validation model for the Change block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Change.
Modelica definition
model Change
Buildings.Controls.OBC.CDL.Integers.Change cha
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2(
offset=0,
height=20,
duration=1)
;
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler changeSampler
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler increaseSampler
;
Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler decreaseSampler
;
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;
Validation model for the Equal block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Equal.
Modelica definition
model Equal
Buildings.Controls.OBC.CDL.Integers.Equal intEqu
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
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;
Validation model for the Greater block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Greater.
Modelica definition
model Greater
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1(
duration=1,
offset=-3.5,
height=10.0)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2(
duration=1,
offset=-1.5,
height=5.0)
;
Buildings.Controls.OBC.CDL.Integers.Greater intGre
;
Buildings.Controls.OBC.CDL.Continuous.Round round1(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Continuous.Round round2(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
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;
Validation model for the GreaterEqual block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.GreaterEqual.
Modelica definition
model GreaterEqual
Buildings.Controls.OBC.CDL.Integers.GreaterEqual intGreEqu
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
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;
Validation model for the GreaterEqualThreshold block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold.
Modelica definition
Validation model for the GreaterThreshold block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.GreaterThreshold.
Modelica definition
Validation model for the Less block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Less.
Modelica definition
model Less
Buildings.Controls.OBC.CDL.Integers.Less intLes
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
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;
Validation model for the LessEqual block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.LessEqual.
Modelica definition
model LessEqual
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1(
duration=1,
offset=-3.5,
height=10.0)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2(
duration=1,
offset=-1.5,
height=5.0)
;
Buildings.Controls.OBC.CDL.Integers.LessEqual intLesEqu
;
Buildings.Controls.OBC.CDL.Continuous.Round round1(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Continuous.Round round2(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
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;
Validation model for the LessEqualThreshold block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.LessEqualThreshold.
Modelica definition
Validation model for the LessThreshold block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.LessThreshold.
Modelica definition
Validation model for the Max block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Max.
Modelica definition
model Max
Buildings.Controls.OBC.CDL.Integers.Max max1
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1(
duration=1,
offset=-3.5,
height=10.0)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2(
duration=1,
offset=-1.5,
height=5.0)
;
Buildings.Controls.OBC.CDL.Continuous.Round round1(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Continuous.Round round2(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
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;
Validation model for the Min block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Min.
Modelica definition
model Min
Buildings.Controls.OBC.CDL.Integers.Min min1
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1(
duration=1,
offset=-3.5,
height=10.0)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2(
duration=1,
offset=-1.5,
height=5.0)
;
Buildings.Controls.OBC.CDL.Continuous.Round round1(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Continuous.Round round2(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
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;
Validation model for the block to find sum of multiple inputs
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.MultiSum.
Modelica definition
model MultiSum
Buildings.Controls.OBC.CDL.Integers.MultiSum add1(
nin=3)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1(
duration=1,
offset=-3.5,
height=7.0)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2(
duration=1,
offset=-0.5,
height=7.0)
;
Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp3(
duration=1,
height=7.0,
offset=-1.5)
;
Buildings.Controls.OBC.CDL.Continuous.Round round1(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt
;
Buildings.Controls.OBC.CDL.Continuous.Round round2(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
Buildings.Controls.OBC.CDL.Continuous.Round round3(
n=0)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt2
;
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;
Validation model for the OnCounter block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.OnCounter.
Modelica definition
Validation model for the Product block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Product.
Modelica definition
model Product
Buildings.Controls.OBC.CDL.Integers.Product product
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt1
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt2
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
Buildings.Controls.OBC.CDL.Continuous.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])
;
equation
connect(reaToInt1.y,product.u1);
connect(reaToInt2.y,product.u2);
connect(timTabLin.y[1],reaToInt1.u);
connect(timTabLin1.y[1],reaToInt2.u);
end Product;