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 Integers, 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.Stage Stage Output total stages that should be enabled
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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signals"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Buildings.Controls.OBC.CDL.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"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"; Buildings.Controls.OBC.CDL.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_start0Start value of pre(u) at initial time

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 "Start value of pre(u) at initial time"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Connector of Boolean output signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput up "Connector of Boolean output signal indicating input increase"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Buildings.Controls.OBC.CDL.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"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"; Buildings.Controls.OBC.CDL.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"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of first Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of second Integer input signal"; Buildings.Controls.OBC.CDL.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"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"; Buildings.Controls.OBC.CDL.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"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Buildings.Controls.OBC.CDL.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 Integers, 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 Integers, 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"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u[nin] "Connector of Integer input signals"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Buildings.Controls.OBC.CDL.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"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput trigger "Boolean input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput reset "Reset the counter"; Buildings.Controls.OBC.CDL.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.Stage Buildings.Controls.OBC.CDL.Integers.Stage

Output total stages that should be enabled

Buildings.Controls.OBC.CDL.Integers.Stage

Information

Block that outputs the total number of stages to be enabled.

The block compares the input u with the threshold of each stage. If the input is greater than a stage threshold, the output is set to that stage. The block outputs the total number of stages to be enabled.

The parameter n specifies the maximum number of stages. The stage thresholds are evenly distributed, i.e. the thresholds for stages [1, 2, 3, ... , n] are [0, 1/n, 2/n, ... , (n-1)/n], plus a hysteresis which is by default h=0.02/n. Once the output changes, it cannot change for at least holdDuration seconds.

Parameters

TypeNameDefaultDescription
Integern Number of stages that could be enabled
RealholdDuration Minimum time that the output needs to be held constant. Set to 0 to disable hold time [s]
Realh0.02/nHysteresis for comparing input with threshold
Integerpre_y_start0Value of pre(y) at initial time

Connectors

TypeNameDescription
input RealInputuReal input for specifying stages
output IntegerOutputyTotal number of stages that should be enabled

Modelica definition

block Stage "Output total stages that should be enabled" parameter Integer n(final min=1) "Number of stages that could be enabled"; parameter Real holdDuration( final quantity="Time", final unit="s", min=0) "Minimum time that the output needs to be held constant. Set to 0 to disable hold time"; parameter Real h( min=0.001/n, max=0.5/n) = 0.02/n "Hysteresis for comparing input with threshold"; parameter Integer pre_y_start = 0 "Value of pre(y) at initial time"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u( final min=0, final max=1) "Real input for specifying stages"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y( final min=1, final max=n) "Total number of stages that should be enabled"; protected final parameter Real staThr[n]={(i - 1)/n for i in 1:n} "Stage thresholds"; discrete Real tNext( final unit="s") "Next instant at which the block checks if it has passed the minimum hold time"; discrete Real upperThreshold "Current upper bound of the stage range which the input is in"; discrete Real lowerThreshold "Current lower bound of the stage range which the input is in"; Boolean checkUpper "Check if the input value is greater than the upper bound"; Boolean checkLower "Check if the input value is greater than the lower bound"; initial equation upperThreshold = 0; lowerThreshold = 0; pre(checkUpper) = false; pre(checkLower) = true; tNext =time + holdDuration; pre(y)=pre_y_start; equation checkUpper = not pre(checkUpper) and (u > (pre(upperThreshold) + h)) or pre(checkUpper) and (u >= (pre(upperThreshold) - h)); checkLower = not pre(checkLower) and (u > (pre(lowerThreshold) + h)) or pre(checkLower) and (u >= (pre(lowerThreshold) - h)); when (time >= pre(tNext) and (checkUpper or not checkLower)) then tNext =time + holdDuration; y =if (u >= staThr[n]) then n else sum({(if ((u < staThr[i]) and (u >= staThr[i - 1])) then i - 1 else 0) for i in 2:n}); upperThreshold = if (y == n) then staThr[n] else staThr[y + 1]; lowerThreshold = if (y == 0) then pre(lowerThreshold) else staThr[y]; end when; end Stage;

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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Connector of Integer input signal 1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Connector of Integer input signal 2"; Buildings.Controls.OBC.CDL.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" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u2 "Boolean switch input signal, if true, y=u1, else y=u3"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u3 "Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Integer output signal"; equation y=if u2 then u1 else u3; end Switch;