Search the archive:
YaBB - Yet another Bulletin Board
 
   
 
Page Index Toggle Pages: 1
Send Topic Print
Foster 511 RNAV Project in XML, need help! (Read 178 times)
Dec 16th, 2011 at 6:39pm

demyhr   Offline
Lieutenant Colonel
I Like Flight Simulation!

Posts: 5
*****
 
I'm trying to reproduce the panel and function of a 1966 C172 G model I used to own in the 80's. The Foster 511 RNAV is the last instrument I need to finish the project. I have modified and coded the Narco Radios and found exact gauges for everything else. It's more a sentimental journey than something serious. I had a lot of good times flying the plane. It had an Avcon Lycoming O-260 180hp engine, Hartzell constant speed prop, flap and aileron seals, remote mag compass, King HSI slaved to compass, Narco MK12 and COM/NAV 11 radios, King DME, King ADF, and the Foster RNAV.

While the 180hp didn't make it go faster, I lived in Colorado Springs and the airport I flew out of was 6888 ft elevation and the plane could get off the ground in less than 1200 ft on a 90 degree day at full gross weight. Due to the seals on the flaps and ailerons I could actually slow the plane down with full flaps and power such that the airspeed indicated "0" and still have control, albeit right on the ragged edge of a stall. Flying in the mountains of Colorado was no problem as the plane would reach 18,000 msl which is a fair amount above a normal 172's ceiling. Of course you need oxygen and ifr rating to do that. I regularly would get up to 13,000-14,000 ft going through the passes. I once flew to CA by going straight west and there are areas over northern Nevada where at 10,000 ft you can see no evidence of mankind whatever. needless to say, I tried to stay in radio contact with flight service on that flight. But I digress.

I have now got the input to the RNAV working and have a basic idea of the math required to find the offset to the VOR based on the RNAV bearing and distance input. I have tried to couple this to the Bendix/King HSI XML of the FSX Beach Baron. I'm not having much luck getting it working because of my lack of knowledge of the internals of FSX. My relevant code is shown below:

Any help with getting this to work would be appreciated. Keep in mind RNAV was used in the 80's (no GPS) with only the input to the RNAV (radial and distance) combined with the tuned VOR radial and the DME distance. I'm hoping to duplicate this operation without resorting to FSX GPS info if possible.

Thanks for the help.

<!--convert VOR radial to 0-359 degrees-->
<!--calc angle between nav radial and wp radial -->

     (A:NAV1 RADIAL,degrees) dnor (L:WP1_BEARING,degrees)  - s0
     abs dgrd (&gt;L:VOR_WP_ANGLE,radians)

<!-- calc distance from WP to plane  = sqrt of (a^2 + b^2 - 2*a*b*cosC)
a = wp dist from vor L:WP1_DISTANCE
b = dme dist VOR to plane  A:NAV1 DME
C = angle between nav radial and wp radial L:NAV1_WP -->
<!-- postfix  a^2 b^2 2 a b C cos * * * - + sqrt  -->

     (L:WP1_DISTANCE,nmiles) sqr
     (A:NAV1 DME,nmiles) sqr
     2 (L:WP1_DISTANCE,nmiles)
     (A:NAV1 DME,nmiles)
     (L:VOR_WP_ANGLE,radians) cos * * * - + sqrt
     (&gt;L:DIST_PLANE_TO_WP,nmiles)

<!--calc VOR radial from WP in degrees
a = wp dist from vor  L:WP1_DISTANCE
b = dme dist VOR to plane A:NAV1 DME
c =dist from plane to WP  DIST_PLANE_TO_WP -->
<!--postfix  BAC = b^2 c^2 a^2 - + 2 b c * * / acos  -->

     (A:NAV1 DME,nmiles) sqr
     (L:DIST_PLANE_TO_WP,nmiles) sqr
     (L:WP1_DISTANCE,nmiles) sqr - + 2
     (A:NAV1 DME,nmiles)
     (L:DIST_PLANE_TO_WP,nmiles) * * / acos
     (&gt;L:TEMP,radians)
     
     <!-- Calculate course to fly
     if s0 < 0 then  VOR_OFFSET is negative
     If s0 > 0 then  VOR_OFFSET is positive-->

     l0 0 &lt;      if{ (L:TEMP,radians) /-/ } els{ (L:TEMP,radians) } (&gt;L:VOR_OFFSET,radians)


