Jump to content

Archived

This topic is now archived and is closed to further replies.

COBS

Help with Scrolling a loop based Flt Plan listing

Recommended Posts

I have created a test gauge in FS9 xml that displays Flight plan data.The following shot shows 3 instruments depicting the FLTPLN.1. The Test Flight plan Listing gauge.2. Radar with FLTPLN line displayed.3. Data MFD with page relating to FLTPLN.From (3) it will be noted that the FLTPLN consists of 17 legs, The test instrument (1) can only display up to 14 legs.The purpose of the test instrument is to display well in excess of 30 legs.I need help getting the test instrument listing to Scroll .The listing is loop based , rather than a Bitmap .Any help with implementing scrolling of the list would be greatly appreciated.CheersKarol974fsx_2011_11_07_16_25_4.jpg

Share this post


Link to post
Share on other sites

The complete code for the above instrument is provided below.The background bitmap size is 456 x 410 and it only needs to be coloured black.CheersKarol

<Gauge Name="zDATA TFDDATFD" Version="1.0"><Image Name="DAT77_backgrnd.bmp" /><!--Bitmap dimensions are 456 x 410--><Update Frequency="18" /><Macro Name="c">C:fs9gps</Macro><Macro Name="g">C:fs9gps</Macro><Macro Name="FPLEnrouteHeader">(@c:FlightPlanIsActiveFlightPlan) (@c:FlightPlanIsLoadedApproach) and</Macro><Macro Name="FPLLinesCount">  0  @FPLEnrouteHeader +  (@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) + }</Macro><Macro Name="FPLLineIndex">  (@c:FlightPlanIsActiveApproach) if{   (@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) }  } els{   (@c:FlightPlanActiveWaypoint)  }  @FPLEnrouteHeader +</Macro><Macro Name="FPLLegalLeg">  @1  @FPLEnrouteHeader -  sp0  1 (@c:FlightPlanWaypointsNumber) 1 - l0 rng (@c:FlightPlanIsActiveFlightPlan) and  (@c:FlightPlanIsActiveFlightPlan) if{ (@c:FlightPlanWaypointsNumber) }</Macro><Macro Name="FPLActivateLeg">  @1  @FPLEnrouteHeader -  sp0  1 (@c:FlightPlanWaypointsNumber) -- l0 rng (@c:FlightPlanIsActiveFlightPlan) and if{   l0 (>@c:FlightPlanActiveWaypoint)  }</Macro><Macro Name="FPLLegName">  @1  @FPLEnrouteHeader -  sp0  1 (@c:FlightPlanWaypointsNumber) -- l0 rng (@c:FlightPlanIsActiveFlightPlan) and if{   l0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent)  }</Macro>  <Element>		<Element Name="TKEInfoText">	<Position X="85" Y="340"/>	<FormattedText X="75" Y="20" Font="Tahoma" FontSize="16" Adjust="Left" VerticalAdjust="Center" Color="#93FF72" Bright="Yes">	 <String>%TKE %((A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS WP TRACK ANGLE ERROR, degrees))%!d!°%{end}</String>	</FormattedText>   </Element>     <Element Name="XTKInfoText">	<Position X="230" Y="340"/>	<FormattedText X="95" Y="20" Font="Tahoma" FontSize="16" Adjust="Left" VerticalAdjust="Center" Color="#93FF72" Bright="Yes">	 <String>%XTK %((A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS WP CROSS TRK, nmiles) s1 abs d s0 100 >=)%{if}%!d!%{else}%(l0 10 >=)%{if}%!.1f!%{else}%!.2f!%{end}%{end}\{dpl=nm}%(l1 100 * near s0 0 >)%{if}>%{else}%(l0 0 <)%{if}<%{end}%{end}%{end}</String>	</FormattedText>   </Element>    <Element>			 <Position X="55" Y="13"/>			 <FormattedText X="320" Y="30" Font="Tahoma" FontSize="16" LineSpacing="16" Adjust="Left" Color="#93FF72" Bright="Yes" Tabs="0,60L,150L,210L,270L">			   <String>\tWPT\tDTK \{dplo=M}\tDIS \{dpl=nm}\tTOT \{dpl=nm}\n</String>			 </FormattedText>		</Element>  <Element>	 <Position X="52" Y="27"/>	 <Rectangle Width="381" Height="347" LineWidth="1" Color="#000000" FillColor="#000000" Bright="Yes"/>	 <Element>			 <Position X="3" Y="5"/>			 <FormattedText X="320" Y="305" Font="Tahoma" FontSize="16" LineSpacing="20" Adjust="Left" Color="#349F34" Bright="Yes" Tabs="0,30R,60L,155L,235R,300R">	<ScrollY>		(@g:listScroll)	   </ScrollY>	   <BlinkCode>@BlinkerCode</BlinkCode>	   <Color Value="Cyan"/>				<String>				%(0 sp3)		%(@FPLEnrouteHeader)		 %{if}		  \t\{clr2}		  %((@g:listItems) (@g:listCurrent) l3 == and)%{if}\{blnk}%{end}%(l3 ++ sp3)		  Enroute\{clr}\{nr}\n		 %{end}		%((@c:FlightPlanIsActiveFlightPlan) (@c:FlightPlanWaypointsNumber) s2 0 != and)		%{if}		 %(0 sp1)		 %{loop}		  %(l1 (>@c:FlightPlanWaypointIndex))		  %((@g:listItems) (@g:listCurrent) l3 == and)%{if}\{blnk}%{end}%(l3 ++ sp3)		  \t%((@c:FlightPlanWaypointIndex))%!d!		  \t%((@c:FlightPlanWaypointIdent))%!s!		  \{nr}		  %(l1 0 !=)%{if}		   \t%((@c:FlightPlanWaypointMagneticHeading,degrees) d360)%!03d!		   \t%((@c:FlightPlanWaypointRemainingDistance,nmiles) s0 0 !=)%{if}%(l0)%!d!%{end}		   \t%((@c:FlightPlanWaypointRemainingTotalDistance,nmiles) s0 0 !=)%{if}%(l0)%!d!%{end}		  %{end}		  %(l1 ++ s1 l2 <)		  \n		 %{next}		%{end}				 </String>			 </FormattedText>		</Element>  <Element>	  <Visible>	   (@c:FlightPlanIsActiveWaypoint)	  </Visible>	  <RelClip Left="1" Top="10" Width="324" Height="305"/>	  <Polyline Color="#93FF72" LineWidth="2">	   <Point X="7" Y="8"/>	   <Point X="2" Y="8"/>	   <Point X="2" Y="-11"/>	   <Point X="6" Y="-11"/>	   <Point X="6" Y="-10"/>	   <Point X="3" Y="-10"/>	   <Point X="3" Y="7"/>	   <Point X="7" Y="7"/>	   <Point X="5" Y="10"/>	   <Point X="5" Y="5"/>	   <Point X="7" Y="8"/>	  </Polyline>	  <Shift>	   <Value>		@FPLLineIndex		20 * (@g:listScroll) - 7 +	   </Value>	   <Scale Y="1"/>	  </Shift>	 </Element>	 <Element>	  <Visible>	   (@c:FlightPlanIsActiveWaypoint)	  </Visible>	  <RelClip Left="1" Top="10" Width="324" Height="305"/>	  <Polyline Color="#349F34" LineWidth="1">	   <Point X="25" Y="21"/>	   <Point X="300" Y="21"/>	   <Point X="25" Y="21"/>	  </Polyline>	  <Shift>	   <Value>		@FPLLineIndex		20 * (@g:listScroll) - 7 +	   </Value>	   <Scale Y="1"/>	  </Shift>	 </Element>					   </Element></Element></Gauge>

