# 遲滯繼電器 (`hysteresis`)

> 輸入升過門檻時把輸出切到一個準位，降到較低的門檻以下時再切回來。

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

[元件參考](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/) · [English](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/hysteresis/)

**分類:** 控制 · **種類:** `{"block":"hysteresis","kind":"control"}`

## 何時使用

用於砰砰（遲滯）電流控制器、恆溫器、欠壓鎖定或施密特觸發器。比較兩個訊號請用比較器。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `in` | 訊號 | 訊號輸入 |
| `out` | 訊號 | yon 或 yoff |

## 常用參數

- `on`: Input above which the output switches to yon (預設值: 0.5)
- `off`: Input below which the output switches to yoff; not above on (預設值: -0.5)
- `yon`: Output after the input rises above on (預設值: 1)
- `yoff`: Output after the input falls below off, and at the start (預設值: 0)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 |
|---|---|---|---|---|
| `on` | — | 0.5 |  | Input above which the output switches to yon |
| `off` | — | -0.5 |  | Input below which the output switches to yoff; not above on |
| `yon` | — | 1 |  | Output after the input rises above on |
| `yoff` | — | 0 |  | Output after the input falls below off, and at the start |

_參數說明在兩種語言中都是英文。_

## 模型

輸入高於 on 時輸出為 yon，低於 off 時為 yoff，介於兩者之間時保持上一個值，所以 off 到 on 的區間就是遲滯帶。除非輸入一開始就高於 on，否則從 yoff 開始。on 不可低於 off；on = off 時就是對這個門檻的比較器。程式碼產生會把保持的準位放在狀態結構中。

## 常見錯誤

- 輸出只在求解步改變，所以輸入可能超過門檻最多一個步長的變化量。請讓 maxStep 相對於輸入穿過遲滯帶的速度夠小。
- off 高於 on 會被拒絕。輸入有雜訊時，遲滯帶必須比雜訊寬，否則輸出會在每次穿越時來回跳動。

Problems 規則: `compile.error`

## 規格書與來源

沒有規格書。做欠壓鎖定時，on 與 off 就是控制器規格書中的上升與下降門檻。

## 範例

以指令 `file.openExample` 開啟範例，名稱為 `demo:hysteresis`.

---
由 `cargo xtask reference` 依使用說明文字與參數規格產生，請勿手動編輯。
