-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-Ideal Wires Causing Errors #3
Comments
Is the circuit the same one in #1 ? |
No, it is a different one. It appears to be happening any time I connect op-amps with no feedback loop directly to the base of p or n MOSFETs. Here is one such circuit.
|
After more than 2 years, I realized that the default wire resistance was too low. I have increased it from 1pΩ to 1µΩ. It may not fix the problem entirely, but this seems to be an issue with the original simulation algorithm; if you use Paul Falstad's original version and replace the wires with 1pΩ resistors, you'll get the same error. |
Unfortunately I think the sections of code written to use realistic wires are still causing quite a few errors.
I noticed this problem when one of my circuits ran fine on Falstad's original, but yet fails to converge in this version. Setting the boolean ideal to true inside WireElm allows the circuit to run properly on this version.
Rather difficult to debug, but so far I have traced the error to the program attempting to set one of the nodes to a voltage of 2.6 billion volts.
The value of 2.6 billion volts is inserted into the array called "volts". Inside of MosfetElm, this causes execution to run inside one of these if-statements, replacing the value with lastv2 + 0.5.
After that, the convergence is set to false, here:
This repeats until it has looped the maximum of 5,000 times, where it then fails. Each time the large value of 2.6 billion alternates between being in volts[1] or volts[2]
Now trying to trace this backwards, that result of 2.6 Billion is computed inside lu_solve in the matrix called b. Harder to trace at this point because I don't know which value is incorrect.
It comes from the statement:
b[i] = tot / a[i][i]
tot = -2.6*10^21
And a[i][i] = -1*10^12, (in this case i=29)
This may or may not be of any help. At this point it becomes much harder because this is getting into all of the matrix calculations
The text was updated successfully, but these errors were encountered: