# 電流感測放大器 (`currentSenseAmp`)

> 把分流電阻上的小電壓放大成以接地為參考的訊號。

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

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

**分類:** 積體電路 · **種類:** `{"definition":"currentSenseAmp","kind":"subsystem"}`

## 何時使用

用來由分流電阻取得訊號，供控制器或比較器使用，並保留真實的頻寬與電源限制。要自己搭配回授網路時，改用單極點運算放大器。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `INP` | 電氣 | 正感測輸入，接分流電阻的匯流排側 |
| `INN` | 電氣 | 負感測輸入，接分流電阻的負載側 |
| `OUT` | 電氣 | 輸出，以 GND 為參考 |
| `VS` | 電氣 | 電源，決定輸出上限 |
| `GND` | 電氣 | 輸出與電源的接地參考 |

## 常用參數

- `gain`: Gain (the A3 device) (預設值: 100)
- `bw`: Bandwidth: the single pole of the response (預設值: 150000)
- `sr`: Slew rate (2 V/us) (預設值: 2000000)
- `vos`: Input offset voltage (the datasheet gives it as +/-) (預設值: 0.000025)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 | 規格書來源 |
|---|---|---|---|---|---|
| `gain` | V/V | 100 | 100m – 100k V/V | Gain (the A3 device) | Section 7.5 G, A3 devices, p.8 |
| `gainErr` | — | 0 | -100m – 100m | Gain error as a fraction (the datasheet gives +/-0.1 % typical; 0 = nominal) | Section 7.5 EG typ +/-0.1 %, p.8 (set to 0 here) |
| `bw` | Hz | 150000 | 1 – 1g Hz | Bandwidth: the single pole of the response | Section 7.5 BW, A3 devices, CLOAD = 10 pF, p.8 |
| `sr` | V/s | 2000000 | 1k – 10g V/s | Slew rate (2 V/us) | Section 7.5 SR typ, p.8 |
| `vos` | V | 0.000025 | -100m – 100m V | Input offset voltage (the datasheet gives it as +/-) | Section 7.5 VOS typ +/-25 uV, p.8 |
| `swingHi` | V | 0.02 | 0 – 10 V | Output swing below the VS rail | Section 7.5 VSP typ, RL = 10 kOhm, p.8 |
| `swingLo` | V | 0.0005 | 0 – 10 V | Output swing above GND | Section 7.5 VSN typ, RL = 10 kOhm, p.8 |

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

## 模型

目標值為 gain * (1 + gainErr) * (V(INP) - V(INN) + vos)，並被限制在 GND + swingLo 到 VS - swingHi 之間。輸出以單極點 dy/dt = 2*pi*bw*(target - y) 追隨被限制後的目標，變化率限制在正負 sr，因此不會積分飽和。輸入不吸取電流，只看兩者的差值。共模範圍與 CMRR、偏壓電流、輸出阻抗、雜訊與雙向（參考腳）型號都沒有建模。輸出只在 GND 與 VS 之間擺動，所以負的感測電壓會被截在 swingLo。

## 常見錯誤

- gain 與 bw 要成對修改，因為規格書對每種增益型號列出不同的頻寬。也請確認增益乘以滿載感測電壓小於電源，否則輸出被截波，電流讀數會偏低。
- 輸出會晚一到兩個求解步長才進入電路。步長請小於響應時間的十分之一左右，150 kHz 時約為 1 us，要得到準確的整定時間則要更小。
- INP 要接分流電阻的電源側、INN 接負載側。否則感測電壓為負，輸出停在最低準位，VS 與 GND 也必須與電路共用接地。

Problems 規則: `step.too_large`, `param.out_of_range`

## 規格書與來源

gain 取你所用型號的標稱增益，bw 取該型號在所列負載電容下的小訊號頻寬。sr 取典型轉換率並換成 V/s（2 V/us 即 2e6）。vos 取典型輸入偏移電壓。gainErr 取增益誤差的比例值（0.1 % 填 0.001，0 表示標稱）。swingHi 與 swingLo 取指定負載下輸出離電源與離接地的距離。

## 範例

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

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