1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Elevator Trim/Elevator Trim Indicator Problem

Discussion in 'Gauges' started by jimi08, 14/3/12.

  1. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    I searched the forums for a bit looking for an answer to this problem with no luck. Hopefully someone here can help me out...

    I am currently working on a gauge that will allow the pilot to trim his/her aircraft to a desired AOA while the aircraft is in Powered Approach Mode. By using the elevator trim up and elevator trim down functions, the pilot actually sets the indicated AOA that he/she wants the aircraft to maintain during approach, and the aircraft's flight control system actually controls the elevator trim to maintain indicated AOA.

    The problem I am running into is that I can't seem to find a way to disconnect the elevator movement from what's indicated in the jet. I need the elevator trim indicator value to remain at what the pilot has set and not display the actual, real-time position of the trim.

    XML coding would be something similar to this:

    (A:AIRSPEED TRUE,knots) 250 <
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 40 > &&
    (A:GEAR CENTER POSITION,Percent) 30 > &&
    if{ (A:ELEVATOR TRIM POSITION, degrees) (A:INCIDENCE ALPHA,Degrees) / } (>L:AOA Selector, number) } els{ }

    (L:AOA Selector, number) 1 >
    (A:GEAR CENTER POSITION,Percent) 30 > &&
    (A:INCIDENCE ALPHA,Degrees) 22 < &&
    (A:AIRSPEED TRUE,knots) 250 < &&
    (A:SIM ON GROUND, bool) ! &&
    (A:AUTOPILOT MASTER, bool) ! &&
    if{ (>K:ELEV_TRIM_UP) } els{ }

    (L:AOA Selector, number) 1 <
    (A:GEAR CENTER POSITION,Percent) 30 > &&
    (A:INCIDENCE ALPHA,Degrees) 22 < &&
    (A:AIRSPEED TRUE,knots) 250 < &&
    (A:SIM ON GROUND, bool) ! &&
    (A:AUTOPILOT MASTER, bool) ! &&
    if{ (>K:ELEV_TRIM_DN) } els{ }

    The coding above assumes that the "ELEVATOR TRIM POSITION" would be the reinterpreted as the dialed or assigned AOA by the pilot (this number doesn't change unless done so by the pilot). From there, it gets compared to the actual (real-time) AOA of the aircraft. By dividing the Assigned AOA by the Actual AOA, you get a numerical value that is either greater than one (1) or less that one (1). This, in turn, determines whether the Flight Control System (FCS) should provide nose up trim or nose down trim in an attempt to keep the ratio 1/1.

    As of now, I can dial in the AOA that I want the FCS to maintain, but as soon as it is dialed in, the FCS changes the elevator trim state as defined in the XML coding, thereby changing the indicated value, at this point the trim is like "a dog chasing its tail".

    I hope I have explained my issue with sufficient details so that someone may be able to help. Thanks again.
  2. tgibson

    tgibson

    Joined:
    22/9/06
    Messages:
    4,420
    Country:
    us-california
    Your trim indicator will need to use a custom L: variable for its display, not the real trim indicator variable. When the pilot changes his trim, he should be altering the value of the L: variable, not the real trim variable.

    Hope this helps,
  3. Roy Holmes

    Roy Holmes Resource contributor

    Joined:
    20/2/11
    Messages:
    815
    Country:
    us-virginia
    AOA in steady flight is a function of airspeed interacting with the lift coefficient, wing area and aircraft weight. If you could set an AOA you would only have steady flight if the airspeed happened to be correct.

    If you wanted to have a flight control system that caused the aircraft to fly at constant AOA you would have to include a feedback that controlled the airspeed appropriately.

    Another way would be to set autothrottle to the correct speed for the desired AOA. The speed can be calculated as some base airspeed plus so many knots per pound of fuel. If you have performance data for the aircraft you can easily come up with the numbers. If not, you need to do a series of tests of AOA versus IAS in the landing configuration and do it at different weights. From the results you can do a linear interpolation and derive the base speed plus the knots per pound.

    For example, an A-7D will fly at the corrrect AOA on the approach if the IAS is 119 knots plus 1.3 knots per 1000 lbs of fuel, assuming no retained bombs or other heavy items.

    To sum up, when on a steady 1 g flight path. you can not adjust AOA, you can only adjust the airspeed that gives you the AOA you want.

    Roy
  4. tgibson

    tgibson

    Joined:
    22/9/06
    Messages:
    4,420
    Country:
    us-california
    I would think that setting the AOA and maintaining that would change your airspeed? I.e. set more up trim and you will go slower. I am assuming no autothrottle/autospeed here.

    An example: let's say I was in level attitude and level flight. I then reset my AOA to 1 degree up. The trim system would set more up trim until my nose was pointed 1 degree up. I would start to climb until my speed slowed to the point that I was in equilibrium with that power setting. Whether I was level, climbing, or descending would depend on my throttle setting.

    Is this not correct?
  5. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Thanks for the quick reply gents.

    Most of my work is on the F/A-18. During carrier landings, maintaining the proper AOA (8.1 degrees in the F/A-18) is more important than a certain airspeed. This past weekend at Miramar, I had the fortune to sit and fly in an actual F/A-18 simulator used by the Marine Corps to train its aviators. While shooting a couple of approaches, I noticed that it was the AOA that the flight control system trimmed to. If you added a little bit of nose up trim, the AOA that you were trimming to would briefly display itself on the HUD. The opposite would happen with nose down trim. So as you rolled in on approach, you would trim up/down to 8.1 on the display and the jet would use pitch to maintain that AOA for you. If you pulled power, the FCS would start trimming the nose down in an effort to reestablish you on the set AOA, if you added power, the nose would rise. The end-state is that once the pilot has dialed in the correct AOA, the jet will automatically maintain it for him. The pilot mainly uses power to maintain proper glideslope, but doesn't have to provide manual pitch input to maintain proper AOA while making those power adjustments. Very little push/pull was needed during these approaches.

    -Break-

    As for making an L Var to separate the indicator and the actual trim position.... I've tried a few things with no luck. I'm still a little new at the whole XML gauge thing. A little help please :)

    Thanks again!
  6. Roy Holmes

    Roy Holmes Resource contributor

    Joined:
    20/2/11
    Messages:
    815
    Country:
    us-virginia
    Tom,
    There is a lot of interaction here. However, AOA is an A:var. Ignoring simconnect, you can not set AOA.

    You can increase it by stick back pressure. If in your example you are in straight and level flight and you increase AOA, you increase lift and g force. With no other input than maintaining AOA with the stick, the airplane will pitch up and enter an increasing climb angle until it begins to slow down. At some point with constant AOA and reduced airspeed hence reduced lift you will enter a descent then speed up until you are back where you started from. You can use trim to maintain a specific AOA because trim is a substitute for stick pressure.

    However, my reading of the original post is that he wanted to be able to set AOA during a powered approach. I'm also assuming that the approach would be at a constant glide slope angle. To maintain that angle, the airplane velocity vector must be aligned with the glide slope. The velocity vector is below the airplane fuselage pitch angle by the AOA.

    Lets say the glide slope is 3 degrees and your current AOA is 5 degrees. You need a two degree nose up pitch angle to maintain the glide slope. You also have to be at a speed that provides the correct amount of lift to maintain the glide slope. If you slow down and maintain the 5 degrees AOA, you will have less lift than required and will sink below the glide slope. You could get back at the lower speed by increasing the pitch angle and AOA or you could speed up to regain the correct speed and AOA. An autothrottle set to the correct speed for the desired AOA can sort that out but the key is to know the AOA/speed relationship.

    If you have a read out of the flight parameters of an AI airplane on an approach you will see that they set the nose exactly 2 degrees up in pitch and then adjust throttle hence airspeed to give a 5 degree AOA, or thereabouts depending on how close they are to a 3 degree glide slope. This 5 degree AOA target and the lift characteristics are what determines an AI approach speed.

    My experience flying the F-4 on an approach was that you aimed the aircraft's flight path at the touchdown point with the stick and used power to adjust speed to get the desired AOA. Once the AOA was correct the glide slope was maintained by minor stick movements and compensatory throttle movements to maintain AOA until touchdown. In FS the exact same technique works for models where AOA is the prime reference for an approach.

    The point I'm making is that a specific AOA, for a given airplane weight and landing configuration is only achieved by flying at a specific airspeed.

    Roy
  7. Roy Holmes

    Roy Holmes Resource contributor

    Joined:
    20/2/11
    Messages:
    815
    Country:
    us-virginia
    Jimi,
    The F-18 is a bit too new for me to know its systems, but I would hazard a guess that in approach/landingmode, the trim switch has a different function than in normal flight. I have flown the F-18 simulator, but only briefly at an air show.

    The main advantage of using AOA as a primary reference is that it sets you up for the best approach without regard to aircraft weight, configuration or speed. Your stall margin is correct at the correct AOA and that is all you need for a safe approach. No need to look at airspeed, just maintain AOA and glideslope.

    As you said, if you set 8.1 as the desired AOA the F-18 system will adjust pitch to maintain 8.1. If you are slow you will lose height so by increasing power you can gain height. To be on the correct glide slope you need to be at a speed where 8.1 AOA points the airplane at the touchdown point. However the system lets you do this without checking speed.

    I could do the same with the F-4 by using the stick to maintain AOA and using power to keep on the glide slope. The F-18 FCS takes over the stick function, but the power adjustments are the same. The net effect is the same, you approach at the correct speed, which is all-important for carrier landings.

    You could achieve the the desired effect with a standard FS autopilot, but you would have to dial in the corrrect airspeed. If you wanted to dial in AOA and have an autopilot that did what the F-18 one does, you are entering a whole new game.

    It is perfectly possible to have code that measures the error between the desired and actual AOA and moves the stick accordingly using PID algorithms. In principle it would be somewhat similar to an autopilot I coded for helos where the throttle/collective position is controlled to maintain altitude with respect to a desired altitude. Speed control is maintained by stick/cyclic adjustment including hovering according to a desired speed. This AP can hold height at 8 feet above the surface and at 135 kts or hover at any altitude. For your application you would have to swap the functions so that AOA control would be done by stick adjustments and height or glideslope deviation would be done with throttle adjustments. Bit complex, perfectly doable, but a lot of work.

    Jets that do not have AOA as a primary reference are flown using the stick for altitude control and the throttle for speed control. It is a lot easier and more accurate if you have an AOA display in view and much better if all you have to fly by is the glideslope.

    Roy
  8. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    I think I've figured out the math. Just divide the desired AOA value with the actual AOA value. If the result is greater than 1 implement nose up trim to correct, if it's less that 1, implement nose down trim. The main problem I am having is getting the desired AOA to stay as set by using the trim keys to set. As soon as the FCS system that I've coded moves the trim, that initial value now gets changed to the actual trim state and now the logic starts chasing after that as it's new desired AOA, and the process keeps looping.

    I just need to find a way to allow for the trim indicator to ignore what the actual trim is doing...
  9. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,312
    Country:
    unitedstates
    Use a custom L:var for your desired AoA, then compare that with actual AoA.

    This way your target value remains constant...

    (L:TargetAoA,enum)

    BTW, you will want to use (A:INCIDENCE ALPHA,degrees) for the actual AoA

    For the Milviz T-38A I worked on, I had to interpolate (A:INCIDENCE ALPHA,degrees) to scale into the "unit system" this a/c uses: 0 to 1.2 "units"...

    The optimum landing attitude for the "green doughnut" is 0.6 "units" (~8ยบ AoA) for the T-38A/C.
  10. tgibson

    tgibson

    Joined:
    22/9/06
    Messages:
    4,420
    Country:
    us-california
    Bill (and me in my first post) is correct - you cannot use a single variable to control two different things! You must use custom L: variables to control the AOA and display the trim indication, and the normal FS variables to read/control the actual trim. Your trim indicator will use an L: variable for its display, so it won't move when your system changes the actual FS trim.

    I.e. do NOT use the FS trim variables in your trim indicator - use a custom L: variable!
  11. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Roger that. We (SLUDGE & I) are currently working on an L Var that will be displayed on the HUD indicating the AOA that the pilot has dialed in. I'm thinking it will basically by an event counter. It will start at a baseline number such as 5.0, and it will record every time the elevator trim up or elevator trim down functions (events) are activated. The code will increment 0.1 to the initial value every time the elevator trim up function is activated, and decrements 0.1 every time the elevator trim down function is activated. This way the pilot can manually select their desired AOA for the aircraft to maintain regardless of what particular buttons, keys, or axis being used. It will be that L Var that will be used as the baseline for the trim system to do its calculations and work off of.

    Does this make sense? Are we on the right track?
  12. tgibson

    tgibson

    Joined:
    22/9/06
    Messages:
    4,420
    Country:
    us-california
    I would use a "desired AOA" variable (L: Desired_AOA, number). The pilot would directly increment and decrement this L: variable using the controls on his panel (i.e. each time he clicked the knob the Desired_AOA variable is incremented/decremented by a set amount).

    As an example, when the Desired_AOA variable is set at 5.0, then the gauge system would adjust the FS up/down trim (using the FS variables) until the actual AOA (A:INCIDENCE ALPHA,degrees) was 5.0 degrees. As the speed slowed down/sped up, it would constantly adjust the trim to maintain that 5 degree AOA. If the pilot then changed the Desired_AOA variable to 4.0, the gauge system would then readjust the trim so the FS AOA variable now maintained 4 degrees.

    Hope this helps,
  13. Roy Holmes

    Roy Holmes Resource contributor

    Joined:
    20/2/11
    Messages:
    815
    Country:
    us-virginia
    Jimi,
    You got me interested! I modified code I had used for the helo autopilot I mentioned, had it adjust trim according to the AOA error and used it as a pop-up gauge for test purposes in my A-7D (current project).

    It holds the desired AOA very well and you can control altitude with small amounts of throttle inputs. I have flown several approaches using the stick only for bank alignment and the throttle for altitude control.

    I used the same Proportional Integral Derivative (PDI) algorithm with one exception. A PID algorithm zeroes the error, but since the output was trim and I did not want zero trim, I added an offset to the final output equivalent to 4.1 degrees nose up trim, which is what my A-7 needs when "on-speed" with 10.5 degrees AOA. Here is the XML code
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Gauge SYSTEM "C:\Program Files (x86)\Altova\XMLSpy2010\gauges.dtd">
    <Gauge Name="A-7D_AOA_HOLD">
    	<Image Name="AOA_HOLD.bmp"/>
    	<Element>
    		<Select>
    			<Value>(A:AIRSPEED INDICATED,knots) 180 &lt;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,degrees) 39 &gt;
    and;
    (A:GEAR CENTER POSITION,percent) 90 &gt;
    and
    (A:SIM ON GROUND,bool) 0 ==
    and
    if{ 1 (&gt;L:VALID HOLD,enum) }
    els{ 0 (&gt;L:VALID HOLD,enum) }
    </Value>
    		</Select>
    	</Element>
    	<Element>
    		<Select>
    			<Value>(L:AOA_init,bool) 0 ==
    	if{ 10.5 (&gt;L:AOA HOLD VAR,number) 1 (&gt;L:AOA_init,bool) }</Value>
    		</Select>
    	</Element>
    	<Element>
    		<Position X="15" Y="64"/>
    		<Select>
    			<Value>(L:FA Select,Bool)</Value>
    			<Case Value="0">
    				<Image Name="Light_Off.bmp"/>
    			</Case>
    		</Select>
    	</Element>
    	<Element>
    		<Position X="65" Y="64"/>
    		<Text X="80" Y="18" Bright="Yes" Length="4" Font="arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
    			<String>%((L:AOA HOLD VAR,number))%!2.1f!</String>
    		</Text>
    	</Element>
    	<Element>
    		<Position X="65" Y="133"/>
    		<Text X="80" Y="16" Bright="Yes" Length="4" Font="arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
    			<String>%((A:INCIDENCE ALPHA,degrees))%!2.1f!</String>
    		</Text>
    	</Element>
    	<Element>
    		<Position X="65" Y="155"/>
    		<Text X="80" Y="16" Bright="Yes" Length="4" Font="arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
    			<String>%((L:TRIMpidOut,Number))%!2.1f!</String>
    		</Text>
    	</Element>
    	<Element>
    		<Position X="65" Y="170"/>
    		<Text X="80" Y="16" Bright="Yes" Length="4" Font="arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
    			<String>%((L:TRIMIntegral,Number))%!2.1f!</String>
    		</Text>
    	</Element>
    	<Element>
    		<Position X="65" Y="185"/>
    		<Text X="80" Y="16" Bright="Yes" Length="4" Font="arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
    			<String>%((L:TRIMDerivative,Number))%!2.1f!</String>
    		</Text>
    	</Element>
    	<Element>
    		<Position X="70" Y="200"/>
    		<Text X="80" Y="16" Bright="Yes" Length="4" Font="arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
    			<String>%((ELEVATOR TRIM INDICATOR,number))%!d!</String>
    		</Text>
    	</Element>
    	<Element>
    		<Position X="70" Y="215"/>
    		<Text X="80" Y="16" Bright="Yes" Length="5" Font="arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
    			<String>%((A:ELEVATOR TRIM POSITION,radians) rddg )%!2.2f!</String>
    		</Text>
    	</Element>
    	<!-- =======================Disengage all modes===================== -->
    	<Element>
    		<Select>
    			<Value>(L:FA Select,Bool) (A:BRAKE PARKING POSITION, bool) &amp;&amp; 
    				if{ (L:FA Select,Bool) ! (&gt;L:FA Select,Bool) 
    					0 (&gt;L:TRIMIntegral,Number)
    					0 (&gt;L:TRIMIntegral,Number) 
    					}
    			</Value>
    		</Select>
    	</Element>
    	<!-- Overall algorithm -->
    	<!-- output  =  loop gain * ( error + (integral(error) / INT) + (derivative(error) * DIF ) ) -->
    	<!-- AOA TRIM HOLD -->
    	<!-- Load Parameters with Loop Gain, Integral Constant, Differential Constant, Time Interval (TI superflous in software?) -->
    	<Element>
    		<Element>
    			<Select>
    				<Value>150 (&gt;L:TRIMLoopGain,Number) 
    				100 (&gt;L:TRIMInt,Number) 
    				1 (&gt;L:TRIMDif,Number) 
    				1 (&gt;L:TRIMTInt,Number)
    			</Value>
    			</Select>
    		</Element>
    		<!-- Proportional -->
    		<Element>
    			<Select>
    				<Value>(A:INCIDENCE ALPHA,degrees) (L:AOA HOLD VAR,number) - 
    				(&gt;L:TRIMSetErr,Number) 
    				(L:TRIMSetErr,Number) (&gt;L:TRIMpidOut,Number)
    			</Value>
    			</Select>
    		</Element>
    		<!-- Integral -->
    		<Element>
    			<Select>
    				<Value>(L:TRIMpidOut,Number) (L:TRIMIntegral,Number) (L:TRIMTInt,Number) (L:TRIMInt,Number) / * + 
    				(&gt;L:TRIMpidOut,Number)
    			</Value>
    			</Select>
    		</Element>
    		<Element>
    			<Select>
    				<Value>(L:TRIMSetErr,Number) abs 2 &lt; 
    			if{ 
    				(L:TRIMIntegral,Number) (L:TRIMSetErr,Number) + 
    				(&gt;L:TRIMIntegral,Number) } 
    			els{ 
    				0 (&gt;L:TRIMIntegral,Number) 
    			}
    			</Value>
    			</Select>
    		</Element>
    		<!-- Derivative -->
    		<Element>
    			<Select>
    				<Value>(L:TRIMSetErr,Number) (L:TRIMDerivative,Number) - 
    				(&gt;L:TRIMChange,Number)
    			</Value>
    			</Select>
    		</Element>
    		<Element>
    			<Select>
    				<Value>(L:TRIMpidOut,Number) (L:TRIMChange,Number) (L:TRIMDif,Number) (L:TRIMTInt,Number) / * + 
    				(&gt;L:TRIMpidOut,Number)
    			</Value>
    			</Select>
    		</Element>
    		<!-- Last Error -->
    		<Element>
    			<Select>
    				<Value>(L:TRIMSetErr,Number) 
    				(&gt;L:TRIMDerivative,Number)
    			</Value>
    			</Select>
    		</Element>
    		<!-- Add loop gain -->
    		<Element>
    			<Select>
    				<Value>(L:TRIMpidOut,Number) (L:TRIMLoopGain,Number) * 
    				(&gt;L:TRIMpidOut,Number)
    			</Value>
    			</Select>
    		</Element>
    		<!-- Output windup limiting-->
    		<Element>
    			<Select>
    				<Value>(L:TRIMpidOut,Number) 3000 min -3000 max 
    				(&gt;L:TRIMpidOut,Number)
    			</Value>
    			</Select>
    		</Element>
    		<!-- Drive output -->
    		<Element>
    			<Select>
    				<Value>(L:FA Select,Bool) 0 != 
    				(L:VALID HOLD,enum) 0 !=
    				and
    				if{ 
    				(L:TRIMpidOut,Number) 4100 -
    				(&gt;K:AXIS_ELEV_TRIM_SET) 
    			}
    			</Value>
    			</Select>
    		</Element>
    	</Element>
    	<Mouse>
    		<!-- ======================= Set AOA====================== -->
    		<Area Left="15" Top="64" Width="18" Height="18">
    			<Tooltip>AOA Select %( (L:FA Select,bool) 1 ==)%{if}On%{else}Off%{end}</Tooltip>
    			<Cursor Type="Hand"/>
    			<Click>(L:FA Select,Bool) ! (&gt;L:FA Select,Bool)</Click>
    		</Area>
    		<Area Left="15" Top="44" Width="18" Height="18">
    			<Cursor Type="UpArrow"/>
    			<Click>(L:AOA HOLD VAR,number) 0.1 + (&gt;L:AOA HOLD VAR,number)</Click>
    		</Area>
    		<Area Left="15" Top="84" Width="18" Height="18">
    			<Cursor Type="DownArrow"/>
    			<Click>(L:AOA HOLD VAR,number) 0.1 - (&gt;L:AOA HOLD VAR,number)</Click>
    		</Area>
    	</Mouse>
    </Gauge>
    The initial code stipulates the conditions required for it to be valid. The desired AOA HOLD VAR is then input as an initialization routine that happens only once.

    The next bunch of code creates readouts on the test display which you can see on the right of the jpg attached. A Mouse section at the end initiates the procedure and allows adjustment below or above the initial 10.5 desired AOA, just for test purposes.

    The "Disengage all modes" section is simply there to give a panic disengage using the parking brake.

    Then you come to the meat of the code.

    First, the PID constants are loaded.

    The Proportional section compares AOA with the Set value and the result is output as the first PID output.

    The Integral section derives the second PID output and zeros the integral unless the Set error is 2 or less. This is done to limit the bounds for integral calculation.

    The Derivative section is then calculated. It is a measure of the rate of change of the solution and is the third PID output. The "Last error section" updates the derivative for use on the next pass through the algorithm.

    Loop gain is applied and limited in the next section to avoid windup.

    Finally, There is a test on whether the routine is activated and has valid conditions. If that test passes the trim position is set according to the PID output and an offset. K:AXIS_ELEV_TRIM_SET will be a number between -16383 and +16383 where 16383 represents the full range of trim specified in degrees in the config file. I made this 16.38 degrees for mathematical convenience and the 4100 offset puts the desired trim at 4.1 degrees nose up with reference to a zero PID result.

    The PID constants have not been optimized because I was concerned with proof of principle. Also the strength of trim effect is a coefficient in the .air file (section 1101 Cm_dt Pitch Moment - Trim) which is -1 for my model and -2.2 for the FA-18. Your PID constants would most likelly be different than mine.

    The JPG shows (assuming I get it uploaded) short finals 100 feet AGL with 10.6 degreees AOA versus the 10.5 set value. I probably applied a bit of back pressure on the stick, but 0.1 degrees off is peanuts.

    The code works best if you start close to the desired AOA and speed. Very small power changes are required or you will overcontrol. However, it does work. It does control AOA accurately and the glide slope is maintained using throttle only. Sounds something like what you needed.

    Roy

    Attached Files:

    Last edited: 16/3/12
  14. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Great! I will give this a go when i get home from work this evening. Thank you VERY much!
  15. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Unfortunately, I am realizing that I am very must still in the noobie stage of XML coding. Although I can follow some things in your coding Roy, there is still much I am still trying to wrap my head around (especially when it comes to L Vars).

    So....

    Can someone please help me design a simple "event counter" gauge to do the following:

    -Gauge is triggered, with gear down, flaps >30 degrees, and below 180 KIAS

    -The counter starts with the initial numerical value of 5.0

    -If the Key Event "ELEV_TRIM_UP" is detected, it increases numerical value in 0.1 increments

    -If the Key Event "ELEV_TRIM_DN is detected, it decreases the numerical value in 0.1 decrements

    The visual indicator in the HUD and the XML coding that will use the value provided by the "event counter" is already in place and ready to go. Just need the counter.

    Thanks again.
  16. Roy Holmes

    Roy Holmes Resource contributor

    Joined:
    20/2/11
    Messages:
    815
    Country:
    us-virginia
    Jimi
    What you are asking for is simple to code, but I'm not sure it will help much.

    Some comments.

    You mentioned that your FCS was controlling the approach, can you say more about what it does.

    You need to deliberately turn this code on with a switch action otherwise it could start as you get airborne. While somewhat of an overkill I also made sure it would not work on the ground.

    In any event, your counter after turn-on will just be a read out of the trim angle plus 5 degrees compared to what it was on turn on. How will that help you get to a specific AOA?

    Again, my point is that you can not directly set AOA. What you can do is use trim to maintain AOA provided that you use throttle to maintain the correct airspeed for that AOA. Ignoring automated methods like a PID control, you can achieve this by manually setting the correct trim once and then use throttle for speed/height control.

    Try this. With the F-18 in the desired landing configuration, fly level and adjust power until you are at the 8.2 degree AOA. Note the trim setting required to keep the pitch angle constant while maintaining level flight. That trim setting is what you need if you want to hold 8.2 degrees.

    If you reduce power slightly the nose will drop, if you increase power slightly it will move up.

    I'm purely talking manual flight and your FCS may affect that which is why I asked about it earlier.

    BTW, the PID code is NOT easy to understand, no need for apologies!

    Roy
  17. taguilo

    taguilo Resource contributor

    Joined:
    20/10/06
    Messages:
    1,010
    Country:
    argentina
    Hi,
    You can easily trap both ELEV_TRIM_UP and DN events, bear in mind though it will work fine providing you stay in panel view. As long as you switch to external view the events won't be trapped by the gaugeset and you will need to deal with that in the standard (element set) part of the gauge that controls this operation.


    Tom
  18. Roy Holmes

    Roy Holmes Resource contributor

    Joined:
    20/2/11
    Messages:
    815
    Country:
    us-virginia
    Tom,
    He can achieve the same result by noting the trim setting when the gauge is initiated and save that as a baseline. Then he just needs to compare the baseline with the current trim setting and add 5.

    Roy
  19. taguilo

    taguilo Resource contributor

    Joined:
    20/10/06
    Messages:
    1,010
    Country:
    argentina
    Ah, Ok. Honestly I didn't make a close read to his code, just turned an amber light based on what he wanted to do using the events handler

    Tom
  20. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Roy,

    Ideally, the counter would only count and record pilot initiated elevator trim inputs and that would be what the FCS uses to bounces its trim information off of. Here is how i am thinking it should work?

    1. Conditions are set for the counter to start. Something such as Gear Down, Below 180 KIAS, Flaps set >30 degrees, and maybe even a certain engine RPM %.

    2. From there, the pilot will be able to use whatever keys/buttons, normally used to control the pitch trim, to dial in a selected AOA. This is where the counter comes in. By default, the counter will initially start at 5, meaning that the jet will initially start trimming the aircraft out for 5 degrees AOA. The pilot can adjust to 8.1 degrees if desired by tapping his button for elevator up trim. if he so desired to trim to a lower AOA, he would press the elevator down key. The counter is this there to record keep track of how many times the pilot presses the elevator trim up/down key, not what the actual aircraft elevator trim is doing.

    3. Now, the numeric value contained in the counter is then used in the actual FCS system XML gauge that controls the aircraft's elevator trim, used to maintain a certain AOA. The code would like very similar to what I initially posted. I placed the phase "ELEVATOR TRIM COUNTER" in the code so that you can see where the counter comes in in the grand scheme of things

    (A:AIRSPEED TRUE,knots) 250 &lt;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 40 &gt; &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 30 &gt; &amp;&amp;
    if{ (L:ELEVATOR TRIM COUNTER, number) (A:INCIDENCE ALPHA,Degrees) / (&gt;L:AOA Selector, number) } els{ }

    (L:AOA Selector, number) 1 &gt;
    (A:GEAR CENTER POSITION,Percent) 30 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 22 &lt; &amp;&amp;
    (A:AIRSPEED TRUE,knots) 250 &lt; &amp;&amp;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:AUTOPILOT MASTER, bool) ! &amp;&amp;
    if{ (&gt;K:ELEV_TRIM_UP) } els{ }

    (L:AOA Selector, number) 1 &lt;
    (A:GEAR CENTER POSITION,Percent) 30 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 22 &lt; &amp;&amp;
    (A:AIRSPEED TRUE,knots) 250 &lt; &amp;&amp;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:AUTOPILOT MASTER, bool) ! &amp;&amp;
    if{ (&gt;K:ELEV_TRIM_DN) } els{ }

    4. So without the rest of the coding that actually controls the trim, the counter does nothing. It is just used so that the rest of the coding has a stable number to work with. As for just having the AOA just preset of 8.1, I've tried that in the past and have been successful with it, but after flying the "real deal" Marine Corps simulator this past weekend, I realized that the pilot actually is able to select the desired AOA he/she wants to maintain, 8.1 or otherwise.

    I also want to make the process, as easy and natural to the pilot as possible, where he/she does not have to bring up any other custom panels or or memorize any other keys/buttons to make adjustments. The pilot will use the same keys he has assigned for the elevator trim to make AOA selection adjustments as in the real F/A-18.

    So far, I have the following other FCS systems implemented in my project (Please keep in mind, all of the systems are per what was either found in NATOPS, reviewed by video, or answers provided by actual F/A-18 pilots)

    -Pitch Auto Trim: Trims the aircraft to 1 G flight while in up and away mode

    -Revised Auto Flap System: Per NATOPS flap operation graph, this new system actually uses 9 different flap settings instead of the 3 given by default. Autoflaps system is triggered when aircraft is in "up and away (UA)" mode.

    -G Limiter: Attempts to keep the aircraft under 7.5 Gs when aircraft is under 44,000lbs and under 5 Gs when aircraft is over 44,000 lbs. As in real life, the limiter can be saturated if fast, abrupt inputs are commenced at high speeds, but the limiter will correct in a timely manner

    -Roll Limiter: Restricts the roll rate to no more than 120 degrees a second.

    -Revised Auto Rudder System: initially coordinates turn with rudder trim based on Angle of Bank (AOB) if lateral control inputs are within 30 percent of center. Calculates rudder trim input based on stick deflection if control inputs exceed 30 percent of center.

    There are a few others, but those are the "big ticket" ones. This AOA Trim which will be used in "powered approach (PA)" mode is one of the last items on the list to implement.

    If you are interested and want to check out what I have so far, you can download it at the following link:

    http://www.mediafire.com/?ot9mo83tjkwkuam

Share This Page