Developer Interface¶
This part of the documentation details the classes and functions available within pyPP6
AircraftModel¶
-
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
-
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 corruptedIOError
– 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 corruptedIOError
– 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
pyAPP6.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
pyAPP6.Files.
Config
¶ Class used in ‘AircraftModel’, holds Mass&Limits data
Variables: - text (Text) – Description
- mass (Mass) – Class holding mass 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
pyAPP6.Files.
TOLParameter
¶ Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
Variables:
-
class
pyAPP6.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
pyAPP6.Files.
Gear
¶ Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
Variables:
-
class
pyAPP6.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
pyAPP6.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
pyAPP6.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
pyAPP6.Files.
JetThrust
¶ Class used in ‘JetPropulsionData’, holds jet thrust data
Variables:
-
class
pyAPP6.Files.
JetFuel
¶ Class used in ‘JetPropulsionData’, holds jet fuel flow data
Variables:
-
class
pyAPP6.Files.
PropPropulsionData
¶ Class used in ‘AircraftModel’, holds propeller propulsion data
-
class
pyAPP6.Files.
PropThrust
¶ Class used in ‘PropPropulsionData’, holds propeller and power data
-
class
pyAPP6.Files.
PropFuel
¶ Class used in ‘PropPropulsionData’, holds fuel flow data
-
class
pyAPP6.Files.
Store
¶ Class used in ‘AircraftModel’, holds store data
-
class
pyAPP6.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
pyAPP6.Files.
StoreDataList
¶ Holds a list of StoreData. Used in ProjectAircraft and ProjectAircraftSetting.
-
class
pyAPP6.Files.
StoreDataList
Holds a list of StoreData. Used in ProjectAircraft and ProjectAircraftSetting.
-
class
pyAPP6.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
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
-
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
-
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
pyAPP6.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) – Optimizer settings
-
class
pyAPP6.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 APP6
- 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
pyAPP6.Files.
MisOptData
¶ Holds mission optimization data, used in ‘MissionDefinition’.
-
class
pyAPP6.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
pyAPP6.Files.
VariationData
¶ Holds mission variation data, used in ‘MissionComputationFile’.
PerformanceChartFile¶
-
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
-
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
pyAPP6.Files.
PointPerfSolver
¶ Base class for a performance chart (PerformanceChartFile) type. Do not use directly, use the class ‘PointPerfHelper’ to generate child classes.
-
class
pyAPP6.Files.
PointSolveParaStudy
¶ ‘Point Performance Computation’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP6.Files.
PointSolveLFEnvelope
¶ ‘G-Envelope’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP6.Files.
PointSolveSEPEnvelope
¶ ‘SEP-Envelope’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP6.Files.
PointSolveSEPTurnRate
¶ ‘Turn-Rate Chart (SEP)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP6.Files.
PointSolveAltTurnRate
¶ ‘Turn-Rate Chart (Altitude)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP6.Files.
PointSolveAltSEP
¶ ‘SEP Chart (Altitude)’ performance chart type, used in ‘PerformanceChartFile’
-
class
pyAPP6.Files.
PointSolveThrustDrag
¶ ‘Thrust and Drag’ performance chart type, used in ‘PerformanceChartFile’
Common Classes¶
-
class
pyAPP6.Files.
FlightData
¶ Holds all data that defines a flight state.
-
class
pyAPP6.Files.
ResArrayData
¶ Holds data for ranges used in performance charts (‘PointPerfSolver’)
-
class
pyAPP6.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
pyAPP6.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_TURNRATE_SEP_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 pyAPP6ValueError
– 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 pyAPP6ValueError
– If the ‘cmpType’ is not a valid chart type.
Data Types¶
-
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)
-
class
pyAPP6.Files.
Boolean
¶ Wrapper to read/write an APP boolean
Tables¶
-
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
-
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
-
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)
-
clear
()¶ Remove all elements from the table
-
getIndex
(value)¶ Returns index of table with value “value”
Parameters: - value (float) – value of the table
- Retruns –
- ------- –
- int – index of table with “value”
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 existsValueError
– If data is not of shape N
-
remove
(i)¶ Remove table of index i
-
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
-
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 existsValueError
– If x2Table is not of type X2Table
-
remove
(i)¶ Remove table of index i
Mission Computations¶
-
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
-
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 APP6 using the command line mode and loads the results.
After the APP6 computation has terminated, the result is read into ‘result’.
Parameters: - inputfile (str) – path to the APP6 .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 pyAPP6 directory.
Returns: True if successful, False otherwise.
Return type: bool
Raises: IOError
– If the mission file (inputfile) does not existsIOError
– If the aircraft file specified in the mission does not exists or if no aircraft path was providedValueError
– If the computation type of the mission file is not set to ‘Single Mission’
-
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
-
classmethod
fromFile
(filename)¶ Creates a new MissionResult instance from the path ‘filename’
Raises: IOError
– If the file cannot be opened
-
getVariableIndex
(name)¶ Returns the first variable index starting with the name ‘name’
Parameters: name (str) – name of the variable Raises: 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
pyAPP6.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
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-
run
(inputfile, imperial=False, suffix='_output')¶ This method runs APP6 using the command line mode and load the results.
After the APP6 computation has terminated, the result is read into ‘result’.
Parameters: - inputfile (str) – path to the APP6 .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 existsIOError
– If the aircraft file specified in the performance file does not exists or if no aircraft path was provided
-
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
-
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
-
getVariableIndex
(name)¶ Returns the first variable index starting with the name ‘name’
Parameters: name (str) – name of the variable Raises: 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 APP6 performance chart result
Parameters: filename (str) – path to the results txt file written by APP6
-
class
pyAPP6.Performance.
ResultLine
¶ Represents a line in an APP6 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.