GreaterOrEqualThreshold Icon
Compare.GreaterOrEqualThreshold
GreaterOrEqualThreshold()Compares a real-valued input signal (u) against a fixed threshold value and outputs whether the input is greater than or equal to the threshold.
Variables
u: Real input signaly: 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 = 7.0 → y = 1.0 (input greater than threshold)
u = 5.0 → y = 1.0 (input equals threshold)
u = 4.9 → y = 0.0 (input less than threshold)This component extends from partialThresholdComparison
Usage
PrimitiveComponents.Compare.GreaterOrEqualThreshold(threshold)
Parameters:
| Name | Description | Units | Default 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) \geq \mathtt{threshold}, 1, 0 \right) \end{align} \]
Source
"""
GreaterOrEqualThreshold()
Compares a real-valued input signal (u) against a fixed threshold value and outputs whether the input is greater than or equal to the threshold.
# 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.
# Examplesthreshold = 5.0 u = 7.0 → y = 1.0 (input greater than threshold) u = 5.0 → y = 1.0 (input equals threshold) u = 4.9 → y = 0.0 (input less than threshold)
"""</span>
<span class="hljs-keyword">component</span> GreaterOrEqualThreshold
<span class="hljs-keyword">extends</span> <span class="hljs-link"><a href="../../types/partialThresholdComparison.html">partialThresholdComparison</a></span>()
<span class="hljs-keyword">relations</span>
# y = 1.0 when u ≥ threshold , otherwise y = 0.0
y = ifelse(u >= threshold, float_sym(1.0), float_sym(0.0))
<span class="hljs-keyword">metadata</span> {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": " $(threshold)", "x": 500, "y": -150, "rot": 0}
],
"icons": {"default": "dyad://PrimitiveComponents/GreaterEqualThreshold.svg"}
}
}
<span class="hljs-keyword">end</span></code></pre>
Flattened Source
"""
GreaterOrEqualThreshold()
Compares a real-valued input signal (u) against a fixed threshold value and outputs whether the input is greater than or equal to the threshold.
# 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.
# Examplesthreshold = 5.0 u = 7.0 → y = 1.0 (input greater than threshold) u = 5.0 → y = 1.0 (input equals threshold) u = 4.9 → y = 0.0 (input less than threshold)
"""</span>
<span class="hljs-keyword">component</span> GreaterOrEqualThreshold
# Real output(either 1.0 or 0.0)
<span class="hljs-symbol">y</span> = <span>Dyad.RealOutput</span>() {
"Dyad": {
"placement": {
"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
}
}
}
# Real input
<span class="hljs-symbol">u</span> = <span>Dyad.RealInput</span>() {
"Dyad": {
"placement": {
"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
}
}
}
# threshold to compare against
<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">threshold</span>::<span>Real</span>()
<span class="hljs-keyword">relations</span>
# y = 1.0 when u ≥ threshold , otherwise y = 0.0
y = ifelse(u >= threshold, float_sym(1.0), float_sym(0.0))
<span class="hljs-keyword">metadata</span> {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": " $(threshold)", "x": 500, "y": -150, "rot": 0}
],
"icons": {"default": "dyad://PrimitiveComponents/GreaterEqualThreshold.svg"}
}
}
<span class="hljs-keyword">end</span></code></pre>
Test Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses