Problems setting reference altitude

info@rjsim.com
Posts: 4
Joined: Thu Mar 10, 2011 7:12 pm

Postby info@rjsim.com » Wed Mar 30, 2011 1:31 pm

In playing around with manipulating the Autopilot I've run across a problem while trying to set the reference altitude. If I make the following call to set the reference altitude;



SimConnect_TransmitClientEvent(hSimConnect, 0, AP_ALT_VAR_SET_ENGLISH, 4420, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);



And then check our reference altitude with the following data definition;



SimConnect_AddToDataDefinition(hSimConnect, RADIO_DEFINITION, "AUTOPILOT ALTITUDE LOCK VAR", "Feet");



I get a value of 4500. If I set the altitude to anything 20-99, I get a returned value that has been rounded up to the above 100 foot mark like above. If I set the altitude to anything from 1-19, it rounds down (ie, if I set the altitude value to 4419, I get 4400 returned).



Now, the other weirdness that I'm seeing is if I set the reference altitude in meters, with the following call;



SimConnect_TransmitClientEvent(hSimConnect, 0, AP_ALT_VAR_SET_METRIC, 1347, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);



and I would expect to see the value of 4419 returned (1347 meters equals 4419 feet), but instead I get back a value of 1476.4.



So, this is all strange/confusing in that if I set the value in feet, I get a rounded value and if I set the value in meters, I get a value that I'm unsure of what it is. Are we using this completely wrong, are we completely missing something, or is there a bug somewhere?

User avatar
Beau Hollis
Lockheed Martin
Posts: 2167
Joined: Wed Oct 06, 2010 3:25 pm

Postby Beau Hollis » Thu Mar 31, 2011 8:09 am

Interesting. I'm guessing it was intended to round to the nearest 100 feet or 10 meters by design but that the system needed it in ft. There is probably a bug wherein it remembers the units you set it in, but forgets that it converted them to ft. Someone would need to look into the code to be sure, but here is my guess as to what is happening:



- 1347 converted to 4419

- it was then rounded up to 4500

- 4500 in 100s of feet is 45

- Your requested meters

- 45 in 10s of meters is 450m

- 450m converts to 1476.4 ft



Beau
Beau Hollis
Prepar3D Software Architect

info@rjsim.com
Posts: 4
Joined: Thu Mar 10, 2011 7:12 pm

Postby info@rjsim.com » Thu Mar 31, 2011 11:48 am

Well, I guess that makes some sense of the numbers, but seems really bad (and I should've noted that it's not just that SimConnect returns the bad numbers, but that those are the numbers that get set into the instruments as well).



What would be the purpose of rounding up to the nearest 100? I feel that if I wanted to fly at 4550ft, I should be able to.



Thanks,

Nate

FSMP
Posts: 678
Joined: Sat Sep 25, 2010 9:38 am

Postby FSMP » Thu Mar 31, 2011 3:57 pm



Typically, in the Real World, if you are flying "On Autopilot" in a country that specifies altitude in feet, you fly at 500ft Incements. ( 3000ft or above).



So being able to set the altimeter in 100 ft steps, (as opposed to 50 ft, or 1 ft ), makes "Real World Sense" sense.



In the very unlikely event that you wanted to fly at 4550ft on the Autopilot, instead of 4500 ft, you could always do the very risky process of adjusting your altimeter to be -50 ft off true altimeter setting, but I would not recommend that in the real world.



Setting the Altitude in the Autopilot, is not the only place where maths seem to be a little confused between units.



(Turbine Itt, Celcius) seems to be off by



(Itt.true, Celcius) = (Turbine Itt, celcius) + 32/2 - (T.amb,Celcius) DegC.



The above correction seems necessary to make Itt = T.amb when the engine has been at rest for some time, across typical ambient temperature extremes.



That 32/2 correctons seems to be a very big coincidence. :)





Geoff


info@rjsim.com
Posts: 4
Joined: Thu Mar 10, 2011 7:12 pm

Postby info@rjsim.com » Fri Apr 01, 2011 2:29 pm

Hello FSMP



The reason not being able to set the AP altitude to smaller units than 100' increments is as follows, and this happens in the real world daily.



Using a typical GA autopilot such as a the GFC 700 that is integrated into G1000 units, if you are flying at 3000' MSL and ATC clears you to 8000', you would set 8000' into your altitude preselect and begin climbing. If at any point you need to level off from your climb before reaching 8000' (say for a traffic conflict), a pilot would press the ALT button. When you press the ALT button, the AP will stop the climb and stay at the altitude you were at the moment the ALT button was pressed (rounded up or down to the nearest 10'). So, if you press the ALT button during a climb at 4577', the autopilot will hold 4580'.



The altitude preselect function of every autopilot I have ever used increments by 100', but that does not mean that the autopilot can only fly at altitudes of only 100' increments. Most autopilots will capture and fly altitudes in increments of 10', not 100' as explained in the example above.











Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 8 guests