Buildings.Controls.OBC.CDL.Routing

Package with blocks that combine and extract signals

Information

This package contains blocks to combine and extract signals.

Package Content

Name Description
Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal BooleanExtractSignal Extract signals from a boolean input signal vector
Buildings.Controls.OBC.CDL.Routing.BooleanExtractor BooleanExtractor Extract scalar signal out of boolean signal vector dependent on integer input index
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator BooleanScalarReplicator Boolean signal replicator
Buildings.Controls.OBC.CDL.Routing.BooleanVectorFilter BooleanVectorFilter Filter a boolean vector based on a boolean mask
Buildings.Controls.OBC.CDL.Routing.BooleanVectorReplicator BooleanVectorReplicator Boolean vector signal replicator
Buildings.Controls.OBC.CDL.Routing.IntegerExtractSignal IntegerExtractSignal Extract signals from an integer input signal vector
Buildings.Controls.OBC.CDL.Routing.IntegerExtractor IntegerExtractor Extract scalar signal out of integer signal vector dependent on integer input index
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator IntegerScalarReplicator Integer signal replicator
Buildings.Controls.OBC.CDL.Routing.IntegerVectorFilter IntegerVectorFilter Filter an integer vector based on a boolean mask
Buildings.Controls.OBC.CDL.Routing.IntegerVectorReplicator IntegerVectorReplicator Integer vector signal replicator
Buildings.Controls.OBC.CDL.Routing.RealExtractSignal RealExtractSignal Extract signals from an input signal vector
Buildings.Controls.OBC.CDL.Routing.RealExtractor RealExtractor Extract scalar signal out of signal vector dependent on Integer input index
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator RealScalarReplicator Real signal replicator
Buildings.Controls.OBC.CDL.Routing.RealVectorFilter RealVectorFilter Filter a real vector of based on a boolean mask
Buildings.Controls.OBC.CDL.Routing.RealVectorReplicator RealVectorReplicator Real vector signal replicator
Buildings.Controls.OBC.CDL.Routing.Validation Validation Collection of models that validate the routing blocks of the CDL

Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal

Extract signals from a boolean input signal vector

Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal

Information

Extract signals from the vector-valued boolean input signal and transfer them to the vector-valued boolean output signal.

The extraction scheme is specified by the integer vector extract. This vector specifies which input signals are taken and in which order they are transferred to the output vector. Note that the dimension of extract has to match the number of outputs and the elements of extract has to be in the range of [1, nin]. Additionally, the dimensions of the input connector signals and the output connector signals have to be explicitly defined via the parameters nin and nout.

Example

The specification

     nin = 7 "Number of inputs";
     nout = 4 "Number of outputs";
     extract[nout] = {6,3,3,2} "Extracting vector";

extracts four output signals (nout=4) from the seven elements of the input vector (nin=7):

   y[1, 2, 3, 4] = u[6, 3, 3, 2];

Parameters

TypeNameDefaultDescription
Integernin1Number of inputs
Integernout1Number of outputs
Integerextract[nout]1:noutExtracting vector

Connectors

TypeNameDescription
input BooleanInputu[nin]Boolean input signals
output BooleanOutputy[nout]Boolean signals extracted from the input vector with the extraction scheme specified by the integer vector

Modelica definition

block BooleanExtractSignal "Extract signals from a boolean input signal vector" parameter Integer nin=1 "Number of inputs"; parameter Integer nout=1 "Number of outputs"; parameter Integer extract[nout]=1:nout "Extracting vector"; Interfaces.BooleanInput u[nin] "Boolean input signals"; Interfaces.BooleanOutput y[nout] "Boolean signals extracted from the input vector with the extraction scheme specified by the integer vector"; initial equation assert( Modelica.Math.BooleanVectors.andTrue({(extract[i] > 0 and extract[i] <= nin) for i in 1:nout}), "In " + getInstanceName() + ": The element of the extracting vector has out of range value.", AssertionLevel.error); equation for i in 1:nout loop y[i]=u[extract[i]]; end for; end BooleanExtractSignal;

Buildings.Controls.OBC.CDL.Routing.BooleanExtractor Buildings.Controls.OBC.CDL.Routing.BooleanExtractor

Extract scalar signal out of boolean signal vector dependent on integer input index

Buildings.Controls.OBC.CDL.Routing.BooleanExtractor

Information

Block that returns

    y = u[index];

where u is a vector-valued Boolean input signal and index is an Integer input signal. When the index is out of range,

