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

Pulse voltage stuck at 15.9154943092 duty cycle (square duty works) #95

Open
signaldust opened this issue Aug 7, 2024 · 4 comments
Open

Comments

@signaldust
Copy link

For some reason, with the version at https://www.falstad.com/circuit/circuitjs.html when I draw a new voltage source (both one- and two-terminal versions seem to be affected) and change it to pulse mode, the duty cycle appears to default to 15.9154943092 and even though it can be changed in the dialog and using a slider, this doesn't seem to have any effect on simulation (ie. 15.9154943092 is still used).

Latest Chrome, macOS.

Loading an older circuit (the most recent I have has timestamp Jul 5 at which point there wasn't any issue) with pulsed source with duty cycle sliders appears to work just fine until the source is changed to some other waveform and then back to pulse, at which point it again sets duty cycle to 15.9154943092 and stops responding to changes. Copy-pasting an existing working pulse-source also doesn't break it, so it appears the issue is somehow linked to the waveform selection dialog.

@signaldust
Copy link
Author

Looking at Chrome's dev-tools, there doesn't seem to be anything useful in console (ie. no errors); the only issue it complains is about component edit box form field elements not having id/name attributes, but I think that's probably not relevant, 'cos it happens even with component dialogs that work perfectly fine.

I also tried in Safari, with the same results, so doesn't appear to be Chrome-specific

@pfalstad
Copy link
Owner

pfalstad commented Aug 7, 2024

It works for me.. I created a one-terminal voltage source, changed the waveform to pulse, changed the duty cycle to 50% and it works. A slider also works.

The weird default value for duty cycle is 100/(2*pi). It originally wasn't possible to change the pulse waveform duty cycle so it didn't matter that it wasn't an integer.

@signaldust
Copy link
Author

Interesting, I just tried on another system running Windows and on an Android phone.. and I'm getting the same (broken) results on both. Tried clearing all side data too, no change. Not sure how to test the version directly from github though.

This used to work just fine for me as well just a month or so ago I think, I wonder if anything has actually changed since then?

@signaldust
Copy link
Author

signaldust commented Aug 8, 2024

Ok, I figured out what is going on.

There is both a "square wave" and "pulse" in the waveform drop-down.

Choosing "square wave" works perfectly fine and allows changing the pulse width just fine (looks like that's what I was using in earlier circuits). Choosing "pulse" gives a duty cycle of 15.9, no matter what the duty cycle is actually set to. I guess the "pulse" choice is really a left-over and not really even needed anymore (except to support legacy files?) with duty cycle adjustable squares?

@signaldust signaldust changed the title Pulse voltage recently stuck at 15.9154943092 duty cycle Pulse voltage stuck at 15.9154943092 duty cycle (square duty works) Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants