Jump to content
Sign in to follow this  
phjvh

XML Math problem

Recommended Posts

Guest b_zwanikken

Hi, I'm trying to disply Groundspeed/drift angle ie 182/02Port. Im new to XML and I've tried to follow the rules given in the SDK, but why doesn't this work?%((A:GPS GROUND SPEED, knots) near)%!d! / %((A: PLANE HEADING DEGREES MAGNETIC, degrees)(A:GPS GROUND MAGNETIC TRACK, degrees) - )%!d!%Cheers, Brendan

Share this post


Link to post
Share on other sites

Hi, A "workaround"The math's:(A:GPS GROUND SPEED, knots) (>L:groundspeed,number) (A: PLANE HEADING DEGREES MAGNETIC, degrees) (>L:magheading,number) (A:GPS GROUND MAGNETIC TRACK, degrees) (>L:gpsheading,number) (L:magheading,number) (L:gpsheading,number) - (>L:difference,number) (L:groundspeed,number) (L:difference,number) / (>L:result,number) The result:%((L:result,number))%!d!With the speed:%((L:groundspeed,number))%!d!% / %((L:result,number))%!d!Hope it helps,Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest b_zwanikken

Thanks that seemed to work, however, I'm not entirely convinced. I was getting -1 drift on all headings even though I had 36kts from 044deg. there should be both - and + drift and it should be up at least as high as 5 as I was only travelling at 160kt. Is this a problem with the .air file of the aircraft, or is the gauge file not updating?Cheers fot your help this far

Share this post


Link to post
Share on other sites

It's been a while since i've played with this stuff - but here's a shot.. Maybe right... maybe not..Instead of using " (A: PLANE HEADING DEGREES MAGNETIC, degrees)(A:GPS GROUND MAGNETIC TRACK, degrees) - " and relying on GPS track maybe use parts of the trend indicator of the 747 HSI which computes actual track?? (velocities) ." (A:Velocity world X, m/s) (A:Velocity world Z, m/s) atg2 (A:Magvar, radians) - (A:Plane heading degrees gyro, radians) - " For the final: Uses no part of the GPS and is true heading. For mag hdg take out the "(A:Magvar, radians) - " portion of the code.%((A:GROUND VELOCITY, knots) near)%!d! / %((A:Velocity world X, m/s) (A:Velocity world Z, m/s) atg2 (A:Magvar, radians) - (A:Plane heading degrees gyro, radians) - rddg s1 d 180 > if{ l1 360 - } els{ l1 } )%!d!%hope it helps.Regards,Roman


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest b_zwanikken

Thanks that second equation seemed to work alot better. I was probably useing the wrong variables.There is a couple of problems with this though with regards to the drift part of the equation,1) all results between 180 and 360 give results between -349 and -371 degrees nevera positive either. however the results to the east are correct giving results from -11 to 11 degrees. Any ideas?2) the - and + results are around the wrong way, is that just as simple as switching the if/else around?3) I would like to show P or S (port/starboard drift) after the result instead of a + or - in front, thats in the if/else too? How do I write that?Many thanks for you execlent help thus far, I've been struggling on this one for over a week now.

Share this post


Link to post
Share on other sites

Hi,As far as i know Drift Angle is the angle between True Haeding and True Track.The A:Var's i can find are:(A:PLANE HEADING DEGREES TRUE,degrees) or(A:GPS GROUND TRUE HEADING,degrees)and (A:GPS GROUND TRUE TRACK,degrees) I tested%((A:PLANE HEADING DEGREES TRUE, degrees) (A:GPS GROUND TRUE TRACK,degrees) -)%!d!% and%(A:GPS GROUND TRUE HEADING,degrees) (A:GPS GROUND TRUE TRACK,degrees) -)%!d!%and both codes give, with wind from different directions, a good indication of the drift angle.When wind comes from the left you'll have a - sign and from the righta + sign.Wind ahead or astern gives 0 as expected.Some code:(A:GPS GROUND TRUE HEADING, degrees) (A:GPS GROUND TRUE TRACK,degrees) - -1 > (A:GPS GROUND TRUE HEADING, degrees) (A:GPS GROUND TRUE TRACK,degrees) - 1 < && if{ 0 (>L:te,number) } (A:GPS GROUND TRUE HEADING, degrees) (A:GPS GROUND TRUE TRACK,degrees) - 1 > if{ 1 (>L:te,number) } (A:GPS GROUND TRUE HEADING, degrees) (A:GPS GROUND TRUE TRACK,degrees) - -1 < if{ 2 (>L:te,number) }Now the next string will give you port and starboard:%((A:GPS GROUND TRUE HEADING, degrees) (A:GPS GROUND TRUE TRACK,degrees) - abs)%!d!%((L:te,enum))%{case}%{:0}0%{:1}Port%{:2}Starboard%{end}You may have to change P and S!So the final formula ought to be (tested):%((A:GPS GROUND SPEED, knots))%!d!% / %((A:GPS GROUND TRUE HEADING, degrees) (A:GPS GROUND TRUE TRACK,degrees) - abs)%!d!% %((L:te,enum))%{case}%{:0}- - -%{:1}Port%{:2}Starboard%{end}Hope it will get you closer,Jan"Beatus Ille Procul Negotiis"Sorry for using GPS....

