I think I agree. When we go about fixing this up, I think we should pass a "dt" to the modules which would be in units = seconds and of type double.
Regards, Curt. Christian Mayer writes: > David Megginson wrote: > > > > Jon Berndt writes: > > > > > I was remembering first how the F-16 sim at Link was run at 25 Hz, which > > > is of course 0.04 seconds. Wait ... (thinking, this time). Yes, that's > > > right ;-) > > > Then, I went to the numpad on my keyboard and hit 0.01 as I was typing in > > > the dt for 100 Hz. Only I missed. On purpose or accident I am not sure. > > > > Currently, we have > > > > FGSubsystem::update (int dt) > > > > where dt represents the elapsed time in ms since the last update. That > > puts a limit of 2^31 ms, or just under 600 hours, between updates. It > > has the advantage of keeping us in integer math, and the disadvantage > > of not being able to represent a granularity of under 1ms. That's OK > > for a simulator involving human interaction, since we cannot notice > > such a small difference, but it would obviously be a problem for other > > kinds of simulations such as rapid chemical reactions. > > As soon as something depends on the dt it's quite likely that it > involves floats. And one of the most common uses of dt is for > integration. As integration "summs the values up" one wrong value is > enough to make all following results wrong, too (*). > > So I want (as I wrote some time ago, too), that a float or double dt in > the unit second gets passed to the update functions/methods. > > > So, what do we do? John mentioned that reporting in sec rather than > > ms is standard, so do we switch to > > > > FGSubsystem::update (double dt_sec) > > Yes > > > or do we simply rename dt to elapsed_ms > > > > FGSubsystem::update (int elapsed_ms) > > > > No, there we'll get problems when we need a accurate "dt". And offering > a int elapsed_ms as well as a double dt doesn't make much sense IMHO. > > > or do stick with ms but allow finer granularity > > > > FGSubsystem::update (double elapsed_ms) > > No. Stick to the standard. And when I get ms I probably still want sec > (or hour or µs or whatever). So let the modules do the work to get the > correctly shaped value, we can only guess (and guess it wrong) > > > ? I don't see any harm in sticking with the integer value, > > I do. > > > but I > > agree that a better name, proper documentation, and some debugging is > > essential. > > That's definitely a requirement. > > CU, > Christian > > -- > The idea is to die young as late as possible. -- Ashley Montague > > Whoever that is/was; (c) by Douglas Adams would have been better... > > _______________________________________________ > Flightgear-devel mailing list > [EMAIL PROTECTED] > http://mail.flightgear.org/mailman/listinfo/flightgear-devel -- Curtis Olson IVLab / HumanFIRST Program FlightGear Project Twin Cities [EMAIL PROTECTED] [EMAIL PROTECTED] Minnesota http://www.menet.umn.edu/~curt http://www.flightgear.org _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel