From df12d2b2187ebe04abc792617d1db347ad3a5d30 Mon Sep 17 00:00:00 2001 From: alanwatsonforster <68709385+alanwatsonforster@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:46:20 -0600 Subject: [PATCH] Fix FP calculation. --- airpower/aircraft/_normalflight.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/airpower/aircraft/_normalflight.py b/airpower/aircraft/_normalflight.py index 93c4e242..b07b769f 100644 --- a/airpower/aircraft/_normalflight.py +++ b/airpower/aircraft/_normalflight.py @@ -632,8 +632,7 @@ def determinerequiredhfpvfpmix(): # See rules 8.2.1 and 8.2.3. if lastflighttype == "VD": minvfp = math.floor(self._speed / 2) - else: - minhfp = math.ceil(onethird(fp)) + minhfp = math.ceil(onethird(fp)) elif flighttype == "UD": @@ -644,10 +643,6 @@ def determinerequiredhfpvfpmix(): else: minunloadedhfp = 0 - assert minvfp == 0 - assert (minvfp == 0 and maxvfp == fp) or (minhfp == 0 and maxhfp == fp) or (minhfp == maxhfp) - assert minhfp == 0 or maxhfp == fp or (minhfp == maxhfp) - if maxvfp == 0: self._log("- all FPs must be HFPs.") elif minhfp == maxhfp: @@ -656,13 +651,16 @@ def determinerequiredhfpvfpmix(): self._log("- at least %d FPs must be HFPs." % minhfp) elif maxhfp < fp: self._log("- at most %d FPs can be HFPs." % maxhfp) + if minvfp > 0: + self._log("- at least %d FPs must be VFPs." % maxvfp) elif maxvfp < fp: self._log("- at most %d FPs can be VFPs." % maxvfp) + assert minunloadedhfp == 0 or maxunloadedhfp == fp if minunloadedhfp > 0: self._log("- at least %d FPs must be unloaded HFPs." % minunloadedhfp) - if maxunloadedhfp > 0: - self._log("- at most %d FPs can be unloaded HFPs." % maxunloadedhfp) + elif maxunloadedhfp == fp: + self._log("- all FPs may be unloaded HFPs.") self._minhfp = minhfp self._maxhfp = maxhfp