Skip to content

Commit

Permalink
HFP limits for VCs.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwatsonforster committed Sep 30, 2023
1 parent b6f32d6 commit 7625056
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airpower/aircraft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def _endmove(self):
else:
self._log("altitude band is unchanged at %s." % self._altitudeband)

self._log("- carrying %+.2f APs and %s altitude levels." % (
self._log("carrying %+.2f APs and %s altitude levels." % (
self._apcarry, apaltitude.formataltitudecarry(self._altitudecarry)
))

Expand Down
13 changes: 13 additions & 0 deletions airpower/aircraft/_normalflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,11 @@ def _startnormalflight(self, actions):
self._log("- must use no more than 1 VFP.")
else:
self._log("- must use no more than %d VFPs." % math.floor(twothirds(self._fp)))
elif self._flighttype == "VC":
if self._lastflighttype != "VC":
self._log("- must use exactly %d HFPs." % math.floor(onethird(self._fp)))
else:
self._log("- must use no more than %d HFPs." % math.floor(onethird(self._fp)))

self._hfp = 0
self._vfp = 0
Expand Down Expand Up @@ -540,6 +545,14 @@ def _endnormalflight(self):
else:
if self._vfp > twothirds(self._fp):
self._log("must use no more than 2/3 of FPs as VFPs")
elif self._flighttype == "VC":
# See rule 8.1.3
if self._lastflighttype != "VC":
if (self._hfp != math.floor(onethird(self._fp))):
raise RuntimeError("must use exactly 1/3 of FPs as HFPs.")
else:
if (self._hfp > math.floor(onethird(self._fp))):
raise RuntimeError("must use no more 1/3 of FPs as HFPs.")

if self._maxturnrate != None:
self._log("- turned at %s rate." % self._maxturnrate)
Expand Down

0 comments on commit 7625056

Please sign in to comment.