Now for the next question...
As part of the Flight Control System in this aircraft, I've been working on some coding that will enable the aircraft to correlate stick position to the amount of G pulled by the aircraft, regardless of speed. So, if you pull back on your stick 20%, for example, the aircraft's elevator trim will work alongside the aircraft's elevator and will continuously adjust itself so that the aircraft will achieve and maintain 2.4 G. As the speed increases, the elevator trim will automatically decrease, and the opposite as speed decreases. Here is the code, that I've developed:
Although initial implementation and testing has proven successful, it does take a few seconds for the trim to increment/decrement to where it initially needs to be, or for it to release the trim once the G is released. Does anyone know how to change the speed at which the simulator increments or decrements the elevator trim once commanded? As usual, thanks everyone for your help!
As part of the Flight Control System in this aircraft, I've been working on some coding that will enable the aircraft to correlate stick position to the amount of G pulled by the aircraft, regardless of speed. So, if you pull back on your stick 20%, for example, the aircraft's elevator trim will work alongside the aircraft's elevator and will continuously adjust itself so that the aircraft will achieve and maintain 2.4 G. As the speed increases, the elevator trim will automatically decrease, and the opposite as speed decreases. Here is the code, that I've developed:
Code:
// --- G FORCE / STICK CONNECT
<!-- Algorithm to calculate commanded G based on stick position. Neutral stick commands 1 G, full aft stick commands 7.5 G (F/A-18's Max commanded G) -->
<!-- Calculation starts if stick is pulled from neutral by more than 3%-->
[B](A:ELEVATOR POSITION, Percent) 3 >[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [COLOR="red"][B](A:ELEVATOR POSITION, Percent) 0.065 * 1 + (>L:G_CUTOFF_INDEX,number)[/B][/COLOR] }
<!-- Calculation starts if stick is pushed from neutral by more than 3%-->
[B](A:ELEVATOR POSITION, Percent) -3 <[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [COLOR="red"][B](A:ELEVATOR POSITION, Percent) 0.065 * 1 + (>L:G_CUTOFF_INDEX,number)[/B][/COLOR] }
<!-- Compares the commanded G to actual aircraft G by diving the two together. -->
<!-- Compares commanded G to actual aircraft G when stick is pulled -->
[B](A:ELEVATOR POSITION, Percent) 3 >[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [COLOR="red"][B](L:G_CUTOFF_INDEX,number) (A:G FORCE,G Force) / (>L:G_CUTOFF,number)[/B][/COLOR] }
<!-- Compares commanded G to actual aircraft G when stick is pushed -->
[B](A:ELEVATOR POSITION, Percent) -3 <[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [COLOR="red"][B](L:G_CUTOFF_INDEX,number) (A:G FORCE,G Force) / (>L:G_CUTOFF,number)[/B][/COLOR] }
<!-- Commands elevator down trim if current G is more than commanded G while stick is pulled -->
[B](L:G_CUTOFF,number) 1 <[/B]
[B](A:ELEVATOR POSITION, Percent) 3 > and[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [COLOR="red"][B](>K:ELEV_TRIM_DN)[/B][/COLOR] }
<!-- Commands elevator down trim if current G is more than commanded G while stick is pushed-->
[B](L:G_CUTOFF,number) 1 <[/B]
[B](A:ELEVATOR POSITION, Percent) -3 < and[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [B][COLOR="red"](>K:ELEV_TRIM_DN)[/COLOR][/B] }
<!-- Commands elevator up trim if current G is less than commanded G while stick is pulled-->
[B](L:G_CUTOFF,number) 1 >[/B]
[B](A:ELEVATOR POSITION, Percent) 3 > and[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [COLOR="red"][B](>K:ELEV_TRIM_UP)[/B][/COLOR] }
<!-- Commands elevator up trim if current G is less than commanded G while stick is pushed-->
[B](L:G_CUTOFF,number) 1 >[/B]
[B](A:ELEVATOR POSITION, Percent) -3 < and[/B]
(A:GEAR CENTER POSITION,Percent) 30 < and
(A:AIRSPEED TRUE,knots) 50 > and
(A:SIM ON GROUND, bool) ! and
(A:AUTOPILOT MASTER, bool) ! and
if{ [COLOR="Red"][B](>K:ELEV_TRIM_UP)[/B][/COLOR] }
Although initial implementation and testing has proven successful, it does take a few seconds for the trim to increment/decrement to where it initially needs to be, or for it to release the trim once the G is released. Does anyone know how to change the speed at which the simulator increments or decrements the elevator trim once commanded? As usual, thanks everyone for your help!