Share this post


Link to post
Share on other sites

b_zwanikken & Jan, Here's a version that works without using GPS vars. ( which will only show when a valid plan is loaded ) It will work hand flying, or using HDG,VOR,GPS,LOC & APP holds. As from previous posts it calculates track by using world velocities, think of it as an IRU.This one has been tested. It will not show any drift if under 0.1* P or S.b_zwanikken, I am assuming you want an active E6B drift calculator? %((A:GROUND VELOCITY, knots) near)%!d! kts / %((A:Velocity world X, m/s) (A:Velocity world Z, m/s) atg2 (A:Magvar, radians) - (A:Plane heading degrees gyro, radians)- rddg dnor s1 abs d 180 < if{ l1 /-/ s1 } els{ 360 l1 - s1 } )%(l1 0.1 < l1 -0.1 > &)%{if} %{else}%(l1 0.1 >)%{if}%( l1 )%!3.1f!%


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest b_zwanikken

Thanks to both of you for your efforts. The first equation was causing an error that ment my panel would'nt show up. But the second works fine. Very accurate to by the way.I am actually a Trainee Navigator in Winnipeg with the CAF, but working for the RNZAF. I'm making a 'radar' panel that is as close as I can get too the ones we use in the Dash 8 here. The drift angle comes from the doppler in real life but there is no such thing in FS, thats why I had the trouble.I have a further few questions, on the Dash 8 radar the mouse curser gives out a reading of reletive bearing of a target, ie hold the mouse over a spot and in the bottom left corner the range and reletive bearing to the aircraft is shown. Any Ideas if this can be done? I can send you the panel thus far if that would help so you can see what I'm talking about.Also for the equation given to me by Roman, the Dash 8 is only accurate to 1deg, due to the fact that the pilot and autopilot can't be anymore acurate so its a waste of memory. What part of the code do I take out to change this, and it doesn't have the deg symbol either, what do I take out there?Cheers for your help that was a big problem.

Share this post


Link to post
Share on other sites

Hi, Enclosed is another .txt file containing some modified versions. You may see what was changed by comparing.Radar gauge- As long as the radar gauge is done in .XML or some other forms where the .xml can be placed on top of it I think it could be done. You would use the (M:X) and (M:Y) variables to get coordinates on gauge, then some math to get relative bearing from aircraft. Etc.. Etc.. My mind is realing with ideas, would like to give it a shot for you.removeme!spokes2112@new.rr.com Regards,Romanhttp://home.new.rr.com/spokes2112/images/Image2.gif


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites

HiFun to "pain" the brain isn't it!I tested Roman's and mine quite extensive with and without a loaded flightplan and degrees into the tenth's and they gave exact the same values.My question, observation:The GPS Var's without WP(!) are working even when you have no flightplan loaded.So you can use them as in real live(?)Jan

Share this post


Link to post
Share on other sites
Guest b_zwanikken

Thanks for the ofer to help further Roman. I have sent you an email from b_zwanikken@hotmail.com containing the files I have done so far. And some further info.The drift equation is working perfectly. Thnaks for everyones help.

Share this post


Link to post
Share on other sites
Guest b_zwanikken

Roman, the email bounced, email me when you get a chance and I'll send you the email again. Cheers

Share this post


Link to post
Share on other sites

Hi,I think, you only need to have the GPS loaded into your panel??????Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...