User Guide¶
This user guide to pyAPP6 is structured into four parts. First, an overview over the package strcuture is provided. The second section describes how to read and write APP files (aircraft, missions and performance charts) using Python. The last two sections describe how to execute APP’s mission computations and performance chart computations by using Python and parse the results written by APP.
Package Structure¶
The pyAPP6 package comprises the following modules:
- Files
- Classes for Reading and Writing APP Files.
- Mission
- Classes for executing Mission Computations and reading the results.
- Performance
- Classes for executing Performance Charts computations and reading the results.
- Database
- Helper class to read APP’s string table.
- Global
- Constants as used in APP.
- Units
- Unit conversion factors as used in APP.
Reading and Writing APP Files¶
For each APP6 filetype, pyAPP6 offers a class to read, manipulate and write a file. The classes are located in the Files module:
APP File | pyAPP6 Class |
---|---|
Aircraft (.acft) | Files.AircraftModel |
Mission Computation (.mis) | Files.MissionComputationFile |
Performance Charts (.perf) | Files.PerformanceChartFile |
The classes are located in the Files module:
-
class
pyAPP6.Files.
AircraftModel
¶ Holds the APP6 aircraft model that is used to read and write APP .acft files
Each type of data (Mass&Limits, Aerodynamcis, Propulsion, Stores) is stored in two lists: one list containing names and one list containing data. These two lists have to have the same length. The configurations are built by using these list indices. Take proper care when manipulating these lists manually and update the ‘ProjectAircraft’ (m_Prj).
Examples
The best way to create an instance of an AircraftModel is to use the classmethod fromFile:
from pyAPP6 import Files acft = Files.AircraftModel.fromFile(r'myAircraft.acft')
Variables: - m_GeneralData (GeneralData) – General data about the aircraft
- text (Text) – Content of the comment text box in ‘General Data’
- configName (list[str]) – list holding the names of the Mass&Limits datasets (‘Config’ classes)
- aeroName (list[str]) – list holding the names of the Aerodynamics datasets (‘Aero’ classes)
- propulsionName (list[str]) – list holding the names of the Propulsion datasets (‘PropulsionData’ child classes)
- storeName (list[str]) – list holding the names of the Store datasets (‘Store’ classes)
- m_config (list[Config]) – list of the Mass&Limits datasets (‘Config’ classes)
- m_aero (list[Aero]) – list of the Aerodynamics datasets (‘Aero’ classes)
- m_propulsion (list[PropulsionData]) – list of the Propulsion datasets (‘PropulsionData’ child classes)
- m_store (list[Store]) – list of the Store datasets (‘Store’ classes)
- m_Prj (ProjectAircraft) – Contains the Configurations and Store Configurations
-
class
pyAPP6.Files.
MissionComputationFile
¶ Reads an APP .mis file
This class reads an APP mission computation file. Most of the data is stored in a ProjectAircraftSetting object (aircraft configuration and stores) and a MissionDefinition object (initial conditions, list of segments). When manipulating mission files, consult the source code and documentation of these two classes.
Note
Data for APP’s “Parameter Study” computation mode is read as well (into the variationData attribute). However, APP’s command line mode does not support this computation type
Examples
The best way to create an instance of a MissionComputationFile is to use the classmethod fromFile:
from pyAPP6 import Files mis = Files.MissionComputationFile.fromFile(r'myMission.mis')
Variables: - text (Text) – Description text
- name (str) – name of the mission computation
- author (str) – name of the author of the mission file
- aircraftpath (str) – path to the aircraft, either relative (to the location of the mis file) or absolute
- projectAircraftSetting (ProjectAircraftSetting) – holds the used configuration of the aircraft and settings of stores
- misDef (MissionDefinition) – Holds the initial conditions and the list of segments
- resData (ResArrayData) – Holds the computation type (CMP_MISSION or CMP_MISSIONVAR)
- variationData (VariationData) – Holds data for the Parameter Study mission computation type
-
class
pyAPP6.Files.
PerformanceChartFile
¶ Reads an APP .perf file
This class reads an APP performance chart file. Most of the data is stored in a ProjectAircraftSetting object (aircraft, configuration and stores), a FlightData object (initial conditions and flight state) and a PointPerfSolver child class object (specific data, related to the type of performance chart).
Note
Not all types of point performance charts can be computed by the APP command line mode. See documentation for valid types.
Examples
The best way to create an instance of a PerformanceChartFile is to use the classmethod fromFile:
from pyAPP6 import Files chart = Files.PerformanceChartFile.fromFile(r'myPerfFile.perf')
Variables: - text (Text) – Description text
- name (str) – name of the mission computation
- author (str) – name of the author of the mission file
- aircraftpath (str) – path to the aircraft, either relative (to the location of the perf file) or absolute
- projectAircraftSetting (ProjectAircraftSetting) – holds the used configuration of the aircraft and settings of stores
- flightData (FlightData) – holds the flight state (initial conditions)
- perf (PointPerfSolver) – instance of a child class of PointPerfSolver, defines the type of performance chart
NExtReal¶
APP defines two custom data types: NExtReal and XTables. When using pyAPP6 to manipulate APP files, it is important to understand these data types.
NExtReals are recognizable in the APP user interface by a text followed by a value and a unit:
-
class
pyAPP6.Files.
NExtReal
¶ APP datatype that wraps a float and allows to specify a label, type of variable (through an index string) and indicate if the value is a limiter
Variables: - xx (float) – value of variable
- label (str) – label of the value, e.g. ‘[Mach]’
- realIdx (str) – index (type) of variable, e.g. ‘REAL_MACH’
- limitActive (int) – 0 or 1, depends on whether the variable has an active limit. E.g used for Max. Take-Off Mass
- note (.) – use readASCIILimited and writeASCIILimited if the variable is a limited value.
Examples
When using pyAPP6 to read APP files, usually no direct use of this type is needed. This information is mostly for developers/maintainers. The text format of a simple, non-limited NExtReal looks like this:
[Mach] REAL_MACH 0.985
This is parsed using readASCII with the flag full=True. The full flag has to be set to True to read the index string ‘REAL_MACH’.
>>> val = NExtReal() >>> f = open('path to text file') >>> val.readASCII(f, full=True)
resulting in the following attributes:
val.xx = 0.985 val.realIdx = 'REAL_MACH' val.label = '[Mach]' val.limitActive = 0
If the text format has no index string,
[Mach] 0.985
readASCII is called with with the flag full=False:
>>> val = NExtReal() >>> f = open('path to text file') >>> val.readASCII(f)
XTable¶
XTables are used everywhere you see a spreadsheet-like table in APP. pyAPP6 uses the numpy module to store data tables. numpy offers a lot of functionality to manipulate arrays. pyAPP6 defines four different tables, with increasing dimensionality: X0Table, X1Table, X2Table and X3Table.
The X0Table is used for one-column data ranges, for example in performance charts for the X-Range and Parameter range.
-
class
pyAPP6.Files.
X0Table
¶ Holds a 1D table (data range)
Variables: - data (list[str]) – Table data with table factor and interpolation settings
- table (ndarray) – numpy array of shape (N,1)
- label (str) – Header string
- X0Typ (str) – APP variable type
The X1Table is a simple two-column table. An example would be the Mach limit or CLmax table. The data is stored in a two-dimensional numpy array.
-
class
pyAPP6.Files.
X1Table
¶ Holds a 2D table
Variables: - data (list[str]) – Table data with table factor and interpolation settings
- table (ndarray) – numpy array of shape (N,2)
- label (str) – Header string
The X2Table is a list of two-column tables. An example would be the induced drag tables or the max. thrust tables. The data is stored in a list of two-dimensional numpy arrays (table attribute). Each table also has a value (for the induced drag table that would be a Mach number). The values are stored in the value list. The table and value list have the same length and same ordering.
-
class
pyAPP6.Files.
X2Table
(embedded=False)¶ Holds a list of 2D tables
Variables: - data (list[str]) – Table data with table factor and interpolation settings
- table (list[ndarray]) – list of numpy arrays of shape (N,2)
- value (list[float]) – value of each table
- label (str) – Header string
- embedded (bool) – True if table is embedded in an ‘X3Table’. Disables reading/writing of header (data and label)
The X3Table class is used in APP for the fuel flow table. The X3Table consists of a list of X2Tables and corresponding values.
-
class
pyAPP6.Files.
X3Table
¶ Holds a list of X2Tables.
This class holds a list of X2Tables and a value for each table.
Variables: - data (list[str]) – Table data with table factor and interpolation settings
- table (list[X2Table]) – list of X2Table instances
- value (list[float]) – value of each table
- label (str) – Header string
Variables¶
When executing APP via the command line, the user can specify what variables will be written in the output result file. By default, pyAPP6 uses the included ParameterList_All.par file to specify the variables. The ouput data is stored in a large numpy table, and the variable can be best accessed by it’s index. The following table presents the current mapping of indices to the variables when using the default parameter list file.
Index | Variable Name | (SI) | (British) |
0 | (M/SFC)(L/D) | [-] | [-] |
1 | Acceleration | [m/sec2] | [ft/sec2] |
2 | Advance Ratio | [-] | [-] |
3 | Altitude | [m] | [ft] |
4 | AoA | [deg] | [deg] |
5 | Attitude | [deg] | [deg] |
6 | CAS | [m/sec] | [nm/hr] |
7 | CD | [-] | [-] |
8 | CD0 | [-] | [-] |
9 | CDi | [-] | [-] |
10 | CDs | [-] | [-] |
11 | CL | [-] | [-] |
12 | CL/CD | [-] | [-] |
13 | Climb Angle | [deg] | [deg] |
14 | Climb Speed | [m/sec] | [ft/sec] |
15 | CLmax | [-] | [-] |
16 | CO2 Mass | [kg] | [lbs] |
17 | CP | [-] | [-] |
18 | CT | [-] | [-] |
19 | Density | [kg/m3] | [slug/ft3] |
20 | Distance | [km] | [nm] |
21 | Drag | [N] | [lbf] |
22 | Drag Area | [m2] | [ft2] |
23 | dT | [K] | [K] |
24 | Dynamic Pressure | [N/m2] | [lbf/ft2] |
25 | EAS | [m/sec] | [nm/hr] |
26 | Ekin | [Nm] | ft] |
27 | Energy Height | [m] | [ft] |
28 | Engine Revolution | [rpm] | [rpm] |
29 | Epot | [Nm] | ft] |
30 | Etot | [Nm] | ft] |
31 | Fuel Flow | [kg/sec] | [lbs/hr] |
32 | Fuel Mass | [kg] | [lbs] |
33 | Fuel Percent | [%] | [%] |
34 | Fuel Percent (Internal) | [%] | [%] |
35 | Lift | [N] | [lbf] |
36 | Lift Area | [m2] | [ft2] |
37 | Load Factor | [-] | [-] |
38 | Mach | [-] | [-] |
39 | Mass | [kg] | [lbs] |
40 | Max. Thrust | [N] | [lbf] |
41 | Min. Thrust | [N] | [lbf] |
42 | Payload | [%] | [%] |
43 | Placard Mach | [-] | [-] |
44 | Power Setting | [%] | [%] |
45 | Pressure | [N/m2] | [lbf/ft2] |
46 | Pressure Altitude | [m] | [ft] |
47 | Propeller Beta | [deg] | [deg] |
48 | Propeller Efficency | [%] | [%] |
49 | Pull-Up Rate | [deg/sec] | [deg/sec] |
50 | Reference Area | [m2] | [ft2] |
51 | Seg. CO2 Mass | [kg] | [lbs] |
52 | Seg. Dist. | [km] | [nm] |
53 | Seg. Fuel | [kg] | [lbs] |
54 | Seg. Time | [min] | [min] |
55 | SEP | [m/sec] | [ft/sec] |
56 | SFC | N)] | lbf)] |
57 | Shaft Power | [W] | [shp] |
58 | Specific Range | [km/kg] | [nm/lbs] |
59 | Speed of Sound | [m/sec] | [ft/sec] |
60 | Stall Speed | [m/sec] | [nm/hr] |
61 | Stall Speed (CAS) | [m/sec] | [nm/hr] |
62 | T/Tmax | [-] | [-] |
63 | TAS | [m/sec] | [nm/hr] |
64 | Temperature | [K] | [K] |
65 | Thrust | [N] | [lbf] |
66 | Thrust cos(AoA+sigma) | [N] | [lbf] |
67 | Time | [sec] | [sec] |
68 | Turn Radius | [m] | [ft] |
69 | Turn Rate | [deg/sec] | [deg/sec] |
70 | Turns | [turn] | [turn] |
71 | Velocity | [m/sec] | [nm/hr] |
72 | Vx | [m/sec] | [nm/hr] |
73 | X-Acc. | [m/sec2] | [ft/sec2] |
Mission Computations¶
The Mission module, specifically the class MissionComputation, is used to run the APP command line mode for mission computations and parse the result text file.
-
class
pyAPP6.Mission.
MissionComputation
(APP6Directory='C:\Program Files (x86)\ALR Aerospace\APP 6 Professional Edition')¶ Class to execute APP and subsequently load the results.
This class is a helper class to execute APP mission computations. After creating an instance of this object, execute the ‘run’ function. The result will be loaded into the ‘result’ attribute. ‘result’ is of type MissionResult, see the documentation of the MissionResult class for further details.
Note
The ‘Parameter Study’ computation type can not be computed with the APP command line mode.
Examples
This example shows how to run a mission computation and obtain an instance of the mission result:
from pyAPP6 import Mission misCmp = Mission.MissionComputation() misCmp.run(r'myMission.mis') result = misCmp.getResult()
This example assumes APP is installed in the default directory.
Variables: - output (str) – Path to the text file with the mission results written by APP
- result (MissionResult) – The result of the mission computation, parsed from the ‘output’ text file
- misCompFile (Files.MissionComputationFile) – Instance of a MissionComputationFile (APP .mis file). Is available once the method run was called
- db (Database) – Instance of a Database object
- inputfile (str) – Path to the APP mis file
A result from an APP command line computation can also be directly read by using the MissionResult class.
-
class
pyAPP6.Mission.
MissionResult
¶ This class can read the APP mission result text file.
Examples
This example shows how to read a mission result directly from a text file. This is useful to read results from past mission computations, for example when conduction batch simulations:
from pyAPP6 import Mission res = Mission.MissionResult.fromFile(r'myMission.mis_ouput.txt')
Variables: - output (dict) – Dictionary containing the mission flags, error text, number- and list of variables
- segments (list[MissionResultSegment]) – A list of MissionResultSegment class instances, holding the results of each segment
- initialSettings (MissionResultSegment()) – The initial settings of the mission
Performance Charts¶
The Performance module, specifically the class PerformanceChart, is used to run the APP command line mode for performance chart computations and parse the result text file.
-
class
pyAPP6.Performance.
PerformanceChart
(APP6Directory='C:\Program Files (x86)\ALR Aerospace\APP 6 Professional Edition')¶ Helper class to execute a performance chart computation from an existing .perf file.
Variables: - inputfile (str) – Path to the input .perf file
- perfFile (PerformanceChartFile) – Parsed input APP6 .perf file
- output (str) – Path to the resulting txt file
- result (PerformanceChartResult) – Result
- APP6Path (str) – Full path to the APP6 executable
Parameters: APP6Directory (str, optional) – Path to the location of the APP6 executable.
Raises: ValueError
– If the APP6 executable is not found in the specified directory
A result from an APP command line computation can also be directly read by using the PerformanceChartResult class.
-
class
pyAPP6.Performance.
PerformanceChartResult
¶ Reads a result txt file written by the APP6 command line mode for a performance chart.
Examples
This example shows how to read a performance chart result directly from a text file. This is useful to read results from past computations, for example when conduction batch computations:
from pyAPP6 import Performance res = Performance.PerformanceChartResult.fromFile(r'myChart.perf_ouput.txt')
Variables: - output (dict) – stores the result meta-data
- lines (List[ResultLine]) – holds the data of each line of a performanc chart