Jump to content
Sign in to follow this  
GR4Jockey

Autopilot, AP_SPD_VAR_INC limit

Recommended Posts

Hi all,I am currently creating an autopilot for the Panavia Tornado. with the real aircraft when you select THROT the datum is set as the IAS at the point of selecting. You can then increase / decrease the IAS by 30 knots. This is where i am stuck hoe can this be achieved.Image of my AutopilotDisplay Code for IAS (KCAS)

[code//------------------- KCAS Display<Element> <Position X="600" Y="65"/> <Text X="150" Y="100" Length="3" Font="LCD" FontHeight="34" FontWeight="700" Color="#FF0000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Luminous="1"> <String>%((>L:AP_AIS_HOLD_VAR, knots) (A:Autopilot airspeed hold var, knots))%!03d!%{end}</String> </Text> </Element>][/code] Code to increment the Datum IAS
//------------------- IAS Datum Increase  <Area Left="139" Right="383" Top="54" Bottom="89">           <Cursor Type="Hand"/>           <Click Kind="LeftSingle+Leave">                (M:Event) 'LeftSingle' scmp 0 ==                               if{ 1 (>L:AP_IAS_DATUM_ADJUST,bool) (>K:AP_SPD_VAR_INC) }               (M:Event) 'Leave' scmp 0 ==                              if{ 0 (>L:AP_IAS_DATUM_ADJUST,bool)           </Click>   </Area>//------------------- IAS Datum Decrease  <Area Left="139" Right="383" Top="89" Bottom="124">           <Cursor Type="Hand"/>           <Click Kind="LeftSingle+Leave">                (M:Event) 'LeftSingle' scmp 0 ==                               if{ 2 (>L:AP_IAS_DATUM_ADJUST,bool) (>K:AP_SPD_VAR_DEC) }                  (M:Event) 'Leave' scmp 0 ==                                if{ 0 (>L:AP_IAS_DATUM_ADJUST,bool)            </Click>   </Area>

So I want to limit AP_SPD_VAR_INC to IAS Datum +30 and AP_SPD_VAR_DEC to IAS Datum -30. From the image above, that would be 400 +/- 30Can anyone help.Thanks in advanceGR4Jockey

Share this post


Link to post
Share on other sites

Why not calculate the new value, and use K:AP_SPD_VAR_SET to set it?

Share this post


Link to post
Share on other sites

What I want to achieve is to be able to increase or decrease by 30 knots max in increments of 1 knot, is there a way of restricting AP_SPD_VAR_INC and AP_SPD_VAR_DEC to achieve this.CheersGR4Jockey

Share this post


Link to post
Share on other sites

DARNIT - THE FORUM SCREWED UP MY WHOLE POST & I HAVE TO RUN,, SAVED TO A TXT FILE, WILL EDIT AND RETURN LATER - SORRY.OK all fixed,,,GR.4,Yes, as TGibson said, use K:AP_SPD_VAR_SET instead of AP_SPD_VAR_INC or DEC. For instance, at the time THROT is pushed store the current airspeed.

<Click>(A:AIRSPEED INDICATED, knots) (>L:AP_AIS_HOLD_VAR, number)</Click><!-- MAYBE EVEN BETTER, ROUND TO THE NEAREST TEN(S) OF KNOT --><Click>(A:AIRSPEED INDICATED, knots) 10 / near 10 *(>L:AP_AIS_HOLD_VAR, number)</Click>

Now that you have speed at the time of THROT being pushed you can do some math. Whether or knot Just%20Kidding.gif you want the KCAS display to be updated with the new speed reference is up to you.. ( A later deal ) Time to inc/dec some speed.

//------------------- IAS Datum Increase  <Area Left="139" Right="383" Top="54" Bottom="89">     		<Cursor Type="Hand"/>     		<Click Kind="LeftSingle+Leave">                  (M:Event) 'LeftSingle' scmp 0 ==                                 if{ 1 (>L:AP_IAS_DATUM_ADJUST,bool) (L:AP_AIS_HOLD_VAR, number) 30 + s1 (>K:AP_SPD_VAR_SET) l1 (>L:AP_AIS_HOLD_VAR, number) }                 (M:Event) 'Leave' scmp 0 ==                                 if{ 0 (>L:AP_IAS_DATUM_ADJUST,bool) }              </Click>      </Area>      //------------------- IAS Datum Decrease        <Area Left="139" Right="383" Top="89" Bottom="124">              <Cursor Type="Hand"/>              <Click Kind="LeftSingle+Leave">   				(M:Event) 'LeftSingle' scmp 0 ==          						if{ 2 (>L:AP_IAS_DATUM_ADJUST,bool) (L:AP_AIS_HOLD_VAR, number) 30 - s1 (>K:AP_SPD_VAR_SET) l1 (>L:AP_AIS_HOLD_VAR, number) }     				(M:Event) 'Leave' scmp 0 ==                                   if{ 0 (>L:AP_IAS_DATUM_ADJUST,bool) }   			</Click>      </Area>      

Knot Just%20Kidding.gif sure what you're trying to do here..

  //------------------- KCAS Display<String>%((>L:AP_AIS_HOLD_VAR, knots) (A:Autopilot airspeed hold var, knots))%!03d!%{end}</String><!-- IT SHOULD BE SOMETHING LIKE THIS --><String>%((>L:AP_AIS_HOLD_VAR, knots))%!03d!%{end}</String><!-- OR THIS --> <String>%((A:Autopilot airspeed hold var, knots))%!03d!%{end}</String> 

In your original code you have both variables listed but are not evaluating them in any way, so, (A:Autopilot airspeed hold var, knots) will always be displayed. ????Hope this helps, not tested, so mileage may vary, watch out for spaces etc, because of the edit...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

You should have the answer now, but to answer your second question, there is no way to adjust the amount that the INC or DEC Event ID's change things by.

Share this post


Link to post
Share on other sites

Hi GuysThanks for your response, the code works however it inc / dec by 30 knots at a time instead of 1 knot at a time to a maximum of 30 knots from the IAS Datum.RegardsGR4Jockey

Share this post


Link to post
Share on other sites

Ahh, OK, kinda get what you're trying to achieve. ( Missed post #3 ) This assumes that the reference datum stays the same until the THROT button is cycled again - correct? & if so does the KCAS display shows the reference only?

//------------------- IAS Datum Increase  <Area Left="139" Right="383" Top="54" Bottom="89">                  <Cursor Type="Hand"/>                  <Click Kind="LeftSingle+Leave">                  (M:Event) 'LeftSingle' scmp 0 ==                                 if{ 1 (>L:AP_IAS_DATUM_ADJUST,bool) (L:AP_AIS_HOLD_VAR, number) 1 + (>L:AP_AIS_HOLD_VAR, number) 30 + min (>K:AP_SPD_VAR_SET) }                 (M:Event) 'Leave' scmp 0 ==                                 if{ 0 (>L:AP_IAS_DATUM_ADJUST,bool) }              </Click>      </Area>      //------------------- IAS Datum Decrease        <Area Left="139" Right="383" Top="89" Bottom="124">              <Cursor Type="Hand"/>              <Click Kind="LeftSingle+Leave">                                  (M:Event) 'LeftSingle' scmp 0 ==                                                   if{ 2 (>L:AP_IAS_DATUM_ADJUST,bool) (L:AP_AIS_HOLD_VAR, number) 1 - (>L:AP_AIS_HOLD_VAR, number) 30 - max (>K:AP_SPD_VAR_SET) }                                  (M:Event) 'Leave' scmp 0 ==                                   if{ 0 (>L:AP_IAS_DATUM_ADJUST,bool) }                          </Click>      </Area>

Hope this helps, again watch spacing. ( sometimes the forum doesn't keep correct spacing from copy/paste.)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

Hi Spokes2112,The IAS Datum is at the point of selecting THOT, inc and dec changes the datum by +/- 30 knots and the KCAS shows the new IAS Datum. If you deselect and select THROT again, it starts from the new IAS datum, to a maximum of 500 knots.The idea is that if the flight requires an IAS of 400 knots as you are approaching that airspeed you select THROT and the INC / DEC alows you to make minor adjustment to arrive at the correct IAS of 400 knots. hope this helpsCheersGR4Jockey

Share this post


Link to post
Share on other sites

Hi Spokes2112,tested your new code, when i reached 400kts I selected THROT, the KCAS showed 400kts, when selecting INC the KCAS increases to 401 and will not increase further, when selecting DEC the KCAS immediately goes to 399 and will not decrease further. This seems to work as Datum +/- 1.CheersGR4Jockey

Share this post


Link to post
Share on other sites

Hi, Not tested, but try something like:

Pressing THOT:<Click>(L:AP_IAS_DATUM_ADJUST,bool) ! if{ 1 (>L:AP_IAS_DATUM_ADJUST,bool) (A:AIRSPEED INDICATED,knots) 10 / near 10 * (>L:AP_AIS_HOLD_VAR,number) } els{ 0 (>L:AP_IAS_DATUM_ADJUST,bool) (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET) } </Click>Inc and Dec in one button:<Click Kind="LeftSingle+RightSingle" Repeat="Yes">(M:Event) 'LeftSingle' scmp 0 == if{ (L:AP_IAS_DATUM_ADJUST,bool) if{ (L:AP_AIS_HOLD_VAR,number) 1 - -30 max (>L:AP_AIS_HOLD_VAR,number) (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET)  } els{  if you want to use speed decr. here: (>K:AP_SPD_VAR_DEC)  } } (M:Event) 'RightSingle' scmp 0 == if{ (L:AP_IAS_DATUM_ADJUST,bool) if{ (L:AP_AIS_HOLD_VAR,number) 1 + 30 min (>L:AP_AIS_HOLD_VAR,number) (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET) } els{  if you want to use speed incr. here: (>K:AP_SPD_VAR_INC)  } } </Click> 

Hope it helps,Jan

Share this post


Link to post
Share on other sites

In both mouse callbacks, the > symbol is missing:(L:AP_AIS_HOLD_VAR, number) 1 + (>L:AP_AIS_HOLD_VAR, number)(L:AP_AIS_HOLD_VAR, number) 1 - (>L:AP_AIS_HOLD_VAR, number)I call the > symbol the "stuff-it" command, because what it essentialy does is "stuff" the newly calculated value back into the variable, in other words it updates the contents of the variable. :(


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Fr. Bill,Don't understand why the > vanishes and the text becomes green....Jan

Share this post


Link to post
Share on other sites
Fr. Bill,Don't understand why the > vanishes and the text becomes green....Jan
Oh, my reply was directed towards the example Roman gave earlier. This forum software does do some odd "coloring" on XML script though, that's a fact! :(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Good call FR. Bil - missed that completely, Whistle.gif all fixed @ post #7.

Plus all > are now >. 

The question remains,, does the code work under 400 knots? ( IE 250 ) If so, then the .air file is coming into play at/around 400 knots. Math=MathDarn XMLRoman


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

 

Share this post


Link to post
Share on other sites

Thanks guys for your help, but this seems impossible to achieve, phjvh has got the closest but still not how it should be.Once again thanks, i think i will give up on this one. need to look at terrain following.CheersGR4Jockey

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...