-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening and closing switch while paused causes current to jump from negative to positive #778
Comments
May be related to #606 |
@samreid I also noticed that the sign the current reads depends on when the first ammeter was dragged out.
|
For #778 (comment), I think the behavior is as expected, please see #770 (comment) For #778 (comment), there is a rule that the first reading from a completed circuit should be positive. I think that explains the sign change. For #778 (comment), I am seeing the expected behavior, that the current is positive on the first reading on a completed circuit. Are you seeing something different? Also assigning @arouinfar to review these reports. |
@arouinfar and I reviewed the 3 cases above and all the behavior seems to be expected. @arouinfar will check the teacher tips to make sure it discusses that the initial currents are always positive (no matter the direction of the battery). You will see the polarity flip if you flip the battery after connection, but not before. |
@samreid this is what I'm seeing. I can get it to read negative first, but it might be explained by what you said in #778 (comment) |
@arouinfar and I reviewed the behavior, and agreed it is the expected behavior. The current directionality is selected to make initial currents positive at the time the circuit is completed.. |
At today's design meeting, we discussed that it is confusing for the current to change direction when a switch is opened then closed. @kathy-phet asked if I could investigate that. Fixing this is not critical for 1.0, but I'll investigate. The current (pun!) rule is: // Disconnected circuits have a current of exactly 0, so we can use that to determine when to clear the sense
const isReadyToClear = current === 0; We could change the rule to "current is zero and it is not in a loop with an open switch". We would at least like to try that much before 1.0. |
The existing depth-first search algorithms have special handling around switches (to not traverse them) and do not track which elements were traversed, so it would take 2-4 hours to write out this new algorithm and test it thoroughly. I'm not sure whether this is acceptable, especially if it's on the longer side. @arouinfar @kathy-phet @ariel-phet want me to keep working on this for 1.0? UPDATE: This also feels like something that could be layered in efficiently after 1.0 is published, since the proposed algorithm is orthogonal to the existing implementation. |
I vote for deferring this exploration until after 1.0 is published. When we do PhET-iO, we can revisit this issue, but proceed with with publishing the current behavior. |
@arouinfar how should we accomplish that step? |
@samreid let's evaluate at design meeting and decide next steps. |
Self-assigning to understand the current behavior. |
12/15/22 Design Meeting We agree that this is an issue worth spending about 4-8 hours working on since it is related to pedagogical needs. It is not a top priority for this Initial PhET-iO DC release milestone, but should be moved to the Initial PhET-iO AC release milestone. The behavior of the non-contact ammeter is consistent and described within documentation, but this is still worth a couple hours of investigation for the AC edge cases. @matthew-blackman and @samreid will investigate if there are remaining edge cases within DC that could have pedagogical ramifications. |
@samreid and I implemented a possible fix by having circuit components remember their 'currentSense' even when disconnected. This fixes the issue, but could have potential drawbacks. For example, if a new set of students sat down to a sim that was already open, they could be confused as to why the initial current reading was negative. We will also need to check for issues with taking components from one circuit and placing them in another. |
@arouinfar can you please review and advise? |
@samreid and I agree that this behavior is acceptable, but should be clearly documented. We will look into the documentation files that are presented to the user and how this can be best communicated through those files. @arouinfar can you advise the appropriate place to document this? |
I agree that the behavior is acceptable. It is well-documented in the Teacher Tips, but I did make some updates to the AC Tips and the DC Tips (will upload in #886). I think we can go ahead and close this issue. Short of moving to ngspice (#228), I don't think we'll make any further major changes to the circuit dynamics. |
For phetsims/qa#736, also may be related to #770.
When opening and closing a switch while sim is paused, current in one part of a circuit jumps to zero and back to the original value, but current in another part of a circuit jumps from its original (negative) value to zero and then to a positive value.
play.pause.behavior.2.inductors.2.resistors.1.capacitor.1.battery.1.ac.source.mp4
The text was updated successfully, but these errors were encountered: