Buildings.Controls.OBC.CDL.Integers

Package with blocks for integer variables

Information

Package with blocks for elementary mathematical functions for integer variables.

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.AddParameter AddParameter Output the sum of an input plus a parameter
Buildings.Controls.OBC.CDL.Integers.Change Change Output whether the Integer input changes values, increases or decreases
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 a 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 a threshold
Buildings.Controls.OBC.CDL.Integers.LessThreshold LessThreshold Output y is true, if input u is less than a 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.Multiply Multiply Output product of the two inputs
Buildings.Controls.OBC.CDL.Integers.OnCounter OnCounter Increment the output if the input switches to true
Buildings.Controls.OBC.CDL.Integers.Subtract Subtract Output the difference of the two inputs
Buildings.Controls.OBC.CDL.Integers.Switch Switch Switch between two integer signals
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 sum of the two Integer input signals u1 and u2,

    y = u1 + u2.

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" 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 Add;

Buildings.Controls.OBC.CDL.Integers.AddParameter Buildings.Controls.OBC.CDL.Integers.AddParameter

Output the sum of an input plus a parameter

Buildings.Controls.OBC.CDL.Integers.AddParameter

Information

Block that outputs y = u + p, where p is parameter and u is an input.

Parameters

TypeNameDefaultDescription
Integerp Value to be added

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output IntegerOutputyConnector of Integer output signal

Modelica definition

block AddParameter "Output the sum of an input plus a parameter" parameter Integer p "Value to be added"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.IntegerOutput y "Connector of Integer output signal"; equation y=u+p; end AddParameter;

Buildings.Controls.OBC.CDL.Integers.Change Buildings.Controls.OBC.CDL.Integers.Change

Output whether the Integer input changes values, increases or decreases

Buildings.Controls.OBC.CDL.Integers.Change

Information

Block that evaluates the integer input u to check if its value changes.

Parameters

TypeNameDefaultDescription
Integerpre_u_start0Initial value of y

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output BooleanOutputyConnector of Boolean output signal
output BooleanOutputupConnector of Boolean output signal indicating input increase
output BooleanOutputdownConnector of Boolean output signal indicating input decrease

Modelica definition

block Change "Output whether the Integer input changes values, increases or decreases" parameter Integer pre_u_start=0 "Initial value of y"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; Interfaces.BooleanOutput up "Connector of Boolean output signal indicating input increase"; Interfaces.BooleanOutput down "Connector of Boolean output signal indicating input decrease"; initial equation pre(u)=pre_u_start; equation y=change(u); up=u > pre(u); down=u < pre(u); end Change;

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 t. Otherwise the output is false.

Parameters

TypeNameDefaultDescription
Integert0Comparison with respect to a 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 t=0 "Comparison with respect to a threshold"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y=u >= t; end GreaterEqualThreshold;

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

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

Buildings.Controls.OBC.CDL.Integers.GreaterThreshold

Information

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

Parameters

TypeNameDefaultDescription
Integert0Threshold for comparison

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 a threshold" parameter Integer t=0 "Threshold for comparison"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y=u > t; 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 a threshold

Buildings.Controls.OBC.CDL.Integers.LessEqualThreshold

Information

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

Parameters

TypeNameDefaultDescription
Integert0Threshold for comparison

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 a threshold" parameter Integer t=0 "Threshold for comparison"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y=u <= t; end LessEqualThreshold;

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

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

Buildings.Controls.OBC.CDL.Integers.LessThreshold

Information

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

Parameters

TypeNameDefaultDescription
Integert0Threshold for comparison

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 a threshold" parameter Integer t=0 "Threshold for comparison"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y=u < t; 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.Multiply Buildings.Controls.OBC.CDL.Integers.Multiply

Output product of the two inputs

Buildings.Controls.OBC.CDL.Integers.Multiply

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 Multiply "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 Multiply;

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.Subtract Buildings.Controls.OBC.CDL.Integers.Subtract

Output the difference of the two inputs

Buildings.Controls.OBC.CDL.Integers.Subtract

Information

Block that outputs y as the difference of the two input signals u1 and u2,

    y = u1 - u2

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 Subtract "Output the difference 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 Subtract;

Buildings.Controls.OBC.CDL.Integers.Switch Buildings.Controls.OBC.CDL.Integers.Switch

Switch between two integer signals

Buildings.Controls.OBC.CDL.Integers.Switch

Information

Block that outputs one of two integer input signals based on a boolean input signal.

If the input signal u2 is true, the block outputs y = u1. Otherwise, it outputs y = u3.

Connectors

TypeNameDescription
input IntegerInputu1Integer input signal
input BooleanInputu2Boolean switch input signal, if true, y=u1, else y=u3
input IntegerInputu3Integer input signal
output IntegerOutputyInteger output signal

Modelica definition

block Switch "Switch between two integer signals" Interfaces.IntegerInput u1 "Integer input signal"; Interfaces.BooleanInput u2 "Boolean switch input signal, if true, y=u1, else y=u3"; Interfaces.IntegerInput u3 "Integer input signal"; Interfaces.IntegerOutput y "Integer output signal"; equation y=if u2 then u1 else u3; end Switch;