Skip to content
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

The real bulb code looks buggy #765

Closed
samreid opened this issue Oct 23, 2021 · 6 comments
Closed

The real bulb code looks buggy #765

samreid opened this issue Oct 23, 2021 · 6 comments

Comments

@samreid
Copy link
Member

samreid commented Oct 23, 2021

From #764, it looks like it is always setting the resistance to 1.0 no matter what. Either something else is at play, or this is very buggy.

    let needsHelp = false;

    resistorAdapters.forEach( resistorAdapter => {
      if ( resistorAdapter.circuitElement instanceof LightBulb && resistorAdapter.circuitElement.real ) {

        // @ts-ignore
        resistorAdapter.resistance = 1.0;
        needsHelp = true;
      }
    } );
@samreid samreid added this to the AC 1.0 milestone Oct 23, 2021
@samreid samreid self-assigned this Oct 23, 2021
samreid added a commit that referenced this issue Oct 26, 2021
@samreid
Copy link
Member Author

samreid commented Oct 26, 2021

It was straightforward to eliminate the awkward-looking code. It seemed mostly safe but should still be checked. I don't think the real bulb appears in AC, so I published a dev version of DC here:

https://phet-dev.colorado.edu/html/circuit-construction-kit-dc/1.3.0-dev.7/phet/circuit-construction-kit-dc_en_phet.html

@arouinfar or @ariel-phet can you please test, and describe how the real bulb can be tested? For reference, here is the issue where we introduced the real bulbs: #10

@ariel-phet
Copy link

Will do

@ariel-phet
Copy link

ariel-phet commented Oct 27, 2021

@samreid there is an issue with the change you made.

First I compared values to the published sim (resistance, current, voltage) for a simple battery and bulb circuit. All looked correct. However, when the current is removed from the bulb it does not reset its resistance value to the "cold" value. Only when the voltage is explicitly set back to zero does the resistance reset. See the video below for a clear example.

Real.Bulb.mp4

@samreid
Copy link
Member Author

samreid commented Oct 27, 2021

I reverted the change above and was still seeing the buggy behavior, so it must be caused by something else. I'll keep looking.

samreid added a commit that referenced this issue Oct 27, 2021
@samreid
Copy link
Member Author

samreid commented Oct 27, 2021

This problem was introduced when we started excluding "circuit elements that aren't in loops" from the analysis. I added a part for that in the commit.

Can you please test in https://phet-dev.colorado.edu/html/circuit-construction-kit-dc/1.3.0-dev.8/phet/circuit-construction-kit-dc_en_phet.html ? Can you think of other circuit elements that may need another update step like thihs when they are not in a loop?

@ariel-phet
Copy link

@samreid issues seem fixed, IV curve looks good. I cannot think of another element like that currently. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants