Jump to content
The simFlight Network Forums

Baffled by setting the AP altitude.


Recommended Posts

Hi All, I have been working through my program, figuring out little bits about FSUIPC as I go along.

Right now I am a little stuck and can't figure it out. I am setting the AP altitude offset 07d4. I set it externally and use fsuipc to set it in game. This is the piece of c# code that sets it.

Offset AP_ALT = new Offset(0x07d4); <-- this is the offset declaration

--this code is within a function

if( unitOfMeasure == 2) { // if the game is using metric units

AP_ALT.Value = newAltitude*65536;

} else {

AP_ALT.Value = (int)(((newAltitude/3.28084)*65536) +.5);

}

The problem is when the game is set to metric units and I try to set the AP ALT to 2300. I know from the debugger that 2300 is passed in to the function and newAltitude is set to that. It is multiplied by 65536 which is 150732800. In FSUIPC's logging tab I set up that offset to monitor. It is set to the value I expected. The problem is that the display on the autopilot reads 2316. Where did the extra 16 meters come from??!!?

I would understand if there was a bit of rounding error when converting to feet but there is no conversion here, I pass in a value of meters and set it as meters.. Very strange that the display doesnt match the current value of the offset/65536.

Any ideas?

Thanks,

Jason

Link to comment
Share on other sites

Similar problem with the vertical speed setting on the autopilot. When working in feet, no problems. I wonder if the problem is because FSUIPC is using the somconnect calls XXXXXX_ENGLISH when there are also simconnect calls XXXX_METRIC and internally . No idea.

I have been playing around in fsinterogator with the field and it needs to be set in feet, I set it to 328 feet and when the value is 91 on the vert speed on the AP. in fact, a change of a number of feet doesnt seem to alter the vert speed reading at all..

Very confusing..

Link to comment
Share on other sites

I know from the debugger that 2300 is passed in to the function and newAltitude is set to that. It is multiplied by 65536 which is 150732800. In FSUIPC's logging tab I set up that offset to monitor. It is set to the value I expected. The problem is that the display on the autopilot reads 2316. Where did the extra 16 meters come from??!!?

It is because the A/P, or at least its display, operates in 100's of feet. 2316 metres is 7600 feet, which is your 2316 metres -> 7546 feet, rounded to the nearest 100 foot boundary.

Maybe this should not happen when using metric displays (perhaps 50 metres should be the interval, I don't know), but evidently the FS aircraft you are using isn't so sophisticated. I don't know if that's innate to FS or only to the specific gauges I'm afraid.

Regards

Pete

Link to comment
Share on other sites

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.