# OR Gate (`or`)

> Outputs 1 when any input read is above 0.5.

![or](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/or.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/or/)

**Group:** Control · **Kind:** `{"block":"or","kind":"control"}`

## When to use it

Use it to merge several fault sources into one signal. Use AND Gate when all inputs must agree.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in1` | signal | First input; true above 0.5 |
| `in2` | signal | Second input; true above 0.5 |
| `in3` | signal | Third input, read if n is 3 or 4 |
| `in4` | signal | Fourth input, read if n is 4 |
| `out` | signal | Output, always 0 or 1 |

## Common parameters

- `n`: How many inputs the gate has (Default: 2)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `n` | — | 2 |  | How many inputs the gate has |

_Parameter descriptions are in English in both languages._

## Model

The first n inputs are read (n = 2 by default, up to 4). An input is true when it is above 0.5. The output is 1 when at least one of the n inputs is true and 0 when all are false. The gate is combinational: it has direct feedthrough and follows its inputs at every solver step.

## Common mistakes

- With the default n of 2, the pins in3 and in4 are ignored even when wired, so a third fault source is silently missed. Set n to the number of inputs you use; an input that is not wired reads 0 and does not affect the result.
- A pulse shorter than one solver step can be missed, so feed the gate from PWM Generator outputs or comparator signals that change at solver steps. A loop made only of gates is refused.

Problems rules: `compile.error`

## Datasheet and sources

There is no datasheet. n is the number of fault or enable signals you merge. The logic levels come from your protection scheme, with one signal for each trip source.

## Example

Open the example with the command `file.openExample` and the name `demo:or`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
