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.IsHoliday IsHoliday Block that outputs true if the input is a holiday
Buildings.Controls.OBC.CDL.Conversions.IsNonWorkingDay IsNonWorkingDay Block that outputs true if the input is a non-working day
Buildings.Controls.OBC.CDL.Conversions.IsWorkingDay IsWorkingDay Block that outputs true if the input is a working day
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 Boolean equivalent of the Integer 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"; 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 Buildings.Controls.OBC.CDL.Conversions.BooleanToReal

Convert Boolean to Real signal

Buildings.Controls.OBC.CDL.Conversions.BooleanToReal

Information

Block that outputs the Boolean equivalent of the Integer 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
RealrealTrue1Output signal for true Boolean input
RealrealFalse0Output signal for false Boolean input

Connectors

TypeNameDescription
input BooleanInputuConnector of Boolean input signal
output RealOutputyConnector of Integer output signal

Modelica definition

block BooleanToReal "Convert Boolean to Real signal" parameter Real realTrue=1 "Output signal for true Boolean input"; parameter Real realFalse=0 "Output signal for false Boolean input"; Interfaces.BooleanInput u "Connector of Boolean input signal"; Interfaces.RealOutput y "Connector of Integer 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" 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.IsHoliday Buildings.Controls.OBC.CDL.Conversions.IsHoliday

Block that outputs true if the input is a holiday

Buildings.Controls.OBC.CDL.Conversions.IsHoliday

Information

Block that outputs true if the input signal is of type holiday.

Connectors

TypeNameDescription
input DayTypeInputuConnector of DayType input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block IsHoliday "Block that outputs true if the input is a holiday" Interfaces.DayTypeInput u "Connector of DayType input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y=u == Buildings.Controls.OBC.CDL.Types.Day.Holiday; end IsHoliday;

Buildings.Controls.OBC.CDL.Conversions.IsNonWorkingDay Buildings.Controls.OBC.CDL.Conversions.IsNonWorkingDay

Block that outputs true if the input is a non-working day

Buildings.Controls.OBC.CDL.Conversions.IsNonWorkingDay

Information

Block that outputs true if the input signal is of type non-working day.

Connectors

TypeNameDescription
input DayTypeInputuConnector of DayType input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block IsNonWorkingDay "Block that outputs true if the input is a non-working day" Interfaces.DayTypeInput u "Connector of DayType input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y=u == Buildings.Controls.OBC.CDL.Types.Day.NonWorkingDay; end IsNonWorkingDay;

Buildings.Controls.OBC.CDL.Conversions.IsWorkingDay Buildings.Controls.OBC.CDL.Conversions.IsWorkingDay

Block that outputs true if the input is a working day

Buildings.Controls.OBC.CDL.Conversions.IsWorkingDay

Information

Block that outputs true if the input signal is of type working day.

Connectors

TypeNameDescription
input DayTypeInputuConnector of DayType input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block IsWorkingDay "Block that outputs true if the input is a working day" Interfaces.DayTypeInput u "Connector of DayType input signal"; Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y=u == Buildings.Controls.OBC.CDL.Types.Day.WorkingDay; end IsWorkingDay;

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 ) )  for  u > 0,
    y = integer( ceil ( u - 0.5 ) )  for  u < 0.

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output IntegerOutputyConnector 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;