Help creating circuit simulation software

AI Thread Summary
Creating a circuit building simulation in Flash involves allowing users to drag components onto a circuit board and requires understanding Ohm's and Kirchhoff's laws to calculate voltage and current. The project will generate equations based on Kirchhoff's current law for each node, with 20 unknowns corresponding to the voltage at each peg. Proper labeling of nodes is essential, and special attention must be given to nodes with only one connection and the identification of a ground reference node. Additionally, considerations for component behavior, such as the resistance of voltmeters and switches, are necessary to handle user errors effectively. The final step involves solving the generated equations, likely using a linear matrix approach.
chuckylefrek
Messages
1
Reaction score
0
I am creating a circuit building simulation using multimedia software 'Flash'.

Basically the user is presented with a circuit board onto which they can drag components such as batteries, resistors, bulbs, ammeters, voltmeters, switches, and of course lengths of wire.

I have been reading up on ohms law and kirchhoffs law and whilst I understand the principles, I am not sure how to go about resolving the values for the voltage and current at any point on the circuit.

I think I need to work this out based on the entire circuit that the user has built.

What I would like is to know the order of steps to resolve a circuit. The circuit board will have 5 pegs across and 4 down. So the user basically drops the elements (e.g bulbs) in between the pegs to create their custom circuit.

I have a feeling that some seriously difficult maths and physics may be involved like simultaneous equations and matrixes?

If there are any physics experts out there, the more detail you can give me about solving this, the better!

Many thanks in advance

Paul
 
Physics news on Phys.org
In the completely general case, you will have a linear equation in 20 unknowns, the voltage at each of the 20 pegs on the board.

You generate the 20 equations to solve for the 20 unknowns by applying Kirchoff's current law at each peg

You'll have to decide what to do about wires - will they have a truly infinite conductance, or a finite conductance?
 
I had a few more thoughts about the best way to tackle this, but it may be an ambitious project.

The first step is to go through and to number or otherwise label all the "nodes" in the circuit. Any two "pegs" connected by wires should be given the same "node" number. You'll probably want to flag any "dangling" nodes with only one connection for special treatment. Unused pegs don't get a node number.

After this, you start generating equations. A battery connected between two different nodes will set the voltage difference between them. A battery with both terminals conneted to the same node is an error. You'll have to think about how you go about flagging this error to the user.

You'll need to set one node in the circuit as the "ground" or reference node, with a potential of zero. You might label one peg on your circuit "ground", you'll have to think about how the ground node is determined. What if the user doesn't connect anything to the ground node, for instance?

A node that does not connect to a battery in any way whatsoever will have its voltage determined by Kirchoff's current law. The current to a neighboring node will be the voltage difference divided by the resistance. Sum and set to zero. Nodes connected to a battery won't generate any Kirchoff's current law eq's because whatever current is needed will come from the battery.

You'll probably want to give voltmeters a finite but large resistance (10 megohms is probably good), in case some joker puts two voltmeters in series with a battery to see what happens.

You'll probably want to give switches a small but finite "on" resistance. What happens if someone shorts out a battery with a switch?

It may or may not be desirable to give ammeters a finite resistance.

You'll need someway to solve all the equations once you generate them (probably a linear matrix package, elimination to tri-diagonal form).
 
Thread 'Question about pressure of a liquid'
I am looking at pressure in liquids and I am testing my idea. The vertical tube is 100m, the contraption is filled with water. The vertical tube is very thin(maybe 1mm^2 cross section). The area of the base is ~100m^2. Will he top half be launched in the air if suddenly it cracked?- assuming its light enough. I want to test my idea that if I had a thin long ruber tube that I lifted up, then the pressure at "red lines" will be high and that the $force = pressure * area$ would be massive...

Similar threads

Back
Top