Parameters

TypeNameDefaultDescription
Integernin1Number of inputs

Connectors

TypeNameDescription
input IntegerInputindexIndex of input vector element to be extracted out
input BooleanInputu[nin]Boolean input signals
output BooleanOutputyBoolean signal extracted from input vector, u[index]

Modelica definition

block BooleanExtractor "Extract scalar signal out of boolean signal vector dependent on integer input index" parameter Integer nin=1 "Number of inputs"; Interfaces.IntegerInput index "Index of input vector element to be extracted out"; Interfaces.BooleanInput u[nin] "Boolean input signals"; Interfaces.BooleanOutput y "Boolean signal extracted from input vector, u[index]"; equation assert( index > 0 and index <= nin, "In " + getInstanceName() + ": The extract index is out of the range.", AssertionLevel.warning); y = u[min(nin, max(1, index))]; end BooleanExtractor;

Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator

Boolean signal replicator

Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator

Information

This block replicates the Boolean input signal to an array of nout identical Boolean output signals.

Parameters

TypeNameDefaultDescription
Integernout1Number of outputs

Connectors

TypeNameDescription
input BooleanInputuConnector of Boolean input signal
output BooleanOutputy[nout]Connector of Boolean output signals

Modelica definition

block BooleanScalarReplicator "Boolean signal replicator" parameter Integer nout=1 "Number of outputs"; Interfaces.BooleanInput u "Connector of Boolean input signal"; Interfaces.BooleanOutput y[nout] "Connector of Boolean output signals"; equation y=fill( u, nout); end BooleanScalarReplicator;

Buildings.Controls.OBC.CDL.Routing.BooleanVectorFilter Buildings.Controls.OBC.CDL.Routing.BooleanVectorFilter

Filter a boolean vector based on a boolean mask

Buildings.Controls.OBC.CDL.Routing.BooleanVectorFilter

Information

This block filters a Boolean vector of size nin to a vector of size nout given a Boolean mask msk.

If an entry in msk is true, then the value of this input will be sent to the output y, otherwise it will be discarded.

The parameter msk must have exactly nout entries set to true, otherwise an error message is issued.

Parameters

TypeNameDefaultDescription
Integernin Size of input vector
Integernout Size of output vector
Booleanmsk[nin]fill(true, nin)Array mask

Connectors

TypeNameDescription
input BooleanInputu[nin]Connector of Boolean input signal
output BooleanOutputy[nout]Connector of Boolean output signals

Modelica definition

block BooleanVectorFilter "Filter a boolean vector based on a boolean mask" parameter Integer nin "Size of input vector"; parameter Integer nout "Size of output vector"; parameter Boolean msk[nin]=fill(true,nin) "Array mask"; Interfaces.BooleanInput u[nin] "Connector of Boolean input signal"; Interfaces.BooleanOutput y[nout] "Connector of Boolean output signals"; protected parameter Integer mskId[nout] = Modelica.Math.BooleanVectors.index(msk) "Indices of included element in input vector"; initial equation assert(nout==sum({if msk[i] then 1 else 0 for i in 1:nin}), "In " + getInstanceName() + ": The size of the output vector does not match the size of included elements in the mask."); equation y = u[mskId]; end BooleanVectorFilter;

Buildings.Controls.OBC.CDL.Routing.BooleanVectorReplicator Buildings.Controls.OBC.CDL.Routing.BooleanVectorReplicator

Boolean vector signal replicator

Buildings.Controls.OBC.CDL.Routing.BooleanVectorReplicator

Information

This block replicates a Boolean vector input signal of size nin, to a matrix with nout rows and nin columns, where each row is duplicating the input vector.

Parameters

TypeNameDefaultDescription
Integernin1Size of input vector
Integernout1Number of row in output

Connectors

TypeNameDescription
input BooleanInputu[nin]Connector of Boolean vector input signal
output BooleanOutputy[nout, nin]Connector of Boolean matrix output signals

Modelica definition

block BooleanVectorReplicator "Boolean vector signal replicator" parameter Integer nin=1 "Size of input vector"; parameter Integer nout=1 "Number of row in output"; Interfaces.BooleanInput u[nin] "Connector of Boolean vector input signal"; Interfaces.BooleanOutput y[nout, nin] "Connector of Boolean matrix output signals"; equation y=fill(u, nout); end BooleanVectorReplicator;

