Buildings.Controls.OBC.CDL.Conversions
Package with blocks for type conversion
Information
Package with blocks for type conversions.
Package Content
Name | Description |
---|---|
BooleanToInteger | Convert Boolean to Integer signal |
BooleanToReal | Convert Boolean to Real signal |
IntegerToReal | Convert Integer to Real signals |
RealToInteger | Convert Real to Integer signal |
Validation | Collection of models that validate the conversion blocks of the CDL |
Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger
Convert Boolean to Integer signal
Information
Block that outputs the Integer
equivalent of the Boolean
input.
y = if u then integerTrue else integerFalse;
where u
is of Boolean
and y
of Integer
type,
and integerTrue
and integerFalse
are parameters.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Integer | integerTrue | 1 | Output signal for true Boolean input |
Integer | integerFalse | 0 | Output signal for false Boolean input |
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u | Connector of Boolean input signal |
output IntegerOutput | y | Connector of Integer output signal |
Modelica definition
block BooleanToInteger
"Convert Boolean to Integer signal"
parameter Integer integerTrue=1
"Output signal for true Boolean input";
parameter Integer integerFalse=0
"Output signal for false Boolean input";
Interfaces.BooleanInput u
"Connector of Boolean input signal";
Interfaces.IntegerOutput y
"Connector of Integer output signal";
equation
y=if u then
integerTrue
else
integerFalse;
end BooleanToInteger;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal
Convert Boolean to Real signal
Information
Block that outputs the Real
equivalent of the Boolean
input.
y = if u then realTrue else realFalse;
where u
is of Boolean
and y
of Real
type,
and realTrue
and realFalse
are parameters.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Real | realTrue | 1.0 | Output signal for true Boolean input |
Real | realFalse | 0.0 | Output signal for false Boolean input |
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u | Connector of Boolean input signal |
output RealOutput | y | Connector of Real output signal |
Modelica definition
block BooleanToReal
"Convert Boolean to Real signal"
parameter Real realTrue=1.0
"Output signal for true Boolean input";
parameter Real realFalse=0.0
"Output signal for false Boolean input";
Interfaces.BooleanInput u
"Connector of Boolean input signal";
Interfaces.RealOutput y
"Connector of Real output signal";
equation
y=if u then
realTrue
else
realFalse;
end BooleanToReal;
Buildings.Controls.OBC.CDL.Conversions.IntegerToReal
Convert Integer to Real signals
Information
Block that outputs the Real
equivalent of the Integer
input.
y = u;
where u
is of Integer
and
y
of Real
type.
Connectors
Type | Name | Description |
---|---|---|
input IntegerInput | u | Connector of Integer input signal |
output RealOutput | y | Connector of Real output signal |
Modelica definition
block IntegerToReal
"Convert Integer to Real signals"
Interfaces.IntegerInput u
"Connector of Integer input signal";
Interfaces.RealOutput y
"Connector of Real output signal";
equation
y=u;
end IntegerToReal;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger
Convert Real to Integer signal
Information
Block that outputs y
as the nearest integer value of the input u
.
The block outputs
y = integer( floor( u + 0.5 ) ) for u > 0, y = integer( ceil ( u - 0.5 ) ) for u < 0.
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output IntegerOutput | y | Connector of Integer output signal |
Modelica definition
block RealToInteger
"Convert Real to Integer signal"
Interfaces.RealInput u
"Connector of Real input signal";
Interfaces.IntegerOutput y
"Connector of Integer output signal";
equation
y=if
(u > 0) then
integer(
floor(
u+0.5))
else
integer(
ceil(
u-0.5));
end RealToInteger;