Skip to content

Commit

Permalink
Use "chart" rather than "table".
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwatsonforster committed Sep 25, 2023
1 parent 6c8b692 commit 1a7de97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions airpower/aircraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,15 @@ def startmove(self, flighttype, powerap, actions):
if not isinstance(powerap, (int, float)) or powerap < 0 or powerap % 0.5 != 0:
raise ValueError("invalid power AP %s" % powerap)
# TODO: Don't assume CL.
powertable = self._aircrafttype.powertable("CL")
powerchart = self._aircrafttype.powerchart("CL")
if powerap == 0:
powersetting = "NOR"
elif powerap <= powertable["MIL"]:
elif powerap <= powerchart["MIL"]:
powersetting = "MIL"
elif "AB" in powertable and powerap <= powertable["AB"]:
elif "AB" in powerchart and powerap <= powerchart["AB"]:
powersetting = "AB"
else:
raise ValueError("requested power %s exceeds aircraft capability.")
raise ValueError("requested power %s APs exceeds aircraft capability.")

self._restore(apturn.turn() - 1)

Expand Down Expand Up @@ -548,7 +548,8 @@ def _endmove(self):
turnap = 0.0
else:
# TODO: Don't assume CL.
turnap = -self._aircrafttype.turndragtable("CL")[self._maxturnrate]
# TODO: Calculate this at the moment of the maximum turn, since it depends on the configuration.
turnap = -self._aircrafttype.turndragchart("CL")[self._maxturnrate]

self._report("power APs = %+.1f." % self._powerap)
self._report("turn APs = %+.1f and %+.1f." % (turnap, self._sustainedturnap))
Expand Down
4 changes: 2 additions & 2 deletions airpower/aircrafttype.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class aircrafttype:
def __init__(self, name):
self._name = name

def powertable(self, configuration):
def powerchart(self, configuration):
if self._name == "F-80C":
return {
"CL" : { "MIL": 1.0, },
Expand All @@ -17,7 +17,7 @@ def powertable(self, configuration):
"DT" : { "MIL": 0.5, },
}[configuration]

def turndragtable(self, configuration):
def turndragchart(self, configuration):
if self._name == "F-80C":
return {
"CL" : { "TT": 0.0, "HT": 1.0, "BT": 1.0, },
Expand Down

0 comments on commit 1a7de97

Please sign in to comment.