Buildings.Controls.OBC.CDL.Routing.IntegerExtractSignal Buildings.Controls.OBC.CDL.Routing.IntegerExtractSignal

Extract signals from an integer input signal vector

Buildings.Controls.OBC.CDL.Routing.IntegerExtractSignal

Information

Extract signals from the vector-valued integer input signal and transfer them to the vector-valued integer output signal.

The extraction scheme is specified by the integer vector extract. This vector specifies which input signals are taken and in which order they are transferred to the output vector. Note that the dimension of extract has to match the number of outputs and the elements of extract has to be in the range of [1, nin]. Additionally, the dimensions of the input connector signals and the output connector signals have to be explicitly defined via the parameters nin and nout.

Example

The specification

     nin = 7 "Number of inputs";
     nout = 4 "Number of outputs";
     extract[nout] = {6,3,3,2} "Extracting vector";

extracts four output signals (nout=4) from the seven elements of the input vector (nin=7):

   y[1, 2, 3, 4] = u[6, 3, 3, 2];

Parameters

TypeNameDefaultDescription
Integernin1Number of inputs
Integernout1Number of outputs
Integerextract[nout]1:noutExtracting vector

Connectors

TypeNameDescription
input IntegerInputu[nin]Integer input signals
output IntegerOutputy[nout]Integer signals extracted from the input vector with the extraction scheme specified by the integer vector

Modelica definition

block IntegerExtractSignal "Extract signals from an integer input signal vector" parameter Integer nin=1 "Number of inputs"; parameter Integer nout=1 "Number of outputs"; parameter Integer extract[nout]=1:nout "Extracting vector"; Interfaces.IntegerInput u[nin] "Integer input signals"; Interfaces.IntegerOutput y[nout] "Integer signals extracted from the input vector with the extraction scheme specified by the integer vector"; initial equation assert( Modelica.Math.BooleanVectors.andTrue({(extract[i] > 0 and extract[i] <= nin) for i in 1:nout}), "In " + getInstanceName() + ": The element of the extracting vector has out of range value.", AssertionLevel.error); equation for i in 1:nout loop y[i]=u[extract[i]]; end for; end IntegerExtractSignal;

Buildings.Controls.OBC.CDL.Routing.IntegerExtractor Buildings.Controls.OBC.CDL.Routing.IntegerExtractor

Extract scalar signal out of integer signal vector dependent on integer input index

Buildings.Controls.OBC.CDL.Routing.IntegerExtractor

Information

Block that returns

    y = u[index];

where u is a vector-valued Integer input signal and index is an Integer input signal. When the index is out of range,

Parameters

TypeNameDefaultDescription
Integernin1Number of inputs

Connectors

TypeNameDescription
input IntegerInputindexIndex of input vector element to be extracted out
input IntegerInputu[nin]Integer input signals
output IntegerOutputyInteger signal extracted from input vector, u[index]

Modelica definition

block IntegerExtractor "Extract scalar signal out of integer signal vector dependent on integer input index" parameter Integer nin=1 "Number of inputs"; Interfaces.IntegerInput index "Index of input vector element to be extracted out"; Interfaces.IntegerInput u[nin] "Integer input signals"; Interfaces.IntegerOutput y "Integer signal extracted from input vector, u[index]"; equation assert( index > 0 and index <= nin, "In " + getInstanceName() + ": The extract index is out of the range.", AssertionLevel.warning); y = u[min(nin, max(1, index))]; end IntegerExtractor;

Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator

Integer signal replicator

Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator

Information

This block replicates the Integer input signal to an array of nout identical Integer output signals.

Parameters

TypeNameDefaultDescription
Integernout1Number of outputs

Connectors

TypeNameDescription
input IntegerInputuConnector of Integer input signal
output IntegerOutputy[nout]Connector of Integer output signals

Modelica definition

block IntegerScalarReplicator "Integer signal replicator" parameter Integer nout=1 "Number of outputs"; Interfaces.IntegerInput u "Connector of Integer input signal"; Interfaces.IntegerOutput y[nout] "Connector of Integer output signals"; equation y=fill( u, nout); end IntegerScalarReplicator;

Buildings.Controls.OBC.CDL.Routing.IntegerVectorFilter Buildings.Controls.OBC.CDL.Routing.IntegerVectorFilter

Filter an integer vector based on a boolean mask

Buildings.Controls.OBC.CDL.Routing.IntegerVectorFilter

Information

This block filters a Integer vector of size nin to a vector of size nout given a Boolean mask msk.

If an entry in msk is true, then the value of this input will be sent to the output y, otherwise it will be discarded.

The parameter msk must have exactly nout entries set to true, otherwise an error message is issued.

Parameters

TypeNameDefaultDescription
Integernin Size of input vector
Integernout Size of output vector
Booleanmsk[nin]fill(true, nin)Array mask

Connectors

TypeNameDescription
input IntegerInputu[nin]Connector of Integer input signal
output IntegerOutputy[nout]Connector of Integer output signals

Modelica definition

block IntegerVectorFilter "Filter an integer vector based on a boolean mask" parameter Integer nin "Size of input vector"; parameter Integer nout "Size of output vector"; parameter Boolean msk[nin]=fill(true,nin) "Array mask"; Interfaces.IntegerInput u[nin] "Connector of Integer input signal"; Interfaces.IntegerOutput y[nout] "Connector of Integer output signals"; protected parameter Integer mskId[nout] = Modelica.Math.BooleanVectors.index(msk) "Indices of included element in input vector"; initial equation assert(nout==sum({if msk[i] then 1 else 0 for i in 1:nin}), "The size of the output vector does not match the size of included elements in the mask."); equation y = u[mskId]; end IntegerVectorFilter;

Buildings.Controls.OBC.CDL.Routing.IntegerVectorReplicator Buildings.Controls.OBC.CDL.Routing.IntegerVectorReplicator

Integer vector signal replicator

Buildings.Controls.OBC.CDL.Routing.IntegerVectorReplicator

Information

This block replicates an Integer vector input signal of size nin, to a matrix with nout rows and nin columns, where each row is duplicating the input vector.

Parameters

TypeNameDefaultDescription
Integernin1Size of input vector
Integernout1Number of row in output

Connectors

TypeNameDescription
input IntegerInputu[nin]Connector of Integer vector input signal
output IntegerOutputy[nout, nin]Connector of Integer matrix output signals

Modelica definition

block IntegerVectorReplicator "Integer vector signal replicator" parameter Integer nin=1 "Size of input vector"; parameter Integer nout=1 "Number of row in output"; Interfaces.IntegerInput u[nin] "Connector of Integer vector input signal"; Interfaces.IntegerOutput y[nout, nin] "Connector of Integer matrix output signals"; equation y=fill(u, nout); end IntegerVectorReplicator;

Buildings.Controls.OBC.CDL.Routing.RealExtractSignal Buildings.Controls.OBC.CDL.Routing.RealExtractSignal

Extract signals from an input signal vector

Buildings.Controls.OBC.CDL.Routing.RealExtractSignal

Information

Extract signals from the input connector and transfer them to the output connector.

The extracting scheme is given by the integer vector extract. This vector specifies which input signals are taken and in which order they are transferred to the output vector. Note that the dimension of extract has to match the number of outputs. Additionally, the dimensions of the input connector signals and the output connector signals have to be explicitly defined via the parameters nin and nout.

Example

The specification

     nin = 7 "Number of inputs";
     nout = 4 "Number of outputs";
     extract[nout] = {6,3,3,2} "Extracting vector";

extracts four output signals (nout=4) from the seven elements of the input vector (nin=7):

   output no. 1 is set equal to input no. 6
   output no. 2 is set equal to input no. 3
   output no. 3 is set equal to input no. 3
   output no. 4 is set equal to input no. 2

Parameters

TypeNameDefaultDescription
Integernin1Number of inputs
Integernout1Number of outputs
Integerextract[nout]1:noutExtracting vector

Connectors

TypeNameDescription
input RealInputu[nin]Connector of Real input signal
output RealOutputy[nout]Connector of Real output signal

Modelica definition

block RealExtractSignal "Extract signals from an input signal vector" parameter Integer nin=1 "Number of inputs"; parameter Integer nout=1 "Number of outputs"; parameter Integer extract[nout]=1:nout "Extracting vector"; Interfaces.RealInput u[nin] "Connector of Real input signal"; Interfaces.RealOutput y[nout] "Connector of Real output signal"; equation for i in 1:nout loop y[i]=u[extract[i]]; end for; end RealExtractSignal;

Buildings.Controls.OBC.CDL.Routing.RealExtractor Buildings.Controls.OBC.CDL.Routing.RealExtractor

Extract scalar signal out of signal vector dependent on Integer input index

Buildings.Controls.OBC.CDL.Routing.RealExtractor

Information

