PositionSwitch_GreaterOrEqual >= PositionSwitch_GreaterOrEqual Icon

Switches.PositionSwitch_GreaterOrEqual

PositionSwitch_GreaterOrEqual(; name, threshold)

A conditional switch that selects between two real-valued inputs based on a threshold comparison using greater-than-or-equal logic.

Parameters

  • threshold: Threshold value for comparison

Variables

  • switch_primary: Control signal input for threshold comparison
  • input_primary: Primary real input signal
  • input_secondary: Secondary real input signal
  • switch_position: Output signal after switch

Description

Switches between two inputs based on whether the control signal is greater than or equal to the threshold. When switchprimary >= threshold, outputs inputprimary, otherwise outputs input_secondary.

Examples

threshold = 5.0
switch_primary = 7  → output = input_primary  (since 7 ≥ 5)
switch_primary = 5  → output = input_primary  (since 5 ≥ 5)
switch_primary = 4  → output = input_secondary (since 4 < 5)

Usage

PrimitiveComponents.Switches.PositionSwitch_GreaterOrEqual(threshold)

Parameters:

NameDescriptionUnitsDefault value
threshold

Connectors

  • switch_primary - This connector represents a real signal as an input to a component (RealInput)
  • input_primary - This connector represents a real signal as an input to a component (RealInput)
  • input_secondary - This connector represents a real signal as an input to a component (RealInput)
  • switch_position - This connector represents a real signal as an output from a component (RealOutput)

Behavior

\[ \begin{align} \mathtt{switch\_position}\left( t \right) &= ifelse\left( \mathtt{switch\_primary}\left( t \right) \geq \mathtt{threshold}, \mathtt{input\_primary}\left( t \right), \mathtt{input\_secondary}\left( t \right) \right) \end{align} \]

Source

"""
    PositionSwitch_GreaterOrEqual(; name, threshold)

A conditional switch that selects between two real-valued inputs based on a threshold comparison using greater-than-or-equal logic.

# Parameters
- `threshold`: Threshold value for comparison

# Variables
- `switch_primary`: Control signal input for threshold comparison
- `input_primary`: Primary real input signal
- `input_secondary`: Secondary real input signal
- `switch_position`: Output signal after switch

# Description
Switches between two inputs based on whether the control signal is greater than or equal to the threshold.
When switch_primary >= threshold, outputs input_primary, otherwise outputs input_secondary.

# Examples

threshold = 5.0 switchprimary = 7 → output = inputprimary (since 7 ≥ 5) switchprimary = 5 → output = inputprimary (since 5 ≥ 5) switchprimary = 4 → output = inputsecondary (since 4 < 5)

"""</span>
<span class="hljs-keyword">component</span> PositionSwitch_GreaterOrEqual
&nbsp;&nbsp;<span class="hljs-symbol">switch_primary</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": 0.04, "sw": 0.04, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">input_primary</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": 110, "y2": 150, "sh": 0.04, "sw": 0.04, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 110, "y2": 150, "sh": 0.04, "sw": 0.04, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">input_secondary</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": 800, "y2": 840, "sh": 0.04, "sw": 0.04, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 800, "y2": 840, "sh": 0.04, "sw": 0.04, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">switch_position</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;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">threshold</span>::<span>Real</span>()
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;switch_position = ifelse(switch_primary >= threshold, input_primary, input_secondary)
<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/Switch.svg"}
&nbsp;&nbsp;}
}
<span class="hljs-keyword">end</span></code></pre>
Flattened Source
"""
    PositionSwitch_GreaterOrEqual(; name, threshold)

A conditional switch that selects between two real-valued inputs based on a threshold comparison using greater-than-or-equal logic.

# Parameters
- `threshold`: Threshold value for comparison

# Variables
- `switch_primary`: Control signal input for threshold comparison
- `input_primary`: Primary real input signal
- `input_secondary`: Secondary real input signal
- `switch_position`: Output signal after switch

# Description
Switches between two inputs based on whether the control signal is greater than or equal to the threshold.
When switch_primary >= threshold, outputs input_primary, otherwise outputs input_secondary.

# Examples

threshold = 5.0 switchprimary = 7 → output = inputprimary (since 7 ≥ 5) switchprimary = 5 → output = inputprimary (since 5 ≥ 5) switchprimary = 4 → output = inputsecondary (since 4 < 5)

"""</span>
<span class="hljs-keyword">component</span> PositionSwitch_GreaterOrEqual
&nbsp;&nbsp;<span class="hljs-symbol">switch_primary</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": 0.04, "sw": 0.04, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">input_primary</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": 110, "y2": 150, "sh": 0.04, "sw": 0.04, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 110, "y2": 150, "sh": 0.04, "sw": 0.04, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">input_secondary</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": 800, "y2": 840, "sh": 0.04, "sw": 0.04, "rot": 0},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icon": {"x1": -40, "x2": 0, "y1": 800, "y2": 840, "sh": 0.04, "sw": 0.04, "rot": 0}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;<span class="hljs-symbol">switch_position</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;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">threshold</span>::<span>Real</span>()
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;switch_position = ifelse(switch_primary >= threshold, input_primary, input_secondary)
<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/Switch.svg"}
&nbsp;&nbsp;}
}
<span class="hljs-keyword">end</span></code></pre>


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses