Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Dear Pete,

I'm looking for a way to access the FS9 SDK's ELAPSED_SECONDS variable using FSUIPC. This contains the number of seconds of simulated time that have elapsed since midnight -- and the important thing for me is that it does it with sub-second resolution.

I see that offsets 0238 to 023A give me the current time, but only with a resolution of one second; offset 0310 does give sub-second resolution, but it does not speed up or slow down with time acceleration, which is what I would want...

Any chance you could expose ELAPSED_SECONDS through FSUIPC?

Best regards,

Martin

Posted

I'm looking for a way to access the FS9 SDK's ELAPSED_SECONDS variable using FSUIPC.

Which SDK is that in?

I see that offsets 0238 to 023A give me the current time, but only with a resolution of one second; offset 0310 does give sub-second resolution, but it does not speed up or slow down with time acceleration, which is what I would want...

0310 and 0368 (?) are the only ones I know. Not sure about 0368 though. Maybe that's it?

Does this SDK-mentioned one you found speed up and slow down? Maybe you have to take care of that adjustment yourself, reading the sim rate in 0C1A. What about pauses or menu accesses stopping time?

[LATER]

Okay, I've looked up the "ELAPSED_SECONDS" value -- it's a Gauge Token Variable. I could probably read it as such, but I wouldn't want to have to try reading it at very frequent intervals as such access is relatively expensive (performance-wise). Most of the fast stuff I do is by mapping directly into the actual value in FS's memory. If i can't find this easily it has to be by athis expensive set of function calls.

So, please tell me more about this need and how you'd be using it so I can assess whether I can provide it adequately.

BTW FSX, via Simconnect, offers" ABSOLUTE TIME", which doesn't sound like it's going to sped up and slow down like you ask. It is described as "Time, as referenced from 12:00 AM January 1, 0000".

Pete

Posted

I'm looking for a way to access the FS9 SDK's ELAPSED_SECONDS variable using FSUIPC. This contains the number of seconds of simulated time that have elapsed since midnight -- and the important thing for me is that it does it with sub-second resolution.

I see that offsets 0238 to 023A give me the current time, but only with a resolution of one second; offset 0310 does give sub-second resolution, but it does not speed up or slow down with time acceleration, which is what I would want...

Okay, this is now available in FSUIPC 3.769, from the Other Downloads announcement above, and it will be available in FSUIPC 4 later, maybe tomorrow.

Yes, it does vary correctly with the sim rate, and does pause when it should too. But it doesn't count from midnight (which really wouldn't make much sense in view of all this), but from the time the aircraft is first ready, at the start of the session.

Offset 04A8, as a double (FLOAT64).

Regards

Pete

Posted
0310 and 0368 (?) are the only ones I know. Not sure about 0368 though. Maybe that's it?

I think I checked that a while ago, and it wasn't what I needed...

Does this SDK-mentioned one you found speed up and slow down? Maybe you have to take care of that adjustment yourself, reading the sim rate in 0C1A. What about pauses or menu accesses stopping time?

ELAPSED_SECONDS does speed up and slow down, just the way I'd want it to.

To give you an idea of what I'm trying to do: I want to implement a custom autopilot. Ultimately, I'll probably want to run it as a gauge, but at the moment I'm doing it externally via FSUIPC because it's easier to debug that way. I need ELAPSED_SECONDS (I think) because I want to use PID controllers... for which I need to compute the integral and the derivative of certain values I'm observing. For example, I want to know how quickly airspeed is increasing or decreasing, and that's why I need to know how much simulated time has passed between two airspeed measurements.

Anyway, since this is only for the "prototype autopilot" anyway, it's not worth making it accessible through FSUIPC if that would mean a lot of effort on your part or if it would slow FSUIPC down a lot. I was just hoping it was maybe a variable you hadn't made available yet because there didn't seem to be a need...

But it seems the easiest solution is probably just to use the "ticks" and to compensate for time acceleration myself.

BTW FSX, via Simconnect, offers" ABSOLUTE TIME", which doesn't sound like it's going to sped up and slow down like you ask. It is described as "Time, as referenced from 12:00 AM January 1, 0000".

Thanks for the pointer -- I haven't done any work on FSX yet (still using FS9 exclusively), but I'll surely look into it at some point...

Cheers,

Martin

Posted

Seems our postings crossed... ;)

Okay, this is now available in FSUIPC 3.769, from the Other Downloads announcement above, and it will be available in FSUIPC 4 later, maybe tomorrow.

Wow, you're quick... thanks a lot! I'll try it out and report back!

Best regards,

Martin

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.