# DC Current Source (`dcCurrentSource`)

> Pushes a fixed current through itself.

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

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/sources/dcCurrentSource/)

**Group:** Sources · **Kind:** `{"kind":"dcCurrentSource"}`

## When to use it

Use it for constant loads, bias currents and test injections. For a current that follows a signal, use Controlled Source.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `p` | electrical | Current enters here and flows to n |
| `n` | electrical | Current returns to the circuit here |

## Common parameters

- `i`: Current the source pushes (Default: required)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `i` | A | required |  | Current the source pushes |
| `pwl` | — | optional (off) |  | Time and value pairs joined by straight lines; replaces the fixed value |
| `profile` | — | optional (off) |  | 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 |

_Parameter descriptions are in English in both languages._

**Use for:** Constant-current loads · Bias currents · Load steps · Test injection

**Not for:** Constant-power loads → [`powerLoad`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/sources/powerLoad/) · Current set by a signal → [`controlledSource`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/sources/controlledSource/)

## Formulas

| Formula | Equation | Source |
|---|---|---|
| Voltage across the load | V = i·rl | Hayt, Kemmerly & Durbin, Engineering Circuit Analysis, 8th ed. (2012), Ch. 2 |
| Load power | P = i²·rl | Hayt, Kemmerly & Durbin, Engineering Circuit Analysis, 8th ed. (2012), Ch. 2 |

## Quick check

Inputs:

- `i`: Source current = 1 A, `i`
- `rl`: Load resistance = 10 Ω

Outputs:

- `v`: Voltage across the load = `i*rl` V
- `p`: Load power = `i^2*rl` W

## Model logic

- The part adds the current i from p through itself to n straight into the node equations; the voltage across it is whatever the rest of the circuit sets.
- A profile (a load step at a slew rate, a replayed trace) wins over pwl, and pwl wins over i; pwl holds its end values and repeats when repeat is 1.
- It is ideal: no shunt resistance and no compliance voltage limit, so a node fed only by it, with no other path, has no defined voltage.

## Model

The source forces the current i through itself from p to n, whatever the voltage across it. It takes charge from the net at p and delivers it to the net at n. The part has no voltage limit and no internal resistance. With pwl set to a list of times and values, the output follows straight lines between those points instead of holding i, stays at the last value after the last time, and starts over there when repeat is 1.

## Common mistakes

- A node fed by a current source with no resistive path to ground has no defined voltage. Put a large resistor across the source.
- The sign is easy to flip. A positive i flows from p through the source to n, so a load on the p side has current taken out of it.

Problems rules: `cutset.inductor_current`

## Datasheet and sources

There is no datasheet. i is the load current, LED current or bias current you want to hold.

## Example

Open the example with the command `file.openExample` and the name `demo:dcCurrentSource`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
