September 3, 201213 yr Moderator Move the call for @REQGSAP to the mouse event you use to select the waypoint. That way it will only be called at that point once the mouse button is "clicked." Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
September 3, 201213 yr Author Bill, Thanks for your quick answer. I've tried what you suggested and put @REQGSAP in the mouse statement. Autopilot works normal and ok but the airspeedpointer (<) does not follow the Required G/S, eg the coupling does not take place. I will try to explain what should happen via situations and hopefully you will understand what this system oughts to do followed by the code. The example will be derived from the picture shown above (#5) and involves 3 instruments eg the HUD with the airspeedpointer (<), the Data Entry Display (DED, display on the right side showing CRUS page in yellow), Integraded Control Pane (ICP, keyboard) and the autopilot (AP) which is not shown but is a standard AP. Its kind of complecated so bare with me! Situation #1: No .pln file loaded AP works normal Airspeed pointer points to value of AP (which is good) Situation #2: .pln file loaded WPT not selected, WPT number is 0 (zero) AP goes bezerk and flickers between 000 and any preset AP IAS value (AP ought to function normal like situation #1) Airspeed pointer switches up and down reflecting 000 and preset value (should point to preset AP IAS value) Situation #3: Select WPT number 19 via the numerical keyboard (integrated control panel, ICP in the middle of the screen) followed by Enter button ETA is calculated and shown in the DED (on the picture 10:54:05) (calculation takes place via @DESTOS macro in ICP xml and DED xml) AP shows maximum speed (990 IAS) and is not functioning Airspeed pointer points to AP IAS value (990 IAS) Situation #4: Input Desired Time Over Steerpoint (DES TOS value on DED, on the picture it is 10:50:00) Required Groundspeed (REQ G/S) 461 knots is calculated to meet the DES TOS time (along the flightplan, not direct) REQ G/S value is set in the AP, but AP does not hold the speed when activated Airspeed pointer points to AP IAS value (461 knots) When REQ G/S value changes (due to windchanges for instance) AP value follows changed REQ G/S value CODES: ICP xml (keyboard) (snippets) used for input WPT number and DES TOS time: <Macro Name="DESTOS"> (L:ComGoldSetValue, number) s1 s0 24 <= if{ l0 100 * sp1 } 1000000 9999999 l0 rng if{ l0 10 * sp1 } l1 1000000 % 10000 / int 3600 * 1000000 9999999 l0 rng if{ l0 10 * sp1 } l1 10000 % 100 / int 60 * + 1000000 9999999 l0 rng if{ l0 10 * sp1 } l1 100 % 1 / + (>L:DES-TOS,seconds) </Macro> <Macro Name="STEERPOINT"> (L:ComGoldSetValue, number) (>L:STEERPOINT, number) 0 (>L:ComGoldSetValue, number) 2(>L:ICP-SEQ2, enum) </Macro> <!-- ENTER Key --> <Area Left="176" Right="206" Top="95" Bottom="125"> <Tooltip>ENTER</Tooltip> <Cursor Type="Hand"/> <Click> (L:ICP-MODE,enum) 8 == (L:ICP-SEQ2,enum) 1 == if{ (L:ComGoldSetValue, number) 0 < (L:ComGoldSetValue, number) 99 > || @STEERPOINT} 2 (>L:ICP-SEQ2, enum) (L:ICP-MODE,enum) 8 == (L:ICP-SEQ2,enum) 2 == if{ (L:ComGoldSetValue, number) 0 < (L:ComGoldSetValue, number) 240000 > || @DESTOS} 0 (>L:ICP-SEQ2, enum) </Click> </Area> HUD xml snippets which are used for airspeedtape and airspeed pointer: <Macro Name="RNGTOTGT">((A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS FLIGHT PLAN WP Count,number) 1 - (L:STEERPOINT,number) (>C:fs9gps:FlightPlanWaypointIndex) (C:fs9gps:FlightPlanWaypointRemainingTotalDistance, nmiles))</Macro> <Macro Name="DESTOSSECONDS">(L:DES-TOS,seconds) (P:ZULU TIME, seconds) -</Macro> <Macro Name="ACTTOT">@RNGTOTGT @DESTOSSECONDS / 3600 *</Macro> <Macro Name="REQGS">(A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS FLIGHT PLAN WP Count,number) 1 - (L:STEERPOINT,number) (C:fs9gps:FlightPlanWaypointRemainingTotalDistance, nmiles) @DESTOSSECONDS / 3600 * </Macro> <Macro Name="REQGSAP">(A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS FLIGHT PLAN WP Count,number) 1 - (L:STEERPOINT,number) (C:fs9gps:FlightPlanWaypointRemainingTotalDistance, nmiles) @DESTOSSECONDS / 3600 * (>K:AP_SPD_VAR_SET) </Macro> //-----************************* AIRSPEED SCALE / LEFT DATA BLOCKS (SHIFTING) ******************************************** <!-- ########################################### AIRSPEED ############################################# --> <Element> <Shift> <Value Maximum="16" Minimum="5.5">(A:Circuit general panel on, bool) (A:GEAR HANDLE POSITION,bool) && if{ @DEVY } els{ 6.92 }</Value> <Scale Y="43.00"/> </Shift> <Element> <Visible>(A:Circuit general panel on, bool)</Visible> <Position X="0" Y="-300"/> <MaskImage Name="Airspeed_back_mask_white-6.bmp" ImageSizes="280,628"> <Axis X="127" Y="1157"/> </MaskImage> <Image Name="Airspeed_Tape_white.bmp" Bright="Yes" ImageSizes="63,765"> <Nonlinearity> <Item Value="1305" X="0" Y="1110"/> <Item Value="0" X="0" Y="2235"/> </Nonlinearity> </Image> <Shift> <Value Maximum="1305" Minimum="0"> (A:GROUND VELOCITY,knots) (A:AIRSPEED TRUE,knots) 40 < if{ 0 } els{ (A:AIRSPEED TRUE,knots) 43 max } (A:AIRSPEED INDICATED,knots) 40 < if{ 0 } els{ (A:AIRSPEED INDICATED,knots) 43 max } 3 (L:HUD-SPD,enum) case </Value> </Shift> </Element> <Element> <Position X="0" Y="-298"/> <Image Name="Airspeed_back_mask_white-1.bmp" Bright="Yes" ImageSizes="183,55"/> </Element> <Element> <Position X="190" Y="2"/> <Image Name="Vertical_speed_pointer_white-2.bmp" Bright="Yes"> </Image> <Shift> <Value Minimum="-71" Maximum="80">(A:GROUND VELOCITY,knots) (A:Autopilot airspeed hold var, knots) -</Value> <Scale Y="0.80"/> </Shift> </Element> <Element> <Position X="170" Y="12"/> <Text Bright="Yes" X="60" Y="18" Length="5" Font="arial" Color="#FFFFFF" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No"> <String>% %(@REQGSAP)%</String> </Text> </Element> DED xml snippets (input data in DED and display calculated values) <!-- TOS --> <Element> <Visible>(L:ICP-CRUS,enum) 1 ==</Visible> <!-- TEXT --> <Element> <Position X="17" Y="15"/> <Text X="90" Y="20" Bright="Yes" Length="4" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="right" VerticalAdjust="center"> <String>%TIME%!s!</String> </Text> </Element> <Element> <Position X="17" Y="31"/> <Text X="90" Y="20" Bright="Yes" Length="7" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="right" VerticalAdjust="center"> <String>%DES TOS%!s!</String> </Text> </Element> <Element> <Position X="17" Y="47"/> <Text X="90" Y="20" Bright="Yes" Length="3" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="right" VerticalAdjust="center"> <String>%ETA%!s!</String> </Text> </Element> <Element> <Position X="17" Y="63"/> <Text X="90" Y="20" Bright="Yes" Length="7" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="right" VerticalAdjust="center"> <String>%REQ G/S%!s!</String> </Text> </Element> <!-- VALUES --> <!-- SYSTEM --> <!-- STPTNUMBER SCRATCH --> <Element> <Visible>(L:ICP-SEQ2,enum) 1 == (L:ComGoldSetValue, number) 0 != &&</Visible> <Position X="82" Y="-1"/> <Text X="130" Y="20" Bright="Yes" Length="4" Font="arial black" Bold="Yes" Color="greenyellow" Adjust="right" VerticalAdjust="center"> <String>%((L:ComGoldSetValue, number) (A:GPS FLIGHT PLAN WP Count,number) 1 - >))%{if}%ERR%{else}%((L:ComGoldSetValue, number))%!02d!</String> </Text> </Element> <!-- STPTNUMBER --> <Element> <Visible>(L:ICP-SEQ2,enum) 1 == (L:ComGoldSetValue, number) 0 != && !</Visible> <Position X="82" Y="-1"/> <Text X="130" Y="20" Bright="Yes" Length="4" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="right" VerticalAdjust="center"> <String>%((L:STEERPOINT,number))%!2d!</String> </Text> </Element> <!-- DES-TOS SCRATCH --> <Element> <Visible>(L:ICP-SEQ2,enum) 2 == (L:ComGoldSetValue, number) 0 != &&</Visible> <Position X="60" Y="32"/> <Text X="130" Y="20" Bright="Yes" Length="7" Font="arial black" Bold="Yes" Color="greenyellow" Adjust="right" VerticalAdjust="center"> <String>%((L:ComGoldSetValue, number) 240000 >)%{if}%ERR%{else}%((L:ComGoldSetValue, number))%!6d!</String> </Text> </Element> <!-- DES-TOS DESIGNATED Time Over Steerpoint--> <Element> <Visible>(L:ICP-SEQ2,enum) 2 == (L:ComGoldSetValue, number) 0 != && !</Visible> <Position X="63" Y="31"/> <Text X="130" Y="20" Bright="Yes" Length="15" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="right" VerticalAdjust="center"> <String>%((L:DES-TOS, seconds) + flr 3600 / flr 24 %)%!02d!%:%((L:DES-TOS, seconds) flr 60 / flr 60 %)%!02d!%:%((L:DES-TOS, seconds) flr 60 %)%!02d!%</String> </Text> </Element> <Element> <Position X="120" Y="15"/> <Text X="110" Y="20" Bright="Yes" Length="8" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="left" VerticalAdjust="center"> <String>%((E:ZULU TIME,hours) flr 24 %)%!02d!%:%((E:ZULU TIME,minutes) flr 60 %)%!02d!%:%((E:ZULU TIME,seconds) flr 60 %)%!02d!</String> </Text> </Element> <!-- ETA --> <Element> <Visible>(A:Circuit general panel on, bool)</Visible> <Position X="120" Y="47"/> <Text X="110" Y="20" Bright="Yes" Length="8" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="left" VerticalAdjust="center"> <String>%((A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS FLIGHT PLAN WP Count,number) 1 - (L:STEERPOINT,number) (>C:fs9gps:FlightPlanWaypointIndex) (C:fs9gps:FlightPlanWaypointETA) (P:TIME ZONE OFFSET,seconds) + flr 3600 / flr 24 %)%!02d!%:%((C:fs9gps:FlightPlanWaypointETA) flr 60 / flr 60 %)%!02d!%:%((C:fs9gps:FlightPlanWaypointETA) flr 60 %)%!02d!%{else}%(@ETATAC flr 3600 / flr)%!02d!%:%(@ETATAC flr 60 / flr 60 %)%!02d!%:%(@ETATAC flr 60 %)%!02d!</String> </Text> </Element> <!-- REQ G/S --> <Element> <Position X="120" Y="63"/> <Text X="110" Y="20" Bright="Yes" Length="10" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="left" VerticalAdjust="center"> <String>%((A:GPS IS ACTIVE WAY POINT, bool))%{if}%((A:GPS FLIGHT PLAN WP Count,number) 1 - (L:STEERPOINT,number) (C:fs9gps:FlightPlanWaypointRemainingTotalDistance, nmiles) @DESTOSSECONDS / 3600 *)%!5d!</String> </Text> </Element> </Element> <!-- END of TOS --> This is the compleet xml's concerning airspeedtape, airspeedpointer, input via keyboard and input/display in DED for Desired Time Over Steerpoint along the flightplan and not direct-to. The only thing i want is that the AP works as is should and still have the possibillity to reflect the Required G/S when a DES TOS time is entered. I hope you understand what i want to achieve with this complex instrument. Thanks in advance. Slammer
September 3, 201213 yr OK So you have a distance and a required time and this gives the needed speed. Say 100 nm in 10 minutes is 600 Kts. Put this value in an L:Var, say (>L:req speed,number) In the speedtape the pointer should move with: <Value>(A:Airspeed select indicated or true,knots) (L:req speed,number) - </Value> (same nonlinearity tables) Du moment you select "Your mode" the autopilot can follow (L:req speed,number) with: (L:desired mode,enum) yours == if{ (A:Autopilot airspeed hold var,knots) (L:req speed,number) != if{ (L:req speed,number) (>K:AP_SPD_VAR_SET) } els{ 0 } Tested this in my hud and it works. Hope it helps, Jan "Beatus ille qui procul negotiis..."
September 4, 201213 yr Moderator Jan has the general approach to take. The key is that you must only issue the (>K:event) whenever it is required because of a change from the previous state. You can have your existing @Macro calculate all the time without encountering any problems, but change the final bit to simply update a custom L:variable instead. Personally though, I'd put the entire @Macro calculation in an <Update> section, then add a timer to allow the (re)calculation to be done less frequently for performance purposes. All @Macros should of course be placed above the <Update> section: <Macro Name="DESTOSSECONDS">(L:DES-TOS,seconds) (P:ZULU TIME, seconds) -</Macro> <Update Hidden="Yes"> <!-- 1 SECOND UPDATE --> (P:Absolute time,seconds) 1 % 0.5 > ! if{ (A:GPS IS ACTIVE WAY POINT, bool) if{ (A:GPS FLIGHT PLAN WP Count,number) 1 - (L:STEERPOINT,number) (C:fs9gps:FlightPlanWaypointRemainingTotalDistance, nmiles) @DESTOSSECONDS / 3600 * (>L:RequiredSpeed,enum) } (A:Autopilot airspeed hold var,knots) (L:RequiredSpeed,enum) != if{ (L:RequiredSpeed,enum) (>K:AP_SPD_VAR_SET) } } </Update> Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
September 5, 201213 yr Author Jan and Bill, Finally it works! Super thanks for all your help and insights. A happy Slammer! :biggrin: :biggrin: Final code: //-----************************* AIRSPEED SCALE / LEFT DATA BLOCKS (SHIFTING) ******************************************** <!-- ########################################### AIRSPEED ############################################# --> <Element> <Shift> <Value Maximum="16" Minimum="5.5">(A:Circuit general panel on, bool) (A:GEAR HANDLE POSITION,bool) && if{ @DEVY } els{ 6.92 }</Value> <Scale Y="43.00"/> </Shift> <Element> <Visible>(A:Circuit general panel on, bool)</Visible> <Position X="0" Y="-300"/> <MaskImage Name="Airspeed_back_mask_white-6.bmp" ImageSizes="280,628"> <Axis X="127" Y="1157"/> </MaskImage> <Image Name="Airspeed_Tape_white.bmp" Bright="Yes" ImageSizes="63,765"> <Nonlinearity> <Item Value="1305" X="0" Y="1110"/> <Item Value="0" X="0" Y="2235"/> </Nonlinearity> </Image> <Shift> <Value Maximum="1305" Minimum="0"> (A:GROUND VELOCITY,knots) (A:AIRSPEED TRUE,knots) 40 < if{ 0 } els{ (A:AIRSPEED TRUE,knots) 43 max } (A:AIRSPEED INDICATED,knots) 40 < if{ 0 } els{ (A:AIRSPEED INDICATED,knots) 43 max } 3 (L:HUD-SPD,enum) case </Value> </Shift> </Element> <Element> <Position X="0" Y="-298"/> <Image Name="Airspeed_back_mask_white-1.bmp" Bright="Yes" ImageSizes="183,55"/> </Element> <Element> <Visible>(L:req speed,number) 1 ></Visible> <Position X="175" Y="2"/> <Image Name="Vertical_speed_pointer_white-2.bmp" Bright="Yes"> </Image> <Shift> <Value Minimum="-90" Maximum="80">(A:GROUND VELOCITY,knots) (L:req speed,number) - </Value> <Scale Y="0.80"/> </Shift> </Element> <Element> <Position X="170" Y="12"/> <Text Bright="Yes" X="60" Y="18" Length="5" Font="arial" Color="#FFFFFF" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No"> <String>%(@REQGSAP 0 < if{ (A:Autopilot airspeed hold var,knots) (L:req speed,number) != if{ (L:req speed,number) (>K:AP_SPD_VAR_SET) } els{ 0 }) %</String> </Text> </Element>
Create an account or sign in to comment