Library of components with Boolean input and output signals
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).
Name | Description |
---|---|
And | Logical 'and': y = u1 and u2 |
Or | Logical 'or': y = u1 or u2 |
Xor | Logical 'xor': y = u1 xor u2 |
Nor | Logical 'nor': y = not (u1 or u2) |
Nand | Logical 'nand': y = not (u1 and u2) |
Not | Logical 'not': y = not u |
Pre | Breaks algebraic loops by an infinitesimal small time delay (y = pre(u): event iteration continues until u = pre(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)) |
Change | Output y is true, if the input u has a rising or falling edge (y = change(u)) |
GreaterThreshold | Output y is true, if input u is greater than threshold |
GreaterEqualThreshold | Output y is true, if input u is greater or equal than threshold |
LessThreshold | Output y is true, if input u is less than threshold |
LessEqualThreshold | Output y is true, if input u is less or equal than threshold |
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 |
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 |
ZeroCrossing | Trigger zero crossing of input u |
LogicalSwitch | Logical Switch |
Switch | Switch between two Real signals |
Hysteresis | Transform Real to Boolean signal with Hysteresis |
OnOffController | On-off controller |
TriggeredTrapezoid | Triggered trapezoid generator |
Timer | Timer measuring the time from the time instant where the Boolean input became true |
RSFlipFlop | A basic RS Flip Flop |
TerminateSimulation | Terminate simulation if condition is fulfilled |
Logical 'and': y = u1 and u2
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).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Logical 'or': y = u1 or u2
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).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Logical 'xor': y = u1 xor u2
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).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Logical 'nor': y = not (u1 or u2)
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).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Logical 'nand': y = not (u1 and u2)
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).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Logical 'not': y = not u
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).
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Breaks algebraic loops by an infinitesimal small time delay (y = pre(u): event iteration continues until u = pre(u))
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).
Name | Description |
---|---|
pre_u_start | Start value of pre(u) at initial time |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if the input u has a rising edge (y = edge(u))
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).
Name | Description |
---|---|
pre_u_start | Start value of pre(u) at initial time |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if the input u has a falling edge (y = edge(not u))
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).
Name | Description |
---|---|
pre_u_start | Start value of pre(u) at initial time |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if the input u has a rising or falling edge (y = change(u))
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).
Name | Description |
---|---|
pre_u_start | Start value of pre(u) at initial time |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u is greater than threshold
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).
Name | Description |
---|---|
threshold | Comparison with respect to threshold |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u is greater or equal than threshold
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).
Name | Description |
---|---|
threshold | Comparison with respect to threshold |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u is less than threshold
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).
Name | Description |
---|---|
threshold | Comparison with respect to threshold |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u is less or equal than threshold
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).
Name | Description |
---|---|
threshold | Comparison with respect to threshold |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u1 is greater than input u2
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)).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u1 is greater or equal than input u2
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)).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u1 is less than input u2
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)).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Output y is true, if input u1 is less or equal than input u2
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)).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
y | Connector of Boolean output signal |
Trigger zero crossing of input u
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).
Name | Description |
---|---|
y | Connector of Boolean output signal |
u | |
enable | Zero input crossing is triggered if the enable input signal is true |
Logical Switch
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).
Name | Description |
---|---|
u1 | Connector of first Boolean input signal |
u2 | Connector of second Boolean input signal |
u3 | Connector of third Boolean input signal |
y | Connector of Boolean output signal |
Switch between two Real signals
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).
Name | Description |
---|---|
u1 | Connector of first Real input signal |
u2 | Connector of Boolean input signal |
u3 | Connector of second Real input signal |
y | Connector of Real output signal |
Transform Real to Boolean signal with Hysteresis
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).
Name | Description |
---|---|
uLow | if y=true and u<=uLow, switch to y=false |
uHigh | if y=false and u>=uHigh, switch to y=true |
pre_y_start | Value of pre(y) at initial time |
Name | Description |
---|---|
u | |
y |
On-off controller
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).
Name | Description |
---|---|
bandwidth | Bandwidth around reference signal |
pre_y_start | Value of pre(y) at initial time |
Name | Description |
---|---|
reference | Connector of Real input signal used as reference signal |
u | Connector of Real input signal used as measurement signal |
y | Connector of Real output signal used as actuator signal |
Triggered trapezoid generator
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).
Name | Description |
---|---|
amplitude | Amplitude of trapezoid |
rising | Rising duration of trapezoid [s] |
falling | Falling duration of trapezoid [s] |
offset | Offset of output signal |
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Real output signal |
Timer measuring the time from the time instant where the Boolean input became true
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).
Name | Description |
---|---|
u | Connector of Boolean input signal |
y | Connector of Real output signal |
A basic RS Flip Flop
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).
Name | Description |
---|---|
Qini | Start value of Q at initial time |
Name | Description |
---|---|
Q | |
QI | |
S | |
R |
Terminate simulation if condition is fulfilled
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".
Name | Description |
---|---|
condition | Terminate simulation when condition becomes true |
terminationText | Text that will be displayed when simulation is terminated |
Name | Description |
---|---|
condition | Terminate simulation when condition becomes true |