# Sine Source (`sine`)

> Outputs a sine wave with set amplitude, frequency, phase and offset.

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

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

**Group:** Control · **Kind:** `{"block":"sine","kind":"control"}`

## When to use it

Use it for a reference, a test disturbance or a modulation wave. Use Three-Phase Sine Source for a three-phase set and Step Source for a one-time change.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `out` | signal | Offset plus a sine wave |

## Common parameters

- `amp`: Height of the wave peak (Default: 1)
- `freq`: Frequency (Default: required)
- `phase`: Where the wave starts in its cycle (Default: 0)
- `offset`: Fixed amount added to the wave (Default: 0)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `amp` | — | 1 |  | Height of the wave peak |
| `freq` | Hz | required |  | Frequency |
| `phase` | ° | 0 |  | Where the wave starts in its cycle |
| `offset` | — | 0 |  | Fixed amount added to the wave |

_Parameter descriptions are in English in both languages._

## Model

out = offset + amp*sin(2*pi*freq*t + phase), where phase is in degrees and freq is in Hz. The value has no unit of its own. For a cosine, set phase to 90.

## Common mistakes

- As a duty reference for PWM Generator the wave must stay between 0 and 1. Set offset to 0.5 and amp to at most 0.5.
- The phase is in degrees, while the angle inputs of the transform blocks use radians. Keep the maximum step at or below one fiftieth of the period, which is 400 us for 50 Hz.

Problems rules: `duty.out_of_range`, `step.too_large`

## Datasheet and sources

No datasheet applies. The value of freq is the frequency you need, amp is the peak value and offset is the DC level, all in the unit of the signal the wave drives.

## Example

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

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