LesserThreshold LesserThreshold Icon

Compare.LesserThreshold

LesserThreshold()

Compares a real-valued input signal (u) against a fixed threshold value.

Variables

  • u: Real input signal
  • y: Real output (1.0 if u < threshold, 0.0 otherwise)
  • threshold: Threshold value to compare against

Description

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

Examples

threshold = 5.0
u = 4.0 → y = 1.0  (true, u is less than threshold)
u = 5.0 → y = 0.0  (false, u equals threshold)
u = 6.0 → y = 0.0  (false, u is greater than threshold)

This component extends from partialThresholdComparison

Usage

PrimitiveComponents.Compare.LesserThreshold(threshold)

Parameters:

NameDescriptionUnitsDefault value
threshold

Connectors

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

Behavior

\[ \begin{align} y\left( t \right) &= ifelse\left( u\left( t \right) < \mathtt{threshold}, 1, 0 \right) \end{align} \]

Source

"""
    LesserThreshold()

Compares a real-valued input signal (u) against a fixed threshold value.

# Variables
- `u`: Real input signal
- `y`: Real output (1.0 if u < threshold, 0.0 otherwise)
- `threshold`: Threshold value to compare against

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

# Examples

threshold = 5.0 u = 4.0 → y = 1.0 (true, u is less than threshold) u = 5.0 → y = 0.0 (false, u equals threshold) u = 6.0 → y = 0.0 (false, u is greater than threshold)

"""</span>
<span class="hljs-keyword">component</span> LesserThreshold
&nbsp;&nbsp;<span class="hljs-keyword">extends</span> <span class="hljs-link"><a href="../../types/partialThresholdComparison.html">partialThresholdComparison</a></span>()
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;# y is 1.0 if u < threshold  otherwise y is 0.0
&nbsp;&nbsp;y = ifelse(u < threshold, float_sym(1.0), float_sym(0.0))
<span class="hljs-keyword">metadata</span> {
&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;"labels": [
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": " $(threshold)", "x": 500, "y": -150, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;],
&nbsp;&nbsp;&nbsp;&nbsp;"icons": {"default": "dyad://PrimitiveComponents/LessThanThreshold.svg"}
&nbsp;&nbsp;}
}
<span class="hljs-keyword">end</span></code></pre>
Flattened Source
"""
    LesserThreshold()

Compares a real-valued input signal (u) against a fixed threshold value.

# Variables
- `u`: Real input signal
- `y`: Real output (1.0 if u < threshold, 0.0 otherwise)
- `threshold`: Threshold value to compare against

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

# Examples

threshold = 5.0 u = 4.0 → y = 1.0 (true, u is less than threshold) u = 5.0 → y = 0.0 (false, u equals threshold) u = 6.0 → y = 0.0 (false, u is greater than threshold)

"""</span>
<span class="hljs-keyword">component</span> LesserThreshold
&nbsp;&nbsp;# Real output(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;# Real input
&nbsp;&nbsp;<span class="hljs-symbol">u</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": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;# threshold to compare against
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">threshold</span>::<span>Real</span>()
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;# y is 1.0 if u < threshold  otherwise y is 0.0
&nbsp;&nbsp;y = ifelse(u < threshold, float_sym(1.0), float_sym(0.0))
<span class="hljs-keyword">metadata</span> {
&nbsp;&nbsp;"Dyad": {
&nbsp;&nbsp;&nbsp;&nbsp;"labels": [
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": " $(threshold)", "x": 500, "y": -150, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;],
&nbsp;&nbsp;&nbsp;&nbsp;"icons": {"default": "dyad://PrimitiveComponents/LessThanThreshold.svg"}
&nbsp;&nbsp;}
}
<span class="hljs-keyword">end</span></code></pre>


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses