Color MOSFET and op-amp by operating region#290
Open
esaruoho wants to merge 1 commit intopfalstad:devfrom
Open
Color MOSFET and op-amp by operating region#290esaruoho wants to merge 1 commit intopfalstad:devfrom
esaruoho wants to merge 1 commit intopfalstad:devfrom
Conversation
MOSFETs show channel color based on operating region (cutoff=gray, linear/triode=blue, saturation=green). Op-amps show saturation indication when output clips (positive=red, negative=blue fill). Both ideal and real (LM741/LM324) op-amps are supported. Toggled via Other Options > Show Operating Region (persisted in localStorage, off by default). Addresses sharpie7#846. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2e8f568 to
280e4e1
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
OpAmpElmand realOpAmpRealElm) show a colored fill when the output is saturating: red tint for positive rail clipping, blue tint for negative rail clippinglocalStorage, and off by defaultDetails
The MOSFET already tracks its operating region in the
modevariable (0=cutoff, 1=linear, 2=saturation). This PR draws a wider colored line behind the channel segments to visually indicate the region. The colors are chosen to be distinct and meaningful: gray suggests no conduction, blue suggests resistive/linear behavior, and green suggests active/saturation operation.For op-amps, the output voltage is compared against the supply rails. The ideal op-amp checks against
maxOut/minOut, while the real op-amp checks against the actual supply voltages (volts[3]/volts[4]). When saturating, the triangle body is filled with a muted red or blue to indicate which rail the output is clipping to.JFETs (
JfetElm) inherit the MOSFET coloring automatically since they extendMosfetElm.Files changed
CircuitElm.java— addedstatic boolean showOperatingRegionfield andshowOperatingRegion()accessorEditOptions.java— added "Show Operating Region" checkbox at index 14 (shifted existing options)UIManager.java— initializeshowOperatingRegionfromlocalStorageon startupMosfetElm.java— draw colored channel background based onmode(cutoff/linear/saturation)OpAmpElm.java— fill triangle when output is near supply railsOpAmpRealElm.java— fill triangle when output is near actual supply voltagesTest plan
Addresses sharpie7#846.
🤖 Generated with Claude Code