Buildings.Controls.OBC.CDL.Conversions

Package with blocks for type conversion

Information

Package with blocks for type conversions.

Package Content

Name Description
Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger BooleanToInteger Convert Boolean to Integer signal
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal BooleanToReal Convert Boolean to Real signal
Buildings.Controls.OBC.CDL.Conversions.IntegerToReal IntegerToReal Convert Integer to Real signals
Buildings.Controls.OBC.CDL.Conversions.RealToInteger RealToInteger Convert Real to Integer signal
Buildings.Controls.OBC.CDL.Conversions.Validation Validation Collection of models that validate the conversion blocks of the CDL

Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger

Convert Boolean to Integer signal

Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger

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

TypeNameDefaultDescription
IntegerintegerTrue1Output signal for true Boolean input
IntegerintegerFalse0Output signal for false Boolean input

Connectors

TypeNameDescription
input BooleanInputuConnector of Boolean input signal
output IntegerOutputyConnector 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"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u "Connector of Boolean input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Connector of Integer output signal"; equation y=if u then integerTrue else integerFalse; end BooleanToInteger;

Buildings.Controls.OBC.CDL.Conversions.BooleanToReal Buildings.Controls.OBC.CDL.Conversions.BooleanToReal

Convert Boolean to Real signal

Buildings.Controls.OBC.CDL.Conversions.BooleanToReal

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

TypeNameDefaultDescription
RealrealTrue1.0Output signal for true Boolean input
RealrealFalse0.0Output signal for false Boolean input

Connectors

TypeNameDescription
input BooleanInputuConnector of Boolean input signal
output RealOutputyConnector 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"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u "Connector of Boolean input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of Real output signal"; equation y=if u then realTrue else realFalse; end BooleanToReal;

Buildings.Controls.OBC.CDL.Conversions.IntegerToReal Buildings.Controls.OBC.CDL.Conversions.IntegerToReal

Convert Integer to Real signals

Buildings.Controls.OBC.CDL.Conversions.IntegerToReal

Information

Block that outputs the Real equivalent of the Integer input.

  y = u;

where u is of Integer and y of Real type.

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output RealOutputyConnector of Real output signal

Modelica definition

block IntegerToReal "Convert Integer to Real signals" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of Real output signal"; equation y=u; end IntegerToReal;

Buildings.Controls.OBC.CDL.Conversions.RealToInteger Buildings.Controls.OBC.CDL.Conversions.RealToInteger

Convert Real to Integer signal

Buildings.Controls.OBC.CDL.Conversions.RealToInteger

Information

Block that outputs y as the nearest integer value of the input u.

The block outputs

    y = integer( floor( u + 0.5 ) )  if u > 0,
    y = integer( ceil ( u - 0.5 ) )  otherwise.

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output IntegerOutputyConnector of Integer output signal

Modelica definition

block RealToInteger "Convert Real to Integer signal" Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Connector of Real input signal"; Buildings.Controls.OBC.CDL.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;