# 直流電流源 (`dcCurrentSource`)

> 讓固定的電流流過自己。

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

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

**分類:** 電源 · **種類:** `{"kind":"dcCurrentSource"}`

## 何時使用

用於固定負載、偏壓電流與測試注入。電流要隨訊號變化時，請用受控源。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `p` | 電氣 | 電流由此進入，流向 n |
| `n` | 電氣 | 電流在此回到電路 |

## 常用參數

- `i`: Current the source pushes (預設值: 必填)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 |
|---|---|---|---|---|
| `i` | A | 必填 |  | Current the source pushes |
| `pwl` | — | 選填（預設關閉） |  | Time and value pairs joined by straight lines; replaces the fixed value |
| `profile` | — | 選填（預設關閉） |  | Current over time: vrstep(i0 i1 delay slew in A/µs [width period]), workload, pulse, steps or pwl as for the power load; replaces pwl and i |
| `repeat` | — | 0 |  | Set to 1 to repeat the pwl pattern over and over |

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

**適用於:** 定電流負載 · 偏壓電流 · 負載階躍 · 測試注入

**不適用於:** 定功率負載 → [`powerLoad`](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/sources/powerLoad/) · 由訊號設定的電流 → [`controlledSource`](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/sources/controlledSource/)

## 公式

| 公式 | 方程式 | 出處 |
|---|---|---|
| 負載電壓 | V = i·rl | Hayt, Kemmerly & Durbin, Engineering Circuit Analysis, 8th ed. (2012), Ch. 2 |
| 負載功率 | P = i²·rl | Hayt, Kemmerly & Durbin, Engineering Circuit Analysis, 8th ed. (2012), Ch. 2 |

## 快速驗算

輸入:

- `i`: 電源電流 = 1 A, `i`
- `rl`: 負載電阻 = 10 Ω

輸出:

- `v`: 負載電壓 = `i*rl` V
- `p`: 負載功率 = `i^2*rl` W

## 模型邏輯

- 元件把由 p 經自身流到 n 的電流 i 直接加入節點方程式；兩端電壓完全由電路其餘部分決定。
- profile（依斜率的負載階躍、重播的波形）優先於 pwl，pwl 又優先於 i；pwl 在兩端維持端點值，repeat 為 1 時重複。
- 這是理想電源：沒有並聯電阻，也沒有順從電壓限制，所以只由它供電、沒有其他路徑的節點電壓無法確定。

## 模型

不論兩端電壓為何，電源都強制電流 i 由 p 流經自身到 n。它從 p 的節點取走電荷，送到 n 的節點。元件沒有電壓限制，也沒有內阻。設定 pwl 為一串時間與數值後，輸出會沿著這些點之間的直線變化，不再固定在 i，最後一個時間之後維持最後的值，repeat 為 1 時則在那裡重新開始。

## 常見錯誤

- 由電流源供電、卻沒有電阻路徑通往地的節點，電壓無法確定。請在電流源旁並聯一個大電阻。
- 正負號很容易弄反。正的 i 由 p 經電源流到 n，所以接在 p 側的負載會被抽走電流。

Problems 規則: `cutset.inductor_current`

## 規格書與來源

沒有規格書。i 是你想維持的負載電流、LED 電流或偏壓電流。

## 範例

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

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