From fe53c4d75388f19b2265c3ebab4f4b6a24c3d8cc Mon Sep 17 00:00:00 2001 From: Josh Davidson Date: Mon, 11 Apr 2022 20:17:06 -0400 Subject: [PATCH 1/3] Control: Fix buggy and wrong spoiler roll commands, inhibit overspeed prot in stall --- .../Effects/Particles/wing-condensation-L.xml | 2 +- .../Effects/Particles/wing-condensation-R.xml | 2 +- Models/Fuselage/fuselage.xml | 6 ++-- Nasal/Libraries/property-tree-setup.nas | 2 +- Systems/a320-adr.xml | 6 ++-- Systems/a320-fbw.xml | 13 ++++++++ Systems/a320-hydraulic.xml | 2 +- Systems/a320-libraries.xml | 4 +-- Systems/a320-spoiler.xml | 32 +++++++------------ Systems/libraries.xml | 2 +- 10 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Models/Effects/Particles/wing-condensation-L.xml b/Models/Effects/Particles/wing-condensation-L.xml index af700a66..ce22b284 100644 --- a/Models/Effects/Particles/wing-condensation-L.xml +++ b/Models/Effects/Particles/wing-condensation-L.xml @@ -18,7 +18,7 @@ environment/relative-humidity 0.075 - fdm/jsbsim/aero/alpha-deg-norm + fdm/jsbsim/aero/alpha-deg-fixed 13.5 diff --git a/Models/Effects/Particles/wing-condensation-R.xml b/Models/Effects/Particles/wing-condensation-R.xml index 5359f148..71c0d823 100644 --- a/Models/Effects/Particles/wing-condensation-R.xml +++ b/Models/Effects/Particles/wing-condensation-R.xml @@ -18,7 +18,7 @@ environment/relative-humidity 0.075 - fdm/jsbsim/aero/alpha-deg-norm + fdm/jsbsim/aero/alpha-deg-fixed 13.5 diff --git a/Models/Fuselage/fuselage.xml b/Models/Fuselage/fuselage.xml index f6e40b0b..0f5fef62 100644 --- a/Models/Fuselage/fuselage.xml +++ b/Models/Fuselage/fuselage.xml @@ -3014,7 +3014,7 @@ AOA Vane L1 rotate AOASensorL1 - fdm/jsbsim/aero/alpha-deg-norm + fdm/jsbsim/aero/alpha-deg-fixed -6085 -3560 @@ -3038,7 +3038,7 @@ AOA Vane R rotate AOASensorR - fdm/jsbsim/aero/alpha-deg-norm + fdm/jsbsim/aero/alpha-deg-fixed -60-85 -35-60 @@ -3062,7 +3062,7 @@ AOA Vane L2 rotate AOASensorL2 - fdm/jsbsim/aero/alpha-deg-norm + fdm/jsbsim/aero/alpha-deg-fixed -6085 -3560 diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 3f99e4f6..ac526b15 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -107,7 +107,7 @@ var Fdm = { JSBsim: { Aero: { alpha: props.globals.getNode("/fdm/jsbsim/aero/alpha-deg"), - alphaNorm: props.globals.getNode("/fdm/jsbsim/aero/alpha-deg-norm"), + alphaNorm: props.globals.getNode("/fdm/jsbsim/aero/alpha-deg-fixed"), }, Fadec: { detent: [props.globals.getNode("/fdm/jsbsim/fadec/control-1/detent"),props.globals.getNode("/fdm/jsbsim/fadec/control-2/detent")], diff --git a/Systems/a320-adr.xml b/Systems/a320-adr.xml index dd10285d..a94c6108 100644 --- a/Systems/a320-adr.xml +++ b/Systems/a320-adr.xml @@ -51,7 +51,7 @@ - aero/alpha-deg-norm + aero/alpha-deg-fixed 12 -180 @@ -60,7 +60,7 @@ - aero/alpha-deg-norm + aero/alpha-deg-fixed 12 -180 @@ -69,7 +69,7 @@ - aero/alpha-deg-norm + aero/alpha-deg-fixed 12 -180 diff --git a/Systems/a320-fbw.xml b/Systems/a320-fbw.xml index c3ce72ce..c1385191 100644 --- a/Systems/a320-fbw.xml +++ b/Systems/a320-fbw.xml @@ -70,12 +70,25 @@ + + + + atmosphere/density-altitude + + 0 15.5 + 43000 8.3 + +
+
+
+ position/wow eq 1 /it-fbw/law ne 0 /instrumentation/airspeed-indicator/indicated-speed-kt le /FMGC/internal/vmo-mmo + aero/alpha-deg-damped ge fbw/stall-alpha-deg /instrumentation/airspeed-indicator/indicated-speed-kt ge /FMGC/internal/vmo-mmo-plus-6 diff --git a/Systems/a320-hydraulic.xml b/Systems/a320-hydraulic.xml index cfa9ab61..c8863a3a 100644 --- a/Systems/a320-hydraulic.xml +++ b/Systems/a320-hydraulic.xml @@ -142,7 +142,7 @@ velocities/vc-kts - aero/alpha-deg-norm + aero/alpha-deg-fixed -60 0 0 1 diff --git a/Systems/a320-libraries.xml b/Systems/a320-libraries.xml index 3c19cf45..eae41dc4 100644 --- a/Systems/a320-libraries.xml +++ b/Systems/a320-libraries.xml @@ -7,7 +7,7 @@ - + gear/unit[0]/WOW eq 0 @@ -15,7 +15,7 @@ - aero/alpha-deg-norm + aero/alpha-deg-fixed 10 diff --git a/Systems/a320-spoiler.xml b/Systems/a320-spoiler.xml index 5eb5636f..416c8b2d 100644 --- a/Systems/a320-spoiler.xml +++ b/Systems/a320-spoiler.xml @@ -242,7 +242,6 @@ /systems/hydraulic/yellow-psi ge 1500 /systems/failures/spoilers/spoiler-l2 eq 0 - spoilers/main-cmd eq 0 0.0 @@ -338,7 +337,6 @@ /systems/hydraulic/blue-psi ge 1500 /systems/failures/spoilers/spoiler-l3 eq 0 - spoilers/main-cmd eq 0 0.0 @@ -434,7 +432,6 @@ /systems/hydraulic/yellow-psi ge 1500 /systems/failures/spoilers/spoiler-l4 eq 0 - spoilers/main-cmd eq 0 0.0 @@ -506,7 +503,6 @@ /systems/hydraulic/green-psi ge 1500 /systems/failures/spoilers/spoiler-l5 eq 0 - spoilers/main-cmd eq 0 0.0 @@ -663,7 +659,6 @@ /systems/hydraulic/yellow-psi ge 1500 /systems/failures/spoilers/spoiler-r2 eq 0 - spoilers/main-cmd eq 0 0.0 @@ -704,8 +699,8 @@
fbw/roll/s-r-3 - 0.0 0.0 - 1.0 -0.7 + -1.0 -0.7 + 0.0 0.0
@@ -722,8 +717,8 @@ fbw/roll/s-r-3 - 0.0 0.0 - 1.0 -0.7 + -1.0 -0.7 + 0.0 0.0
@@ -735,8 +730,8 @@ fbw/roll/s-r-3 - 0.0 0.0 - 1.0 0.7 + 0.0 0.0 + 1.0 0.7
@@ -759,7 +754,6 @@ /systems/hydraulic/blue-psi ge 1500 /systems/failures/spoilers/spoiler-r3 eq 0 - spoilers/main-cmd eq 0 0.0 @@ -800,8 +794,8 @@ fbw/roll/s-r-4 - 0.0 0.0 - 1.0 -0.7 + -1.0 -0.7 + 0.0 0.0
@@ -818,8 +812,8 @@ fbw/roll/s-r-4 - 0.0 0.0 - 1.0 -0.7 + -1.0 -0.7 + 0.0 0.0
@@ -831,8 +825,8 @@ fbw/roll/s-r-4 - 0.0 0.0 - 1.0 0.7 + 0.0 0.0 + 1.0 0.7
@@ -855,7 +849,6 @@ /systems/hydraulic/yellow-psi ge 1500 /systems/failures/spoilers/spoiler-r4 eq 0 - spoilers/main-cmd eq 0 0.0 @@ -927,7 +920,6 @@ /systems/hydraulic/green-psi ge 1500 /systems/failures/spoilers/spoiler-r5 eq 0 - spoilers/main-cmd eq 0 0.0 diff --git a/Systems/libraries.xml b/Systems/libraries.xml index c39d269f..59e0cb86 100644 --- a/Systems/libraries.xml +++ b/Systems/libraries.xml @@ -55,7 +55,7 @@ 1.000.010 - /fdm/jsbsim/aero/alpha-deg-norm + /fdm/jsbsim/aero/alpha-deg-fixed 0.00.00 7.50.0117.00.03 From 6f829acacc67cdd9d03fbc3f5cc83016882b7674 Mon Sep 17 00:00:00 2001 From: Josh Davidson Date: Mon, 11 Apr 2022 21:32:13 -0400 Subject: [PATCH 2/3] FMGC: rework of alphaprot/max try 1, Control: Reduce upwards authority nearing stall alpha --- Models/Instruments/PFD/PFD.nas | 17 ++++++++----- Nasal/FMGC/FMGC.nas | 10 ++++---- Systems/a320-cfm56-5b4-engine-fadec.xml | 2 +- Systems/a320-fbw.xml | 32 ++++++++++++++++++------- Systems/a320-fmgc.xml | 31 ++++++++++++++++++++++++ Systems/a320-v2527-a5-engine-fadec.xml | 2 +- 6 files changed, 74 insertions(+), 20 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 310d8d9c..bb15cbc0 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -89,6 +89,8 @@ var canvas_pfd = { tgt_kts: 0, tgt_ias: 0, vapp: 0, + valphaprot: 0, + valphamax: 0, vls: 0, new: func(svg, name, number) { var obj = {parents: [canvas_pfd] }; @@ -656,6 +658,9 @@ var canvas_pfd = { if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !notification.gear1Wow and !notification.gear2Wow) { me.vls = fmgc.FMGCNodes.vls.getValue(); + me.valphaprot = fmgc.FMGCNodes.valphaProt.getValue(); + me.valphamax = fmgc.FMGCNodes.valphaMax.getValue(); + if (me.vls <= 30) { me.VLSmin = 0 - me.ASI; } else if (me.vls >= 420) { @@ -664,20 +669,20 @@ var canvas_pfd = { me.VLSmin = me.vls - 30 - me.ASI; } - if (fmgc.FMGCInternal.alpha_prot <= 30) { + if (me.valphaprot <= 30) { me.ALPHAprot = 0 - me.ASI; - } else if (fmgc.FMGCInternal.alpha_prot >= 420) { + } else if (me.valphaprot >= 420) { me.ALPHAprot = 390 - me.ASI; } else { - me.ALPHAprot = fmgc.FMGCInternal.alpha_prot - 30 - me.ASI; + me.ALPHAprot = me.valphaprot - 30 - me.ASI; } - if (fmgc.FMGCInternal.alpha_max <= 30) { + if (me.valphamax <= 30) { me.ALPHAmax = 0 - me.ASI; - } else if (fmgc.FMGCInternal.alpha_max >= 420) { + } else if (me.valphamax >= 420) { me.ALPHAmax = 390 - me.ASI; } else { - me.ALPHAmax = fmgc.FMGCInternal.alpha_max - 30 - me.ASI; + me.ALPHAmax = me.valphamax - 30 - me.ASI; } if (fmgc.FMGCInternal.vsw <= 30) { diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 2188ff10..32fc182a 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -261,6 +261,7 @@ var FMGCNodes = { clean: props.globals.getNode("/FMGC/internal/clean"), flap2: props.globals.getNode("/FMGC/internal/flap-2"), flap3: props.globals.getNode("/FMGC/internal/flap-3"), + ktsToMachFactor: props.globals.getNode("/FMGC/internal/kts-to-mach-factor"), lw: props.globals.getNode("/FMGC/internal/lw"), lwClean: props.globals.getNode("/FMGC/internal/lw-clean"), lwVs1gConf0: props.globals.getNode("/FMGC/internal/lw-vs1g-conf-0"), @@ -269,14 +270,13 @@ var FMGCNodes = { lwVs1gConf3: props.globals.getNode("/FMGC/internal/lw-vs1g-conf-3"), lwVs1gConfFull: props.globals.getNode("/FMGC/internal/lw-vs1g-conf-full"), mngSpdAlt: props.globals.getNode("/FMGC/internal/mng-alt-spd"), - ktsToMachFactor: props.globals.getNode("/FMGC/internal/kts-to-mach-factor"), machToKtsFactor: props.globals.getNode("/FMGC/internal/mach-to-kts-factor"), mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"), - slat: props.globals.getNode("/FMGC/internal/slat"), Power: { FMGC1Powered: props.globals.getNode("systems/fmgc/power/power-1-on"), FMGC2Powered: props.globals.getNode("systems/fmgc/power/power-2-on"), }, + slat: props.globals.getNode("/FMGC/internal/slat"), toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"), toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"), tow: props.globals.getNode("/FMGC/internal/tow"), @@ -289,6 +289,8 @@ var FMGCNodes = { v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"), v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"), phase: props.globals.initNode("/FMGC/internal/phase", 0, "INT"), + valphaMax: props.globals.getNode("/FMGC/internal/valpha-max"), + valphaProt: props.globals.getNode("/FMGC/internal/valpha-prot"), vls: props.globals.getNode("/FMGC/internal/vls"), vmax: props.globals.getNode("/FMGC/internal/vmax"), vs1g: props.globals.getNode("/FMGC/internal/vs1g"), @@ -823,8 +825,8 @@ var masterFMGC = maketimer(0.2, func { aoa = getprop("/systems/navigation/adr/output/aoa-1"); cas = getprop("/systems/navigation/adr/output/cas-1"); if (aoa > -5) { - FMGCInternal.alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0)); - FMGCInternal.alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0)); + FMGCInternal.alpha_prot = FMGCNodes.valphaProt.getValue(); + FMGCInternal.alpha_max = FMGCNodes.valphaMax.getValue(); } else { FMGCInternal.alpha_prot = 0; FMGCInternal.alpha_max = 0; diff --git a/Systems/a320-cfm56-5b4-engine-fadec.xml b/Systems/a320-cfm56-5b4-engine-fadec.xml index b041023b..dad7a6c1 100644 --- a/Systems/a320-cfm56-5b4-engine-fadec.xml +++ b/Systems/a320-cfm56-5b4-engine-fadec.xml @@ -1009,7 +1009,7 @@ - + /controls/flight/flaps-pos eq 1 /controls/flight/flaps-pos eq 2 diff --git a/Systems/a320-fbw.xml b/Systems/a320-fbw.xml index c1385191..a01f016a 100644 --- a/Systems/a320-fbw.xml +++ b/Systems/a320-fbw.xml @@ -1474,16 +1474,32 @@ + + aero/alpha-deg-fixed + -fbw/stall-alpha-deg + + -
- fbw/pitch/max-rad-error - - -0.087266 -1.0 - -0.034907 -0.1 - 0.000000 0.0 - -
+ + + fbw/pitch/max-rad-error + + -0.087266 -1.0 + -0.034907 -0.1 + 0.000000 0.0 + +
+ + fbw/pitch/stall-alpha-error + /it-fbw/law + + 0 1 + -2.5 -1 -1 + 0.0 0 -1 + +
+
diff --git a/Systems/a320-fmgc.xml b/Systems/a320-fmgc.xml index 149532fa..64620344 100644 --- a/Systems/a320-fmgc.xml +++ b/Systems/a320-fmgc.xml @@ -4,7 +4,10 @@ + /FMGC/internal/vmo-kts + test + test2 @@ -189,6 +192,34 @@ + + + aero/alphadot-rad_sec + test2 + + + + /FMGC/internal/valphadot-lag + test + + + + + + + /FMGC/internal/vs1g-kts + 1.09 + + /FMGC/internal/valphadot-offset + + + + + + /FMGC/internal/vs1g-kts + /FMGC/internal/valphadot-offset + + diff --git a/Systems/a320-v2527-a5-engine-fadec.xml b/Systems/a320-v2527-a5-engine-fadec.xml index 1b8b444e..26216e69 100644 --- a/Systems/a320-v2527-a5-engine-fadec.xml +++ b/Systems/a320-v2527-a5-engine-fadec.xml @@ -1468,7 +1468,7 @@ - + /controls/flight/flaps-pos eq 1 /controls/flight/flaps-pos eq 2 From ca198b718c744b9b385e79e704022b4aaa9fc9c2 Mon Sep 17 00:00:00 2001 From: Josh Davidson Date: Mon, 11 Apr 2022 21:33:24 -0400 Subject: [PATCH 3/3] FMGC: Quick fix in valpha calculation --- Systems/a320-fmgc.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Systems/a320-fmgc.xml b/Systems/a320-fmgc.xml index 64620344..37617d74 100644 --- a/Systems/a320-fmgc.xml +++ b/Systems/a320-fmgc.xml @@ -6,8 +6,6 @@ /FMGC/internal/vmo-kts - test - test2 @@ -195,12 +193,12 @@ aero/alphadot-rad_sec - test2 + 0.75 /FMGC/internal/valphadot-lag - test + 125