---
url: /dyad/dev/stdlib/DiscreteComponents/components/Examples.Integrator.Switch.md
description: >-
  Dyad Examples.Integrator.Switch docs. 
  DiscreteComponents.Examples.Integrator.Switch()
---

# `Examples.Integrator.Switch` {#Examples.Integrator.Switch}

## Usage {#Usage}

`DiscreteComponents.Examples.Integrator.Switch()`

## Connectors {#Connectors}

* `u1` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `u2` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

* `signal` - This connector represents a boolean signal as an input to a component ([`BooleanInput`](/stdlib/Dyad/connectors/BooleanInput#BooleanInput))

## Behavior {#Behavior}

Behavior of this component cannot be rendered because it includes `path` variables.

## Source {#Source}

```dyad
component Switch
  u1 = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": 190, "x2": 60, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  u2 = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 690, "x2": 50, "y2": 790, "rot": 0}
      },
      "tags": []
    }
  }
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  signal = BooleanInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -40, "x2": 550, "y2": 60, "rot": 90}
      },
      "tags": []
    }
  }
relations
  y = ifelse(signal, u1, u2)
metadata {"Dyad": {"doc": {"behavior": false}}}
end
```

```dyad
component Switch
  u1 = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": 190, "x2": 60, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  u2 = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 690, "x2": 50, "y2": 790, "rot": 0}
      },
      "tags": []
    }
  }
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  signal = BooleanInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -40, "x2": 550, "y2": 60, "rot": 90}
      },
      "tags": []
    }
  }
relations
  y = ifelse(signal, u1, u2)
metadata {"Dyad": {"doc": {"behavior": false}}}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
