Buildings.Controls.OBC.CDL.Integers

Package with elementary mathematical functions for integer variables

Information

Package with blocks for elementary mathematical functions for integer variables.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Buildings.Controls.OBC.CDL.Integers.Abs Abs Output the absolute value of the input
Buildings.Controls.OBC.CDL.Integers.Add Add Output the sum of the two inputs
Buildings.Controls.OBC.CDL.Integers.Equal Equal Output y is true, if input u1 is equal to input u2
Buildings.Controls.OBC.CDL.Integers.Greater Greater Output y is true, if input u1 is greater than input u2
Buildings.Controls.OBC.CDL.Integers.GreaterEqual GreaterEqual Output y is true, if input u1 is greater or equal than input u2
Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold GreaterEqualThreshold Output y is true, if input u is greater or equal than threshold
Buildings.Controls.OBC.CDL.Integers.GreaterThreshold GreaterThreshold Output y is true, if input u is greater than threshold
Buildings.Controls.OBC.CDL.Integers.Less Less Output y is true, if input u1 is less than input u2
Buildings.Controls.OBC.CDL.Integers.LessEqual LessEqual Output y is true, if input u1 is less or equal than input u2
Buildings.Controls.OBC.CDL.Integers.LessEqualThreshold LessEqualThreshold Output y is true, if input u is less or equal than threshold
Buildings.Controls.OBC.CDL.Integers.LessThreshold LessThreshold Output y is true, if input u is less than threshold
Buildings.Controls.OBC.CDL.Integers.Max Max Pass through the largest signal
Buildings.Controls.OBC.CDL.Integers.Min Min Pass through the smallest signal
Buildings.Controls.OBC.CDL.Integers.MultiSum MultiSum Sum of Reals, y = k[1]*u[1] + k[2]*u[2] + ... + k[n]*u[n]
Buildings.Controls.OBC.CDL.Integers.OnCounter OnCounter Increment the output if the input switches to true
Buildings.Controls.OBC.CDL.Integers.Product Product Output product of the two inputs
Buildings.Controls.OBC.CDL.Integers.Sources Sources Package with blocks that generate source signals
Buildings.Controls.OBC.CDL.Integers.Validation Validation Collection of models that validate the integer blocks of the CDL

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

Output the absolute value of the input

Buildings.Controls.OBC.CDL.Integers.Abs

Information

Block that outputs y = abs(u), where u is an Integer input.

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signals
output IntegerOutputyConnector of Integer output signals

Modelica definition

block Abs "Output the absolute value of the input" Interfaces.IntegerInput u "Connector of Integer input signals"; Interfaces.IntegerOutput y "Connector of Integer output signals"; equation y = if u >= 0 then u else -u; end Abs;

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

Output the sum of the two inputs

Buildings.Controls.OBC.CDL.Integers.Add

Information

Block that outputs y as the weighted sum of the two Integer input signals u1 and u2,

    y = k1*u1 + k2*u2;

where k1 and k2 are Integer parameters.

Parameters

TypeNameDefaultDescription
Integerk1+1Gain of upper input
Integerk2+1Gain of lower input

Connectors

TypeNameDescription
input IntegerInputu1Connector of Integer input signal 1
input IntegerInputu2Connector of Integer input signal 2
output IntegerOutputyConnector of Integer output signal

Modelica definition

block Add "Output the sum of the two inputs" parameter Integer k1=+1 "Gain of upper input"; parameter Integer k2=+1 "Gain of lower input"; Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Interfaces.IntegerOutput y "Connector of Integer output signal"; equation y = k1*u1 + k2*u2; end Add;

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

Output y is true, if input u1 is equal to input u2

Buildings.Controls.OBC.CDL.Integers.Equal

Information

Block that outputs true if the Integer input u1 is equal to the Integer input u2. Otherwise the output is false.

Connectors

TypeNameDescription
input IntegerInputu1Connector of first Integer input signal
input IntegerInputu2Connector of second Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block Equal "Output y is true, if input u1 is equal to input u2" Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u1 == u2; end Equal;

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

