Gracc

Solving Electrical Circuit using graph


Keywords
Electrical, Circuit, Solver, computational-science, electrical-circuits, graph-theory, linear-algebra, mathematics-model
License
BSD-3-Clause
Install
pip install Gracc==0.0

Documentation

What this repository is about?

this repository is about modeling circuits as graphs and analyzing them with graph theory algorithms for more detail read this article

How to run this?

Open In Colab

How to give Gracc a circuit as an input?

the goal is to give a picture as an input but since hand drawn circuit detection is still underdevelopment we use a text file to do so :-)

How to give Gracc an input via text?

  • well, we got to descript a circuit (kirchoff_graph) with a text file to do so:
    in the first line of the text write two number, the first one is nodes_number and the second is edges_number
    in the next n lines (n = edges_number) you've got to explain the edges details
    such that ( x y z a b c ) means that node x and y are
    connected with z_ohm resistor , a_volt battery , b_farad capacitor & c_henry inductor
  • for example consider circuit1 as an input, it is descripting this circuit

Screenshot from 2022-08-12 04-55-20

  • after descripting your circuit as a text locate it Here open the jupyter file and download your circuit by wget like that

image

How to see the solution of our circut?

  • run all the cell in the jupyter file
  • parse your text file to create the kirchoff graph by
kg5 = circuit_parser('circuit5.txt')
  • plot your input to see your input by
plot_kirchoffgraph(kg5)
  • analyze the input by
plot_kirchoffgraph_after_solving(kg5)
  • then you will see the solution of your circuit for example for the circuit5 the solution is:

image

Notes

  • gracc doesn't support RLC circuits yet :)
  • solving differential equations which is a difficult task itself is done thanks to odeintw
  • archive folder is just for making an archive, delete it in your own fork