Comments (4)
Yes, this is exactly the problem with trapezoidal approximation, and why there's a checkbox to turn it off. Trapezoidal is more accurate for circuits without analog switches (or the equivalent), and I thought those would be more common, so that's why I made it the default. The accuracy difference is pretty small though, so maybe I should turn it off by default.
from circuitjs1.
Ah. Well I'm thinking the type of glitch I experienced from trapezoidal is a dramatically greater "inaccuracy", even though it only occurs with circuits with the equivalent of analog switches. (Now that you mention that, I recall seeing a similar glitches in other circuits with similar types of switching...)
It took me a while to ponder this strange behavior and to take a guess to turn off trapezoidal, but an electronics beginner would be even more confused by it and might misinterpret the circuit functionality. I consider circuitjs to be more suited for getting reasonable behavior rather than most accurate (users can use spice if accuracy is most desired, or even protype it is real world behavior is desired), so I would suggest to disable trapezoidal by default. But you are the maintainer, so you be the judge.
from circuitjs1.
I'm also observing that the glitch with trapezoidal decreases as the simulator's time step size is decreased, such that when reduced to 100 ns, then it is just a one pixel difference in the scope. So maybe as an alternative solution would be for the simulator to automatically detect if this glitch is going to be noticeable and to automatically decrease the time step size...but that might be too involved of a solution.
from circuitjs1.
I'm noting the glitch also happens with a regular mechanical switch (in addition to the "analog switch"), for instance with the following circuit:
If I repeatedly toggle the switch with my mouse, the capacitor's voltage will randomly jump up either to 10 V or down to 0 V, when it should always just remain at the voltage it was at when the switch was closed:
I can't quite figure out the pattern of whether it jumps up or down, but I'm guessing the direction it jumps may be due to the exact time that the switch toggling in relation to the simulator tick.
I am also noting that I can produce the glitch while the simulator is running by manually removing the wire between the voltage source and the capacitor:
...for instance when deleting it:
or also by dragging the wire away to disconnect the capacitor:
I think this was how I've experienced the glitch before.
Anyway I'm more and more thinking that the trapezoidal approximation should be disabled by default. And then only if the user deliberately knows what they are doing, then they can manually enable the approximation.
from circuitjs1.
Related Issues (20)
- Feature Request: Wire Junction Points HOT 2
- Most recent version HOT 3
- Bug: Transformers HOT 1
- mac .dmgs "damaged HOT 6
- Incorrect audio output file header HOT 1
- Option for making a circuit with zero resistance for educational purpose HOT 1
- NAND on Small Grid Bugs Simulation when Paused
- 错误:无法创建子电路 HOT 1
- Single pulse generator HOT 2
- [Feature request] ability to add user's own circuits to menu
- [Feature] Draw MOSFET's body diode on symbol if it's being simulated
- subcircuits with 2-terminal voltage sources don't work HOT 3
- FEATURE-merge two circuits HOT 1
- ArrayIndexOutOfBoundsException in YTb (circuitjs1-0.js:997)
- [FEATURE] remove subcircuit definition in circuitJS (standalone)
- [BUG] Some inputs do not appear in subcircuit HOT 1
- Feature: Noise generator - nV/√Hz or PINK/WHITE/BROWN
- 1N34 (germanium diode) incorrectly simulated? HOT 3
- [FEATURE] a lot of value for research.
- No current run visualisation when adding the DPDT Switch with 4 poles
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circuitjs1.