Block that extracts a scalar output signal out the vector of input signals dependent on the Integer value of the input index:

    y = u [ index ] ;

where index is an additional Integer input signal.

Parameters

TypeNameDefaultDescription
BooleanallowOutOfRangefalseIndex may be out of range
Integernin1Number of inputs
RealoutOfRangeValue1e10Output signal if index is out of range

Connectors

TypeNameDescription
input IntegerInputindexIndex of input vector element to be extracted out
input RealInputu[nin]Connector of Real input signals
output RealOutputyConnector of Real output signal

Modelica definition

block RealExtractor "Extract scalar signal out of signal vector dependent on Integer input index" parameter Boolean allowOutOfRange=false "Index may be out of range"; parameter Integer nin=1 "Number of inputs"; parameter Real outOfRangeValue=1e10 "Output signal if index is out of range"; Interfaces.IntegerInput index "Index of input vector element to be extracted out"; Interfaces.RealInput u[nin] "Connector of Real input signals"; Interfaces.RealOutput y "Connector of Real output signal"; protected Real k[nin] "Indicator used to extract the signal"; initial equation pre(index)=0; equation when {initial(),change(index)} then for i in 1:nin loop k[i]= if index == i then 1 else 0; end for; end when; y=if not allowOutOfRange or index > 0 and index <= nin then k*u else outOfRangeValue; end RealExtractor;

Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator

Real signal replicator

Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator

Information

This block replicates the Real input signal to an array of nout identical Real output signals.

Parameters

TypeNameDefaultDescription
Integernout1Number of outputs

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputy[nout]Connector of Real output signal

Modelica definition

block RealScalarReplicator "Real signal replicator" parameter Integer nout=1 "Number of outputs"; Interfaces.RealInput u "Connector of Real input signal"; Interfaces.RealOutput y[nout] "Connector of Real output signal"; equation y=fill( u, nout); end RealScalarReplicator;

Buildings.Controls.OBC.CDL.Routing.RealVectorFilter Buildings.Controls.OBC.CDL.Routing.RealVectorFilter

Filter a real vector of based on a boolean mask

Buildings.Controls.OBC.CDL.Routing.RealVectorFilter

Information

This block filters a Real vector of size nin to a vector of size nout given a boolean mask msk.

If an entry in msk is true, then the value of this input will be sent to the output y, otherwise it will be discarded.

The parameter msk must have exactly nout entries set to true, otherwise an error message is issued.

Parameters

TypeNameDefaultDescription
Integernin Size of input vector
Integernout Size of output vector
Booleanmsk[nin]fill(true, nin)Array mask

Connectors

TypeNameDescription
input RealInputu[nin]Connector of Real input signal
output RealOutputy[nout]Connector of Real output signals

Modelica definition

block RealVectorFilter "Filter a real vector of based on a boolean mask" parameter Integer nin "Size of input vector"; parameter Integer nout "Size of output vector"; parameter Boolean msk[nin]=fill(true,nin) "Array mask"; Interfaces.RealInput u[nin] "Connector of Real input signal"; Interfaces.RealOutput y[nout] "Connector of Real output signals"; protected parameter Integer mskId[nout] = Modelica.Math.BooleanVectors.index(msk) "Indices of included element in input vector"; initial equation assert(nout==sum({if msk[i] then 1 else 0 for i in 1:nin}), "The size of the output vector does not match the size of included elements in the mask."); equation y = u[mskId]; end RealVectorFilter;

Buildings.Controls.OBC.CDL.Routing.RealVectorReplicator Buildings.Controls.OBC.CDL.Routing.RealVectorReplicator

Real vector signal replicator

Buildings.Controls.OBC.CDL.Routing.RealVectorReplicator

Information

This block replicates an Real vector input signal of size nin, to a matrix with nout rows and nin columns, where each row is duplicating the input vector.

Parameters

TypeNameDefaultDescription
Integernin1Size of input vector
Integernout1Number of row in output

Connectors

TypeNameDescription
input RealInputu[nin]Connector of Real vector input signal
output RealOutputy[nout, nin]Connector of Real matrix output signals

Modelica definition

block RealVectorReplicator "Real vector signal replicator" parameter Integer nin=1 "Size of input vector"; parameter Integer nout=1 "Number of row in output"; Interfaces.RealInput u[nin] "Connector of Real vector input signal"; Interfaces.RealOutput y[nout, nin] "Connector of Real matrix output signals"; equation y=fill(u, nout); end RealVectorReplicator;