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 |
AddParameter
|
Validation model for the AddParameter 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 |
Multiply
|
Validation model for the Multiply block |
OnCounter
|
Validation model for the OnCounter block |
Subtract
|
Validation model for the Subtract block |
Switch
|
Validation model for the Switch 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 AddParameter block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.AddParameter.
Modelica definition
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 Multiply block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Multiply.
Modelica definition
model Multiply
Buildings.Controls.OBC.CDL.Integers.Multiply 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 Multiply;
Validation model for the OnCounter block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.OnCounter.
Modelica definition
Validation model for the Subtract block
Information
Validation test for the block
Buildings.Controls.OBC.CDL.Integers.Subtract.
Modelica definition
model Subtract
Buildings.Controls.OBC.CDL.Integers.Subtract sub
;
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, sub.u1);
connect(reaToInt1.y, sub.u2);
end Subtract;
Validation model for the Switch block
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
Buildings.Controls.OBC.CDL.Integers.Switch integerSwitch
;
Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul1(
width=0.7,
period=1.5)
;
Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul2(
width=0.5,
period=3)
;
Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul3(
width=0.5,
period=5)
;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt(
k=5)
;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt1(
k=2)
;
protected
Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt
;
Buildings.Controls.OBC.CDL.Integers.Multiply proInt ;
Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt1
;
Buildings.Controls.OBC.CDL.Integers.Multiply proInt1 ;
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;