Modelica.Blocks.Logical

Library of components with Boolean input and output signals

Information

This package provides blocks with Boolean input and output signals to describe logical networks. A typical example for a logical network built with package Logical is shown in the next figure:

LogicalNetwork1.png

The actual value of Boolean input and/or output signals is displayed in the respective block icon as "circle", where "white" color means value false and "green" color means value true. These values are visualized in a diagram animation.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Modelica.Blocks.Logical.And And Logical 'and': y = u1 and u2
Modelica.Blocks.Logical.Or Or Logical 'or': y = u1 or u2
Modelica.Blocks.Logical.Xor Xor Logical 'xor': y = u1 xor u2
Modelica.Blocks.Logical.Nor Nor Logical 'nor': y = not (u1 or u2)
Modelica.Blocks.Logical.Nand Nand Logical 'nand': y = not (u1 and u2)
Modelica.Blocks.Logical.Not Not Logical 'not': y = not u
Modelica.Blocks.Logical.Pre Pre Breaks algebraic loops by an infinitesimal small time delay (y = pre(u): event iteration continues until u = pre(u))
Modelica.Blocks.Logical.Edge Edge Output y is true, if the input u has a rising edge (y = edge(u))
Modelica.Blocks.Logical.FallingEdge FallingEdge Output y is true, if the input u has a falling edge (y = edge(not u))
Modelica.Blocks.Logical.Change Change Output y is true, if the input u has a rising or falling edge (y = change(u))
Modelica.Blocks.Logical.GreaterThreshold GreaterThreshold Output y is true, if input u is greater than threshold
Modelica.Blocks.Logical.GreaterEqualThreshold GreaterEqualThreshold Output y is true, if input u is greater or equal than threshold
Modelica.Blocks.Logical.LessThreshold LessThreshold Output y is true, if input u is less than threshold
Modelica.Blocks.Logical.LessEqualThreshold LessEqualThreshold Output y is true, if input u is less or equal than threshold
Modelica.Blocks.Logical.Greater Greater Output y is true, if input u1 is greater than input u2
Modelica.Blocks.Logical.GreaterEqual GreaterEqual Output y is true, if input u1 is greater or equal than input u2
Modelica.Blocks.Logical.Less Less Output y is true, if input u1 is less than input u2
Modelica.Blocks.Logical.LessEqual LessEqual Output y is true, if input u1 is less or equal than input u2
Modelica.Blocks.Logical.ZeroCrossing ZeroCrossing Trigger zero crossing of input u
Modelica.Blocks.Logical.LogicalSwitch LogicalSwitch Logical Switch
Modelica.Blocks.Logical.Switch Switch Switch between two Real signals
Modelica.Blocks.Logical.Hysteresis Hysteresis Transform Real to Boolean signal with Hysteresis
Modelica.Blocks.Logical.OnOffController OnOffController On-off controller
Modelica.Blocks.Logical.TriggeredTrapezoid TriggeredTrapezoid Triggered trapezoid generator
Modelica.Blocks.Logical.Timer Timer Timer measuring the time from the time instant where the Boolean input became true
Modelica.Blocks.Logical.RSFlipFlop RSFlipFlop A basic RS Flip Flop
Modelica.Blocks.Logical.TerminateSimulation TerminateSimulation Terminate simulation if condition is fulfilled

Modelica.Blocks.Logical.And Modelica.Blocks.Logical.And

Logical 'and': y = u1 and u2

Information

The output is true if all inputs are true, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSI2SO (Partial block with 2 input and 1 output Boolean signal).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Or Modelica.Blocks.Logical.Or

Logical 'or': y = u1 or u2

Information

The output is true if at least one input is true, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSI2SO (Partial block with 2 input and 1 output Boolean signal).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Xor Modelica.Blocks.Logical.Xor

Logical 'xor': y = u1 xor u2

Information

The output is true if exactly one input is true, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSI2SO (Partial block with 2 input and 1 output Boolean signal).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Nor Modelica.Blocks.Logical.Nor

Logical 'nor': y = not (u1 or u2)

Information

The output is true if none of the inputs is true, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSI2SO (Partial block with 2 input and 1 output Boolean signal).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Nand Modelica.Blocks.Logical.Nand

Logical 'nand': y = not (u1 and u2)

Information

The output is true if at least one input is false, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSI2SO (Partial block with 2 input and 1 output Boolean signal).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Not Modelica.Blocks.Logical.Not

Logical 'not': y = not u

Information

The output is true if the input is false, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSISO (Partial block with 1 input and 1 output Boolean signal).

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Pre Modelica.Blocks.Logical.Pre

Breaks algebraic loops by an infinitesimal small time delay (y = pre(u): event iteration continues until u = pre(u))

Information

This block delays the Boolean input by an infinitesimal small time delay and therefore breaks algebraic loops. In a network of logical blocks, in every "closed connection loop" at least one logical block must have a delay, since algebraic systems of Boolean equations are not solvable.

