How to check Circuit state after create a circuit?
When create circuit ,it's necessary to know circuit state. Especially tell user why fail to create circuit. Is the a method to do this ? Thx.
If you can call analyze() followed by doTick() without an error being thrown, the state of state of each circuit component should be updated. For example myComponent.getLeadVoltage(0) would return the voltage of the first node (terminal) of the first component in the circuit.
If you're having problems running analyze(), you'll need to be much more specific and ideally provide example code.
I should mention that this is an extremely outdated version of this library, I have been working on a total rewrite but I never got around to posting it on github.
Glad to ur relpy. I'm trying to simulate electric experiment for my students by Unity3D. It seems hard to find a good C# SPICE engine which can be used directly for Unity3D. I used SharpCircuit to make a easy demo, it seems OK. But if I want to make more experiments,as u said, it's an outdated version. I found a bug ,when exec ParallelVoltageSource ,as code bellow: `private static void ParallelVoltageSource() { Circuit sim = new Circuit();
var volt0 = sim.Create<DCVoltageSource>();
var volt1 = sim.Create<DCVoltageSource>();
var res0 = sim.Create<Resistor>();
sim.Connect(volt0.leadPos, res0.leadOut);
sim.Connect(res0.leadIn, volt0.leadNeg);
sim.Connect(volt1.leadPos, res0.leadOut);
sim.Connect(res0.leadIn, volt1.leadNeg);
sim.doTick();
string s1 = string.Format("V{0} = I*R {1}*{2}", res0.getVoltageDelta(), res0.getCurrent(), res0.resistance);
Debug.Log(s1); // V = I x R
Console.WriteLine("program complete");
}`
Thx at last,BTW ,do u consider to make a plugin and sell in the Unity Assert Store(There are few this type plugins ), I'm pleasure to buy one.I think this is not a easy thing for most people who not master electric simulation.