LesserOrEqual LesserOrEqual Icon

Compare.LesserOrEqual

LesserOrEqual()

Compares two real-valued input signals (u1 and u2) and checks whether the first input (u1) is less than or equal to the second input (u2).

Variables

  • u1: First real input signal
  • u2: Second real input signal
  • y: Real output (1.0 if u1 ≤ u2, 0.0 otherwise)

Description

This component extends the partialComparison component and outputs a logical (real) value.

Examples

u1 = 4.0,  u2 = 5.0   → y = 1.0  (u1 is less)
u1 = 5.0,  u2 = 5.0   → y = 1.0  (u1 equals u2)
u1 = 5.1,  u2 = 5.0   → y = 0.0  (u1 is greater)

This component extends from partialComparison

Usage

PrimitiveComponents.Compare.LesserOrEqual()

Connectors

  • y - This connector represents a real signal as an output from a component (RealOutput)
  • u1 - This connector represents a real signal as an input to a component (RealInput)
  • u2 - This connector represents a real signal as an input to a component (RealInput)

Behavior

\[ \begin{align} y\left( t \right) &= ifelse\left( \mathtt{u1}\left( t \right) \leq \mathtt{u2}\left( t \right), 1, 0 \right) \end{align} \]

Source

"""
    LesserOrEqual()

Compares two real-valued input signals (u1 and u2) and checks whether the first input (u1) is less than or equal to the second input (u2).

# Variables
- `u1`: First real input signal
- `u2`: Second real input signal
- `y`: Real output (1.0 if u1 ≤ u2, 0.0 otherwise)

# Description
This component extends the `partialComparison` component and outputs a logical (real) value.

# Examples

u1 = 4.0, u2 = 5.0 → y = 1.0 (u1 is less) u1 = 5.0, u2 = 5.0 → y = 1.0 (u1 equals u2) u1 = 5.1, u2 = 5.0 → y = 0.0 (u1 is greater)

"""</span>
<span class="hljs-keyword">component</span> LesserOrEqual
&nbsp;&nbsp;<span class="hljs-keyword">extends</span> <span class="hljs-link"><a href="../../types/partialComparison.html">partialComparison</a></span>()
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;# Output (y) is 1.0 if u1 ≤ u2, and 0.0 otherwise.
&nbsp;&nbsp;y = ifelse(u1 <= u2, float_sym(1.0), float_sym(0.0))
<span class="hljs-keyword">metadata</span> {
&nbsp;&nbsp;"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/LessEqualThreshold.svg"}}
}
<span class="hljs-keyword">end</span></code></pre>
Flattened Source
"""
    LesserOrEqual()

Compares two real-valued input signals (u1 and u2) and checks whether the first input (u1) is less than or equal to the second input (u2).

# Variables
- `u1`: First real input signal
- `u2`: Second real input signal
- `y`: Real output (1.0 if u1 ≤ u2, 0.0 otherwise)

# Description
This component extends the `partialComparison` component and outputs a logical (real) value.

# Examples

u1 = 4.0, u2 = 5.0 → y = 1.0 (u1 is less) u1 = 5.0, u2 = 5.0 → y = 1.0 (u1 equals u2) u1 = 5.1, u2 = 5.0 → y = 0.0 (u1 is greater)

"""</span>
<span class="hljs-keyword">component</span> LesserOrEqual
&nbsp;&nbsp;# Real output signal representing the result of the comparison (either 1.0 or 0.0)
&nbsp;&nbsp;<span class="hljs-symbol">y</span> = <span>Dyad.RealOutput</span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;# First real input signal
&nbsp;&nbsp;<span class="hljs-symbol">u1</span> = <span>Dyad.RealInput</span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": -40, "x2": 0, "y1": 170, "y2": 210, "sh": 0.04, "sw": 0.04, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 170, "y2": 210, "sh": 0.04, "sw": 0.04, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;# Second real input signal
&nbsp;&nbsp;<span class="hljs-symbol">u2</span> = <span>Dyad.RealInput</span>() {
&nbsp;&nbsp;&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"diagram": {"x1": -40, "x2": 0, "y1": 710, "y2": 750, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 710, "y2": 750, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;# Output (y) is 1.0 if u1 ≤ u2, and 0.0 otherwise.
&nbsp;&nbsp;y = ifelse(u1 <= u2, float_sym(1.0), float_sym(0.0))
<span class="hljs-keyword">metadata</span> {
&nbsp;&nbsp;"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/LessEqualThreshold.svg"}}
}
<span class="hljs-keyword">end</span></code></pre>


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses