Add configurable simulation temperature for diodes and transistors#225
Closed
esaruoho wants to merge 1 commit intopfalstad:masterfrom
Closed
Add configurable simulation temperature for diodes and transistors#225esaruoho wants to merge 1 commit intopfalstad:masterfrom
esaruoho wants to merge 1 commit intopfalstad:masterfrom
Conversation
Fixes pfalstad#147: The thermal voltage (vt = k*T/q) was hardcoded to 27°C (300.15K) in Diode.java, DiodeModel.java, and TransistorElm.java. - Add CirSim.temperature and CirSim.vt static fields with setTemperature() method that recalculates vt from Boltzmann/charge - Replace hardcoded vt in Diode.java, DiodeModel.java, TransistorElm.java with CirSim.vt references - Make Diode.vzcoef dynamic (computed in setup() from CirSim.vt) - Add DiodeModel.updateAllModels() to refresh all models on temp change - Add temperature control in Other Options dialog (°C input) - Changing temperature triggers updateAllModels() + updateModels() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 1, 2026
Author
|
Superseded by #243 which targets |
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
Adds a configurable simulation temperature parameter, replacing the hardcoded 27°C (300.15K) thermal voltage used by diodes and transistors.
vt = k*T/q(Boltzmann constant * temperature / elementary charge) was hardcoded to 0.025865V (27°C) inDiode.java,DiodeModel.java, andTransistorElm.java. This PR makes it dynamic:CirSim.temperature(Kelvin) andCirSim.vt(thermal voltage) as central static fieldsCirSim.setTemperature()recalculates vt and refreshes all diode modelsCirSim.vtinstead of local hardcoded constantsDiode.vzcoef(Zener coefficient) becomes a dynamic instance variableDiodeModel.updateAllModels()propagates temperature changes to all modelsChanges across 5 files (54 insertions, 29 deletions). Default behavior unchanged (27°C).
Test plan
🤖 Generated with Claude Code