HSI code

(&gt;L:VOR_OFFSET,radians)
<?xml version="1.0" encoding="utf-8"?>
<Gauge Name="HSI" Version="1.0">
     <Image Name="HSI_Background.bmp" Luminous="Yes" ImageSizes="118,112,186,177"/>
<Update>
     (A:NAV1 OBS,radians) (&gt;L:NAV1_OBS,radians)
<!--      (A:NAV1 OBS,radians) (L:VOR_OFFSET,radians) + (&gt;L:NAV1_OBS,radians)-->
<!--      (A:Autopilot heading lock dir,radians) (L:VOR_OFFSET,radians) + (&gt;L:Autopilot heading lock dir,radians)-->
<!--      (A:Plane heading degrees gyro,radians) (L:VOR_OFFSET,radians) + (&gt;L:Plane heading degrees gyro,radians)-->
</Update>
     <Element>
           <Position X="0" Y="0"/>
           <MaskImage Name="HSI_Card_Outside_Mask.bmp" Luminous="Yes" ImageSizes="118,112,186,177">
                 <Axis X="58" Y="57"/>
           </MaskImage>
           <Image Name="HSI_Card_Outside.bmp" Luminous="Yes" ImageSizes="106,106,170,170">
                 <Axis X="53" Y="53"/>
           </Image>
           <Rotate>
                 <Value>(A:Plane heading degrees gyro,radians) /-/</Value>
                 <Failures>
                       <SYSTEM_ELECTRICAL_PANELS Action="Freeze"/>
                       <GAUGE_GYRO_HEADING Action="Freeze"/>
                 </Failures>
           </Rotate>
     </Element>
     <Element>
           <Position X="58" Y="57"/>
           <Image Name="HSI_Card_Inside.bmp" Luminous="Yes" ImageSizes="70,72,110,114">
                 <Axis X="35" Y="36"/>
           </Image>
           <Clip/>
           <Rotate>
                 <Value>(L:NAV1_OBS,radians) (A:Plane heading degrees gyro,radians) - </Value>
           </Rotate>
     </Element>
     <Element>
           <Position X="58" Y="57"/>
           <Select>
                 <Value>(A:HSI TF flags, ENUM)</Value>
                 <Case Value="1">
                       <Image Name="HSI_To_Pointer.bmp" Luminous="Yes" ImageSizes="15,8,24,13">
                             <Axis X="-7" Y="15"/>
                       </Image>
                 </Case>
                 <Case Value="2">
                       <Image Name="HSI_From_Pointer.bmp" Luminous="Yes" ImageSizes="15,8,24,13">
                             <Axis X="-7" Y="15"/>
                       </Image>
                 </Case>
           </Select>
           <Rotate>
                 <Value>(L:NAV1_OBS,radians) (A:Plane heading degrees gyro,radians) - </Value>
           </Rotate>
     </Element>
     <Element>
           <Position X="58" Y="57"/>
           <Image Name="HSI_Needle.bmp" Luminous="Yes" ImageSizes="4,39,8,65">
                 <Axis X="2" Y="20"/>
           </Image>
           <Shift>
                 <Value>(A:HSI CDI needle valid, bool) if{ (A:HSI CDI needle, number)  } els{ 0 }</Value>
                 <Scale X="0.173"><!--22/127 = 0.173-->
                 </Scale>
           </Shift>
           <Rotate>
                 <Value>(L:NAV1_OBS,radians) (A:Plane heading degrees gyro,radians) - </Value>
           </Rotate>
     </Element>
     <Element>
           <Position X="27" Y="17"/>
           <Select>
                 <Value>(A:HSI CDI needle valid,bool)</Value>
                 <Case Value="0">
                       <Image Name="HSI_Flag_Nav.bmp" Luminous="Yes" ImageSizes="24,13,37,19"/>
                 </Case>
           </Select>
     </Element>
     <Element>
           <Position X="71" Y="17"/>
           <Select>
                 <Value>(A:Partial panel heading,enum) 0 != (A:Partial panel electrical,enum) 0 != || </Value>
                 <Case Value="1">
                       <Image Name="HSI_Flag_Hdg.bmp" Luminous="Yes" ImageSizes="24,13,37,19"/>
                 </Case>
           </Select>
     </Element>
     <Element>
           <Position X="58" Y="57"/>
           <Image Name="HSI_Pointer.bmp" Luminous="Yes" ImageSizes="12,9,19,15">
                 <Axis X="5" Y="44"/>
           </Image>
           <Rotate>
                 <Value>(A:Autopilot heading lock dir,radians) (L:Plane heading degrees gyro,radians) - </Value>
           </Rotate>
     </Element>
     <Element>
           <Image Name="hsi_glide_slope_left.bmp " Luminous="Yes" ImageSizes="4,7,6,11">
                 <Axis X="4" Y="3.5"/>
           </Image>
           <Shift>
                 <Value Minimum="-220" Maximum="120">(A:HSI GSI needle valid, bool) if{ (A:HSI GSI needle, number) } els{ -220 }</Value>
                 <Nonlinearity>
                       <Item Value="0" X="14" Y="57"/>
                       <Item Value="-120" X="14" Y="36"/>
                 </Nonlinearity>
                 <Delay PixelsPerSecond="20"/>
           </Shift>
     </Element>
     <Element>
           <Image Name="hsi_glide_slope_right.bmp" Luminous="Yes" ImageSizes="4,7,6,11">
                 <Axis X="0" Y="3.5"/>
           </Image>
           <Shift>
                 <Value Minimum="-220" Maximum="120">(A:HSI GSI needle valid, bool) if{ (A:HSI GSI needle, number) } els{ -220 }</Value>
                 <Nonlinearity>
                       <Item Value="0" X="103" Y="57"/>
                       <Item Value="-120" X="103" Y="36"/>
                 </Nonlinearity>
                 <Delay PixelsPerSecond="20"/>
           </Shift>
     </Element>
     <Element>
           <Image Name="hsi_mask.bmp" Luminous="Yes" ImageSizes="118,112,186,177"/>
     </Element>
     <Element>
           <Position X="103" Y="90"/>
           <Image Name="HSI_Knob_Right.bmp" ImageSizes="21,21,30,30">
                 <Axis X="10.5" Y="10.5"/>
           </Image>
           <Rotate>
                 <Value>(A:Autopilot heading lock dir,radians) 3 *</Value>
           </Rotate>
     </Element>
     <Element>
           <Position X="14" Y="90"/>
           <Image Name="HSI_Knob_Left.bmp" Luminous="Yes" ImageSizes="21,21,30,30">
                 <Axis X="10.5" Y="10.5"/>
           </Image>
           <Rotate>
                 <Value>(A:NAV1 OBS,radians) 3 *</Value>
           </Rotate>
     </Element>
     <Mouse>
           <Help ID="HELPID_GAUGE_HSI"/>
           <Tooltip ID="TOOLTIPTEXT_HSI_HEADING_COURSE"/>
           <Area Left="92" Right="114" Top="79" Bottom="101">
                 <Help ID="HELPID_GAUGE_HEADING_BUG_ADJUST"/>
                 <Area Right="11">
                       <Cursor Type="DownArrow"/>
                       <Click Event="HEADING_BUG_DEC" Repeat="Yes"/>
                 </Area>
                 <Area Left="11">
                       <Cursor Type="UpArrow"/>
                       <Click Event="HEADING_BUG_INC" Repeat="Yes"/>
                 </Area>
           </Area>
           <Area Left="3" Right="25" Top="79" Bottom="101">
                 <Help ID="HELPID_GAUGE_HSI_OBS1"/>
                 <Area Right="11">
                       <Cursor Type="DownArrow"/>
                       <Click Event="VOR1_OBI_DEC" Repeat="Yes"/>
                 </Area>
                 <Area Left="11">
                       <Cursor Type="UpArrow"/>
                       <Click Event="VOR1_OBI_INC" Repeat="Yes"/>
                 </Area>
           </Area>
     </Mouse>
</Gauge>
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print