Package Modelica.​Blocks.​LogicalLibrary 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:

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 Contents

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

Block Modelica.​Blocks.​Logical.​AndLogical 'and': y = u1 and u2

Information

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

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

Connectors

TypeNameDescription
`input ``BooleanInput``u1`Connector of first Boolean input signal
`input ``BooleanInput``u2`Connector of second Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​OrLogical 'or': y = u1 or u2

Information

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

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

Connectors

TypeNameDescription
`input ``BooleanInput``u1`Connector of first Boolean input signal
`input ``BooleanInput``u2`Connector of second Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​XorLogical 'xor': y = u1 xor u2

Information

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

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

Connectors

TypeNameDescription
`input ``BooleanInput``u1`Connector of first Boolean input signal
`input ``BooleanInput``u2`Connector of second Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​NorLogical '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 `Modelica.​Blocks.​Interfaces.​partialBooleanSI2SO` (Partial block with 2 input and 1 output Boolean signal).

Connectors

TypeNameDescription
`input ``BooleanInput``u1`Connector of first Boolean input signal
`input ``BooleanInput``u2`Connector of second Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​NandLogical '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 `Modelica.​Blocks.​Interfaces.​partialBooleanSI2SO` (Partial block with 2 input and 1 output Boolean signal).

Connectors

TypeNameDescription
`input ``BooleanInput``u1`Connector of first Boolean input signal
`input ``BooleanInput``u2`Connector of second Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​NotLogical 'not': y = not u

Information

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

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

Connectors

TypeNameDescription
`input ``BooleanInput``u`Connector of Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​PreBreaks 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 `Modelica.​Blocks.​Interfaces.​partialBooleanSISO` (Partial block with 1 input and 1 output Boolean signal).

Parameters

TypeNameDefaultDescription
`Boolean``pre_u_start``false`Start value of pre(u) at initial time

Connectors

TypeNameDescription
`input ``BooleanInput``u`Connector of Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​EdgeOutput 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 `Modelica.​Blocks.​Interfaces.​partialBooleanSISO` (Partial block with 1 input and 1 output Boolean signal).

Parameters

TypeNameDefaultDescription
`Boolean``pre_u_start``false`Start value of pre(u) at initial time

Connectors

TypeNameDescription
`input ``BooleanInput``u`Connector of Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​FallingEdgeOutput 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 `Modelica.​Blocks.​Interfaces.​partialBooleanSISO` (Partial block with 1 input and 1 output Boolean signal).

Parameters

TypeNameDefaultDescription
`Boolean``pre_u_start``false`Start value of pre(u) at initial time

Connectors

TypeNameDescription
`input ``BooleanInput``u`Connector of Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​ChangeOutput 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 `Modelica.​Blocks.​Interfaces.​partialBooleanSISO` (Partial block with 1 input and 1 output Boolean signal).

Parameters

TypeNameDefaultDescription
`Boolean``pre_u_start``false`Start value of pre(u) at initial time

Connectors

