This blog is about Python Power Electronics - a free and open source software for power electronics and power systems professionals. Aimed at providing education about power electronics application specifically to renewable energy and smart grids, the software will be accompanied by simulation examples, short reports and presentations. The software can found on the website http://www.pythonpowerelectronics.com/.

Wednesday, January 2, 2013

Network representation

I need a way to describe a circuit that is both convenient to the user but won't require horrendous effort in programming or be a drain on the system. So would like to avoid GUI based circuit drawing. Also, to ask the user to describe the circuit as a net list will drive most people away.

One way I can think of is a spreadsheet that is saved as a csv file. This can be done with just about any spread sheet software. A sample case:

The above is a circuit description.

1. I haven't bothered about the objects yet so they are just named as "a", "b", "c" etc.
2. Connections that are zero impedance are named as "wire".
3. Empty cells imply no connection.
4. Connections have to be along a row or a column. Can't make diagonal connections.

The .csv file as a text file looks like this:
------------------------------------------------------------,"wire","wire","b","wire","wire","d","wire","wire",,,"wire",,,"wire""wire","wire",,,"wire",,,"wire""a",,,,"c",,,"wire""wire",,,,"wire",,,"wire""wire","wire","f","wire","wire",,"wire","wire""wire",,,,"k",,,"h""wire",,,,,,,"wire""wire","i","wire","wire","wire","wire","e","wire",,,,"g",,,"wire",,,,"wire","wire","wire","wire"
------------------------------------------------------------

1. A break in the network won't be detected. For example, E8 and F6 are empty. Which means E6 or [5,4] is not a node. This will have to be dealt later maybe by filling up breaks with high resistances or simply throwing error exceptions. The user has to ensure all connections. If its open, connect a large resistance.

2. The circuit starts from the top of the spreadsheet. But even if there are a couple of empty lines, the program still works. There will be an offset in the row indices, that can be removed by detecting the number of empty rows.

The concept behind this node list is that while finding the loops to apply KVL, you can start at a node and snake your way until you other nodes and make your way back to the starting node. I will also need the number of branches so that I can determine the number of loops. That will be the next task.

Ahead, the actual objects will have to be embedded. For example, AC_Voltage(mag=100, freq=60, res=0.1) could be one of the elements above. This may need something like regular expressions.