# Pulse Voltage Source (`pulseVoltageSource`)

> Produces a pulse or square-wave voltage.

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

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

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

## When to use it

Use it for step tests, load or supply steps and test pulses. For switch gate drive, use PWM Generator instead.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `p` | electrical | Positive end |
| `n` | electrical | Negative end, the reference side |

## Common parameters

- `v1`: Low level before the pulse (Default: 0)
- `v2`: High level during the pulse (Default: required)
- `width`: How long each pulse stays high (Default: required)
- `period`: Time from one pulse to the next (Default: 0)
- `delay`: Wait before the first pulse (Default: 0)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `v1` | V | 0 |  | Low level before the pulse |
| `v2` | V | required |  | High level during the pulse |
| `delay` | s | 0 |  | Wait before the first pulse |
| `rise` | s | 0 |  | Rise time |
| `fall` | s | 0 |  | Fall time |
| `width` | s | required |  | How long each pulse stays high |
| `period` | s | 0 |  | Time from one pulse to the next |
| `rs` | Ω | 0 | 1m – 10 Ω | Resistance inside the source |

_Parameter descriptions are in English in both languages._

**Use for:** Step tests · Supply steps · Test pulses

**Not for:** Switch gate drive → [`pwm`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/pwm/) · Steps in control signals → [`step`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/step/)

## Formulas

| Formula | Equation | Source |
|---|---|---|
| Duty cycle | D = width/period | Erickson & Maksimović, Fundamentals of Power Electronics, 3rd ed. (2020), §2.1 |
| Average (sharp edges) | Vavg = v1 + (v2 − v1)·D | Erickson & Maksimović, Fundamentals of Power Electronics, 3rd ed. (2020), §2.1 |
| RMS (sharp edges) | Vrms = √(v1²·(1 − D) + v2²·D) | Erickson & Maksimović, Fundamentals of Power Electronics, 3rd ed. (2020), Appendix A |

## Quick check

Inputs:

- `v1`: Low level = 0 V, `v1`
- `v2`: High level = 5 V, `v2`
- `width`: Pulse width = 5u s, `width`
- `period`: Period = 20u s, `period`

Outputs:

- `duty`: Duty cycle = `width/period` —
- `vavg`: Average voltage = `v1 + (v2 - v1)*duty` V
- `vrms`: RMS voltage = `sqrt(v1^2*(1 - duty) + v2^2*duty)` V

## Model logic

- The output is v1 until delay, ramps linearly to v2 over rise, holds v2 for width, ramps back over fall, then stays at v1 until the next cycle, one period later.
- width is the flat top only, not counting rise and fall; period 0 or less gives one pulse, and a negative rise, fall or width is read as 0.
- The step control lands exactly on every corner in every cycle, so with rise and fall 0 the edge is a clean step and the on-time is the same each cycle.
- It is an ideal voltage branch with an optional series rs inside, on the n side; overshoot, ringing and a drive current limit are not modelled.

## Model

The output is v1 until delay, rises linearly to v2 over rise, holds v2 for width, falls to v1 over fall, and repeats every period (0 means one pulse). The duty is width / period, and rise + width + fall must fit inside period. The step control lands exactly on the edges.

## Common mistakes

- A width longer than the period gives a duty above 100 percent. Set the width to a part of the period.
- width and period are in seconds, so 5 means five seconds, not 5u. width has no default and must be set.

Problems rules: `duty.pulse`, `param.out_of_range`

## Datasheet and sources

There is no datasheet. v1 and v2 are your test levels, period is one divided by the test frequency, and rise and fall follow the edge speed you want to test.

## Example

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

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