Solutions

This software can calculate the following solutions for any given circuit:

Component and node values

These are values that are calculate for every single circuit, regardless of their contents.

Do be warned that the way capacitors and inductors is different than you might expect. Basically, the capacitor voltages and inductor currents will appear as literal values in the solutions in the circuit (including for the state equations).

Component currents

This software is able to find the current through each component in the circuit. When printing the values (through the command line interface and print_currents) current sources and inductors are ignored (since their values are trivial).

Examples of what the software might print for each circuit:


Circuit with current source

Netlist:

I1 IN 0 1m
R1 IN OUT 6k
R2 OUT 0 4k

Currents:

R1 --> 1/1000
R2 --> 1/1000

RLC Circuit

Netlist:

V1 1 0 10
R1 1 2 1k
L1 2 3 100m
C1 3 0 10u

Currents:

V1 --> IL1
R1 --> IL1
C1 --> IL1

Component voltages

This software is able to find the voltage drop one each component in the circuit. When printing the values (through the command line interface and print_component_voltages) voltage sources and capacitors are ignored (since their values are trivial).

Examples of what the software might print for each circuit:


Voltage Divisor

Netlist:

V1 IN 0 10
R1 IN OUT 6k
R2 OUT 0 4k

Voltages:

R1 --> 6
R2 --> 4

RLC Circuit

Netlist:

V1 1 0 10
R1 1 2 1k
L1 2 3 100m
C1 3 0 10u

Voltages:

R1 --> 1000*IL1
L1 --> -1000*IL1 - VC1 + 10

Node voltages

This software is able to find the voltage on each node in the circuit.

Examples of what the software might print for each circuit:


Voltage Divisor

Netlist:

V1 IN 0 10
R1 IN OUT 6k
R2 OUT 0 4k

Voltages:

IN --> 10
OUT --> 4

RLC Circuit

Netlist:

V1 1 0 10
R1 1 2 1k
L1 2 3 100m
C1 3 0 10u

Voltages:

1 --> 10
3 --> VC1
2 --> 10 - 1000*IL1

State Equations

This software is able to print the state equations that describe the circuit. It uses the voltages of the capacitors, and currents of the inductors, as the parameters for the circuit. It is able to print these equations in continuous form (differential equations), and in discrete form (difference equations).

For more information on what state equations are, and how they can used to describe any system (not only circuits), read this Wikipedia page, and the chapter 3 of the book Modern Control Systems, by Richard Dorf. The state equations produced by this circuit are essentially the equation, except, the State Matrix A and Input Matrix B are all bundled together in the form a system of equations.

\dot{x}(t) = A(t)\,x(t) + B(t)\,u(t)

Differential Equations

Here is how the software would print the state equations in differential form for the circuit:

RLC Circuit

Netlist:

V1 1 0 10
R1 1 2 1k
L1 2 3 100m
C1 3 0 10u

State Equations:

dIL1/dt = -10000*IL1 - 10*VC1 + 100
dVC1/dt = 100000*IL1

Difference Equations

The state equations for the circuit can also be written in discrete form, using three methods: Forward Euler, Backward Euler, and the Trapezoidal Rule.

For these methods, it is recommended to choose a time step, be it through the netlist, command line, or when declaring the Circuit object. It isn’t strictly necessary to do so, since it will default to a literal Ts in the difference equations. However, the equations for the backward and trapezoidal methods will get too big, since there generally be terms for Ts squared, cubed, etc.

Forward Method

Here is how the software would print the state equations in difference form, using the forward method:

RLC Circuit

Netlist:

V1 1 0 10
R1 1 2 1k
L1 2 3 100m
C1 3 0 10u
.STEP 1e-4

State Equations (forward method):

IL1_{n} = 1/100 - VC1_{n-1}/1000
VC1_{n} = 10*IL1_{n-1} + VC1_{n-1}

Backward Method

Here is how the software would print the state equations in difference form, using the backward method:

RLC Circuit

Netlist:

V1 1 0 10
R1 1 2 1k
L1 2 3 100m
C1 3 0 10u
.STEP 1e-4

State Equations (backward method):

IL1_{n} = 100*IL1_{n-1}/201 - VC1_{n-1}/2010 + 1/201
VC1_{n} = 1000*IL1_{n-1}/201 + 200*VC1_{n-1}/201 + 10/201

Trapezoidal Method

Here is how the software would print the state equations in difference form, using the trapezoidal method:

RLC Circuit

Netlist:

V1 1 0 10
R1 1 2 1k
L1 2 3 100m
C1 3 0 10u
.STEP 1e-4

State Equations (trapezoidal method):

IL1_{n} = 199*IL1_{n-1}/601 - 2*VC1_{n-1}/3005 + 4/601
VC1_{n} = 4000*IL1_{n-1}/601 + 599*VC1_{n-1}/601 + 20/601

About Capacitors and inductors

Something that may seem counter intuitive for this software, is that all the results in the circuit will depend upon the capacitor voltages, and inductor currents. Take the circuit below for example:

Source with positive connected to IN

This is a classic RC circuit, where, assuming the capacitor is uncharged at t=0, and the voltage input is constant, them the current for, say, the resistor, will be:

I_R = \frac{V}{R} e^{-t/(RC)}

However, by using this software to solve this circuit, the calculated current for the resistor will be:

I_R = \frac{V - V_{C1}}{R}

(the signs in this equation might be slightly different, depending on how you wrote the nodes in the netlist, as explained here).

This occurs because the main goal of this software is on the resolution of the state equations, using the energy storage voltages/currents as parameters. So, the capacitors voltages and inductor currents will always appear in the solutions for the circuit as literal values.

This may seem useless at first, but the generated difference equations from these state equations can be used to simulate the circuit, not only for a constant input (as is the exponential equation shown above), but for arbitrary inputs.

You can imagine as if each capacitor CX is a voltage source with value of VCX, and each inductor LX as a current source with value ILX. Thats pretty much what the software does internally, in fact.