Output y is true, if input u1 is greater than input u2

Buildings.Controls.OBC.CDL.Integers.Greater

Information

Block that outputs true if the Integer input u1 is greater than the Integer input u2. Otherwise the output is false.

Connectors

TypeNameDescription
input IntegerInputu1Connector of first Integer input signal
input IntegerInputu2Connector of second Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block Greater "Output y is true, if input u1 is greater than input u2" Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u1 > u2; end Greater;

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

Output y is true, if input u1 is greater or equal than input u2

Buildings.Controls.OBC.CDL.Integers.GreaterEqual

Information

Block that outputs true if Integer the input u1 is greater than or equal to the Integer input u2. Otherwise the output is false.

Connectors

TypeNameDescription
input IntegerInputu1Connector of first Integer input signal
input IntegerInputu2Connector of second Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block GreaterEqual "Output y is true, if input u1 is greater or equal than input u2" Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u1 >= u2; end GreaterEqual;

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

Output y is true, if input u is greater or equal than threshold

Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold

Information

Block that outputs true if the Integer input is greater than or equal to the parameter threshold. Otherwise the output is false.

Parameters

TypeNameDefaultDescription
Integerthreshold0Comparison with respect to threshold

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block GreaterEqualThreshold "Output y is true, if input u is greater or equal than threshold" parameter Integer threshold=0 "Comparison with respect to threshold"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u >= threshold; end GreaterEqualThreshold;

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

Output y is true, if input u is greater than threshold

Buildings.Controls.OBC.CDL.Integers.GreaterThreshold

Information

Block that outputs true if the Integer input is greater than the parameter threshold. Otherwise the output is false.

Parameters

TypeNameDefaultDescription
Integerthreshold0Comparison with respect to threshold

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block GreaterThreshold "Output y is true, if input u is greater than threshold" parameter Integer threshold=0 "Comparison with respect to threshold"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u > threshold; end GreaterThreshold;

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

Output y is true, if input u1 is less than input u2

Buildings.Controls.OBC.CDL.Integers.Less

Information

Block that outputs true if the Integer input u1 is less than the Integer input u2. Otherwise the output is false.

Connectors

TypeNameDescription
input IntegerInputu1Connector of first Integer input signal
input IntegerInputu2Connector of second Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block Less "Output y is true, if input u1 is less than input u2" Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u1 < u2; end Less;

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

Output y is true, if input u1 is less or equal than input u2

Buildings.Controls.OBC.CDL.Integers.LessEqual

Information

Block that outputs true if the Integer input u1 is less than or equal to the Integer input u2. Otherwise the output is false.

Connectors

TypeNameDescription
input IntegerInputu1Connector of first Integer input signal
input IntegerInputu2Connector of second Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block LessEqual "Output y is true, if input u1 is less or equal than input u2" Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u1 <= u2; end LessEqual;

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

Output y is true, if input u is less or equal than threshold

Buildings.Controls.OBC.CDL.Integers.LessEqualThreshold

Information

Block that outputs true if the Integer input is less than or equal to the parameter threshold. Otherwise the output is false.

Parameters

TypeNameDefaultDescription
Integerthreshold0Comparison with respect to threshold

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block LessEqualThreshold "Output y is true, if input u is less or equal than threshold" parameter Integer threshold=0 "Comparison with respect to threshold"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u <= threshold; end LessEqualThreshold;

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

Output y is true, if input u is less than threshold

Buildings.Controls.OBC.CDL.Integers.LessThreshold

Information

Block that outputs true if the Integer input is less than the parameter threshold. Otherwise the output is false.

Parameters

TypeNameDefaultDescription
Integerthreshold0Comparison with respect to threshold

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block LessThreshold "Output y is true, if input u is less than threshold" parameter Integer threshold=0 "Comparison with respect to threshold"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u < threshold; end LessThreshold;

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

Pass through the largest signal

Buildings.Controls.OBC.CDL.Integers.Max

Information

Block that outputs y = max(u1, u2), where u1 and u2 are inputs.

Connectors

TypeNameDescription
input IntegerInputu1Connector of Integer input signal 1
input IntegerInputu2Connector of Integer input signal 2
output IntegerOutputyConnector of Integer output signal

Modelica definition

block Max "Pass through the largest signal" Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Interfaces.IntegerOutput y "Connector of Integer output signal"; equation y = max(u1, u2); end Max;

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

Pass through the smallest signal

Buildings.Controls.OBC.CDL.Integers.Min

Information

Block that outputs y = min(u1, u2), where u1 and u2 are inputs.

Connectors

TypeNameDescription
input IntegerInputu1Connector of Integer input signal 1
input IntegerInputu2Connector of Integer input signal 2
output IntegerOutputyConnector of Integer output signal

Modelica definition

block Min "Pass through the smallest signal" Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Interfaces.IntegerOutput y "Connector of Integer output signal"; equation y = min(u1, u2); end Min;

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

Sum of Reals, y = k[1]*u[1] + k[2]*u[2] + ... + k[n]*u[n]

Buildings.Controls.OBC.CDL.Integers.MultiSum

Information

Block that outputs

y = ∑i=1n ki   ui,

where k is a parameter with n elements and u is an input of the same length. The dimension of u can be enlarged by drawing an additional connection line. The connection is automatically connected to this new free index.

If no connection to the input connector u is present, the output is y=0.

See Buildings.Controls.OBC.CDL.Integers.Validation.MultiSum for an example.

Parameters

TypeNameDefaultDescription
Integerk[nin]fill(1, nin)Input gains

Connectors

TypeNameDescription
input IntegerInputu[nin]Connector of Integer input signals
output IntegerOutputyConnector of Integer output signal

Modelica definition

block MultiSum "Sum of Reals, y = k[1]*u[1] + k[2]*u[2] + ... + k[n]*u[n]" parameter Integer nin(min=0) = 0 "Number of input connections"; parameter Integer k[nin]=fill(1, nin) "Input gains"; Interfaces.IntegerInput u[nin] "Connector of Integer input signals"; Interfaces.IntegerOutput y "Connector of Integer output signal"; equation if size(u, 1) > 0 then y = k*u; else y = 0; end if; end MultiSum;

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

Increment the output if the input switches to true

Buildings.Controls.OBC.CDL.Integers.OnCounter

Information

Block that outputs how often the trigger input changed to true since the last invocation of reset.

This block may be used as a counter. Its output y starts at the parameter value y_start. Whenever the input signal trigger changes to true, the output is incremented by 1. When the input reset changes to true, then the output is reset to y = y_start. If both inputs trigger and reset change simultaneously, then the ouput is y = y_start.

Parameters

TypeNameDefaultDescription
Integery_start0Initial and reset value of y if input reset switches to true

Connectors

TypeNameDescription
input BooleanInputtriggerBoolean input signal
input BooleanInputresetReset the counter
output IntegerOutputyInteger output signal

Modelica definition

block OnCounter "Increment the output if the input switches to true" parameter Integer y_start=0 "Initial and reset value of y if input reset switches to true"; Interfaces.BooleanInput trigger "Boolean input signal"; Interfaces.BooleanInput reset "Reset the counter"; Interfaces.IntegerOutput y "Integer output signal"; initial equation pre(y) = y_start; equation when {trigger,reset} then y = if reset then y_start else pre(y) + 1; end when; end OnCounter;

Buildings.Controls.OBC.CDL.Integers.Product Buildings.Controls.OBC.CDL.Integers.Product

Output product of the two inputs

Buildings.Controls.OBC.CDL.Integers.Product

Information

Block that outputs y = u1 * u2, where u1 and u2 are Integer inputs.

Connectors

TypeNameDescription
input IntegerInputu1Connector of Integer input signal 1
input IntegerInputu2Connector of Integer input signal 2
output IntegerOutputyConnector of Integer output signal

Modelica definition

block Product "Output product of the two inputs" Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Interfaces.IntegerOutput y "Connector of Integer output signal"; equation y = u1*u2; end Product;