FSDeveloper Community Elevator Trim/Elevator Trim Indicator Problem

 Gauges Use this forum for all your gauges related discussions

#1
13 Mar 2012, 22:02
 jimi08 Join Date: Feb 2008 Posts: 53
Elevator Trim/Elevator Trim Indicator Problem

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 &lt;
(A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 40 &gt; &amp;&amp;
(A:GEAR CENTER POSITION,Percent) 30 &gt; &amp;&amp;
if{ (A:ELEVATOR TRIM POSITION, degrees) (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{ }

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

Justin "Jimi" Hendrix
FSX Blue Angels
#2
14 Mar 2012, 13:24
 tgibson Location: San Diego Join Date: Sep 2006 Posts: 3,772
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,
__________________
Tom Gibson
CalClassic Propliners
http://www.calclassic.com
#3
14 Mar 2012, 15:00
 Roy Holmes Location: Roanoke VA Join Date: Feb 2011 Posts: 776
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
14 Mar 2012, 18:33
 tgibson Location: San Diego Join Date: Sep 2006 Posts: 3,772
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?
__________________
Tom Gibson
CalClassic Propliners
http://www.calclassic.com
#5
14 Mar 2012, 20:37
 jimi08 Join Date: Feb 2008 Posts: 53
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!
__________________

Justin "Jimi" Hendrix
FSX Blue Angels
#6
14 Mar 2012, 20:38
 Roy Holmes Location: Roanoke VA Join Date: Feb 2011 Posts: 776
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
14 Mar 2012, 21:56
 Roy Holmes Location: Roanoke VA Join Date: Feb 2011 Posts: 776
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
14 Mar 2012, 22:14
 jimi08 Join Date: Feb 2008 Posts: 53
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...
__________________

Justin "Jimi" Hendrix
FSX Blue Angels
#9
15 Mar 2012, 10:48
 n4gix Location: Hammond, Indiana Join Date: Sep 2006 Posts: 8,776
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.
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com
Military Visualizations
http://milviz.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
#10
15 Mar 2012, 14:22
 tgibson Location: San Diego Join Date: Sep 2006 Posts: 3,772
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!
__________________
Tom Gibson
CalClassic Propliners
http://www.calclassic.com
#11
15 Mar 2012, 18:16
 jimi08 Join Date: Feb 2008 Posts: 53
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?
__________________

Justin "Jimi" Hendrix
FSX Blue Angels
#12
15 Mar 2012, 19:25
 tgibson Location: San Diego Join Date: Sep 2006 Posts: 3,772
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,
__________________
Tom Gibson
CalClassic Propliners
http://www.calclassic.com
#13
15 Mar 2012, 20:52
 Roy Holmes Location: Roanoke VA Join Date: Feb 2011 Posts: 776
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"/>
<String>%((L:AOA HOLD VAR,number))%!2.1f!</String>
</Text>
</Element>
<Element>
<Position X="65" Y="133"/>
<String>%((A:INCIDENCE ALPHA,degrees))%!2.1f!</String>
</Text>
</Element>
<Element>
<Position X="65" Y="155"/>
<String>%((L:TRIMpidOut,Number))%!2.1f!</String>
</Text>
</Element>
<Element>
<Position X="65" Y="170"/>
<String>%((L:TRIMIntegral,Number))%!2.1f!</String>
</Text>
</Element>
<Element>
<Position X="65" Y="185"/>
<String>%((L:TRIMDerivative,Number))%!2.1f!</String>
</Text>
</Element>
<Element>
<Position X="70" Y="200"/>
<String>%((ELEVATOR TRIM INDICATOR,number))%!d!</String>
</Text>
</Element>
<Element>
<Position X="70" Y="215"/>
</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>
<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 Thumbnails

Last edited by Roy Holmes; 16 Mar 2012 at 08:19.
#14
15 Mar 2012, 22:12
 jimi08 Join Date: Feb 2008 Posts: 53
Great! I will give this a go when i get home from work this evening. Thank you VERY much!
__________________

Justin "Jimi" Hendrix
FSX Blue Angels
#15
16 Mar 2012, 06:59
 jimi08 Join Date: Feb 2008 Posts: 53
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....

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

Justin "Jimi" Hendrix
FSX Blue Angels
#16
16 Mar 2012, 09:02
 Roy Holmes Location: Roanoke VA Join Date: Feb 2011 Posts: 776
Jimi
What you are asking for is simple to code, but I'm not sure it will help much.

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
16 Mar 2012, 09:16
 taguilo Location: San Isidro-BsAs Join Date: Oct 2006 Posts: 742
Quote:
 Originally Posted by jimi08 ... -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
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
16 Mar 2012, 11:19
 Roy Holmes Location: Roanoke VA Join Date: Feb 2011 Posts: 776
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
16 Mar 2012, 12:52
 taguilo Location: San Isidro-BsAs Join Date: Oct 2006 Posts: 742
Quote:
 Originally Posted by Roy Holmes 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
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
16 Mar 2012, 14:28
 jimi08 Join Date: Feb 2008 Posts: 53
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
__________________

Justin "Jimi" Hendrix
FSX Blue Angels

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Developers coffee house     General chat     Showroom     Project recruiting     Wiki Article Discussions     FSDevConf     Test, test Microsoft Flight Simulator development     SDK installation     Aircraft Design         Modeling         Graphics         Gauges         Flight dynamics         Sound         Other     Scenery Design - 3D Objects         3D Objects General         GMax and 3DS Max         FSDS         SketchUp         Blender         ModelConverterX         Static Aircraft Model Maker         Library Creator XML         CAT         MDL Tweaker         ObPlacer and ObPlacer XML     Scenery Design - Airport Design         Airport Design General         Airport Design Editor             Questions and Answers (FAQ) Please Check Here Before Posting             ADE - Ground Polys         BGLComp XML, AFCAD, SceneGenX         FSX Planner     Scenery Design - Terrain Design         Terrain Design General         FSX terrain         Autogen         Ground2k4, SBuilder, SBuilderX         FSX KML     Scenery Design - Other         General         SCASM & ASM tweaking         ScruffyDuck Software Tools (Not ADE)         scenProc         ActiGate     Living World & AI         Living World & AI General         AI Flight Planner     Missions         Mission Development     Special Effects         Special Effects General         FXEditor     SimConnect         SimConnect Other Simulators Development     Prepar3D     ESP     X-Plane         X-Plane General         X-Plane Aircraft Development         X-Plane Scenery Development     FlightGear         FlightGear General         FlightGear Aircraft Development         FlightGear Scenery Development Other     Tools programming     Archive         Other tools by Arno         AutoGen Object Creator         FS wishlist             FSX SDK feedback                 BGL Compiler SDK                 Terrain SDK         Scenery Design Suite X         FSX Photoscene         gPoly

All times are GMT -4. The time now is 05:11.

Kirsch designed by Andrew & Austin