Wednesday, May 1, 2013

User defined objects - II

Spent a couple of days thinking about ways in which a user can define a "block" that could be connected repeatedly in the circuit. But something similar has made that half-possible already - the "jump" labels.

A crude way of defining blocks would be to simply describe a part of a circuit (for example an RLC circuit or a three-phase inverter) and connect it to the rest of the circuit using jump labels. The reason this would be crude is that the entire sub-circuit would have to be copied that many number of times and for each object, the constituent components would have to be given separate labels.

A much more elegant manner would be to define a single sub-circuit as the base class. The main circuit will then contain references to this class and the connections could be made by jump labels with additional unique identifiers. For example a RL sub-circuit could have a jump1 and jump2 labels as connectors. The main circuit can have jump labels as jump1_RL1 and jump2_RL1 to signify a component RL1. The extention "RL1" will result in labels RL1 automatically created that will be appended to the resistor and inductor within the sub-circuit.

The problem with this method is that in a very large circuit with several sub-components repeated, it may be necessary to change the parameters of some of them to simulate special conditions such as nonideal parameters. So by having a single block, additional changes to the structure won't be possible. So, by copying the sub-circuit again and again, this flexibility is provided. The only drawback is that the user will have to edit all the component labels. But that may not be such a bad thing because the program does the error checking for duplicate labels. So a circuit will not run with multiple labels if the user accidentally forgets to edit some of the labels.

So this option of copying a circuit as many times as you need in the circuit is not such a bad idea because even for the sake of appearance, you can have these blocks anywhere in the spreadhseet, not necesarily bang in the middle of the main circuit.

So, now all I have to do is define a current source and I'll be done with the first set of elements.

No comments:

Post a Comment