Tudat/Astrodynamics/Aerodynamics/flightConditions.cpp
//! Function to (compute and) retrieve the value of an independent variable of aerodynamic coefficients
Function to (compute and) retrieve the value of an independent variable of aerodynamic coefficients
Function to ( compute and ) retrieve the value of an independent variable of aerodynamic coefficients
double AtmosphericFlightConditions::getAerodynamicCoefficientIndependentVariable(
        const AerodynamicCoefficientsIndependentVariables independentVariableType,
        const std::string& secondaryIdentifier )
{
    double currentIndependentVariable;
    switch( independentVariableType )
    {
    case mach_number_dependent:
        currentIndependentVariable = getCurrentMachNumber( );
        break;
    case angle_of_attack_dependent:
        if( aerodynamicAngleCalculator_== nullptr )
        {
            throw std::runtime_error( "Error, aerodynamic angle calculator is nullptr, but require angle of attack" );
        }
        currentIndependentVariable = aerodynamicAngleCalculator_->getAerodynamicAngle(
                    reference_frames::angle_of_attack );
        break;
    case angle_of_sideslip_dependent:
        if( aerodynamicAngleCalculator_== nullptr )
        {
            throw std::runtime_error( "Error, aerodynamic angle calculator is nullptr, but require angle of sideslip" );
        }
        currentIndependentVariable = aerodynamicAngleCalculator_->getAerodynamicAngle(
                    reference_frames::angle_of_sideslip );
        break;
    case altitude_dependent:
        if( aerodynamicAngleCalculator_== nullptr )
        {
            throw std::runtime_error( "Error, aerodynamic angle calculator is nullptr, but require angle of sideslip" );
        }
        currentIndependentVariable = getCurrentAltitude( );
        break;
    case control_surface_deflection_dependent:
    {
        try
        {
            currentIndependentVariable = controlSurfaceDeflectionFunction_( secondaryIdentifier );
        }
        catch( std::runtime_error )
        {
            throw std::runtime_error( "Error, control surface " + secondaryIdentifier + "not recognized when updating coefficients" );
        }
        break;
    }
    default:
        if( customCoefficientDependencies_.count( independentVariableType ) == 0 )
        {
            throw std::runtime_error( "Error, did not recognize aerodynamic coefficient dependency "
                                      + std::to_string( independentVariableType ) );
        }
        else
        {
            currentIndependentVariable = customCoefficientDependencies_.at( independentVariableType )( );
        }
    }
    return currentIndependentVariable;
}
double AtmosphericFlightConditions :: getAerodynamicCoefficientIndependentVariable ( const AerodynamicCoefficientsIndependentVariables independentVariableType , const std :: string & secondaryIdentifier ) { double currentIndependentVariable ; switch ( independentVariableType ) { case mach_number_dependent : currentIndependentVariable = getCurrentMachNumber ( ) ; break ; case angle_of_attack_dependent : if ( aerodynamicAngleCalculator_ == nullptr ) { throw std :: runtime_error ( " " ) ; } currentIndependentVariable = aerodynamicAngleCalculator_ -> getAerodynamicAngle ( reference_frames :: angle_of_attack ) ; break ; case angle_of_sideslip_dependent : if ( aerodynamicAngleCalculator_ == nullptr ) { throw std :: runtime_error ( " " ) ; } currentIndependentVariable = aerodynamicAngleCalculator_ -> getAerodynamicAngle ( reference_frames :: angle_of_sideslip ) ; break ; case altitude_dependent : if ( aerodynamicAngleCalculator_ == nullptr ) { throw std :: runtime_error ( " " ) ; } currentIndependentVariable = getCurrentAltitude ( ) ; break ; case control_surface_deflection_dependent : { try { currentIndependentVariable = controlSurfaceDeflectionFunction_ ( secondaryIdentifier ) ; } catch ( std :: runtime_error ) { throw std :: runtime_error ( " " + secondaryIdentifier + " " ) ; } break ; } default : if ( customCoefficientDependencies_ . count ( independentVariableType ) == 0 ) { throw std :: runtime_error ( " " + std :: to_string ( independentVariableType ) ) ; } else { currentIndependentVariable = customCoefficientDependencies_ . at ( independentVariableType ) ( ) ; } } return currentIndependentVariable ; }
Function to (compute and) retrieve the value of an independent variable of aerodynamic coefficients
Function to ( compute and ) retrieve the value of an independent variable of aerodynamic coefficients
//Calculate Mach number if needed. //Get angle of attack if needed. //Get angle of sideslip if needed.