pterasoftware.analyze_steady_trim()

pterasoftware.analyze_steady_trim(
problem: SteadyProblem,
/,
*,
solver_type: str,
boundsVCg__E: tuple[float | int, float | int],
alpha_bounds: tuple[float | int, float | int],
beta_bounds: tuple[float | int, float | int],
boundsExternalFX_W: tuple[float | int, float | int],
objective_cut_off: float | int = 0.01,
num_calls: int = 100,
) → tuple[float, float, float, float] | tuple[None, None, None, None]

Attempts to calculate a trim condition of a SteadyProblem by varying the operating conditions until the net loads are sufficiently low.

Procedure:

Trim is found by minimizing an objective function that combines the net load coefficients' magnitudes.

The optimization process varies four parameters (vCg__E, alpha, beta, and externalFX_W) within their specified bounds. At each iteration, a steady solver is run to compute aerodynamic loads. These loads are combined with the external loads to compute a net load coefficient.

The function uses a two-stage optimization approach: first attempting a local search using L-BFGS-B, and if that fails to converge, it performs a global search using dual annealing.

The search terminates early if the objective function falls below the specified cutoff value. If no trim condition is found within the maximum number of function calls, the function returns None values and logs a critical error.

Parameters:
  • problem -- The SteadyProblem whose trim condition will be found. It must contain exactly one Airplane, and its OperatingPoint's g_E must be non-zero, since the Airplane's weight is placed along g_E's direction. Trim searches for a level flight equilibrium, so the OperatingPoint's angles_E_to_BP1_izyx must resolve to level flight (leave it unset), and each trial resolves its own attitude to level flight at its alpha and beta. The problem's OperatingPoint will be modified during the trim search.

  • solver_type -- Determines what type of steady solver will be used to analyze the SteadyProblem. The options are "steady horseshoe vortex lattice method" and "steady ring vortex lattice method".

  • boundsVCg__E -- A tuple of two positive numbers (ints or floats), in ascending order, determining the range of speeds of the Airplane's CG (in the Earth frame) to search. The SteadyProblem's OperatingPoint's initial vCg__E must be within these bounds. Values are converted to floats internally. The units are in meters per second.

  • alpha_bounds -- A tuple of two numbers (ints or floats), in ascending order and in the range (-180.0, 180.0], determining the range of angles of attack to search. The SteadyProblem's OperatingPoint's initial alpha must be within these bounds. Values are converted to floats internally. The units are in degrees.

  • beta_bounds -- A tuple of two numbers (ints or floats), in ascending order and in the range (-90.0, 90.0), determining the range of sideslip angles to search. The bounds exclude the poles at -90.0 and 90.0 because the search varies alpha and beta independently, and OperatingPoint only accepts alpha = 0.0 there. The SteadyProblem's OperatingPoint's initial beta must be within these bounds. Values are converted to floats internally. The units are in degrees.

  • boundsExternalFX_W -- A tuple of two numbers (ints or floats), in ascending order, determining the range of external forces (in the wind axes' x direction) to search. The SteadyProblem's OperatingPoint's initial externalFX_W must be within these bounds. Values are converted to floats internally. The units are in Newtons.

  • objective_cut_off -- A positive number (int or float) for the trim search's convergence threshold. When the objective function falls below this value, the search terminates successfully. Lower values result in tighter trim conditions but may require more iterations. Values are converted to floats internally. The default is 0.01.

  • num_calls -- A positive int for the maximum number of objective function evaluations allowed during optimization. This limit applies separately to the local search and global search stages. Higher values allow for more thorough searching but increase computation time. The default is 100.

Returns:

A tuple of four floats representing the trimmed parameters found. In order, they are: vCg__E (in meters per second), alpha (in degrees), beta (in degrees), and externalFX_W (in Newtons). If no trim condition was found, it will instead return a tuple of four Nones.