DSAeroToolsSim

Packages

Modules

DSAeroToolsSim.PostProcessing module

DSAeroToolsSim.StandardAtmosphere module

Standard Atmosphere Model

DSAeroToolsSim

class DSAeroToolsSim.StandardAtmosphere.StandardAtmosphere(alt, units='SI', verbose=False)

Bases: object

Standard Atmosphere Model

getSoS()

Speed of Sound Calculator

Returns the speed of sound at the StandardAtmosphere instance’s altitude.

Returns:

Speed of sound ‘a’

Return type:

float

gradient(p0, rho0, T0, a, deltaH, g0=9.81, R=287)
isothermal(p0, rho0, deltaH, T, g0=9.81, R=287)
matchRhoToAltitude(rho)

Rho-Altitude Matching

This method finds the altitude corresponding to a given density.

Not used in DSAeroToolsSim

Parameters:

rho (float) – Density

Returns:

Matched altitude

Return type:

float

standardAtmosphere(h, units='SI')

Standard Atmosphere Properties Calculator

This method populates the StandardAtmosphere instance with the properties at the input altitude.

The approach here is as follows:
  • The atmosphere is divided into layers, each represented by the dictionary layerArr

  • The dictionary holds the lower and upper bounds of the layer, the temperature variation type, and the lapse rate

  • The method iterates through the layers to calculate the properties at the target altitude

  • If the target altitude is beyond the layer, the method calculates the properties at the top of the layer

  • The top-of-layer attributes are used as the reference values for the next layer

Parameters:
  • h (float) – Target altitude

  • units (str, optional) – Units string, defaults to “SI”

Returns:

Pressure, Density, Temperature, Dynamic Viscosity

Return type:

float, float, float, float

DSAeroToolsSim.Units module

Units Class

DSAeroToolsSim

class DSAeroToolsSim.Units.Units

Bases: object

Units class for unit definition. Works much like SUAVE’s units class: every computation is done in base units (SI). However, to allow for user input in any unit, constants are defined such that its name holds the conversion factor to the base unit. E.g.

  • `Units.km = 1000` because if a value is defined in km, it must be converted to base units, thus multiplied by 1000

The definition of a wing span of 10 feet, for instance, would be done as:

  • `wing_span = 10 * Units.ft`

Where Units.ft holds the conversion back to base units. This also allows for the easy conversion of compound units. For example:

  • `Sref = 10 * Units.ft**2` would define a reference area of 10 square feet, which would be converted to square meters

  • `Vcruise = 100 * Units.km/Units.hr` would define a cruise speed of 100 km/h, which would be converted to m/s

And so on and so forth.

J = 1
N = 1
W = 1
cal = 4.184
cm = 0.01
day = 86400
deg = 0.017453292500000002
ft = 0.3048
g = 9.81
gal = 0.00378541
grams = 0.001
hp = 745.7
hr = 3600
inch = 0.0254
kJ = 1000
kW = 1000
kcal = 4184
kg = 1
km = 1000
knot = 0.5144444444444445
lb = 0.453592
lbf = 4.44822
lbm = 0.453592
m = 1
m2 = 1
mile = 1609.34
min = 60
mm = 0.001
nmi = 1852
s = 1
slug = 14.5939
unitless = 1

DSAeroToolsSim.Vehicle module

DSAeroToolsSim.Wrapper module

Model Wrapper Abstraction Class

DSAeroToolsSim

class DSAeroToolsSim.Wrapper.Wrapper(directory, model, Vehicle)

Bases: object

Wrapper Abstraction Class

Wrapper is the backbone of any model in DSAeroTools and is inherited by all models.

When the Vehicle is initialized, every model type (e.g. GeometryModel, WeightModel, etc.) is simply a class that inherits from Wrapper.

Wrapper has two main attributes: `directory` and `model`.

Each model type will be initialed with a `directory` appropriate for that model type, where all of the models for that type are stored. E.g.:

`Vehicle.GeometryModel.directory` would print `"DSAeroToolsSim.Models.Geometry"`

A user chooses what model to use by setting the `model` attribute of the Vehicle’s model. E.g.:

` Vehicle.GeometryModel.model = "conventionalGeometry"`

Notice that the name of the model must match the name of the file in the directory. that is:

`DSAeroToolsSim.Models.Geometry.conventionalGeometry` must exist

Notice also that, in the conventionalGeometry.py file, there must exist a function with the same name as the file. that is:

`def conventionalGeometry(Vehicle):` must be declared in that file

This is because of this crucial fact: the models are simply functions that hold the same name as their file, and the functions simply take in a Vehicle and perform operations/calculations on its attributes!

The Wrapper class simply holds the methods to initialize these models, that is, it imports the model and its function, and then calls the function whenever the model is called.

importFunction()

Function Importer

Imports the function from the now-defined `Wrapper._model` attribute

importModel()

Model Importer

Uses `importlib` to import the model under the directory passed to the Wrapper.

The model is stored as an attribute of the Wrapper instance. The name of the model is also stored as an attribute.