The .PLOT statement specifies signals to capture as XY plot data during simulation. Results are stored in the XyPlots collection of the SpiceSharpModel.
.PLOT [<type>] <expr1> [<expr2> ...] [merge]
| Parameter | Description |
|---|---|
type |
Optional analysis filter: DC, AC, TRAN, NOISE |
expr |
Signal expressions to plot |
merge |
Optional keyword — combine all simulations into one plot |
* Plot output voltage during transient
.PLOT TRAN V(OUT)
* Plot multiple signals during AC
.PLOT AC V(OUT) V(IN)
* Merge all sweep iterations into one plot
.PLOT TRAN V(OUT) merge
.PLOT does not affect convergence, timestep choice, or matrix loading. It
records values after the requested analysis has solved its MNA system.
The plotted expressions use the same sources as .SAVE and .PRINT: node
voltages, branch currents, and device properties computed from the solved
state.
- Without
merge: A separateXyPlotis created for each simulation run (except OP). - With
merge: All simulation runs are combined into a singleXyPlotwith series labeled by simulation.
RC Step Response
V1 IN 0 PULSE(0 5 0 1n 1n 5m 10m)
R1 IN OUT 1k
C1 OUT 0 100n
.TRAN 1e-6 20e-3
.PLOT TRAN V(OUT) V(IN)
.END
var model = reader.Read(parseResult.FinalModel);
foreach (var plot in model.XyPlots)
{
Console.WriteLine(plot.Name);
foreach (var series in plot.Series)
{
Console.WriteLine($" Series: {series.Name}, Points: {series.Points.Count}");
}
}