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 a 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 IntegerInputuInput for absolute function
output IntegerOutputyAbsolute value of the input

Modelica definition

block Abs "Output the absolute value of the input" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Input for absolute function"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Absolute value of the input"; 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 IntegerInputu1Input to be added
input IntegerInputu2Input to be added
output IntegerOutputySum of the two inputs

Modelica definition

block Add "Output the sum of the two inputs" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Input to be added"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Input to be added"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Sum of the two inputs"; 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 Parameter to be added to the input

Connectors

TypeNameDescription
input IntegerInputuInput to be added to the parameter
output IntegerOutputySum of the parameter and the input

Modelica definition

block AddParameter "Output the sum of an input plus a parameter" parameter Integer p "Parameter to be added to the input"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Input to be added to the parameter"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Sum of the parameter and the input"; 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 IntegerInputuInteger to be monitored for a change in value
output BooleanOutputyOutput that is true when the input changes its value
output BooleanOutputupOutput that is true when the input increased its value
output BooleanOutputdownOutput that is true when the input decreased its value

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 "Integer to be monitored for a change in value"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Output that is true when the input changes its value"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput up "Output that is true when the input increased its value"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput down "Output that is true when the input decreased its value"; 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 IntegerInputu1Input to be checked for equality with other input
input IntegerInputu2Input to be checked for equality with other input
output BooleanOutputyOutputs that is true if the two inputs are equal, and false otherwise

Modelica definition

block Equal "Output y is true, if input u1 is equal to input u2" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Input to be checked for equality with other input"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Input to be checked for equality with other input"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs that is true if the two inputs are equal, and false otherwise"; 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 IntegerInputu1First input u1
input IntegerInputu2Second input u2
output BooleanOutputyOutputs true if u1 is greater than u2

Modelica definition

block Greater "Output y is true, if input u1 is greater than input u2" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "First input u1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Second input u2"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u1 is greater than u2"; 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 IntegerInputu1First input u1
input IntegerInputu2Second input u2
output BooleanOutputyOutputs true if u1 is greater or equal than u2

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 "First input u1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Second input u2"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u1 is greater or equal than u2"; 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 a 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
Integert0Threshold against which the input is compared to

Connectors

TypeNameDescription
input IntegerInputuInput to be compared against the threshold
output BooleanOutputyOutputs true if u is greater or equal than the threshold

Modelica definition

block GreaterEqualThreshold "Output y is true, if input u is greater or equal than a threshold" parameter Integer t=0 "Threshold against which the input is compared to"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Input to be compared against the threshold"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u is greater or equal than the threshold"; 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 against which the input is compared to

Connectors

TypeNameDescription
input IntegerInputuInput to be compared against the threshold
output BooleanOutputyOutputs true if u is greater than the threshold

Modelica definition

block GreaterThreshold "Output y is true, if input u is greater than a threshold" parameter Integer t=0 "Threshold against which the input is compared to"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Input to be compared against the threshold"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u is greater than the threshold"; 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 IntegerInputu1First input u1
input IntegerInputu2Second input u2
output BooleanOutputyOutputs true if u1 is less than u2

Modelica definition

block Less "Output y is true, if input u1 is less than input u2" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "First input u1"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Second input u2"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u1 is less than u2"; 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 IntegerInputu1First input
input IntegerInputu2Second input
output BooleanOutputyOutputs true if u1 is less or equal than u2

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 "First input"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Second input"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u1 is less or equal than u2"; 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 IntegerInputuInput to be compared
output BooleanOutputyOutputs true if u is less or equal than the threshold

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 "Input to be compared"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u is less or equal than the threshold"; 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 IntegerInputuInput to be compared against the threshold
output BooleanOutputyOutputs true if u is less than the threshold

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 "Input to be compared against the threshold"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Outputs true if u is less than the threshold"; 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 IntegerInputu1Input to the max function
input IntegerInputu2Input to the max function
output IntegerOutputyMaximum of the inputs

Modelica definition

block Max "Pass through the largest signal" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Input to the max function"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Input to the max function"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Maximum of the inputs"; 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 IntegerInputu1Input to the min function
input IntegerInputu2Input to the max function
output IntegerOutputyMinimum of the inputs

Modelica definition

block Min "Pass through the smallest signal" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Input to the min function"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Input to the max function"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Minimum of the inputs"; 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]Inputs to be multipled with gain and added
output IntegerOutputySum of inputs multiplied by the gain

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] "Inputs to be multipled with gain and added"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Sum of inputs multiplied by the gain"; 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 IntegerInputu1Input for multiplication
input IntegerInputu2Input for multiplication
output IntegerOutputyProduct of the inputs

Modelica definition

block Multiply "Output product of the two inputs" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Input for multiplication"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Input for multiplication"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Product of the inputs"; 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 BooleanInputtriggerTrigger, when set to true, the counter increases
input BooleanInputresetReset, when true, the counter is set to y_start
output IntegerOutputyCounter value

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 "Trigger, when set to true, the counter increases"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput reset "Reset, when true, the counter is set to y_start"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Counter value"; 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 RealInputuInput between 0 and 1 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) "Input between 0 and 1 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 IntegerInputu1Input u1 for the minuend
input IntegerInputu2Input u2 for the subtrahend
output IntegerOutputyOutput with the difference u1-u2

Modelica definition

block Subtract "Output the difference of the two inputs" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Input u1 for the minuend"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2 "Input u2 for the subtrahend"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Output with the difference u1-u2"; 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 IntegerInputu1Input u1
input BooleanInputu2Boolean switch input signal, if true, y=u1, else y=u3
input IntegerInputu3Input u3
output IntegerOutputyOutput with u1 if u2 is true, else u3

Modelica definition

block Switch "Switch between two integer signals" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1 "Input u1"; 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 "Input u3"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Output with u1 if u2 is true, else u3"; equation y=if u2 then u1 else u3; end Switch;