Share this post


Link to post
Share on other sites

Hi,You could assign two pushbuttons in the MFD to scroll the text back and forth with (@g:listScroll).back:

"Your page=?"if{(@g:listscroll) 0 > if{ (@g:listscroll) 120 - 0 max (>@g:listscroll) quit }}

forth:

"Your page=?"if{(@g:listscroll) (@c:FlightPlanWaypointsNumber) 4 / 120 * < if{ (@g:listscroll) 120 + (>@g:listscroll) quit }}  

"Notes: 1: this is working code for LineSpacing="15", 8 lines of text.2: use <Clip Top=".." Bottom="..." /> to make excess text invisibleSo experiment with the numbers120, 4 / 120 * (280?) and the clip values to adapt things for your gauge.Hope it helps,Jan

Share this post


Link to post
Share on other sites

Jan,Thank you for the response , will experiment with it.This instrument is an extract from the GPS 500, I tried various variations on the macros contained in the GPS,but the interlinked nature of the macroscovering GPS sub systems is complex.I suspect that the format of the loop needs to be changed to better suit this instrument.Basically I require it to function to enable flight plan modifications to overcome the corner cutoff at leg junctions to provide valid data for ground targetsup to and after overflight of the targets. The current system transitions to the next leg approx 3 NM / 30 seconds short of the waypoint and consequently Wpt data is lost at a critical time. CheersKarol

Share this post


Link to post
Share on other sites
The current system transitions to the next leg approx 3 NM / 30 seconds short of the waypoint and consequentlyWpt data is lost at a critical time.
Right. That's called Turn Anticipation and it is necessary in order to accommodate Fly-By waypoints. It is the way it is supposed to work. In FS, Turn Anticipation is a function of groundspeed - not a static 30 seconds.Why do you state that critical wpt data are lost? That is, what are you attempting to do? There are ways to "remember" waypoint location, distance, time, etc, if you need to.Bob

Share this post


Link to post
Share on other sites
There are ways to "remember" waypoint location, distance, time, etc, if you need to.
Propwash, thats good news , how do you go about it ?Cheers Karol

Share this post


Link to post
Share on other sites

