i'm trying programmatically calculate voltage changes on large circuit.
*this question may seem geared toward electronics, it's more applying algorithm on set of data.
to keep things simple,
here complete circuit, voltages calculated:

i'm given battery voltage , resistances:

the issue have voltage calculated differently among parallel , series circuits.
a similar question asked on so.
some formulas:
when resistors in parallel:
rtotal = 1/(1/r1 + 1/r2 + 1/r3 ... + 1/rn)
when resistors in series:
rtotal = r1 + r2 + r3 ... + rn
ohm's law:
v = ir
i = v/r
r = v/i
v voltage (volts)
i current (amps)
r resistance(ohms)
every tutorial i've found on internet consists of people conceptually grouping parallel circuits total resistance, , using resistance calculate resistance in series.
this fine small examples, it's difficult derive algorithm out of large scale circuits.
my question:
given matrix of complete paths,
there way me calculate voltage drops?
i have system graph data structure.
of nodes represented(and can looked by) id number.
so example above, if run traversals, i'll list of paths this:
[[0,1,2,4,0] ,[0,1,3,4,0]] each number can used derive actual node , it's corresponding data. kind of transformations/algorithms need perform on set of data?
it's portions of circuit compound, , compound sections may find being in parallel or series other compound sections.
i think problem akin this:
http://en.wikipedia.org/wiki/series-parallel_partial_order
some circuits cannot analyzed in terms of series , parallel, example circuit includes edges of cube (there's code @ bottom of web page might helpful; haven't looked @ it). example can't analyzed series/parallel pentagon/pentagram shape.
a more robust solution thinking series , parallel use kirchhoff's laws.
- you need make variables currents in each linear section of circuit.
- apply kirchhoff's current law (kcl) nodes linear sections meet.
- apply kirchhoff's voltage law (kvl) many cycles can find.
- use gaussian elimination solve resulting linear system of equations.
the tricky part identifying cycles. in example give, there 3 cycles: through battery , left resistor, battery , right resistor, , through left , right resistors. planar circuits it's not hard find complete set of cycles; 3 dimensional circuits, can hard.
you don't need cycles. in above example, 2 enough (corresponding 2 bounded regions circuit divides plane). have 3 variables (currents in 3 linear parts of circuit) , 3 equations (sum of currents @ top node 3 linear segments meet, , voltage drops around 2 cycles). enough solve system currents gaussian elimination, can calculate voltages currents.
if throw in many equations (e.g., currents @ both nodes in example, , voltages on 3 cycles instead of two), things still work out: gaussian elimination eliminate redundancies , you'll still unique, correct answer. real problem if have few equations. example, if use kcl on 2 nodes in example , kvl around 1 cycle, you'll have 3 equations, 1 redundant, you'll have 2 independent equations, not enough. throw in every equation can find , let gaussian elimination sort out.
and can restrict planar circuits, easy find nice set of cycles. otherwise you'll need graph cycle enumeration algorithm. i'm sure can find 1 if need it.
Comments
Post a Comment