RAW File Structure

This section is written to help understand the why the structure of classes is defined as it is.

The RAW file starts with a text preamble that contains information about the names of the traces the order they appear on the binary part and some extra information. In the preamble, the lines are always started by one of the following identifiers:

  • Title: => Contains the path of the source .asc file used to make the simulation preceded by *

  • Date: => Date when the simulation started

  • Plotname: => Name of the simulation. The known Simulation Types are:
    • Operation Point

    • DC transfer characteristic

    • AC Analysis

    • Transient Analysis

    • Noise Spectral Density - (V/Hz½ or A/Hz½)

    • Transfer Function

  • Flags: => Flags that are used in this plot. The simulation can have any combination of these flags.
    • “real” -> The traces in the raw file contain real values. As for exmple on a TRAN simulation.

    • “complex” -> Traces in the raw file contain complex values. As for exmple on an AC simulation.

    • “forward” -> Tells whether the simulation has more than one point. DC transfer characteristic, AC Analysis, Transient Analysis or Noise Spectral Density have the forward flag. Operating Point and Transfer Function don’t have this flag activated.

    • “log” -> The preferred plot view of this data is logarithmic.

    • “stepped” -> The simulation had .STEP primitives.

    • “FastAccess” -> Order of the data is changed to speed up access. See Binary section for details.

  • No. Variables: => number of variables contained in this dataset. See section below for details.

  • No. Points: => number of points per each variable in

  • Offset: => when the saving of data started

  • Command: => Name of the simulator executable generating this file.

  • Backannotation: => Backannotation alerts that occurred during simulation

  • Variables: => a list of variable, one per line as described below

  • Binary: => Start of the binary section. See section below for details.

Variables List

The variable list contains the list of measurements saved in the raw file. The order of the variables defines how they are stored in the binary section. The format is one variable per line, using the following format:

<tab><ordinal number><tab><measurement><tab><type of measurement>

Here is an example:

0   time    time
1   V(n001)    voltage
2   V(n004)    voltage
3   V(n003)    voltage
4   V(n006)    voltage
5   V(adcc)    voltage
6   V(n002)    voltage
7   V(3v3_m)   voltage
8   V(n005)    voltage
9   V(n007)    voltage
10  V(24v_dsp) voltage
11  I(C3)      device_current
12  I(C2)      device_current
13  I(C1)      device_current
14  I(I1)      device_current
15  I(R4)      device_current
16  I(R3)      device_current
17  I(V2)      device_current
18  I(V1)      device_current
19  Ix(u1:+)   subckt_current
20  Ix(u1:-)   subckt_current

Binary Section

The binary section of .RAW file is where the data is usually written, unless the user had explicitly specified an ASCII representation. In this case this section is replaced with a “Values” section. LTSpice stores data directly onto the disk during simulation, writing per each time or frequency step the list of values, as exemplified below for a .TRAN simulation.

<timestamp 0><trace1 0><trace2 0><trace3 0>…<traceN 0>

<timestamp 1><trace1 1><trace2 1><trace3 1>…<traceN 1>

<timestamp 2><trace1 2><trace2 2><trace3 2>…<traceN 2>

<timestamp T><trace1 T><trace2 T><trace3 T>…<traceN T>

Depending on the type of simulation the type of data changes. On TRAN simulations the timestamp is always stored as 8 bytes float (double) and trace values as a 4 bytes (single). On AC simulations the data is stored in complex format, which includes a real part and an imaginary part, each with 8 bytes. The way we determine the size of the data is dividing the total block size by the number of points, then taking only the integer part.

Fast Access

Once a simulation is done, the user can ask LTSpice to optimize the data structure in such that variables are stored contiguously as illustrated below.

<timestamp 0><timestamp 1>…<timestamp T>

<trace1 0><trace1 1>…<trace1 T>

<trace2 0><trace2 1>…<trace2 T>

<trace3 0><trace3 1>…<trace3 T>

<traceN T><traceN T>…<tranceN T>

This can speed up the data reading. Note that this transformation is not done automatically. Transforming data to Fast Access must be requested by the user. If the transformation is done, it is registered in the Flags: line in the header. PyLTSpice supports both Normal and Fast Access formats