TypeNameDescription
`input ``BooleanInput``u`Connector of Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​GreaterThresholdOutput 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 `Modelica.​Blocks.​Interfaces.​partialBooleanThresholdComparison` (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

TypeNameDefaultDescription
`Real``threshold``0`Comparison with respect to threshold

Connectors

TypeNameDescription
`input ``RealInput``u`Connector of Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​GreaterEqualThresholdOutput 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 `Modelica.​Blocks.​Interfaces.​partialBooleanThresholdComparison` (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

TypeNameDefaultDescription
`Real``threshold``0`Comparison with respect to threshold

Connectors

TypeNameDescription
`input ``RealInput``u`Connector of Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​LessThresholdOutput 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 `Modelica.​Blocks.​Interfaces.​partialBooleanThresholdComparison` (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

TypeNameDefaultDescription
`Real``threshold``0`Comparison with respect to threshold

Connectors

TypeNameDescription
`input ``RealInput``u`Connector of Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​LessEqualThresholdOutput 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 `Modelica.​Blocks.​Interfaces.​partialBooleanThresholdComparison` (Partial block to compare the Real input u with a threshold and provide the result as 1 Boolean output signal).

Parameters

TypeNameDefaultDescription
`Real``threshold``0`Comparison with respect to threshold

Connectors

TypeNameDescription
`input ``RealInput``u`Connector of Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​GreaterOutput 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 `Modelica.​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

TypeNameDescription
`input ``RealInput``u1`Connector of first Real input signal
`input ``RealInput``u2`Connector of second Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​GreaterEqualOutput 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 `Modelica.​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

TypeNameDescription
`input ``RealInput``u1`Connector of first Real input signal
`input ``RealInput``u2`Connector of second Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​LessOutput 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 `Modelica.​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

TypeNameDescription
`input ``RealInput``u1`Connector of first Real input signal
`input ``RealInput``u2`Connector of second Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​LessEqualOutput 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 `Modelica.​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

TypeNameDescription
`input ``RealInput``u1`Connector of first Real input signal
`input ``RealInput``u2`Connector of second Real input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​ZeroCrossingTrigger 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 Modelica.Blocks.Discrete.TriggeredSampler.

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

Connectors

TypeNameDescription
`output ``BooleanOutput``y`Connector of Boolean output signal
`input ``RealInput``u`
`input ``BooleanInput``enable`Zero input crossing is triggered if the enable input signal is true

Block Modelica.​Blocks.​Logical.​LogicalSwitchLogical 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 `Modelica.​Blocks.​Interfaces.​partialBooleanSI3SO` (Partial block with 3 input and 1 output Boolean signal).

Connectors

TypeNameDescription
`input ``BooleanInput``u1`Connector of first Boolean input signal
`input ``BooleanInput``u2`Connector of second Boolean input signal
`input ``BooleanInput``u3`Connector of third Boolean input signal
`output ``BooleanOutput``y`Connector of Boolean output signal

Block Modelica.​Blocks.​Logical.​SwitchSwitch 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

TypeNameDescription
`input ``RealInput``u1`Connector of first Real input signal
`input ``BooleanInput``u2`Connector of Boolean input signal
`input ``RealInput``u3`Connector of second Real input signal
`output ``RealOutput``y`Connector of Real output signal

Block Modelica.​Blocks.​Logical.​HysteresisTransform Real to Boolean signal with Hysteresis

Information

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

• When the output was false and the input becomes greater than parameter uHigh, the output switches to true.
• When the output was true and the input becomes less than parameter uLow, the output switches to false.

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

TypeNameDefaultDescription
`Real``uLow` if y=true and u<=uLow, switch to y=false
`Real``uHigh` if y=false and u>=uHigh, switch to y=true
`Boolean``pre_y_start``false`Value of pre(y) at initial time

Connectors

TypeNameDescription
`input ``RealInput``u`
`output ``BooleanOutput``y`

Block Modelica.​Blocks.​Logical.​OnOffControllerOn-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

TypeNameDefaultDescription
`Real``bandwidth` Bandwidth around reference signal
`Boolean``pre_y_start``false`Value of pre(y) at initial time

Connectors

TypeNameDescription
`input ``RealInput``reference`Connector of Real input signal used as reference signal
`input ``RealInput``u`Connector of Real input signal used as measurement signal
`output ``BooleanOutput``y`Connector of Real output signal used as actuator signal

Block Modelica.​Blocks.​Logical.​TriggeredTrapezoidTriggered 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

TypeNameDefaultDescription
`Real``amplitude``1`Amplitude of trapezoid
`Time``rising``0`Rising duration of trapezoid
`Time``falling``rising`Falling duration of trapezoid
`Real``offset``0`Offset of output signal

Connectors

TypeNameDescription
`input ``BooleanInput``u`Connector of Boolean input signal
`output ``RealOutput``y`Connector of Real output signal

Block Modelica.​Blocks.​Logical.​TimerTimer measuring the time from the time instant where the Boolean input became true

Information

When the Boolean input "u" becomes true, the timer starts and the output "y" is the time that has elapsed since "u" became true. When the input becomes false, the timer stops and the output is reset to zero.

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

Connectors

TypeNameDescription
`input ``BooleanInput``u`Connector of Boolean input signal
`output ``RealOutput``y`Connector of Real output signal

Block Modelica.​Blocks.​Logical.​RSFlipFlopA basic RS Flip Flop

Information

The output `Q` is set by the input `S`, is 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

TypeNameDefaultDescription
`Boolean``Qini``false`Start value of Q at initial time

Connectors

TypeNameDescription
`output ``BooleanOutput``Q`
`output ``BooleanOutput``QI`
`input ``BooleanInput``S`
`input ``BooleanInput``R`

Block Modelica.​Blocks.​Logical.​TerminateSimulationTerminate 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

TypeNameDefaultDescription
`String``terminationText``"... End condition reached"`Text that will be displayed when simulation is terminated

Connectors

TypeNameDescription
`output ``BooleanOutput``condition`Terminate simulation when condition becomes true

Generated 2018-12-12 12:09:55 EST by MapleSim.