Simulating simple electric circuits

Dave Baum Dave.Baum at motorola.com
Wed May 9 13:49:12 EDT 2007


In article <5ae44aF2ku9rtU1 at mid.individual.net>,
 Bjoern Schliessmann <usenet-mail-0306.20.chr0n0ss at spamgourmet.com> 
 wrote:

> Sounds more familiar than the analog approach. Maybe I misunderstood
> something ... but I can't transfer my problem to this way of
> thinking yet. My biggest problem is the fact that relays aren't
> really interested in voltage, but current. 
> 
> Also, I find it difficult to transfer this circuit logic to boolean
> logic I can contruct logic gates from. Sometimes, electric circuits
> are used in different directions.

Yep, the traditional digital simulation techniques don't apply very well 
to things like switches and relays.  Going with a different approach is 
probably cleaner.

> 
> I set up the mentioned "controller" which, at the beginning, tries
> out all possible ways through the network and saves them. So, for
> every possible circuit it knows which switches must be closed and
> which relays will work if it's "on". In theory, it should now be
> possible to try out every path, tell the relays if they have
> voltage/current, and let the relays report back in to the
> controller if their status changes so it can again test the
> circuits that may have changed. I haven't tried out the last step,
> but I will in the next days. Is there any logic error in my
> strategy?

Sounds reasonable.  Depending on the size of your network, I might not 
worry too much about precomputing and saving information.  If your 
circuit has loops in it (where the output of a later relay circles back 
to an earlier relay's coil), then it is possible for the circuit to 
oscillate, so you might have to be careful about this.  For example, if 
your basic simulation flow was:

1) set initial conditions (switches, etc)
2) let power flow through the system
3) determine which relays will be thrown
4) if any relays have changed state, go to 2

Then an oscillating circuit would never quit.  You might want to put a 
limit on the number of iterations through the loop, or logic that 
explicitly checks for oscillation.  Or you could analyze the circuit 
ahead of time to see whether it has oscillation or not.

Dave



More information about the Python-list mailing list