<voltagesource />
Overview
<voltagesource /> defines a two-pin voltage source that can drive your circuit
in SPICE simulations. It supports DC sources as well as waveform-driven sources
("sinewave", "square", "triangle", and "sawtooth"). Use this element to
provide input stimulus for filters, rectifiers, power converters, and other
analog designs.
export default () => (
<board routingDisabled>
<voltagesource
name="V1"
waveShape="square"
voltage="5V"
frequency="1kHz"
dutyCycle={0.5}
/>
<resistor name="R1" resistance="1k" />
<trace from=".V1 > .pin1" to=".R1 > .pin1" />
<trace from=".V1 > .pin2" to=".R1 > .pin2" />
<voltageprobe name="VP_OUT" connectsTo=".R1 > .pin1" />
<analogsimulation duration="5ms" timePerStep="0.05ms" spiceEngine="ngspice" />
</board>
)
Properties
| Property | Description | Example |
|---|---|---|
name | Reference designator for the source. | "V1" |
voltage | DC voltage or amplitude voltage for the source. | "5V" |
peakToPeakVoltage | Peak-to-peak voltage for waveform-driven sources. | "4V" |
waveShape | Waveform shape for transient sources: "sinewave", "square", "triangle", or "sawtooth". | "square" |
frequency | Frequency of the waveform. | "1kHz" |
phase | Waveform phase in degrees. | 90 |
dutyCycle | Duty cycle for square waves, from 0 to 1 (or percentage string such as "50%"). | 0.5 |
pulseDelay, riseTime, fallTime, pulseWidth, period | Optional pulse timing parameters for square/pulse waveforms. | riseTime="1ns" |
acMagnitude, acPhase | Small-signal AC analysis magnitude (volts) and phase (degrees). | acMagnitude="1V" |
schX, schY, schRotation | Schematic placement controls. | schRotation={270} |
Use <voltagesource /> alongside <analogsimulation /> to define inputs for
SPICE analysis. For physical power sources on a PCB, consider <battery /> or a
connector instead.