Fix unrealistic stability for positive-feedback opamp buffer#295
Open
esaruoho wants to merge 1 commit intopfalstad:devfrom
Open
Fix unrealistic stability for positive-feedback opamp buffer#295esaruoho wants to merge 1 commit intopfalstad:devfrom
esaruoho wants to merge 1 commit intopfalstad:devfrom
Conversation
Owner
|
The op amp has a number of issues but I'm very nervous about changing it because I've tried to fix them in the past and whenever I make a change, there's always one example circuit that breaks. I will take a look at this but it might be lower priority. |
Author
|
Understood -- no rush on this one. The change only adds a tiny random perturbation (1e-8V) to break the exact metastable equilibrium at startup. It should not affect any circuit that is not already sitting on the knife-edge. Happy to test against all the opamp example circuits if that would help you feel more confident about it. |
Add a tiny initial offset (1e-6 V) to the opamp lastvd state on reset to break metastable equilibrium. Without this, a positive- feedback buffer (non-inverting input wired to output) unrealistically tracks the input because the Newton-Raphson solver converges on the exact metastable solution. Real opamps have input offset voltage that would immediately push the output to a supply rail. The perturbation is small enough to have no effect on normal negative-feedback circuits. Fixes sharpie7#1009 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d358a78 to
64ec688
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastvdstate in a newreset()override, breaking the metastable equilibrium that causes positive-feedback configurations to unrealistically track the input signalFixes sharpie7#1009
Test plan
amp-schmitt.txt) and verify correct hysteresis behaviorGenerated with Claude Code