Howto:Implement a Fly-By-Wire System for Airliners: Difference between revisions

m
→‎/Nasal/fbw.nas: start using the new methods to increment/decrement throttles
m (→‎/Nasal/fbw.nas: use methods to increment and decrement the throttles)
m (→‎/Nasal/fbw.nas: start using the new methods to increment/decrement throttles)
Line 254: Line 254:


if (me.throttles[0] <= me.throttleinit - 0.05) {
if (me.throttles[0] <= me.throttleinit - 0.05) {
me.throttles[0] += INCREMENT * me.fpsfix;
me.inc_throttles();
me.throttles[1] += INCREMENT * me.fpsfix;
} elsif (me.throttles[0] > me.throttleinit + 0.05) {
} elsif (me.throttles[0] > me.throttleinit + 0.05) {
me.throttles[0] -= INCREMENT * me.fpsfix;
me.dec_throttles();
me.throttles[1] -= INCREMENT * me.fpsfix;
} else me.turnthrottlefix = 0;
} else me.turnthrottlefix = 0;
}
}
Line 265: Line 263:


if ((airspeedkt >= 250) and (altitudemsl <= 10000) and (me.throttles[0] != 0) and (me.throttles[1] != 0)) {
if ((airspeedkt >= 250) and (altitudemsl <= 10000) and (me.throttles[0] != 0) and (me.throttles[1] != 0)) {
me.throttles[0] -= INCREMENT * me.fpsfix;
me.dec_throttles();
me.throttles[1] -= INCREMENT * me.fpsfix;
me.throttlefix = 1;
me.throttlefix = 1;
}
}


if ((me.throttlefix == 1) and (airspeedkt < 245) and (altitudemsl <= 10000) and (me.throttles[0] != 1) and (throttles[1] != 1)) {
if ((me.throttlefix == 1) and (airspeedkt < 245) and (altitudemsl <= 10000) and (me.throttles[0] != 1) and (throttles[1] != 1)) {
me.throttles[0] += INCREMENT * me.fpsfix;
me.inc_throttles();
me.throttles[1] += INCREMENT * me.fpsfix;
}
}


Line 278: Line 274:


if ((airspeedkt >= 350) and (altitudemsl > 10000) and (throttles[0] != 0) and (throttles[1] != 0)) {
if ((airspeedkt >= 350) and (altitudemsl > 10000) and (throttles[0] != 0) and (throttles[1] != 0)) {
throttles[0] -= INCREMENT * me.fpsfix;
me.dec_throttles();
throttles[1] -= INCREMENT * me.fpsfix;
me.throttlefix = 1;
me.throttlefix = 1;
}
}


if ((me.throttlefix == 1) and (airspeedkt < 340) and (altitudemsl > 10000) and (throttles[0] != 1) and (throttles[1] != 1)) {
if ((me.throttlefix == 1) and (airspeedkt < 340) and (altitudemsl > 10000) and (throttles[0] != 1) and (throttles[1] != 1)) {
throttles[0] += INCREMENT * me.fpsfix;
me.inc_throttles();
throttles[1] += INCREMENT * me.fpsfix;
}
}


Line 291: Line 285:


if ((airspeedkt < 125) and (me.altitudeagl > 250) and (throttles[0] != 1) and (throttles[1] != 1)) {
if ((airspeedkt < 125) and (me.altitudeagl > 250) and (throttles[0] != 1) and (throttles[1] != 1)) {
throttles[0] += INCREMENT * me.fpsfix;
me.inc_throttles();
throttles[1] += INCREMENT * me.fpsfix;


### Also help by pushing forward on the stick
### Also help by pushing forward on the stick
Line 413: Line 406:
inc_throttles: func {
inc_throttles: func {
forindex(var t; me.throttles)
forindex(var t; me.throttles)
  throttles[t] += INCREMENT * me.fpsfix;
  me.throttles[t] += INCREMENT * me.fpsfix;
},
},


dec_throttles:func {
dec_throttles:func {
forindex(var t; me.throttles)
forindex(var t; me.throttles)
  throttles[t] -= INCREMENT * me.fpsfix;
  me.throttles[t] -= INCREMENT * me.fpsfix;
},
},
     reset : func {
     reset : func {