IEA EBC Annex 60 EBC logo

Annex60.Utilities.Math.Examples

Collection of models that illustrate model use and test models

Information

This package contains examples for the use of models that can be found in Annex60.Utilities.Math.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Annex60.Utilities.Math.Examples.Average Average Test model for average function
Annex60.Utilities.Math.Examples.Bicubic Bicubic Test model for bicubic function
Annex60.Utilities.Math.Examples.Biquadratic Biquadratic Test model for biquadratic function
Annex60.Utilities.Math.Examples.BooleanReplicator BooleanReplicator Test model for boolean replicator
Annex60.Utilities.Math.Examples.IntegerReplicator IntegerReplicator Test model for integer replicator
Annex60.Utilities.Math.Examples.IntegratorWithReset IntegratorWithReset Test model for integrator with reset
Annex60.Utilities.Math.Examples.InverseXRegularized InverseXRegularized Test model for inverseXRegularized function
Annex60.Utilities.Math.Examples.Polynominal Polynominal Test model for ploynominal function
Annex60.Utilities.Math.Examples.PowerLinearized PowerLinearized Test model for powerLinearized function
Annex60.Utilities.Math.Examples.QuadraticLinear QuadraticLinear Test model for quadraticLinear function
Annex60.Utilities.Math.Examples.RegNonZeroPower RegNonZeroPower Test model for regNonZeroPower function
Annex60.Utilities.Math.Examples.SmoothBlocks SmoothBlocks Test model for smooth min and smooth max functions
Annex60.Utilities.Math.Examples.SmoothExponential SmoothExponential Test model for smoothExponential function
Annex60.Utilities.Math.Examples.SmoothHeaviside SmoothHeaviside Test model for smoothHeavisidefunction
Annex60.Utilities.Math.Examples.SmoothLimit SmoothLimit Test model for smooth limit
Annex60.Utilities.Math.Examples.SmoothMin SmoothMin Test model for smooth minimum
Annex60.Utilities.Math.Examples.Splice Splice Test model for splice
Annex60.Utilities.Math.Examples.VectorFunctions VectorFunctions Test model for functions that take a vector as argument

Annex60.Utilities.Math.Examples.Average Annex60.Utilities.Math.Examples.Average

Test model for average function

Annex60.Utilities.Math.Examples.Average

Information

This model tests the implementation of Annex60.Utilities.Math.Average.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model Average "Test model for average function" extends Modelica.Icons.Example; Annex60.Utilities.Math.Average average(nin=2); Modelica.Blocks.Sources.Ramp x1(duration=1); Modelica.Blocks.Sources.Ramp x2( height=2, duration=1, offset=2); Modelica.Blocks.Routing.Multiplex2 multiplex2_1; equation connect(x1.y, multiplex2_1.u1[1]); connect(x2.y, multiplex2_1.u2[1]); connect(multiplex2_1.y, average.u); end Average;

Annex60.Utilities.Math.Examples.Bicubic Annex60.Utilities.Math.Examples.Bicubic

Test model for bicubic function

Annex60.Utilities.Math.Examples.Bicubic

Information

This model tests the implementation of Annex60.Utilities.Math.Bicubic.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

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); Annex60.Utilities.Math.Bicubic bicubic(a={1,2,3,4,5,6,7,8,9,10}); equation connect(x1.y, bicubic.u1); connect(x2.y, bicubic.u2); end Bicubic;

Annex60.Utilities.Math.Examples.Biquadratic Annex60.Utilities.Math.Examples.Biquadratic

Test model for biquadratic function

Annex60.Utilities.Math.Examples.Biquadratic

Information

This model tests the implementation of Annex60.Utilities.Math.Biquadratic.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

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); Annex60.Utilities.Math.Biquadratic biquadratic(a={1,2,3,4,5,6}); equation connect(x1.y, biquadratic.u1); connect(x2.y, biquadratic.u2); end Biquadratic;

Annex60.Utilities.Math.Examples.BooleanReplicator Annex60.Utilities.Math.Examples.BooleanReplicator

Test model for boolean replicator

Annex60.Utilities.Math.Examples.BooleanReplicator

Information

This model tests the implementation of Annex60.Utilities.Math.BooleanReplicator.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model BooleanReplicator "Test model for boolean replicator" extends Modelica.Icons.Example; Modelica.Blocks.Sources.BooleanTable booTab(table={100,200,400,500}) "Boolean input signal"; Annex60.Utilities.Math.BooleanReplicator booRep(nout= 4) "Replicates boolean values"; equation connect(booTab.y, booRep.u); end BooleanReplicator;

Annex60.Utilities.Math.Examples.IntegerReplicator Annex60.Utilities.Math.Examples.IntegerReplicator

Test model for integer replicator

Annex60.Utilities.Math.Examples.IntegerReplicator

Information

