This package contains examples for the use of models that can be found in Buildings.Utilities.Math.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).Name | Description |
---|---|
Bicubic | Test model for bicubic function |
Biquadratic | Test model for biquadratic function |
BooleanReplicator | Test model for boolean replicator |
IntegerReplicator | Test model for integer replicator |
SmoothBlocks | Test model for smooth min and smooth max functions |
VectorFunctions | Test model for functions that take a vector as argument |
SmoothLimit | Test model for smooth limit |
Splice | Test model for splice |
This model tests the implementation of the bicubic function.
Extends from Modelica.Icons.Example (Icon for runnable examples).model Bicubic "Test model for bicubic function" extends Modelica.Icons.Example;Modelica.Blocks.Sources.Ramp x1(duration=1); Modelica.Blocks.Sources.Ramp x2( height=2, duration=1, offset=2); Buildings.Utilities.Math.Bicubic bicubic(a={1,2,3,4,5,6,7,8,9,10}); equationconnect(x1.y, bicubic.u1); connect(x2.y, bicubic.u2); end Bicubic;
This model tests the implementation of the biquadratic function.
Extends from Modelica.Icons.Example (Icon for runnable examples).model Biquadratic "Test model for biquadratic function" extends Modelica.Icons.Example;Modelica.Blocks.Sources.Ramp x1(duration=1); Modelica.Blocks.Sources.Ramp x2( height=2, duration=1, offset=2); Buildings.Utilities.Math.Biquadratic biquadratic(a={1,2,3,4,5,6}); equationconnect(x1.y, biquadratic.u1); connect(x2.y, biquadratic.u2); end Biquadratic;
This model tests the implementation of Buildings.Utilities.Math.BooleanReplicator.
Extends from Modelica.Icons.Example (Icon for runnable examples).model BooleanReplicator "Test model for boolean replicator" extends Modelica.Icons.Example;Modelica.Blocks.Sources.BooleanTable booTab(table={100,200,400,500}) "Boolean input signal"; Buildings.Utilities.Math.BooleanReplicator booRep(nout= 4) "Replicates boolean values"; equationconnect(booTab.y, booRep.u); end BooleanReplicator;
This model tests the implementation of Buildings.Utilities.Math.IntegerReplicator.
Extends from Modelica.Icons.Example (Icon for runnable examples).model IntegerReplicator "Test model for integer replicator" extends Modelica.Icons.Example;Modelica.Blocks.Sources.IntegerTable intTab(table=[0,1;1, 4;1.5, 5;2, 6]) "Integer input signal"; Buildings.Utilities.Math.IntegerReplicator intRep(nout= 2) "Replicates integer values"; equationconnect(intTab.y, intRep.u); end IntegerReplicator;
This model tests the implementation of blocks that approximate non-differentiable functions by smooth functions.
Extends from Modelica.Icons.Example (Icon for runnable examples).model SmoothBlocks "Test model for smooth min and smooth max functions" extends Modelica.Icons.Example;SmoothMax smoMax(deltaX=0.5); Modelica.Blocks.Math.Max max; Modelica.Blocks.Sources.Sine sine(freqHz=8); Modelica.Blocks.Sources.Sine sine1(freqHz=1); Diagnostics.AssertEquality assEquMax(threShold=0.08); SmoothMin smoMin(deltaX=0.5); Modelica.Blocks.Math.Min Min; Diagnostics.AssertEquality assEquMin(threShold=0.08); equationconnect(sine.y, smoMax.u1); connect(sine.y, max.u1); connect(sine1.y, smoMax.u2); connect(sine1.y, max.u2); connect(smoMax.y, assEquMax.u1); connect(max.y, assEquMax.u2); connect(sine.y, smoMin.u1); connect(sine.y, Min.u1); connect(sine1.y, smoMin.u2); connect(sine1.y, Min.u2); connect(smoMin.y, assEquMin.u1); connect(Min.y, assEquMin.u2); end SmoothBlocks;
This model tests the implementation of functions that take a vector as an argument.
Extends from Modelica.Icons.Example (Icon for runnable examples).model VectorFunctions "Test model for functions that take a vector as argument" extends Modelica.Icons.Example;Buildings.Utilities.Math.Min minVec( nin=3); Modelica.Blocks.Sources.Sine sine(freqHz=6); Modelica.Blocks.Sources.Sine sine1( freqHz=8); Modelica.Blocks.Sources.Sine sine2(freqHz=10); Buildings.Utilities.Math.Max maxVec( nin=3); Buildings.Utilities.Math.Average aveVec( nin=3); equationconnect(sine.y, minVec.u[1]); connect(sine1.y, minVec.u[2]); connect(sine2.y, minVec.u[3]); connect(sine.y, maxVec.u[1]); connect(sine1.y, maxVec.u[2]); connect(sine2.y, maxVec.u[3]); connect(sine.y, aveVec.u[1]); connect(sine1.y, aveVec.u[2]); connect(sine2.y, aveVec.u[3]); end VectorFunctions;
This model tests the implementation of smooth limit function.
Extends from Modelica.Icons.Example (Icon for runnable examples).model SmoothLimit "Test model for smooth limit" extends Modelica.Icons.Example;Modelica.Blocks.Sources.Sine sine(freqHz=8); Buildings.Utilities.Math.SmoothLimit smoLim( deltaX=0.001, upper=0.5, lower=0) "Smooth limit"; equationconnect(sine.y, smoLim.u); end SmoothLimit;
This model tests the implementation of Buildings.Utilities.Math.Splice
Extends from Modelica.Icons.Example (Icon for runnable examples).model Splice "Test model for splice" extends Modelica.Icons.Example;Buildings.Utilities.Math.Splice splice(deltax=0.2); Modelica.Blocks.Sources.Sine sine(freqHz=0.5); Modelica.Blocks.Sources.Constant const1(k=-0.5); Modelica.Blocks.Sources.Constant const(k=0.5); equationconnect(sine.y, splice.x); connect(const1.y, splice.u2); connect(const.y, splice.u1); end Splice;