The "Pre" block returns the value of the "input" signal from the last "event iteration". The "event iteration" stops, once both values are identical (u = pre(u)).

Extends from Blocks.Interfaces.partialBooleanSISO (Partial block with 1 input and 1 output Boolean signal).

Parameters

NameDescription
pre_u_startStart value of pre(u) at initial time

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Edge Modelica.Blocks.Logical.Edge

Output y is true, if the input u has a rising edge (y = edge(u))

Information

The output is true if the Boolean input has a rising edge from false to true, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSISO (Partial block with 1 input and 1 output Boolean signal).

Parameters

NameDescription
pre_u_startStart value of pre(u) at initial time

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.FallingEdge Modelica.Blocks.Logical.FallingEdge

Output y is true, if the input u has a falling edge (y = edge(not u))

Information

The output is true if the Boolean input has a falling edge from true to false, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSISO (Partial block with 1 input and 1 output Boolean signal).

Parameters

NameDescription
pre_u_startStart value of pre(u) at initial time

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Change Modelica.Blocks.Logical.Change

Output y is true, if the input u has a rising or falling edge (y = change(u))

Information

The output is true if the Boolean input has either a rising edge from false to true or a falling edge from true to false, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanSISO (Partial block with 1 input and 1 output Boolean signal).

Parameters

NameDescription
pre_u_startStart value of pre(u) at initial time

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.GreaterThreshold Modelica.Blocks.Logical.GreaterThreshold

Output y is true, if input u is greater than threshold

Information

