Developer Interface¶
This part of the documentation details the classes and functions available within pyAPP7
AircraftModel¶
-
class
pyAPP7.Files.
AircraftModel
¶ Holds the APP7 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 pyAPP7 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
-
classmethod
fromFile
(filename)¶ Creates a new AircraftModel instance from the path ‘filename’
- Raises
ValueError – If a parsing error occurs. The aircraft file seems to be corrupted
IOError – If the file cannot be opened
-
load
(f)¶ load an aircraft from a file handle f. Low level function, use fromFile or loadFromFile.
- Raises
ValueError – If a parsing error occurs. The aircraft file seems to be corrupted
-
loadFromFile
(filename)¶ load an aircraft from a file path ‘filename’
- Raises
ValueError – If a parsing error occurs. The aircraft file seems to be corrupted
IOError – If the file cannot be opened
-
saveToFile
(filename, overwrite=False)¶ Write the APP .acft aircraft file.
- Raises
ValueError – If file exists but overwrite was set to False
-
class
pyAPP7.Files.
GeneralData
¶ Class used in ‘AircraftModel’ to store general data.
- Variables
m_sAircraftName (str) – Name of the aircraft model (‘Model’ field in APP)
m_sManufacturer (str) – Name of the manufacturer
m_sVariant (str) – Name of a specific variant for this aircraft
m_sYear (str) – Year
m_sAuthor (str) – Name of the author of the APP model
m_sVersion (str) – Version description of the APP model
m_sDate (str) – Date of the APP model. Format: DD/MM/YYYY (e.g. 24/03/2016)
-
class
pyAPP7.Files.
Config
¶ Class used in ‘AircraftModel’, holds Mass&Limits data
- Variables
text (Text) – Description
mass (Mass) – Class holding mass data
battery (Battery) – Class holding battery data
gear (Gear) – Class holding gear data
tolParameter (TOLParameter) – Class holding parameters for take-off and landing
nEngines (NExtReal) – Number of engines
thrustMult (NExtReal) – Thrust multiplier
fuelFlowMult (NExtReal) – Fuel flow multiplier
relAoA (NExtReal) – Thrust line angle
dDragArea (NExtReal) – Delta drag area
dragMult (NExtReal) – Drag multiplier
posLimitLF (NExtReal) – Positive limit load factor
negLimitLF (NExtReal) – Negative limit load factor
limitAoAMax (NExtReal) – Maximum AoA Limit
limitAoAMin (NExtReal) – Minimum AoA Limit
limitMass (NExtReal) – Maximum Take-Off Mass limiter (optional)
limitMachTable (X1Table) – Mach limiter table (altitide, Mach)
limitAoAGTable (X1Table) – AoA-G limiter table (AoA, g)
-
class
pyAPP7.Files.
Mass
¶ Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
This class holds the mass breakdown. A minimal dataset should have values for the structure, payload and internalFuel entries.
- Variables
structure (NExtReal) – Structure mass
propulsionGroup (NExtReal) – Propulsion group mass
equipment (NExtReal) – Equipment mass
massDeviations (NExtReal) – Mass deviation
fixedOperatingEquipment (NExtReal) – Fixed op. equipment mass
unusableFuelAndOil (NExtReal) – Unusable fuel and oil mass
gun (NExtReal) – Gun mass
removableOperatingEquipment (NExtReal) – Removable op. equipment mass
usableOil (NExtReal) – Usable oil mass
crew (NExtReal) – Crew mass
specMissionEquipment (NExtReal) – Spec. mission euqipment mass
ammunition (NExtReal) – Ammunition mass
payload (NExtReal) – Payload mass
internalFuel (NExtReal) – Fuel mass (internal fuel)
-
class
pyAPP7.Files.
Battery
¶ Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
This class holds the battery properties.
-
class
pyAPP7.Files.
Gear
¶ Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
-
class
pyAPP7.Files.
TOLParameter
¶ Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
-
class
pyAPP7.Files.
Aero
¶ Class used in ‘AircraftModel’, holds aerodynamics data
- Variables
text (Text) – Description
aspectRatio (NExtReal) – Aspect ratio
Sref (NExtReal) – Reference area
cd0Table (X2Table) – Table holding the zero lift drag CD0
cdITable (X2Table) – Table holding the induced drag CDI
clmaxTable (X1Table) – Table holding the maximum CL (CLmax)
cl0Table (X1Table) – Table holding the Cl0 (DCL, i.e. CL for minimum drag)
clTable (X2Table) – Table holding the lift curves (CL)
-
class
pyAPP7.Files.
PropulsionData
¶ Base class for propulsion datasets. Use the class method ‘fromIndex’ to create child classes.
-
classmethod
fromIndex
(index)¶ Creates a PropulsionData child class using the propulsion type (index)
- Parameters
index (str) – The currently available types are ‘PROPULSION_JET’ and ‘PROPULSION_PROP’
-
classmethod
-
class
pyAPP7.Files.
JetPropulsionData
¶ Class used in ‘AircraftModel’, holds jet propulsion data
- Variables
m_manufacturer (str) – Manufacturer of the engine
m_variant (str) – Variant of the engine
nthrustData (int) – Number of thrust characteristics. Equals the length of the thrustData list
thrustData (list[JetThrust]) – List containing the thrust characteristics (JetThrust)
nfuelData (int) – Number of thrust characteristics. Equals the length of the thrustData list
fuelData (list[JetFuel]) – List containing the fuel flow data (JetFuel)
m_index (str) – Type of the propulsion, PROPULSION_JET
-
class
pyAPP7.Files.
JetThrust
¶ Class used in ‘JetPropulsionData’, holds jet thrust data
-
class
pyAPP7.Files.
JetFuel
¶ Class used in ‘JetPropulsionData’, holds jet fuel flow data
-
class
pyAPP7.Files.
PropPropulsionData
¶ Class used in ‘AircraftModel’, holds propeller propulsion data
-
class
pyAPP7.Files.
PropThrust
¶ Class used in ‘PropPropulsionData’, holds propeller and power data
-
class
pyAPP7.Files.
PropFuel
¶ Class used in ‘PropPropulsionData’, holds fuel flow data
-
class
pyAPP7.Files.
Propeller
¶ Class used in ‘PropThrust’, holds propeller data
-
class
pyAPP7.Files.
ElectricPropulsionData
¶ Class used in ‘AircraftModel’, holds electric propeller propulsion data
-
class
pyAPP7.Files.
PropElectricThrust
¶ Class used in ‘PropPropulsionData’, holds propeller and power data
-
class
pyAPP7.Files.
GenericElectricPropulsionData
¶ Class used in ‘AircraftModel’, holds generic electric propulsion data
-
class
pyAPP7.Files.
GenericElectricThrust
¶ Class used in ‘JetPropulsionData’, holds generic electric thrust data
The only difference to JetThrust is the class label.
-
class
pyAPP7.Files.
GenericElectricFuel
¶ Class used in ‘JetPropulsionData’, holds generic electric fuel flow data
-
class
pyAPP7.Files.
RangeExtenderPropulsionData
¶ Class used in ‘AircraftModel’, holds range extender propulsion data
-
class
pyAPP7.Files.
RangeExtenderThrust
¶ Class used in ‘RangeExtenderPropulsionData’, holds range extender and power data
-
class
pyAPP7.Files.
Store
¶ Class used in ‘AircraftModel’, holds store data
-
class
pyAPP7.Files.
ProjectAircraft
¶ Class used in ‘AircraftModel’, holds the configurations and store configurations
- Variables
storeConfigName (list[str]) – List of the store configuration names
storeConfigList (list[StoreDataList]) – List of the store configurations
text (Text) – Description. Currently unused
nrOfProjects (int) – Number of aircraft configurations
nrOfStoreSettings (int) – Number of store configurations
settingName (list[str]) – List of the aircraft configuration names
configName (list[str]) – List of the mass and limit dataset names
aeroName (list[str]) – List of the aerodynamic dataset names
propulsionName (list[str]) – List of the propulsion dataset names
thrustName (list[str]) – List of the thrust rating dataset names
-
checkSettings
()¶ Check the project for consistency
- Raises
AssertionError – If any of the lists do not have the same length as the project
-
class
pyAPP7.Files.
StoreDataList
¶ Holds a list of StoreData. Used in ProjectAircraft and ProjectAircraftSetting.
-
class
pyAPP7.Files.
StoreDataList
¶ Holds a list of StoreData. Used in ProjectAircraft and ProjectAircraftSetting.
-
class
pyAPP7.Files.
StoreData
¶ Holds the state of a store. The correpsonding ‘Store’ data is identified by its name
- Variables
name (string) – Name of the ‘Store’ data
autodrop (int) – set to 1 if the store should be dropped when empty, 0 otherwise (if the store is a fuel tank)
storestate (int) – Indicates if the store is dropped (1) or attached (0)
MissionComputationFile¶
-
class
pyAPP7.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 pyAPP7 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
-
checkAircraftPath
()¶ Check if the aircraft file specified in aircraftpath exists
-
classmethod
fromFile
(filename)¶ Creates a new MissionComputationFile instance from the path ‘filename’
- Raises
IOError – If the file cannot be opened
-
getAbsoluteAircraftPath
(misFilePath)¶ If the aircraftpath is relative, this function returns the absolute path with respect to misFilePath
-
getOptimizerSettings
()¶ kept for backwards compatability
-
load
(f)¶ Loads a mis file using an existing open file handle f. To read from a file path, use the fuction loadFromFile or the classmethod fromFile
-
class
pyAPP7.Files.
MissionDefinition
¶ Class is used in ‘MissionComputationFile’. Holds the initial conditions and the list of segments.
- Variables
initialFd (FlightData) – Initial conditions of the mission
segments (list[MissionSegment]) – List of segments
opt (MisOptData) – Solver settings
-
class
pyAPP7.Files.
MissionSegment
¶ Used in the class ‘MissionDefinition’, holds all data that describes a segment
- Variables
segmentIndex (str) – type of the segment, e.g. ‘SEG_TAKEOFF’ or ‘SEG_CLIMB’. Refer to the documentation for valid strings
versionString (list[str]) – class name and version, set by APP7
segFd (FlightData) – parameters of the segment. Not all segments use all data.
Timestep (NExtReal) – timestep of the segment, in seconds
endValue1,endValue2 (NExtReal) – Segment stop conditions. See documentation for valid NExtReal.realIdx strings
comparatorType1,comparatorType2 (int) – Comparator for each segment stop condition. less=0, greater=1
increaseX,increaseY,increaseZ (int) – flags for x,y and z integration (the z value is currently unused)
specialValue1,specialValue2 (NExtReal) – some segments use additional data. Refer to the documentation
specialInteger (int) – some segments use additional data. Refer to the documentation
-
class
pyAPP7.Files.
MisOptData
¶ Holds mission solver data, used in ‘MissionDefinition’.
-
class
pyAPP7.Files.
ProjectAircraftSetting
¶ Saves the index of the active configuration and store configuration and holds the initial state of the stores within the selected store configuration
Used in ‘PerformanceChartFile’ and ‘MissionComputationFile’
-
class
pyAPP7.Files.
VariationData
¶ Holds mission variation data, used in ‘MissionComputationFile’.
PerformanceChartFile¶
-
class
pyAPP7.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 pyAPP7 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
-
classmethod
fromFile
(filename)¶ Creates a new PerformanceChartFile instance from the path ‘filename’
- Raises
IOError – If the file cannot be opened
-
getAbsoluteAircraftPath
(perfFilePath)¶ If the aircraftpath is relative, this function returns the absolute path with respect to the misFilePath
-
class
pyAPP7.Files.
PointPerfSolver
¶ Base class for a performance chart (PerformanceChartFile) type. Do not use directly, use the class ‘PointPerfHelper’ to generate child classes.
-
class
pyAPP7.Files.
PointSolveParaStudy
¶ ‘Point Performance Computation’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveLFEnvelope
¶ ‘G-Envelope’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveSEPEnvelope
¶ ‘SEP-Envelope’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveAccelEnvelope
¶ ‘SEP-Envelope (Accel)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveSEPTurnRate
¶ ‘Turn-Rate Chart (SEP)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveAccelTurnRate
¶ ‘Turn-Rate Chart (SEP)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveAltTurnRate
¶ ‘Turn-Rate Chart (Altitude)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveAltSEP
¶ ‘SEP Chart (Altitude)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP7.Files.
PointSolveThrustDrag
¶ ‘Thrust and Drag’ performance chart type, used in ‘PerformanceChartFile’
Common Classes¶
-
class
pyAPP7.Files.
FlightData
¶ Holds all data that defines a flight state.
-
class
pyAPP7.Files.
ResArrayData
¶ Holds data for ranges used in performance charts (‘PointPerfSolver’)
-
class
pyAPP7.Files.
Text
¶ Multi-line text, used in ‘Description’ fields of APP
- Variables
text (list[str]) – lines of the text. An empty line is written with a single ‘%’ character
Example
>>> comment=Text() >>> comment.text=['This is a multi-line comment.','%','This is another line'] >>> comment.writeASCII(sys.stdout) [OBJECT VERSION] CText 1 [USER TEXT] 3 This is a multi-line comment. % This is another line
Supporting Classes¶
-
class
pyAPP7.Files.
PointPerfHelper
¶ Factory class to generate ‘PointPerfSolver’ child classes corresponding to a specified performance chart type.
Valid chart types are:
CMP_POINT_PERF
CMP_G_ENVELOPE
CMP_SEP_ENVELOPE
CMP_SEP_ENVELOPE_ACCEL
CMP_TURNRATE_SEP_CHART
CMP_TURNRATE_ACCEL_CHART
CMP_TURNRATE_ALT_CHART
CMP_THRUSTDRAG_CHART
CMP_SEP_ALT_CHART
- Variables
cmpType (string) – type of performance chart. See the class method ‘newSolver’ for a list of valid types.
-
classmethod
fromType
(cmpType)¶ Creates a new ‘PointPerfSolver’ instance with type cmpType.
- Raises
NotImplementedError – If the ‘cmpType’ has not yet been implemented into pyAPP7
ValueError – If the ‘cmpType’ is not a valid chart type.
-
newSolver
(cmpType)¶ Returns a child class instance of base type ‘PointPerfSolver’ by using the attribure ‘cmpType’. cmpType is set using SetType().
- Raises
NotImplementedError – If the ‘cmpType’ has not yet been implemented into pyAPP7
ValueError – If the ‘cmpType’ is not a valid chart type.
Data Types¶
-
class
pyAPP7.Datatypes.
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 pyAPP7 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)
-
class
pyAPP7.Datatypes.
Boolean
¶ Wrapper to read/write an APP boolean
Tables¶
-
class
pyAPP7.Datatypes.
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
-
class
pyAPP7.Datatypes.
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
-
class
pyAPP7.Datatypes.
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)
-
clear
()¶ Remove all elements from the table
-
getIndex
(value)¶ Returns index of table with value “value”
- Parameters
value (float) – value of the table
- Returns
index of table with “value”
- Return type
int
- Raises
IndexError – If table value is not in the list
-
insertTable
(value, data)¶ Insert a new table (value, data) pair
- Parameters
value (float) – value of table to add
data (ndarray) – data table as a numpy array with shape (N,2)
- Raises
ValueError – If table with value ‘value’ already exists
ValueError – If data is not of shape N
-
remove
(i)¶ Remove table of index i
-
class
pyAPP7.Datatypes.
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
-
clear
()¶ Remove all elements from the table
-
insertTable
(value, x2Table)¶ Insert a new table (value, x2Table) pair
- Parameters
value (float) – value of table to add
x2Table (X2Table) – X2Table to insert
- Raises
ValueError – If table with value ‘value’ already exists
ValueError – If x2Table is not of type X2Table
-
remove
(i)¶ Remove table of index i
Mission Computations¶
-
class
pyAPP7.Mission.
MissionComputation
(APP7Directory='C:\\Program Files (x86)\\ALR Aerospace\\APP 7 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 pyAPP7 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
-
printSegmentNames
()¶ Prints the name of the segments
-
printStores
()¶ Prints the name of the stores used in the mission
-
run
(inputfile, imperial=False, suffix='_output', ParameterList='ParameterList_All.par')¶ This method runs APP7 using the command line mode and loads the results.
After the APP7 computation has terminated, the result is read into ‘result’.
- Parameters
inputfile (str) – path to the APP7 .mis file
imperial (bool, optional) – set False for SI units, True for imperial units
suffix (string, optional) – suffix of the written result text filename
ParameterList (string, optional) – filename of the parameter file. Has to be in the pyAPP7 directory.
- Returns
True if successful, False otherwise.
- Return type
bool
- Raises
IOError – If the mission file (inputfile) does not exists
IOError – If the aircraft file specified in the mission does not exists or if no aircraft path was provided
ValueError – If the computation type of the mission file is not set to ‘Single Mission’
-
class
pyAPP7.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 pyAPP7 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
-
classmethod
fromFile
(filename)¶ Creates a new MissionResult instance from the path ‘filename’
- Raises
IOError – If the file cannot be opened
-
getVariableData
(name)¶ Returns an array with all data of the variable starting with the name ‘name’
Use np.hstack() on the return value ‘mission_data’ to get a single array.
- Parameters
name (str) – name of the variable
- Returns
var_name (str) – Full name of the variable name
mission_data (ndarray) – Variable data for all mission segments as a numpy array.
- Raises
ValueError – If the variable with name ‘name’ does not exists
-
getVariableIndex
(name)¶ Returns the variable index starting with the name ‘name’
- Parameters
name (str) – name of the variable
- Raises
ValueError – If multiple variables starting with ‘name’ exist
ValueError – If the variable with name ‘name’ does not exists
-
getVariableList
()¶ Returns an ordered list of the variable names
-
getVariableName
(idx)¶ returns the name of the variable at index idx
-
class
pyAPP7.Mission.
MissionResultSegment
¶ Class used to store the result of a single mission segment. This class is used in the MissionResult class to parse each segment.
- Variables
name (str) – Name of the segment
data (ndarray) – Data table as a numpy array with shape (ndata,n_var). n_var is stored in the MissionResult.output[‘n_var’]
ndata (int) – Number of datapoints in the segment
Performance Chart Computations¶
-
class
pyAPP7.Performance.
PerformanceChart
(APP7Directory='C:\\Program Files (x86)\\ALR Aerospace\\APP 7 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 APP7 .perf file
output (str) – Path to the resulting txt file
result (PerformanceChartResult) – Result
APP7Path (str) – Full path to the APP7 executable
- Parameters
APP7Directory (str, optional) – Path to the location of the APP7 executable.
- Raises
ValueError – If the APP7 executable is not found in the specified directory
-
run
(inputfile, imperial=False, suffix='_output', par_file=None)¶ This method runs APP7 using the command line mode and load the results.
After the APP7 computation has terminated, the result is read into ‘result’.
- Parameters
inputfile (str) – path to the APP7 .perf file
imperial (bool, optional) – set False for SI units, True for imperial units
suffix (string, optional) – suffix of the written result text filename
- Returns
True if successful, False otherwise.
- Return type
bool
- Raises
IOError – If the performance file (inputfile) does not exists
IOError – If the aircraft file specified in the performance file does not exists or if no aircraft path was provided
-
class
pyAPP7.Performance.
PerformanceChartResult
¶ Reads a result txt file written by the APP7 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 pyAPP7 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
-
classmethod
fromFile
(filename)¶ Creates a new PerformanceChartResult instance from the path ‘filename’
- Raises
IOError – If the file cannot be opened
-
getErrorText
()¶ Returns the error text
-
getLine
(idx)¶ Returns the ResultLine at index idx
-
getLineData
(idx)¶ - Parameters
idx (int) – Index of line
- Returns
numpy array of all data points, with shape (n_points,n_variables)
- Return type
ndarray
-
getLineLabelList
()¶ Returns a list of all line labels
-
getLineList
()¶ Returns the list of ResultLines
-
getLineVariableData
(idx, varIdx)¶ - Parameters
idx (int) – Index of line
varIdx (int) – Index of variable
- Returns
numpy array with data points and shape (n,)
- Return type
ndarray
-
getVariableData
(name)¶ Returns an array with all data of the variable starting with the name ‘name’
- Parameters
name (str) – name of the variable
- Returns
var_name (str) – Full name of the variable name
line_data (ndarray) – Variable data for all chart lines as a numpy array.
- Raises
ValueError – If the variable with name ‘name’ does not exists
-
getVariableIndex
(name)¶ Returns the variable index starting with the name ‘name’
- Parameters
name (str) – name of the variable
- Raises
ValueError – If multiple variables starting with ‘name’ exist
ValueError – If the variable with name ‘name’ does not exists
-
getVariableList
()¶ Returns an ordered list of the variable names
-
getVariableName
(idx)¶ returns the name of the variable at index idx
-
isSuccessful
()¶ Returns True if the performance result was computed sucessfully
-
loadFromFile
(filename)¶ Read a APP7 performance chart result
- Parameters
filename (str) – path to the results txt file written by APP7
-
class
pyAPP7.Performance.
ResultLine
¶ Represents a line in an APP7 performance chart.
- Variables
label (str) – Label of the line
value (str) – Value of the line
ndata (int) – Number of data points of the line
data (ndarray) – Data array of all points with shape (ndata,nvariables)
-
load
(f)¶ This function is called by the PerformanceChartResult class, do not use directly. Reads a line from the file handle f.