This model tests the implementation of Annex60.Utilities.Math.IntegerReplicator.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

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"; Annex60.Utilities.Math.IntegerReplicator intRep(nout= 2) "Replicates integer values"; equation connect(intTab.y, intRep.u); end IntegerReplicator;

Annex60.Utilities.Math.Examples.IntegratorWithReset Annex60.Utilities.Math.Examples.IntegratorWithReset

Test model for integrator with reset

Annex60.Utilities.Math.Examples.IntegratorWithReset

Information

This model tests the implementation of Annex60.Utilities.Math.IntegratorWithReset with and without reset, and with different start values and reset values.

The integrator intWitRes1 is triggered by a sample trigger which becomes true at t=0, while intWitRes2 is triggered by a boolean pulse with is true at t=0. Hence, intWitRes1 starts with y(0)=y_reset while intWitRes2 starts with y(0)=y_start.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model IntegratorWithReset "Test model for integrator with reset" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Constant cons(k=10) "Constant as source term"; Annex60.Utilities.Math.IntegratorWithReset intWitRes1( y_start=5, reset=Annex60.Types.Reset.Parameter, k=0.5, y_reset=2) "Integrator with reset"; Annex60.Utilities.Math.IntegratorWithReset intWitRes2( y_reset=10, y_start=-5, reset=Annex60.Types.Reset.Input, k=0.5) "Integrator with reset and y_reset = 2"; Modelica.Blocks.Sources.BooleanPulse booleanPulse(width=50, period=0.2) "Boolean pulse"; Annex60.Utilities.Math.IntegratorWithReset intNoReset( reset=Annex60.Types.Reset.Disabled, k=0.5, y_start=1) "Integrator without reset"; Modelica.Blocks.Sources.SampleTrigger sampleTrigger(period=0.2) "Sample trigger"; Modelica.Blocks.Sources.Ramp ramp( height=-1, duration=1, offset=-2) "Ramp as a source term"; Annex60.Utilities.Math.IntegratorWithReset intDef "Integrator with default values"; equation connect(cons.y, intWitRes1.u); connect(intNoReset.u, cons.y); connect(cons.y, intWitRes2.u); connect(sampleTrigger.y, intWitRes1.trigger); connect(booleanPulse.y, intWitRes2.trigger); connect(ramp.y, intWitRes2.y_reset_in); connect(cons.y, intDef.u); end IntegratorWithReset;

Annex60.Utilities.Math.Examples.InverseXRegularized Annex60.Utilities.Math.Examples.InverseXRegularized

Test model for inverseXRegularized function

Annex60.Utilities.Math.Examples.InverseXRegularized

Information

This model tests the implementation of Annex60.Utilities.Math.InverseXRegularized.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model InverseXRegularized "Test model for inverseXRegularized function " extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp x1(duration=1, height=2, offset=-1); Annex60.Utilities.Math.InverseXRegularized inverseXRegularized(delta=0.1); equation connect(x1.y, inverseXRegularized.u); end InverseXRegularized;

Annex60.Utilities.Math.Examples.Polynominal Annex60.Utilities.Math.Examples.Polynominal

Test model for ploynominal function

Annex60.Utilities.Math.Examples.Polynominal

Information

This model tests the implementation of Annex60.Utilities.Math.Polynominal.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model Polynominal "Test model for ploynominal function " extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp x1(duration=1); Annex60.Utilities.Math.Polynominal polynominal(a={1,2}); equation connect(x1.y, polynominal.u); end Polynominal;

Annex60.Utilities.Math.Examples.PowerLinearized Annex60.Utilities.Math.Examples.PowerLinearized

Test model for powerLinearized function

Annex60.Utilities.Math.Examples.PowerLinearized

Information

This model tests the implementation of Annex60.Utilities.Math.PowerLinearized.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model PowerLinearized "Test model for powerLinearized function " extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp x1(duration=1); Annex60.Utilities.Math.PowerLinearized powerLinearized(n=2, x0=0.5); equation connect(x1.y, powerLinearized.u); end PowerLinearized;

Annex60.Utilities.Math.Examples.QuadraticLinear Annex60.Utilities.Math.Examples.QuadraticLinear

Test model for quadraticLinear function

Annex60.Utilities.Math.Examples.QuadraticLinear

Information

This model tests the implementation of Annex60.Utilities.Math.QuadraticLinear.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model QuadraticLinear "Test model for quadraticLinear function " extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp x1(duration=1); Annex60.Utilities.Math.QuadraticLinear quadraticLinear(a={1,2,3,4,5,6}); Modelica.Blocks.Sources.Ramp x2( duration=1, offset=2, height=5); equation connect(x2.y, quadraticLinear.u2); connect(x1.y, quadraticLinear.u1); end QuadraticLinear;

Annex60.Utilities.Math.Examples.RegNonZeroPower Annex60.Utilities.Math.Examples.RegNonZeroPower

