Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Xml - Calculating Vertical Profile Angle

Featured Replies

  • Moderator

I'm embarrased to admit that my trig skills have long since vanished (if indeed they ever existed!)... so here I am, hat in hand again. :( I need to calculate the theta of a right triangle. I know the length of the opposite and the adjacent sides:b = opposite side = (A:AUTOPILOT ALTITUDE LOCK VAR,feet) (A:Indicated Altitude,feet) -a = adjacent side = (@c:FlightPlanWaypointRemainingDistance,feet)calculateanglerighttriawb6.jpgUnless my memory has totally failed, this is the formula needed:tan(theta) = b / a If this is accurate, what would the XML syntax for this formula be???The SDK states: tg Tangent (input in radians) This script produces garbage... :(

			<Element Name="Vertical Profile">				<Position X="166" Y="668"/>				<Polyline LineWidth="3" Color="White" Bright="Yes">					<Axis X="0" Y="0"/>					<Point X="0" Y="0"/>					<Point X="160" Y="0"/>				</Polyline>				<Rotate>					<Value Minimum="-90" Maximum="90">						(@c:FlightPlanWaypointRemainingDistance,feet) (A:AUTOPILOT ALTITUDE LOCK VAR,feet) (A:Indicated Altitude,feet) - / dgrd tg /-/					</Value>				</Rotate>				<Shift>					<Value Minimim="0" Maximum="24000">						(A:Indicated Altitude,feet)					</Value>					<Scale Y="-0.0055"/>				</Shift>											</Element>

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
I'm embarrased to admit that my trig skills have long since vanished (if indeed they ever existed!)... so here I am, hat in hand again. :blush: I need to calculate the theta of a right triangle. I know the length of the opposite and the adjacent sides:b = opposite side = (A:AUTOPILOT ALTITUDE LOCK VAR,feet) (A:Indicated Altitude,feet) -a = adjacent side = (@c:FlightPlanWaypointRemainingDistance,feet)calculateanglerighttriawb6.jpgUnless my memory has totally failed, this is the formula needed:tan(theta) = b / a If this is accurate, what would the XML syntax for this formula be???The SDK states: tg Tangent (input in radians) This script produces garbage... :blush:
			<Element Name="Vertical Profile">				<Position X="166" Y="668"/>				<Polyline LineWidth="3" Color="White" Bright="Yes">					<Axis X="0" Y="0"/>					<Point X="0" Y="0"/>					<Point X="160" Y="0"/>				</Polyline>				<Rotate>					<Value Minimum="-90" Maximum="90">						(@c:FlightPlanWaypointRemainingDistance,feet) (A:AUTOPILOT ALTITUDE LOCK VAR,feet) (A:Indicated Altitude,feet) - / dgrd tg /-/					</Value>				</Rotate>				<Shift>					<Value Minimim="0" Maximum="24000">						(A:Indicated Altitude,feet)					</Value>					<Scale Y="-0.0055"/>				</Shift>											</Element>

I use Indicated Altitude, feet FlightPlanDestinationAltitude,feet - distance remaing nmiles 6076.13 * / tg rddg = Vertical bearing in degrees

Paul EGLD

Fr. Bill,This works somehow:<Element Name="Vertical Profile"><Position X="60" Y="360"/><Polyline LineWidth="3" Color="White" Bright="Yes"><Axis X="0" Y="0"/><Point X="0" Y="0"/><Point X="160" Y="0"/></Polyline><Rotate><Value Minimum="-90" Maximum="90">(A:AUTOPILOT ALTITUDE LOCK VAR,feet) (A:Indicated Altitude,feet) - (@c:FlightPlanWaypointRemainingDistance,feet) / tg rddg -1 * </Value></Rotate><Shift><Value Minimim="0" Maximum="32000">(A:Indicated Altitude,feet)</Value><Scale Y="-0.01"/></Shift> </Element>Of course not knowing what you are exactly up to.Jan

Jan

 

 

 

"Beatus ille qui procul negotiis..."

  • Author
  • Moderator
Fr. Bill,This works somehow:
Thanks! I only had to make one tiny correction to properly scale the output to my display:(A:AUTOPILOT ALTITUDE LOCK VAR,feet) (A:Indicated Altitude,feet) - (@c:FlightPlanWaypointRemainingDistance,feet) / tg rddg -0.1 *

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author
  • Moderator
I use Indicated Altitude, feet FlightPlanDestinationAltitude,feet - distance remaing nmiles 6076.13 * / tg rddg = Vertical bearing in degrees
Thanks for the reply. That will work fine providing that the flightplan has a "planned altitude" for specific waypoints. AFAIK, default FS flightplans do not have such information available...

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
I need to calculate the theta of a right triangle. I know the length of the opposite and the adjacent sides:b = opposite side = (A:AUTOPILOT ALTITUDE LOCK VAR,feet) (A:Indicated Altitude,feet) -a = adjacent side = (@c:FlightPlanWaypointRemainingDistance,feet)Unless my memory has totally failed, this is the formula needed:tan(theta) = b / a If this is accurate, what would the XML syntax for this formula be???
Bill, unless I am very out of trigs, the correct formula should be:theta = arctan( b / a )I see in previous posts that you are doing (value1,feet) (value2,feet) / tg rddg , but (value1,feet) (value2,feet) / gives a number, so you are actually calculating the tangent of a number where you should be calculating the tangent of an angle. :( Instead, I think you should use (value1,feet) (value2,feet) / atg rddg; atg is the arctangent of a number that returns its corresponding arc-angle- in radians, which you convert to degrees with rddg.I've used atg in some of my gauges (a steering tiller for example) and works fine.Tom
  • Author
  • Moderator
Bill, unless I am very out of trigs, the correct formula should be:theta = arctan( b / a )I see in previous posts that you are doing (value1,feet) (value2,feet) / tg rddg , but (value1,feet) (value2,feet) / gives a number, so you are actually calculating the tangent of a number where you should be calculating the tangent of an angle. :( Instead, I think you should use (value1,feet) (value2,feet) / atg rddg; atg is the arctangent of a number that returns its corresponding arc-angle- in radians, which you convert to degrees with rddg.I've used atg in some of my gauges (a steering tiller for example) and works fine.Tom
Oddly enough, there's no difference in the end result whether I use tg or atg in the formula... :( I have a sinking feeling that I'm not going to be able to accomplish my final goal via XML for the V Profile. Here is a V Profile drawn in GDI+ for a Honeywell Primus 2000 MFD. I'm trying to implement something similar using XML and I don't think it will be possible since there's no way to dynamically change the x,y coordinates... :( rmu850000026aj1.jpg

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
Oddly enough, there's no difference in the end result whether I use tg or atg in the formula... B)
Oh yes, there is quite a difference :( The reason you don't see it clearly is because you're testing with small angles (1-10 degrees), where the values are almost the same because of tg/atg expressed in radians. But as long as both sides of the triangle (altitude/distance) approach to the same size, using tg will tend to show a +-90 deg angle, and using atg will do the same towards +-45 deg angle which would be the correct one.
I have a sinking feeling that I'm not going to be able to accomplish my final goal via XML for the V Profile. Here is a V Profile drawn in GDI+ for a Honeywell Primus 2000 MFD. I'm trying to implement something similar using XML and I don't think it will be possible since there's no way to dynamically change the x,y coordinates... :( rmu850000026aj1.jpg
Well, I might agree with you here. Despite it would be technically possible to draw the V profile in XML, the lack of dynamical change in X,Y coordinates would make it a complex and tedious task.. :( Tom
  • Author
  • Moderator
Can you draw vector lines by calculated x/y values?
No, as I stated previously. That's because x,y coordinate pairs are passed the to the XML parsing engine as string instead of integer or float values... ...which is idiotic since the XML parsing engine converts the string data to floats for the C/GDI rendering engine... :(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author
  • Moderator
Oh yes, there is quite a difference :( Well, I might agree with you here. Despite it would be technically possible to draw the V profile in XML, the lack of dynamical change in X,Y coordinates would make it a complex and tedious task.. :( Tom
Yeah, after I did a bit more testing I realized that your observation is correct.The company that commissioned this project aren't paying nearly enough to support that amount of effort, so I've opted drawing a single "leg" at a time rather than the complete flightplan......which is why I need to use a calculated angle for the single v-path vector... B) What makes this display more challenging (as if it weren't enough challenge already!) is that, unlike the Primus 2000 V-Path display, in this design the a/c symbol "rises up" to the target altitude, with the vertical scale on the left side "rising also" when > FL240, and the horizontal scale changes in response to the selected "range" of the ND display! :(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.