# Exporting Data

When the

*ExportData* event is called, the program still needs to extract the useful information from the Circuit object. This part explains where all crucial properties are situated.

## How is it stored

Almost all information is stored in the form of (Math.Net) vectors. This section explains how exactly you know which vector contains which information, and how you can access it.

## CircuitState

Each Circuit object contains a

**State** property. This property will contain data generated by simulations that output real data (as opposed to complex). This is the case for transient simulations and DC sweeps. It contains a number of useful properties:

**Time**: The current time (transient) or the currently swep quantity (DC)
**Order**: The order of the integration method currently used. This is changed when doing transient analysis!
**Solution**: The current solution of node voltages/currents/quantities. **States** (array): The internal states used by devices. Each device can store extra information that can be recalled later or integrated.
**OldSolution**: The solution before the final one. This is used to check for convergence!
**Matrix** and **Rhs**: The last Modified Node Analysis (MNA) equation matrix and vector, that was solved and lead to the current solution.

## CircuitStateComplex

Each Circuit object also contains a

**StateComplex** property. This property contains complex data, generated for example by an AC analysis. Its properties are:

**Omega**: The point of evaluation. In AC analysis this is 1i * w (the angular frequency in rad/s). In this implementation it is possible to also do AC analysis in points that aren't purely imaginary.
**Solution**: The current solution of node voltage/currents/quantities. **Matrix** and **Rhs**: The MNA equation matrix and vector, which was solved and leads to the current solution.

## Nodes

In each "Solution"of either StateComplex or State, we still need to find out which node corresponds to what index. This is handled by the

*NodeList* class. Each circuit has a

**Nodes** property.

You can access any node by name, by using it's indexer. Like so:

Each node has:

**Name**: The (possibly empty) name of the node. Devices can generate extra nodes, in which case the node cannot be accessed directly.
**Number**: The index of the node in a Solution vector (0 is always the ground node)
**Nodeset**: A value that can help convergence **IC**: The initial condition value **Type**: The type of node (Voltage or Current)

Both Nodeset and IC are of type Parameter<double>(). They store whether or not the parameter is "Given". If not, they are ignored (default).

Here are some examples:

// Get the voltage at node "B" for a DC analysis or Transient analysis
ckt.State.Solution[ckt.Nodes["B"].Number]
// Get the phasor at node "out" for AC analysis
ckt.StateComplex.Solution[ckt.Nodes["out"].Number]

## Devices

The instances themselves sometimes expose parameters such as current, capacitance (eg. diode capacitance), power, ... Each instance has a

**ParamTable** property that gives you a list of parameters you can use. In order to access these parameters, the instance sometimes needs the Circuit-object where it needs to fetch the data, usually from the CircuitState's

**States** property.

For a Diode, the parameter "id" gives you the diode current. So we can access it using:

double current = diode["id", ckt];