# 含分流電阻的分流放大器 (`shuntAmplifier`)

> 分流電阻加放大器，可讀雙向電流。

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

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

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

## 何時使用

用分流電阻量測雙向電流時使用。只有單向電流時改用電流感測放大器，需要隔離時改用含分流電阻的隔離式放大器。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `IPP` | 電氣 | 一次側電流輸入，讀值為正 |
| `IPN` | 電氣 | 一次側電流輸出 |
| `OUT` | 電氣 | 輸出，以 GND 為參考 |
| `GND` | 電氣 | 輸出的接地參考 |

## 常用參數

- `rSense`: The shunt resistor between IPP and IPN (your choice, not part of the IC) (預設值: 0.005)
- `gain`: Gain (the A1 device: 20 V/V) (預設值: 20)
- `bw`: Bandwidth: the single pole of the response (-3 dB, all gains) (預設值: 400000)
- `vref`: Output at zero current: both reference pins at VS / 2 for a bidirectional output (預設值: 2.5)
- `noise`: RMS output noise; 0 = a noiseless amplifier (預設值: 0)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 | 規格書來源 |
|---|---|---|---|---|---|
| `rSense` | Ω | 0.005 | 1u – 10 Ω | The shunt resistor between IPP and IPN (your choice, not part of the IC) | assumption |
| `gain` | V/V | 20 | 1 – 10k V/V | Gain (the A1 device: 20 V/V) | Section 7.5 G, INA240A1, p.5 |
| `gainErr` | — | 0 | -100m – 100m | Gain error as a fraction (typically +/-0.05 %; 0 = nominal) | Section 7.5 gain error typ +/-0.05 %, p.5 (set to 0 here) |
| `bw` | Hz | 400000 | 1k – 100meg Hz | Bandwidth: the single pole of the response (-3 dB, all gains) | Section 7.5 BW typ, p.5 |
| `vos` | V | 0.000005 | -1m – 1m V | Input offset voltage (the datasheet gives it as +/-) | Section 7.5 VOS typ +/-5 uV, p.5 |
| `vref` | V | 2.5 | 0 – 5.5 V | Output at zero current: both reference pins at VS / 2 for a bidirectional output | Section 7.5 test conditions VREF1 = VREF2 = VS / 2, p.5 |
| `vs` | V | 5 | 2.7 – 5.5 V | Supply voltage: sets the upper output limit | Section 7.5 test conditions VS = 5 V, p.5 |
| `swingHi` | V | 0.05 | 0 – 1 V | Output swing below the VS rail | Section 7.5 swing to VS power-supply rail typ, RL = 10 kOhm, p.5 |
| `swingLo` | V | 0.001 | 0 – 1 V | Output swing above GND | Section 7.5 swing to GND typ, VREF = 0 V, p.5 |
| `noise` | V | 0 | 0 – 1 V | RMS output noise; 0 = a noiseless amplifier | Section 7.5 voltage noise density 40 nV/sqrt(Hz) input referred, p.5 (about 0.6 mV rms at the output over 400 kHz with gain 20) |
| `seed` | — | 1 | 0 – 9007t | Whole-number seed of the noise | model parameter |

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

## 模型

一次側路徑是分流電阻 rSense 串聯一個電流量測元件，因此壓降為 rSense * i。輸出是受控電壓源，依序為 vref + gain * (1 + gainErr) * (rSense * i + vos)、頻寬 bw 的一階低通、有效值為 noise 伏特的固定種子高斯雜訊，最後限制在 GND + swingLo 到 vs - swingHi。電源與參考是參數（vs、vref）而不是接腳。輸入偏壓電流、共模範圍、PWM 抑制、轉換率與漂移都沒有建模。

## 常見錯誤

- 電流過大時輸出會飽和，預設的增益與分流電阻下約在 24 A。電流更大時請改用較小的分流電阻或較低的增益。
- rSense 是你自己選的分流電阻，不是規格書的值，壓降與發熱要自行檢查。gain 與 bw 要成對修改，步長則要小於響應時間的十分之一左右。
- noise 預設為 0。要看到預設增益下規格書的雜訊，請設定約 0.6 mV 的有效值，換 seed 就得到另一組雜訊。

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

## 規格書與來源

gain 取你所用型號的增益（20、50、100 或 200 V/V），bw 取 -3 dB 頻寬，vos 取典型輸入偏移。gainErr 取增益誤差的比例值（0.05 % 填 0.0005）。swingHi 與 swingLo 取輸出離電源與離接地的典型擺幅，雙向輸出時 vref 取電源的一半。rSense 與 vs 是你的設計值。以 ic.fromSpec 搭配 shuntAmplifier 模板傳入，並把腳位改成規格書的名稱，或放置 INA181A1 至 INA181A4 預設（SBOS793H：增益 20、50、100、200 V/V，頻寬 350、210、150、105 kHz）。

## 範例

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

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