circuitjs1 icon indicating copy to clipboard operation
circuitjs1 copied to clipboard

Question/Bug-Correct Usage of setTimeStep()

Open JustusE20 opened this issue 2 years ago • 3 comments

I am running the simulator in an iframe and want my webpage to control the size of time steps in the simulation. That's why I am executing simulation.setTimeStep(timeStepSize) on simulation.ontimestep, which does change the time step size. However, when the time step size set by the webpage deviates from the value in the simulation settings, the messages "timestep up = 0.000005 at 0.073..." and "converged after 0 iterations, timeStep = 0.000004" are being issued constantly in the console. It seems as if my time step value is being overwritten by the settings value. Is there a way to avoid this overwrite or at least the console output?

JustusE20 avatar Feb 07 '23 21:02 JustusE20

It looks like a bug in simulation.setTimeStep(). As a workaround, try setting the timestep in Options->Other Options... to something very small. Then use setTimeStep() to something larger. As long as it's larger, you shouldn't see those messages. (I haven't tested that, but it's worth a try.)

pfalstad avatar Feb 08 '23 01:02 pfalstad

The workaround works in preventing the console outputs, but then the scopes in the simulation get incredibly fast.

JustusE20 avatar Feb 08 '23 08:02 JustusE20

I also noticed that voltage values get falsified, when the values of simulation.setTimeStep and the time step size setting differ. To test this, I used the A/C Circuits Capacitor circuit.

JustusE20 avatar Feb 14 '23 11:02 JustusE20