-
2 Attachment(s)
Pendulum Problem
I am trying to create a physics lab using a simulated pendulum. The students will have to time the period of the pendulum and calcualte the acceleration of gravity using an equation. The only way I have found to time the period of the pendulum is with the Timer X extension. It allows me to set every so many ms using an expression which is calculated based on the length of the pendulum and the acceleration of gravity.
Now the problem. I cannot seem to get enough precision in the setting of the period of the pendulum. Since I cannot set the Timer X object in fractions of a ms, the error in the round off is too large. The less round off error I have, the worse the simulation of the swinging pendulum looks.
Anyone have any ideas, other extensions, some sneaky work around to solve this problem? Any help appreciated.
The attached file is a rough first beta of the simualtion. The error is the difference between the time (ms) for each 6 degrees and the same as an integer. The simulation looks worse the more degrees are skipped between each drawing of the pendulum string and the movement of the bob (weight on the end of the string).
-
Re: Pendulum Problem
I have only had a quick look,
I suggest not using the alway event in the pendulum simulator engine tied in with the event loop for a start. (Use the timer object instead) You need to use a real clock otherwise if your app pauses it looses time against the real clock.
You may also you need to check for any program limits and assumptions. In particular division by zero issues and overflow when your simulation goes on for too long.
-
Re: Pendulum Problem
Thanks for the ideas Joewski. The always conditions don't really affect the time since they only draw in the string for the pendulum. The timing that is critical is the ball at the bottom of the string that is swinging back and forth. So far tests have not shown any change when the app is running for a very long time - the swing times remain constant, whether they are right or wrong.
Steve
-
Re: Pendulum Problem
You could also try enabling machine-independant speed.