This class provides functions to handel simulation results and convert it into different formats. More...
| void | setSource(string filename,string type) |
| string | source() |
| string | sourceType() |
| void | setPlotTool(string plotTool) |
| string | plotTool() |
| void | setPortMapping(string netlistType) |
| string | mappedPort(string port) |
| string | nodeName() |
| string | deviceName() |
| string | portName() |
| void | readSource() |
| bool | dataRead() |
| void | writeData(string filename, string format, intList items) |
| int | items() |
| doubleList | itemData(int) |
| string | itemTitle(int) |
| string | itemNativeTitle(int) |
| string | itemUnit(int) |
| int | findItem() |
| int | findItemTitle(string title) |
| void | setError(string error) |
plotData holds simulation waveforms so the Schematic Editor can probe a net after a run. LayoutEditor does not simulate here; a macro loads a result file with setSource and readSource, then calls schematicDisplay setProbeMode with this object. When the user clicks a node, a device or a port, the plot macro runs and iPlot() from callbacks returns the same data. nodeName, deviceName and portName tell you what was clicked. findItem picks the matching data row; itemData returns that row as a doubleList. Call readSource before writeData, items or itemTitle. Supported source types are ngspice, ltspice and qucs (ASCII). If a row cannot be found, findItem returns -1; setError shows a message after the plot macro finishes.
Example:
plotData *pd = iPlot();
if (pd == NULL)
return 1;
if (!pd->dataRead())
pd->readSource();
int row = pd->findItem();
if (row < 0)
row = pd->findItemTitle(pd->nodeName());
if (row < 0) {
pd->setError("no waveform for this node");
return 1;
}
doubleList y = pd->itemData(row);
string unit = pd->itemUnit(row);
Sets the result file filename and its type. Supported types are ngspice, ltspice and qucs, all ASCII encoded.
| Parameter: | |
|---|---|
| filename | path of the file |
| type | mode selector |
Returns: the file name of the simulation results.
Returns: the type of the simulation result file.
Sets the plot macro that displays the results. If nothing is set, the last used plot macro is used. In probe mode the user can also change the plot macro.
Returns: the file name of the chosen plot macro.
Sets the netlist format used to map device port names onto names in the result file.
Returns: the mapped name of port. For a SPICE transistor, devicename:port for the collector becomes Ic(short_devicename).
Returns: the name of the clicked node in probe mode, or an empty string if a node was not selected.
Returns: the name of the clicked device in probe mode, or an empty string if a device was not selected.
Returns: the name of the clicked device port in probe mode, or an empty string if a port was not selected.
Loads the simulation file into memory. Call this before writeData, items, itemData or findItem.
Returns: true if readSource has already loaded the file, otherwise false.
Writes previously loaded data to filename. format is array (tab-separated), csv (comma-separated, as in the setup dialog) or cvseurope (semicolon-separated, comma as decimal sign). If items is empty, every row is written; otherwise only the listed row numbers are written.
| Parameter: | |
|---|---|
| filename | output file name |
| format | array, csv or cvseurope |
| items | row numbers to write, or empty for all rows |
Returns: the number of loaded data rows.
Returns: one data row as a doubleList. The argument is the row index from 0 to items()-1.
Returns: the display title of that data row.
Returns: the title as stored in the simulation file. It matches itemTitle when no separate native name exists.
Returns: the unit of that data row, or an empty string if the file has no unit.
Returns: the row index of the clicked node, device or port, or -1 if no matching row is found.
Returns: the row index whose title is title.
Sets an error message that is shown after the plot macro finishes.