next up previous contents index
Next: Common Simulation Data File Up: File Formats Previous: Rawfile Format   Contents   Index


Comma Separated Value (CSV) Format

A comma-separated variable (CSV) format for plot data can be generated and read by WRspice. This is intended to facilitate transfer of data to and from other programs which can accept a CSV data style. The format is extended by comment lines so that the CSV format in WRspice can transfer the same data attributes as the rawfile format.

The file structure is reminiscent of the rawfile format, and the same format for the strings is used, but strings are printed after a leading `#' which indicates a comment. These comments will be used by WRspice as the file is read, but are expected to be ignored by other programs. Numerical data values are ASCII text in exponential or integer format, unlike rawfiles there is no binary option.

There are two non-commented fields for a single set of plot data. The Variables field consists of a comma-separated set of double-quoted strings, one for each plot vector saved. Each string contains at least one token, the vector name. This may be followed by space-separated attribute sepecifiers, in the same format as in rawfiles. If the vector has units data, this will be specified by the first attribute, following a ``units='' prefix. Finally, if the vector has non-default dimensions, a dimension string will appear following the attributes. The initial (leftmost) vector name corresponds to the scale vector. Vectors are sorted by length, longest to shortest.

The Values field consists of N lines, where each line is a comma-separated list of numbers. The numbers are the values for a certain scale point, in the same order as the variable names. The number of such lines N is the number of data points in the longest vector.

As for rawfiles, CSV files can be concatenated, and new plots will be generated as needed when read with the load command.

In WRspice, CSV format can be specified by giving the target file name a ``.csv'' extension. This applies to all commands and functions that generate or read plot data files. The CSV file generator follows the setting of the rawfileprec variable, which sets the number of significant figures to use for real values.

Below is output from the jjcntr.cir example with rawfileprec set to 5, as an example of the format.

\vt
#Title: CKT1
#Date: Sun Dec 29 09:37:34 2024
#Plotname: Transient analysis
#Flags: real
#No. Variables: 5
#No. Points: 601
#Command: version 4.3.22
#Variables:
"time units=S","v(4) units=V","v(8) units=V","v(12) units=V","v(16) units=V"
#Values:
0.00000e+00,0.00000e+00,0.00000e+00,0.00000e+00,0.00000e+00
1.00000e-12,1.29809e-12,1.45806e-12,1.29529e-12,4.17511e-13
2.00000e-12,3.88752e-13,4.56935e-13,4.22761e-13,3.72036e-13
3.00000e-12,1.68408e-13,2.39349e-13,2.57441e-13,2.37048e-13
...
5.99000e-10,1.47074e-11,-3.04534e-11,2.82106e-11,-1.05018e-11
6.00000e-10,1.35034e-11,-2.79655e-11,2.59221e-11,-9.65660e-12


next up previous contents index
Next: Common Simulation Data File Up: File Formats Previous: Rawfile Format   Contents   Index
Stephen R. Whiteley 2025-02-09