# 斜率限制器 (`rateLimiter`)

> 跟隨輸入，但變化速度不超過上升與下降斜率。

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

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

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

## 何時使用

用於參考值的軟啟動、斜坡速度命令，或責任比的變化率限制。要限制數值本身請用限幅器。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `in` | 訊號 | 要跟隨的訊號 |
| `out` | 訊號 | 限制斜率後的訊號 |

## 常用參數

- `rise`: Fastest rise of the output, in units per second (預設值: 必填)
- `fall`: Fastest fall of the output, in units per second; the rising rate when empty (預設值: rise)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 |
|---|---|---|---|---|
| `rise` | 1/s | 必填 |  | Fastest rise of the output, in units per second |
| `fall` | 1/s | rise |  | Fastest fall of the output, in units per second; the rising rate when empty |

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

## 模型

開始時輸出等於輸入。在每個長度為 h 的被接受步長中，輸出從前一步的值朝輸入移動，上升最多 rise·h、下降最多 fall·h，所以輸入的階躍會變成斜率為 rise（或 −fall）的斜坡。若輸入來自階躍源或比較器，其跳變落在步長之內（階躍源的跳變落在步長結尾，求解器會在該處落步），輸出只在跳變之後的那段步長內移動，因此斜坡從跳變處開始，與步長無關。rise 與 fall 的單位是每秒；fall 預設等於 rise。此方塊有直通。

## 常見錯誤

- 斜率是以模擬時間的每秒計算。此方塊的輸出若流向 PWM 讀取的責任比，程式碼產生會以程式的取樣時間 ts 寫出它，每個取樣最多上升 rise·ts、下降 fall·ts；在其他位置則會略過，請以 zDelay、加法器與 rise·ts 的限幅器自行搭建。
- rise 與 fall 必須為正。放在迴路中時，限制會加入取決於步長的延遲；請不要放在快速的內迴路裡。

Problems 規則: `compile.error`

## 規格書與來源

沒有規格書。

## 範例

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

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