Exporting/Importing Graphs and Data

In this topic:

Clipboard Operations

Overview

SIMetrix offers facilities to copy both graph data and the graph's graphical image to the system clipboard. This provides the ability to export simulation results to other applications. The data - for example - may be exported to a spreadsheet application for custom processing, while the graphical image may be exported to a word processor for the preparation of documents.

SIMetrix may also import data in a tabulated ASCII format. This feature may be used to display data from a spreadsheet allowing, for example, a comparison between measured and simulated data.

Copy Data to the Clipboard

  1. Select the graphs you wish to export
  2. Select the menu Edit > Copy ASCII Data
The data will be copied in a tabulated ASCII format. The first line will contain the names of the curves, while the remaining lines will contain the curves' data arranged in columns

Copying Graphics to the Clipboard

There are three different ways a graph can be copied to the clipboard. Use the menus under Edit > Copy Graphics. These are detailed below:

Colour Copies graph to clipboard in full colour. The curve legends identify the curves using coloured squares similar to how the graph is displayed on the screen.
Monochrome Copies graph to clipboard in monochrome. Curves are distinguished using varying markers and line styles. Curve legends distinguish curves with a straight line example
Colour with markers Copies graph to clipboard in full colour but also differentiates curves using markers and line styles. Curve legends distinguished curves with a straight line example.

Paste Data from the Clipboard

SIMetrix can plot curves using tabulated ASCII data from the clipboard. The format is the same as used for exporting data. See Copy Data to the Clipboard for more details.

Exporting Graphics

You may export schematic graphics to other applications such as word processors or drawing programs. You can do this via the clipboard (see Copying Graphics to the Clipboard) or by writing out to a file. To export waveform graphics to a file, select the graph menu File > Save Picture... then select the format of your choice using the Save as type: drop down box. The choices are:

  1. Windows Meta File (.EMF and .WMF). Nearly all windows applications that support graphics import will accept this format. Note that this is a scalable format and therefore suitable for high resolution printing.
  2. Scalable Vector Graphics (.svg). Like EMF and WMF, this is a scalable format. It is an open format and supported by programs on all platforms whereas EMF and WMF is only available on Windows.
  3. Bitmap - default image size (.png, .jpg, .bmp). These are available on all platforms, are widely supported by graphics applications but these are not scalable formats and so do not offer good quality when printed using high resolution printers. PNG is the default format if you do not choose a file extension and generally this format works well for schematics and graphs. To choose JPG (JPEG format) or BMP (windows bitmap format) you must explicitly enter .jpg or .bmp file extensions respectively. With this option the image size will match the image size currently displayed on screen. If you wish to specify a different image size, use next option.
  4. Bitmap - specify image size (.png, .jpg, .bmp). As 3 above but you must explicitly define the image resolution in pixels. You will be prompted for this when you close the file selection dialog box.

Data Import and Export

SIMetrix provides the capability to export simulation data to a file in text form and also to import data from a file in text form. This makes it possible to process simulation data using another application such as a spreadsheet or custom program. The operations described in this section handle data independent of the graph system. There are also ways to export plotted data from a graph and also directly plot external data. For information on these topics refer to Copying Data to the Clipboard and Paste Data from the Clipboard

SIMetrix may also import data in SPICE3 raw file format and CSDF format. Some other simulation products can output in one or both of these formats.

Importing SPICE3 Raw and CSDF Files

  1. Select menu Simulator > Load Simulation Data...
  2. In Files of type select SPICE3 Raw Files or CSDF Files as required.
  3. Select file to import.
SIMetrix will read the entire file and write its data out to a temporary .sxdat file in the same way as it does when saving its own simulation data. The data read from the raw file is buffered in RAM in order to maximise the efficiency of the saved data. SIMetrix will use up to 10% of system RAM for this purpose.

Note that this feature is not available with SIMetrix/SIMPLIS Elements.

Importing Tabulated ASCII Data

SIMetrix can import data in a tabulated ASCII format allowing the display of data created by a spreadsheet program. There is a no menu for this, but this can be done using the command OpenGroup with the /text switch. E.g. at the command line type:

OpenGroup /text data.txt

This will read in the file data.txt and create a new group called textn. See Data Files Text Format for details of format.

Note that if you create the file using another program such as a spreadsheet, the above command may fail if the file is still open in the other application. Closing the file in the other application will resolve this.

Exporting SPICE3 Raw Files

SIMetrix can export all simulation data to a SPICE3 raw file. This format may be accepted by third party waveform viewers.

To export a SPICE3 raw file, proceed as follows:

  1. Select menu File > Data > Save...
  2. Under Save as type: choose SPICE3 Raw Files.
Note that various applications use slightly different variants of this format. By default, SIMetrix outputs the data in a form that is the same as the standard unmodified SPICE3 program. This can be modified using the option setting "ExportRawFormat". Use the Set command to set this value. See Set for details. Set this value to 'spice3', 'spectre' or 'other'.

Exporting Data

To export data, use the command Show (see Show) with the /file switch. E.g:
Show /file data.txt vout r1_p q1#c

will output to data.txt the vectors vout, r1_p, and q1#c. The values will be output in a form compatible with OpenGroup /text.

Vector Names

In the above example the vector names are vout, r1_p and q1#c. If you simulate a schematic, the names used for voltage signals are the same as the node names in the netlist which in turn are assigned by the schematic's netlist generator. To find out what these names are, move the mouse cursor over the node of interest on the schematic. You should see the node name and therefore the vector name in the status box in the form "NET=???". To find the current name, place the mouse cursor on the device pin of interest and press control-P.

You can also fix the name of any node using a Terminal symbol. See menu Place > Connectors > Terminal. Place a Terminal symbol to the node of interest then set its name to any value of your choice. (But note it is best to avoid any characters other than letters numbers and the usnderscore character).

Launching Other Applications

Data import and export makes it possible to process simulation data using other applications. SIMetrix has a facility to launch other programs using the Shell command. You could therefore write a script to export data, process it with your own program then read the processed data back in for plotting. To do this you must specify the /wait switch for the Shell command to force SIMetrix to wait until the external application has finished. E.g.
Shell /wait procdata.exe
will launch the program procdata.exe and will not return until procdata.exe has closed.

Data Files Text Format

SIMetrix has the ability to read in data in text form using the OpenGroup command (see OpenGroup). This makes it possible to use SIMetrix to graph data generated by other applications such as a spreadsheet. This can be useful to compare simulated and measured results.

There are two alternative formats. The first is simply a series of values separated by white space. This will be read in as a single vector with a reference equal to its index.

The second format is as follows:

A text data file may contain any number of blocks. Each block has a header followed by a list of datapoints. The header and each datapoint must be on one line.

The header is of the form: reference_name ydata1_name [ ydata2_name ... ]

Each datapoint must be of the form: reference_value ydata1_value [ ydata2_value ... ]

The number of entries in each datapoint must correspond to the number of entries in the header. The reference is the x data (e.g. time or frequency).

Data Files Text Format - Example

Time        Voltage1    Voltage2
0           14.5396     14.6916
1e-09       14.5397     14.6917
2e-09       14.5398     14.6917
4e-09       14.54       14.6917
8e-09       14.5408     14.6911
1.6e-08     14.5439     14.688
3.2e-08     14.5555     14.6766
6.4e-08     14.5909     14.641
1e-07       14.6404     14.5905
1.064e-07   14.6483     14.5821

If the above was read in as a text file (using OpenGroup /text), a new group called textn where n is a number would be generated. The group would contain three vectors called time, Voltage1 and Voltage2. The vectors Voltage1 and Voltage2 would have a reference of Time. Time itself would not have a reference.

To read in complex values, enclose the real and imaginary parts in parentheses and separate with a comma. E.g:
Frequency      :VOUT
1000           (-5.94260997, 0.002837811)
1004.61579     (-5.94260997, 0.00285091)
1009.252886    (-5.94260996, 0.002864069)
1013.911386    (-5.94260995, 0.002877289)
1018.591388    (-5.94260994, 0.00289057)
1023.292992    (-5.94260993, 0.002903912)
1028.016298    (-5.94260992, 0.002917316)
1032.761406    (-5.94260991, 0.002930782)
1037.528416    (-5.9426099, 0.00294431)
1042.317429    (-5.94260989, 0.0029579)
1047.128548    (-5.94260988, 0.002971553)