Test model for regNonZeroPower function

Annex60.Utilities.Math.Examples.RegNonZeroPower

Information

This model tests the implementation of Annex60.Utilities.Math.RegNonZeroPower.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model RegNonZeroPower "Test model for regNonZeroPower function " extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp x1(duration=1); Annex60.Utilities.Math.RegNonZeroPower regNonZeroPower(n=0.5); equation connect(x1.y, regNonZeroPower.u); end RegNonZeroPower;

Annex60.Utilities.Math.Examples.SmoothBlocks Annex60.Utilities.Math.Examples.SmoothBlocks

Test model for smooth min and smooth max functions

Annex60.Utilities.Math.Examples.SmoothBlocks

Information

This model tests the implementation of blocks that approximate non-differentiable functions by smooth functions.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

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); Annex60.Utilities.Math.SmoothMin smoMin(deltaX=0.5); Modelica.Blocks.Math.Min Min; Diagnostics.AssertEquality assEquMin(threShold=0.08); equation connect(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;

Annex60.Utilities.Math.Examples.SmoothExponential Annex60.Utilities.Math.Examples.SmoothExponential

Test model for smoothExponential function

Annex60.Utilities.Math.Examples.SmoothExponential

Information

This model tests the implementation of Annex60.Utilities.Math.SmoothExponential.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SmoothExponential "Test model for smoothExponential function " extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp x1(duration=1, height=2, offset=-1); Annex60.Utilities.Math.SmoothExponential smoothExponential(delta=0.1); equation connect(x1.y, smoothExponential.u); end SmoothExponential;

Annex60.Utilities.Math.Examples.SmoothHeaviside Annex60.Utilities.Math.Examples.SmoothHeaviside

Test model for smoothHeavisidefunction

Annex60.Utilities.Math.Examples.SmoothHeaviside

Information

This model tests the implementation of Annex60.Utilities.Math.SmoothHeaviside.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SmoothHeaviside "Test model for smoothHeavisidefunction " extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp x1(duration=1, height=2, offset=-1); Annex60.Utilities.Math.SmoothHeaviside smoothHeaviside(delta=0.1); equation connect(x1.y, smoothHeaviside.u); end SmoothHeaviside;

Annex60.Utilities.Math.Examples.SmoothLimit Annex60.Utilities.Math.Examples.SmoothLimit

Test model for smooth limit

Annex60.Utilities.Math.Examples.SmoothLimit

Information

This model tests the implementation of Annex60.Utilities.Math.SmoothLimit.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SmoothLimit "Test model for smooth limit" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine sine(freqHz=8); Annex60.Utilities.Math.SmoothLimit smoLim( deltaX=0.001, upper=0.5, lower=0) "Smooth limit"; equation connect(sine.y, smoLim.u); end SmoothLimit;

Annex60.Utilities.Math.Examples.SmoothMin Annex60.Utilities.Math.Examples.SmoothMin

Test model for smooth minimum

Annex60.Utilities.Math.Examples.SmoothMin

Information

This model tests the implementation of Annex60.Utilities.Math.SmoothMin.

This model also illustrates that the output can be larger than the minimum of the two input signals. Smaller values for deltaX will reduce this effect. Therefore do not use this function when the minimum output value should be respected.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SmoothMin "Test model for smooth minimum" extends Modelica.Icons.Example; Annex60.Utilities.Math.SmoothMin smoLim[2](deltaX={0.1,0.02}) "Smooth limit"; Modelica.Blocks.Sources.Ramp ramp(height=1, duration=1) "Ramp input"; Modelica.Blocks.Sources.Constant const(k=0.5) "Constant input"; equation connect(ramp.y, smoLim[1].u1); connect(smoLim[2].u1, ramp.y); connect(const.y, smoLim[1].u2); connect(const.y, smoLim[2].u2); end SmoothMin;

Annex60.Utilities.Math.Examples.Splice Annex60.Utilities.Math.Examples.Splice

Test model for splice

Annex60.Utilities.Math.Examples.Splice

Information

This model tests the implementation of Annex60.Utilities.Math.Splice

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model Splice "Test model for splice" extends Modelica.Icons.Example; Annex60.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); equation connect(sine.y, splice.x); connect(const1.y, splice.u2); connect(const.y, splice.u1); end Splice;

Annex60.Utilities.Math.Examples.VectorFunctions Annex60.Utilities.Math.Examples.VectorFunctions

Test model for functions that take a vector as argument

Annex60.Utilities.Math.Examples.VectorFunctions

Information

This model tests the implementation of functions that take a vector as an argument.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model VectorFunctions "Test model for functions that take a vector as argument" extends Modelica.Icons.Example; Annex60.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); Annex60.Utilities.Math.Max maxVec( nin=3); Annex60.Utilities.Math.Average aveVec( nin=3); equation connect(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;

http://iea-annex60.org