Mon Oct 20 07:03:27 EDT 2014

Circuit simulation

Let's take a closer look at what is involved.

Some initial concerns:

  - How to turn network into procedural code? I.e. not all components
    are "directional".  Most are relational.

  - Opamp: probably won't work for set-point analysis (relaxation) if
    not reactive.

Start with some simple components:

 - Ideal opamp:

   4 terminals -> 8 degrees of freedom
   3 equations:
     I- = 0
     I+ = 0
     Vo - Vg = A (V+ - V-)

This is a scalar relation.  Lift it to an operator equation to also
qsupport reactive components.

  - Ideal capacitor:

    2 terminals -> 4 degrees of freedom
    2 equations:
      I+ = - I-
      C (V+ - V-) = dI+/dt

  - Ideal resistor:

    2 terminals -> 4 d.o.f.
    2 equations:
      I+ = - I-
      R I+ = V+ - V-

To solve: 

  - Collect nodes and equations.

  - If #eq = #unk, build diff matrix

  - eliminate algebraic parts?

Question: how to handle algebraic parts, i.e. eliminate variables to
prepare for solving the diff equation.  Is this necessary?  Can it all
be done in one (stupid) move?

They can be done in ping-pong.

  1. Pick initial conditions for all diff state variables.

  2. Solve algebraic equation for current setpoint

  3. Update diff state variables, goto 2.

More questions:

- What to do for non-linear relations?  How to solve a set of
  nonlinear algebraic equations?

- What should the front end for this look like?  

The non-linear equations probably need to be solved iteratively.  I'm
guessing that the iteration step for the time direction and that for
the "space" direction can somehow be combined.

Is it possible to transform the nonlinearities themselves into just
time nonlinearities?  Just to make the whole equation more uniform.

Let's try for a diode.

  - Ideal diode:

    I+ = I-
    I+ = Io e^[(V+ - V-)/VT]

Maybe introducing an extra variable here would work?

Another observation: currently, the only nonlinearity I'm interested
in is the exponential.  This has a special update property.  But
that's maybe not relevant.

Explore this first: transform an algebraic nonlinearity in an
approximate temporal one.

Essentially: an exponential can be computed as the static state of a

Hmm... I'm thinking this might not work due to symmetry issues.  The
idea is to "open up" a nonlinear relation by exposing the
non-linearity.  Let's try again.

  y = f(x0) + f'(x0) (x - x0) + f''(x0) O[(x-x0)^2]

The idea is then to drop the O(.^2) term to compute an update for x
and y using the old values of f(x0) and f'(x0), and then recompute
these coefficients.

Though I'm still thinking about modeling a diode as a diode + series
coil and parallel capacitor.  If the values are in the correct range,
this would give the same low frequency behavior as an ideal diode, but
allow the nonlinearity to be isolated from the terminals.

           |        |

Starting this as an open circuit: L current = 0, C voltage = 0.

( Maybe a cause of problems when approximating ciruits with finite
things is that when not band-limited, circuits can contain an infinite
amount of information? )