# 二極體 (`diode`)

> 只讓電流單向流通，導通時有順向壓降。

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

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

**分類:** 開關元件 · **種類:** `{"kind":"diode"}`

## 何時使用

用於整流、續流路徑與鉗位。要控制導通時用理想開關，要靠閘極脈衝觸發時用閘流體。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `a` | 電氣 | 陽極；順向電流由 a 流向 k |
| `k` | 電氣 | 陰極；另一端 |

## 常用參數

- `vf`: Voltage lost while it conducts (預設值: 0)
- `ron`: Resistance when it is on (預設值: 1m)
- `qrr`: Charge released as the diode recovers (預設值: 0)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 |
|---|---|---|---|---|
| `ron` | Ω | 1m |  | Resistance when it is on |
| `roff` | Ω | 1meg |  | Resistance when it is off |
| `vf` | V | 0 |  | Voltage lost while it conducts |
| `device` | — | 選填（預設關閉） |  | Device name used to look up losses |
| `thermal` | — | 選填（預設關閉） |  | Where the lost heat goes |
| `eon` | J | 0 |  | Energy lost each time it turns on |
| `eoff` | J | 0 |  | Energy lost each time it turns off |
| `err` | J | 0 |  | Energy lost when the diode recovers |
| `vref` | V | 0 |  | Voltage used to measure those energies |
| `iref` | A | 0 |  | Current used to measure those energies |
| `tc` | 1/K | 0 |  | How on-resistance changes with heat |
| `tj` | °C | 25 |  | Junction temperature for the loss tables |
| `nParallel` | — | 1 |  | Identical devices this one switch stands for: the current is shared, the losses add up, each device keeps its own junction |
| `tjMax` | °C | 選填（預設關閉） |  | Highest junction temperature allowed; overrides the device's rating |
| `ls` | H | 0 | 500p – 50n H | Unwanted inductance in series with it |
| `coss` | F | 0 | 10p – 5n F | Capacitance across the device |
| `cj` | F | 0 | 5p – 2n F | Extra capacitance across the junction |
| `tdon` | s | 0 | 1n – 500n s | Delay before it turns on |
| `tdoff` | s | 0 | 1n – 500n s | Delay before it turns off |
| `qrr` | C | 0 | 1n – 5u C | Charge released as the diode recovers |
| `trr` | s | 100n | 10n – 1u s | How long the diode takes to recover |
| `qrrTemp` | — | 選填（預設關閉） |  | Junction temperature (°C) and factor pairs that scale qrr, from the datasheet's curve |
| `part` | — | 選填（預設關閉） |  | Part number; the catalogue part number, such as BSC070N10NS5, written on the schematic; information only, not simulated |
| `vRating` | V | 選填（預設關閉） |  | Voltage rating; the largest blocking voltage of the data sheet's maximum ratings (VDS, VCES, VRRM), written on the schematic; information only, not simulated |
| `iRating` | A | 選填（預設關閉） |  | Current rating; the continuous current of the data sheet's maximum ratings (ID, IC, IF), written on the schematic; information only, not simulated |
| `level` | — | ideal |  | Diode model: `ideal` is piecewise linear (ron, vf); `exponential` follows the Shockley law with is, n and rs |
| `is` | A | 10f |  | Saturation current of the exponential law; exponential level only |
| `n` | — | 1 |  | Ideality factor of the exponential law; exponential level only |
| `rs` | Ω | 0 |  | Series resistance of the exponential diode; exponential level only |
| `cjo` | F | 0 |  | Junction capacitance at zero volts; exponential level only |
| `vj` | V | 1 |  | Junction potential of the junction capacitance; exponential level only |
| `m` | — | 0.5 |  | Grading coefficient; how the junction capacitance falls with the reverse voltage; exponential level only |
| `fc` | — | 0.5 |  | Forward-bias coefficient; above fc·vj the junction capacitance continues as a straight line; exponential level only |
| `tt` | s | 0 |  | Transit time; the stored charge is tt times the diode current, as in SPICE; exponential level only, instead of qrr and trr |
| `bv` | V | 選填（預設關閉） |  | Reverse breakdown voltage; past it the reverse current grows exponentially, as in SPICE; exponential level only |
| `ibv` | A | 1m |  | Reverse current at the breakdown voltage bv; exponential level only |
| `nbv` | — | 選填（預設關閉） |  | Emission coefficient of the breakdown; the reverse current grows e-fold every nbv·k·T/q past bv; defaults to n; exponential level only |
| `ikf` | A | 0 |  | Forward knee current; above it the forward current grows half as steeply (high injection), as in SPICE; 0 for none; exponential level only |
| `isr` | A | 0 |  | Recombination saturation current; adds isr·(exp(v/(nr·Vt)) − 1), scaled by the depletion width through vj and m, as in SPICE; 0 for none; exponential level only |
| `nr` | — | 2 |  | Emission coefficient of the recombination current isr; exponential level only |
| `isw` | A | 0 |  | Sidewall saturation current: the perimeter junction's own exponential law, isw·(exp(v/(ns·Vt)) − 1), added to the bottom junction's, as in SPICE (JSW times the perimeter pj); 0 for none; exponential level only |
| `ns` | — | 選填（預設關閉） |  | Emission coefficient of the sidewall current isw; defaults to n; exponential level only |
| `cjsw` | F | 0 |  | Sidewall junction capacitance at zero volts, as in SPICE (CJP times the perimeter pj); exponential level only |
| `vjsw` | V | 1 |  | Junction potential of the sidewall capacitance; exponential level only |
| `mjsw` | — | 0.33 |  | Grading coefficient of the sidewall capacitance; exponential level only |
| `fcs` | — | 0.5 |  | Forward-bias coefficient of the sidewall capacitance; above fcs·vjsw it continues as a straight line; exponential level only |

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

**適用於:** 整流器 · 飛輪路徑 · 箝位電路

**不適用於:** 固定電壓的參考與箝位 → [`zener`](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/switches/zener/) · 閘極觸發整流 → [`thyristor`](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/switches/thyristor/)

## 公式

| 公式 | 方程式 | 出處 |
|---|---|---|
| 順向壓降 | V = vf + ron·I | IEC 60747-2:2016 (threshold voltage and forward slope resistance of rectifier diodes) |
| 導通損失 | P = vf·Iavg + ron·Irms² | Mohan, Undeland & Robbins, Power Electronics, 3rd ed. (2003), ch. 2 (on-state power loss) |

## 快速驗算

輸入:

- `vf`: 臨界電壓 = 700m V, `vf`
- `ron`: 斜率電阻 = 20m Ω, `ron`
- `iavg`: 平均順向電流 = 5 A
- `irms`: 順向均方根電流 = 7 A

輸出:

- `vdrop`: 平均電流下的壓降 = `vf + ron*iavg` V
- `pcond`: 導通損失 = `vf*iavg + ron*irms^2` W

## 模型邏輯

- 在預設的 ideal 層級，v(a) - v(k) 超過 vf 時導通，之後 i = (v - vf)/ron；電流變負時關斷。
- 關斷時是電阻 roff，預設 1 Mohm；vf 預設為 0，未設定時二極體沒有順向壓降。
- 狀態在每個時間步內反覆求解直到一致，所以關斷落在時間步的終點；步長越小，過零點越準。
- qrr 大於 0 時，電荷以時間常數 trr 趨向 qrr，須由反向電流移除後才關斷；exponential 層級改用 Shockley 定律。

## 模型

當 v(a) - v(k) 超過 vf 時二極體導通，之後遵循 i = (v - vf) / ron。電流變成負值時關斷，關斷後經 roff 阻擋。qrr 大於零時，儲存電荷會以時間常數 trr 向 qrr 累積，逆向電流移除這些電荷之前，二極體持續導通，因此產生逆向恢復尖峰。

## 常見錯誤

- vf 預設為 0，沒有設定 vf 的二極體沒有順向損耗。蕭特基二極體約設 0.4 V，矽二極體約設 0.7 V。
- 二極體與理想電流源串聯，或開關排成迴路時，可能找不到一致的狀態。請在元件上並聯電阻或緩衝電路。
- 這裡的 trr 是電荷時間常數，不是規格書上的恢復時間。指定元件庫的 device 後，電流接近額定值時會出現警告。

Problems 規則: `solver.not_settled`, `param.out_of_range`, `device.rating`

## 規格書與來源

vf 與 ron 取自順向曲線，vf 取低電流處的壓降，ron 取工作電流附近的斜率。qrr 取逆向恢復電荷，vref 與 iref 是損耗能量的測試條件（或指定元件庫的 device，使用表格損耗）。

## 範例

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

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