The output is true if the Real input is greater than parameter threshold, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanThresholdComparison (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

NameDescription
thresholdComparison with respect to threshold

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.GreaterEqualThreshold Modelica.Blocks.Logical.GreaterEqualThreshold

Output y is true, if input u is greater or equal than threshold

Information

The output is true if the Real input is greater than or equal to parameter threshold, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanThresholdComparison (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

NameDescription
thresholdComparison with respect to threshold

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.LessThreshold Modelica.Blocks.Logical.LessThreshold

Output y is true, if input u is less than threshold

Information

The output is true if the Real input is less than parameter threshold, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanThresholdComparison (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

NameDescription
thresholdComparison with respect to threshold

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.LessEqualThreshold Modelica.Blocks.Logical.LessEqualThreshold

Output y is true, if input u is less or equal than threshold

Information

The output is true if the Real input is less than or equal to parameter threshold, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanThresholdComparison (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

NameDescription
thresholdComparison with respect to threshold

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Greater Modelica.Blocks.Logical.Greater

Output y is true, if input u1 is greater than input u2

Information

The output is true if Real input u1 is greater than Real input u2, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanComparison (Partial block with 2 Real input and 1 Boolean output signal (the result of a comparison of the two Real inputs)).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.GreaterEqual Modelica.Blocks.Logical.GreaterEqual

Output y is true, if input u1 is greater or equal than input u2

Information

The output is true if Real input u1 is greater than or equal to Real input u2, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanComparison (Partial block with 2 Real input and 1 Boolean output signal (the result of a comparison of the two Real inputs)).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Less Modelica.Blocks.Logical.Less

Output y is true, if input u1 is less than input u2

Information

The output is true if Real input u1 is less than Real input u2, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanComparison (Partial block with 2 Real input and 1 Boolean output signal (the result of a comparison of the two Real inputs)).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.LessEqual Modelica.Blocks.Logical.LessEqual

Output y is true, if input u1 is less or equal than input u2

Information

The output is true if Real input u1 is less than or equal to Real input u2, otherwise the output is false.

Extends from Blocks.Interfaces.partialBooleanComparison (Partial block with 2 Real input and 1 Boolean output signal (the result of a comparison of the two Real inputs)).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.ZeroCrossing Modelica.Blocks.Logical.ZeroCrossing

Trigger zero crossing of input u

Information

The output "y" is true at the time instant when the input "u" becomes zero, provided the input "enable" is true. At all other time instants, the output "y" is false. If the input "u" is zero at a time instant when the "enable" input changes its value, then the output y is false.

Note, that in the plot window of a Modelica simulator, the output of this block is usually identically to false, because the output may only be true at an event instant, but not during continuous integration. In order to check that this component is actually working as expected, one should connect its output to, e.g., component ModelicaAdditions.Blocks.Discrete.TriggeredSampler.

Extends from Blocks.Interfaces.partialBooleanSO (Partial block with 1 output Boolean signal).

Connectors

NameDescription
yConnector of Boolean output signal
u 
enableZero input crossing is triggered if the enable input signal is true

Modelica.Blocks.Logical.LogicalSwitch Modelica.Blocks.Logical.LogicalSwitch

Logical Switch

Information

The LogicalSwitch switches, depending on the Boolean u2 connector (the middle connector), between the two possible input signals u1 (upper connector) and u3 (lower connector).

If u2 is true, connector y is set equal to u1, else it is set equal to u3.

Extends from Blocks.Interfaces.partialBooleanSI3SO (Partial block with 3 input and 1 output Boolean signal).

Connectors

NameDescription
u1Connector of first Boolean input signal
u2Connector of second Boolean input signal
u3Connector of third Boolean input signal
yConnector of Boolean output signal

Modelica.Blocks.Logical.Switch Modelica.Blocks.Logical.Switch

Switch between two Real signals

Information

The Logical.Switch switches, depending on the logical connector u2 (the middle connector) between the two possible input signals u1 (upper connector) and u3 (lower connector).

If u2 is true, the output signal y is set equal to u1, else it is set equal to u3.

Extends from Modelica.Blocks.Icons.PartialBooleanBlock (Basic graphical layout of logical block).

Connectors

NameDescription
u1Connector of first Real input signal
u2Connector of Boolean input signal
u3Connector of second Real input signal
yConnector of Real output signal

Modelica.Blocks.Logical.Hysteresis Modelica.Blocks.Logical.Hysteresis

Transform Real to Boolean signal with Hysteresis

Information

This block transforms a Real input signal into a Boolean output signal:

The start value of the output is defined via parameter pre_y_start (= value of pre(y) at initial time). The default value of this parameter is false.

Extends from Modelica.Blocks.Icons.PartialBooleanBlock (Basic graphical layout of logical block).

Parameters

NameDescription
uLowif y=true and u<=uLow, switch to y=false
uHighif y=false and u>=uHigh, switch to y=true
pre_y_startValue of pre(y) at initial time

Connectors

NameDescription
u 
y 

Modelica.Blocks.Logical.OnOffController Modelica.Blocks.Logical.OnOffController

On-off controller

Information

The block OnOffController sets the output signal y to true when the input signal u falls below the reference signal minus half of the bandwidth and sets the output signal y to false when the input signal u exceeds the reference signal plus half of the bandwidth.

Extends from Modelica.Blocks.Icons.PartialBooleanBlock (Basic graphical layout of logical block).

Parameters

NameDescription
bandwidthBandwidth around reference signal
pre_y_startValue of pre(y) at initial time

Connectors

NameDescription
referenceConnector of Real input signal used as reference signal
uConnector of Real input signal used as measurement signal
yConnector of Real output signal used as actuator signal

Modelica.Blocks.Logical.TriggeredTrapezoid Modelica.Blocks.Logical.TriggeredTrapezoid

Triggered trapezoid generator

Information

The block TriggeredTrapezoid has a Boolean input and a real output signal and requires the parameters amplitude, rising, falling and offset. The output signal y represents a trapezoidal signal dependent on the input signal u.

The behaviour is as follows: Assume the initial input to be false. In this case, the output will be offset. After a rising edge (i.e., the input changes from false to true), the output is rising during rising to the sum of offset and amplitude. In contrast, after a falling edge (i.e., the input changes from true to false), the output is falling during falling to a value of offset.

Note, that the case of edges before expiration of rising or falling is handled properly.

Extends from Modelica.Blocks.Icons.PartialBooleanBlock (Basic graphical layout of logical block).

Parameters

NameDescription
amplitudeAmplitude of trapezoid
risingRising duration of trapezoid [s]
fallingFalling duration of trapezoid [s]
offsetOffset of output signal

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Real output signal

Modelica.Blocks.Logical.Timer Modelica.Blocks.Logical.Timer

Timer measuring the time from the time instant where the Boolean input became true

Information

When the Boolean input "u" becomes true, the timer is started and the output "y" is the time from the time instant where u became true. The timer is stopped and the output is reset to zero, once the input becomes false.

Extends from Modelica.Blocks.Icons.PartialBooleanBlock (Basic graphical layout of logical block).

Connectors

NameDescription
uConnector of Boolean input signal
yConnector of Real output signal

Modelica.Blocks.Logical.RSFlipFlop Modelica.Blocks.Logical.RSFlipFlop

A basic RS Flip Flop

Information

The output Q is set by the input S and reset by the input R, and keeps its value in between. QI is the inverse of Q.

Extends from Modelica.Blocks.Icons.PartialBooleanBlock (Basic graphical layout of logical block).

Parameters

NameDescription
QiniStart value of Q at initial time

Connectors

NameDescription
Q 
QI 
S 
R 

Modelica.Blocks.Logical.TerminateSimulation Modelica.Blocks.Logical.TerminateSimulation

Terminate simulation if condition is fulfilled

Information

In the parameter menu, a time varying expression can be defined via variable condition, for example "condition = x < 0", where "x" is a variable that is declared in the model in which the "TerminateSimulation" block is present. If this expression becomes true, the simulation is (successfully) terminated. A termination message explaining the reason for the termination can be given via parameter "terminationText".

Parameters

NameDescription
conditionTerminate simulation when condition becomes true
terminationTextText that will be displayed when simulation is terminated

Connectors

NameDescription
conditionTerminate simulation when condition becomes true
Automatically generated Tue Apr 05 09:36:12 2016.