Karol,What I am getting at is that you can always select the index of any waypoint in the flight plan and get its coordinates, if that information is all you need. The only thing that changes as you fly the flight plan is the waypoint that is active and the relevant distances and ETAs, but all waypoint information remains accessible in an active flight plan.As you are aware, for normal flights, the active waypoint is supposed to change before you actually reach the upcoming waypoint and the aircraft needs to begin turning to the next waypoint shortly before reaching the current one. If it didn't, then you would lose turn anticipation and fly-by waypoints would not be possible to execute. The autopilots I have tried (Reality XP, stock FS, Simflyer) initiate turns when the active waypoint changes.If your need is to fly directly over every waypoint, then you could try working with FlightPlanIsActiveWaypointLocked, which is settable, to get the aircraft/autopilot to do what you want. ActiveWaypointLocked locks the ActiveWaypoint's index number so it does not advance, and the result is that the aircraft should proceed to the waypoint without turning. Upon reaching the waypoint, the autopilot will cause the aircraft to circle the waypoint, repeatedly crossing it, until ActiveWaypointLocked is set to 0. Anyway, if you work with this, you could get the aircraft to do what you want. And there might be a better solution out there that someone will suggest.Good luck,Bob

Share this post


Link to post
Share on other sites

BobThank you for that info , I will try the 'locked' in tests.I suspect that eventually I will have to go the pathway of add waypoints when approaching area of specific interest.Add waypoints provides the flexability that I need. ( and of course the complexity that I do not need )Basically the procedure would be a flight plan passing near a specific point , interrupt the flight plan allowing aircraftsufficient time to precisely line up with that point , overfly it maintaining track briefly , then resume flight plan.This procedure would not apply to other portions of the flight plan.The problems are (1) track error on approach to point of interest as it takes autopilot quite a distance to accuratelyalign with a leg and (2) then a waypoint greater than 3NM past that point which could be auto deleted followingoverflight of main point.Is it possible to use add waypoint to add a string of 3 consecutive waypoints into a flight plan , or, do theyneed to be entered separately and individually ?CheersKarolPOSTSCRIPT; Problem (1) can mitigated by switching from NAV to HDG hold and adding a large number of degrees to expedite the required turn then switching back to NAV when leg heading is achieved.

Share this post


Link to post
Share on other sites
Is it possible to use add waypoint to add a string of 3 consecutive waypoints into a flight plan , or, do theyneed to be entered separately and individually ?
New waypoints have to be added 'individually', but only 3 lines of code are required for each new waypoint (assign lat, assign lon, assign index) and you can add as many as you want in succession. Deleting waypoints, when necessary, is just as easy. Note that use of FlightPlanAddWaypoint will also lock the active waypoint, so keep track of that and unlock it as required.In your use, I presume that you will know bearing and distance of the desired new waypoints and from that, you need to compute the lat and lons that are required for AddWaypoint. GeoCalc variables could be used for this, but for the short distances you are probably talking about, two very simple Euclidean geom equations are better, in my opinion. I just went through this for another purpose and can post if desired.Bob

Share this post


Link to post
Share on other sites

Cool, your above reply is very much appreciated, I had never thought about the " Lock " aspect.I would be grateful if you could post those Euclidean equations.I had considered that here might be 5 or so ways to pick up the Lat/Long ,and GeoCalc was one of them, I have beenplaying with rudimentary GeoCalcs to achieve a variable 'Stand off ' feature in both the Radar and Pave Tack.I currently have both fixed and macro based stand off in them ,in the F-111 Pig HUD panel, but the GeoCalc variable stand offwould lend towards another 2 methods to pick up Lat/long.Distances to points of interest would generally be short, with a maximum of about 80Nm ( or could be much more).The 5 possible Lat/Long (waypoint) methods are:1. Read off a real chart and enter with keypad ( slow but important facility).2. Move/scroll radar origin to desired point.3. Move/ scroll Pave Tack Viewer origin to desired point (limited at night without night vision).4. Utilizing an INI with preset Lat/Longs.( as per carriers 2006)5. Simconnect.6. In Hud emulating laser ranging using x,y,z.CheersKarol

Share this post


Link to post
Share on other sites

For short distances, if you know Bearing (true) and Distance from your current Latitude and Longitude, the following plane geom equations are accurate:Lat1 = {[cos(Brg) x Dist] + [A x Lat0]} / ALon1 = {[sin(Brg) x Dist] + [A x cos(Lat0) x Lon0]} / [A x cos(Lat0)]A = Earth Radius x Pi/180Earth Radius = 6378137 metersLat1 = New LatitudeLon1 = New LongitudeLat0 = Current LatitudeLon0 = Current LongitudeBrg = Bearing (true) from current Lat, Lon to new waypointDist = Distance from current Lat, Lon to new waypointBrg, Lat and Lon are in degreesIf the distances you are working with are much more as you indicate, then spherical geom (GeoCalc variables) is needed, or the other ways you indicate.Bob

Share this post


Link to post
Share on other sites

Thanks , I will trial both the equations and GeoCalc, some of the instruments that I'm currently trying to developfall into both very short ranges and the slightly longer distances.Its a matter of testing to see what can be made to work , it would be nice to be able to have multiple options for the pilot to derive and nominate a point of interest waypoint dependant on circumstances as well as having that flexability.Cheers Karol

Share this post


Link to post
Share on other sites

×
×
  • Create New...