Archived

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

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
Help AVSIM continue to serve you!
Please donate today!

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

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

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

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! :(

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

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

What entry in the .air do you think might be affecting this?

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
May be more can be done if your wishes are a little bit more clear.Unfamiliar with the Tornado AP and systems.Jan

Share this post


Link to post
Share on other sites

Hi guys,They say a picture equals a thousand words, so lets give it a go.On this occasion when I select THROT it engages at 350 knotsI can increase the KCAS in increments of 1to a maximum increase of 30 knotsor I can decrease the KCAS in increments of 1to a maximum decrease of 30 knotsThe range of the autothrottle system on a tornado is 150kts - 0 + 30 to 500kts + 0 - 30Below 150 it will not engageAbove 500 it will not engage.I hope this gives a better understanding of the systemCheersGR4Jockey

Share this post


Link to post
Share on other sites

Hi,No way to test it yet, but try:push TROTH

<Click> (L:AP_IAS_DATUM_ADJUST,bool) ! if{ (A:AIRSPEED INDICATED,knots) 150 > (A:AIRSPEED INDICATED,knots) 500 < and if{  1 (>L:AP_IAS_DATUM_ADJUST,bool)  (A:AIRSPEED INDICATED,knots) 10 / near 10 * d (>L:AP_AIS_HOLD_VAR,number) (>L:AP BASE SPEED,number)  } } els{  0 (>L:AP_IAS_DATUM_ADJUST,bool)  (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET)  }  </Click>

Speed -/+

<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) 180 > if{ (L:AP_AIS_HOLD_VAR,number) 1 - (L:AP BASE SPEED,number) 30 - max (>L:AP_AIS_HOLD_VAR,number) (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET) } els{ (L:AP_AIS_HOLD_VAR,number) 1 - 150 max (>L:AP_AIS_HOLD_VAR,number) (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET) } } } (M:Event) 'RightSingle' scmp 0 == if{ (L:AP_IAS_DATUM_ADJUST,bool) if{ (L:AP_AIS_HOLD_VAR,number) 470 < if{ (L:AP_AIS_HOLD_VAR,number) 1 + (L:AP BASE SPEED,number) 30 + min (>L:AP_AIS_HOLD_VAR,number) (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET) } els{ (L:AP_AIS_HOLD_VAR,number) 1 + 500 min (>L:AP_AIS_HOLD_VAR,number) (L:AP_AIS_HOLD_VAR,number) (>K:AP_SPD_VAR_SET) } } } </Click>

Seems to work.....Jan

Share this post


Link to post
Share on other sites