Skip to main content
Glama

calculate_stability_derivatives

Calculate longitudinal stability derivatives for aircraft wings based on wing configuration and flight conditions to analyze aerodynamic stability.

Instructions

Calculate basic longitudinal stability derivatives for a wing.

Args: wing_config: Wing configuration parameters flight_conditions: Flight conditions

Returns: JSON string with stability derivatives

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wing_configYes
flight_conditionsYes

Implementation Reference

  • The primary handler function for the MCP tool 'calculate_stability_derivatives'. It wraps the core implementation from integrations.aero, handles errors, and returns a formatted JSON string response.
    def calculate_stability_derivatives(wing_config: dict, flight_conditions: dict) -> str:
        """Calculate basic longitudinal stability derivatives for a wing.
    
        Args:
            wing_config: Wing configuration parameters
            flight_conditions: Flight conditions
    
        Returns:
            JSON string with stability derivatives
        """
        try:
            from ..integrations.aero import calculate_stability_derivatives as _stability
    
            result = _stability(wing_config, flight_conditions)
            return json.dumps(result, indent=2)
    
        except ImportError:
            return "Stability analysis not available - install aerodynamics packages"
        except Exception as e:
            logger.error(f"Stability analysis error: {str(e)}", exc_info=True)
            return f"Stability analysis error: {str(e)}"
  • Registration of the 'calculate_stability_derivatives' tool in the FastMCP server.
    mcp.tool(calculate_stability_derivatives)
  • Core implementation of stability derivatives calculation using simplified lifting line theory approximations, including lift curve slope (CL_alpha) and pitching moment slope (CM_alpha). Accepts WingGeometry and flight conditions.
    def calculate_stability_derivatives(
        geometry: WingGeometry, alpha_deg: float = 2.0, mach: float = 0.2
    ) -> StabilityDerivatives:
        """
        Calculate basic longitudinal stability derivatives.
    
        Args:
            geometry: Wing geometry
            alpha_deg: Reference angle of attack
            mach: Mach number
    
        Returns:
            StabilityDerivatives object
        """
        # Calculate wing area and aspect ratio
        S = geometry.span_m * (geometry.chord_root_m + geometry.chord_tip_m) / 2
        AR = geometry.span_m**2 / S
    
        # Get airfoil data
        airfoil_data = AIRFOIL_DATABASE.get(
            geometry.airfoil_root, AIRFOIL_DATABASE["NACA2412"]
        )
    
        # 3D lift curve slope
        e = 0.85  # Oswald efficiency
        beta = math.sqrt(max(0.01, 1 - mach**2))
        CL_alpha_2d = airfoil_data["cl_alpha"]
        CL_alpha = CL_alpha_2d / (1 + CL_alpha_2d / (math.pi * AR * e)) / beta
    
        # Pitching moment slope (simplified)
        # Typically negative for stable aircraft
        CM_alpha = -0.1 * CL_alpha  # Rough approximation
    
        return StabilityDerivatives(
            CL_alpha=CL_alpha,
            CM_alpha=CM_alpha,
            CL_alpha_dot=None,  # Would need unsteady analysis
            CM_alpha_dot=None,
        )
  • Pydantic schema for output stability derivatives (CL_alpha, CM_alpha, etc.).
    class StabilityDerivatives(BaseModel):
        """Longitudinal stability derivatives."""
    
        CL_alpha: float = Field(..., description="Lift curve slope (per radian)")
        CM_alpha: float = Field(..., description="Pitching moment curve slope")
        CL_alpha_dot: float | None = Field(None, description="CL due to alpha rate")
        CM_alpha_dot: float | None = Field(None, description="CM due to alpha rate")
  • Pydantic schema for input wing geometry used in stability derivatives and other aero analyses.
    class WingGeometry(BaseModel):
        """Wing planform geometry definition."""
    
        span_m: float = Field(..., gt=0, description="Wing span in meters")
        chord_root_m: float = Field(..., gt=0, description="Root chord in meters")
        chord_tip_m: float = Field(..., gt=0, description="Tip chord in meters")
        sweep_deg: float = Field(
            0.0, ge=-45, le=45, description="Quarter-chord sweep in degrees"
        )
        dihedral_deg: float = Field(
            0.0, ge=-15, le=15, description="Dihedral angle in degrees"
        )
        twist_deg: float = Field(
            0.0, ge=-10, le=10, description="Geometric twist (tip relative to root)"
        )
        airfoil_root: str = Field("NACA2412", description="Root airfoil name")
        airfoil_tip: str = Field("NACA2412", description="Tip airfoil name")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cheesejaguar/aerospace-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server