phetsims / circuit-construction-kit-dc

"Circuit Construction Kit: DC" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
11 stars 8 forks source link

Bug: Inconsistent representation of current in visualization #202

Open mattpen opened 11 months ago

mattpen commented 11 months ago

image

@chrisklus and I got a visit in the office today from Daniel Bolton. He reported that he noticed a bug with the current visualization while teaching CCK in class. The red arrows that you can see in the screen shot are represented much more densely the closer you get to the battery, and they also move slightly slower when they are farther from the battery. However, the current in the cross wires is the same independent of distance. The ammeter is measuring the current correctly, so the model seems to be correct, but the visual representation is misleading.

samreid commented 11 months ago

I believe it is an unfortunate emergent result from our underlying model. The arrows are conserved, and the arrow chooses which path to go down based on which path has the furthest arrow. So I believe this means as you get further from the battery in a cascading circuit like that, the arrows will become less dense. I wonder what would happen if we change the logic from "choose the path with the furthest-away arrow" to "choose the path with the lowest arrow density." But I think a shortsighted implementation of that (where the path is just one wire segment) would probably fail--we would probably need a way to sum up over all possible downstream paths. It's not obvious to me how to implement that. It seems other circuit simulators such as https://www.falstad.com/circuit/ do not show the conservation of individual charges, but do a better job showing a constant charge density.