pyAPP6 package¶
Submodules¶
pyAPP6.Database module¶
This module provides classes to read APP’s string table
Copyright 2016, ALR
-
class
pyAPP6.Database.
Database
¶ Bases:
object
This class parses the APP6 string table
Variables: - idx (lst[str]) – identifier of the string
- unit (lst[str]) – unit index
- text (lst[str]) – text
-
GetTextFromID
(idx)¶
-
pyAPP6.Database.
getParFile
()¶
pyAPP6.Files module¶
This module provides classes for reading and writing APP files
Copyright 2016, ALR
-
class
pyAPP6.Files.
Aero
¶ Bases:
object
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)
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
AircraftModel
¶ Bases:
object
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
-
getAero
(idx)¶
-
getAeroList
()¶
-
getAeroName
(idx)¶
-
getAeroNames
()¶
-
getConfiguration
()¶
-
getConfigurationNames
()¶
-
getGeneralData
()¶
-
getMassLimits
(idx)¶
-
getMassLimitsList
()¶
-
getMassLimitsName
(idx)¶
-
getMassLimitsNames
()¶
-
getPropulsion
(idx)¶
-
getPropulsionList
()¶
-
getPropulsionName
(idx)¶
-
getPropulsionNames
()¶
-
getStore
(idx)¶
-
getStoreConfiguration
(idx)¶
-
getStoreConfigurationNames
()¶
-
getStoreList
()¶
-
getStoreName
(idx)¶
-
getStoreNames
()¶
-
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
-
save
(f)¶
-
saveToFile
(filename, overwrite=False)¶ Write the APP .acft aircraft file.
Raises: ValueError
– If file exists but overwrite was set to False
-
class
pyAPP6.Files.
Boolean
¶ Bases:
object
Wrapper to read/write an APP boolean
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
Config
¶ Bases:
object
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)
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
FlightData
¶ Bases:
object
Holds all data that defines a flight state.
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
Gear
¶ Bases:
object
Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
Variables: -
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
GeneralData
¶ Bases:
object
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)
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
JetFuel
¶ Bases:
object
Class used in ‘JetPropulsionData’, holds jet fuel flow data
Variables: -
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
JetPropulsionData
¶ Bases:
pyAPP6.Files.PropulsionData
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
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
JetThrust
¶ Bases:
object
Class used in ‘JetPropulsionData’, holds jet thrust data
Variables: -
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
Mass
¶ Bases:
object
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)
-
getBasicMass
()¶
-
getEmptyMass
()¶
-
getOperatingEmptyMass
()¶
-
getOperatingMass
()¶
-
getStandardEmptyMass
()¶
-
getZeroFuelMass
()¶
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
MisOptData
¶ Bases:
object
Holds mission optimization data, used in ‘MissionDefinition’.
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
MissionComputationFile
¶ Bases:
object
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
-
getAircraftConfiguration
()¶
-
getAircraftPath
()¶
-
getInitialCondition
()¶
-
getOptimizerSettings
()¶
-
getSegment
(idx)¶
-
getSegmentList
()¶
-
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
-
loadFromFile
(filename)¶
-
save
(f)¶
-
saveToFile
(filename, overwrite=False)¶
-
class
pyAPP6.Files.
MissionDefinition
¶ Bases:
object
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
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
MissionSegment
¶ Bases:
object
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
-
getName
()¶
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
NExtReal
¶ Bases:
object
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)
-
readASCII
(f, full=False)¶
-
readASCIILimited
(f)¶
-
writeASCII
(f, full=False)¶
-
writeASCIILimited
(f)¶
-
xx
¶
-
class
pyAPP6.Files.
PerformanceChartFile
¶ Bases:
object
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
-
getAircraftConfiguration
()¶
-
getAircraftPath
()¶
-
getComputation
()¶
-
getInitialCondition
()¶
-
load
(f)¶
-
loadFromFile
(filename)¶
-
save
(f)¶
-
saveToFile
(filename, overwrite=False)¶
-
class
pyAPP6.Files.
PointPerfHelper
¶ Bases:
object
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.
-
class
pyAPP6.Files.
PointPerfSolver
¶ Bases:
object
Base class for a performance chart (PerformanceChartFile) type. Do not use directly, use the class ‘PointPerfHelper’ to generate child classes.
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PointSolveAltSEP
¶ Bases:
pyAPP6.Files.PointPerfSolver
‘SEP Chart (Altitude)’ performance chart type, used in ‘PerformanceChartFile’
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PointSolveAltTurnRate
¶ Bases:
pyAPP6.Files.PointPerfSolver
‘Turn-Rate Chart (Altitude)’ performance chart type, used in ‘PerformanceChartFile’
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PointSolveLFEnvelope
¶ Bases:
pyAPP6.Files.PointPerfSolver
‘G-Envelope’ performance chart type, used in ‘PerformanceChartFile’
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PointSolveParaStudy
¶ Bases:
pyAPP6.Files.PointPerfSolver
‘Point Performance Computation’ performance chart type, used in ‘PerformanceChartFile’
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PointSolveSEPEnvelope
¶ Bases:
pyAPP6.Files.PointPerfSolver
‘SEP-Envelope’ performance chart type, used in ‘PerformanceChartFile’
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PointSolveSEPTurnRate
¶ Bases:
pyAPP6.Files.PointPerfSolver
‘Turn-Rate Chart (SEP)’ performance chart type, used in ‘PerformanceChartFile’
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PointSolveThrustDrag
¶ Bases:
pyAPP6.Files.PointPerfSolver
‘Thrust and Drag’ performance chart type, used in ‘PerformanceChartFile’
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
ProjectAircraft
¶ Bases:
object
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
-
getConfigurationNames
()¶
-
getStoreConfiguration
(idx)¶
-
getStoreConfigurationNames
()¶
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
ProjectAircraftSetting
¶ Bases:
object
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’
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PropFuel
¶ Bases:
object
Class used in ‘PropPropulsionData’, holds fuel flow data
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PropPropulsionData
¶ Bases:
pyAPP6.Files.PropulsionData
Class used in ‘AircraftModel’, holds propeller propulsion data
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PropThrust
¶ Bases:
object
Class used in ‘PropPropulsionData’, holds propeller and power data
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
PropulsionData
¶ Bases:
object
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.
ResArrayData
¶ Bases:
object
Holds data for ranges used in performance charts (‘PointPerfSolver’)
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
Store
¶ Bases:
object
Class used in ‘AircraftModel’, holds store data
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
StoreData
¶ Bases:
object
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)
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
StoreDataList
¶ Bases:
object
Holds a list of StoreData. Used in ProjectAircraft and ProjectAircraftSetting.
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
TOLParameter
¶ Bases:
object
Class used in the ‘Config’ (Mass&Limits) class for the ‘AircraftModel’
Variables: -
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
Text
¶ Bases:
object
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
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
VariationData
¶ Bases:
object
Holds mission variation data, used in ‘MissionComputationFile’.
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
-
class
pyAPP6.Files.
X0Table
¶ Bases:
object
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
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
X1Table
¶ Bases:
object
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
-
readASCII
(f)¶
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
X2Table
(embedded=False)¶ Bases:
object
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
-
readASCII
(f)¶
-
remove
(i)¶ Remove table of index i
-
writeASCII
(f)¶
-
class
pyAPP6.Files.
X3Table
¶ Bases:
object
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
-
readASCII
(f)¶
-
remove
(i)¶ Remove table of index i
-
writeASCII
(f)¶
-
pyAPP6.Files.
getnextline
(f)¶
-
pyAPP6.Files.
getnextline_ex
(f)¶
-
pyAPP6.Files.
readFileVersion
(f)¶
-
pyAPP6.Files.
readFloat
(f)¶
-
pyAPP6.Files.
readInteger
(f)¶
-
pyAPP6.Files.
readLabel
(f)¶
-
pyAPP6.Files.
readSingleColumn
(f)¶
-
pyAPP6.Files.
readSingleTable
(f)¶
-
pyAPP6.Files.
readString
(f)¶
-
pyAPP6.Files.
readVersion
(f)¶
-
pyAPP6.Files.
readVersionString
(f)¶
-
pyAPP6.Files.
writeFileVersion
(f, name, version)¶
-
pyAPP6.Files.
writeFloat
(f, nr)¶
-
pyAPP6.Files.
writeInteger
(f, nr)¶
-
pyAPP6.Files.
writeLabel
(f, label)¶
-
pyAPP6.Files.
writeSingleColumn
(f, table)¶
-
pyAPP6.Files.
writeSingleTable
(f, table)¶
-
pyAPP6.Files.
writeString
(f, string)¶
-
pyAPP6.Files.
writeVersion
(f, name, version)¶
pyAPP6.Global module¶
This module provides constants and strings as used in APP 6.0
Copyright 2016, ALR
pyAPP6.Mission module¶
This module provides classes for executing APP mission computations and reading the results
Copyright 2016, ALR
-
class
pyAPP6.Mission.
MissionComputation
(APP6Directory='C:\Program Files (x86)\ALR Aerospace\APP 6 Professional Edition')¶ Bases:
object
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
-
getResult
()¶
-
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
¶ Bases:
object
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
-
getSegment
(i)¶
-
getSegmentCount
()¶
-
getSegmentList
()¶
-
getSegmentName
(i)¶
-
getSegmentNameList
()¶
-
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
()¶
-
loadFromFile
(filename)¶
-
class
pyAPP6.Mission.
MissionResultSegment
¶ Bases:
object
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
-
getCount
()¶
-
getData
()¶
-
getName
()¶
-
load
(f)¶
pyAPP6.Performance module¶
This module provides classes for executing APP performance charts computations and reading the results
Copyright 2016, ALR
-
class
pyAPP6.Performance.
PerformanceChart
(APP6Directory='C:\Program Files (x86)\ALR Aerospace\APP 6 Professional Edition')¶ Bases:
object
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-
getResult
()¶
-
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
¶ Bases:
object
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
¶ Bases:
object
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)
-
getData
()¶
-
getLabel
()¶
-
getValue
()¶
-
load
(f)¶ This function is called by the PerformanceChartResult class, do not use directly. Reads a line from the file handle f.
pyAPP6.Units module¶
This module provides unit conversion factors as used in APP
Copyright 2016, ALR
Module contents¶
pyAPP6 Python package to interface with the ALR Aircraft Performance Program APP (TM)
- ALR: http://www.alr-aerospace.ch/
- Documentation: http://aircraftperformance.software/pyapp6/
Copyright 2017, ALR