Skip to main content
Glama

uav_energy_estimate

Calculate UAV flight time and energy consumption using configuration parameters and mission profiles for mission planning.

Instructions

Estimate UAV flight time and energy consumption for mission planning.

Args: uav_config: UAV configuration parameters battery_config: Battery configuration parameters mission_profile: Optional mission profile parameters

Returns: Formatted string with energy analysis results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uav_configYes
battery_configYes
mission_profileNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'uav_energy_estimate' tool. It validates inputs using Pydantic models, calls the core estimation logic from integrations, and formats a detailed human-readable output with recommendations and JSON data.
    def uav_energy_estimate(
        uav_config: dict, battery_config: dict, mission_profile: dict | None = None
    ) -> str:
        """Estimate UAV flight time and energy consumption for mission planning.
    
        Args:
            uav_config: UAV configuration parameters
            battery_config: Battery configuration parameters
            mission_profile: Optional mission profile parameters
    
        Returns:
            Formatted string with energy analysis results
        """
        try:
            from ..integrations.propellers import (
                BatteryConfiguration,
                UAVConfiguration,
            )
            from ..integrations.propellers import (
                uav_energy_estimate as _energy_estimate,
            )
    
            # Create configuration objects
            uav = UAVConfiguration(**uav_config)
            battery = BatteryConfiguration(**battery_config)
            mission = mission_profile or {}
    
            # Run analysis
            result = _energy_estimate(uav, battery, mission)
    
            # Determine aircraft type
            aircraft_type = "Fixed-Wing" if uav.wing_area_m2 else "Multirotor"
    
            # Format response
            result_lines = [
                f"UAV Energy Analysis ({aircraft_type})",
                "=" * 45,
                f"Aircraft Mass: {uav.mass_kg:.1f} kg",
                f"Battery: {battery.capacity_ah:.1f} Ah @ {battery.voltage_nominal_v:.1f}V ({battery.mass_kg:.2f} kg)",
            ]
    
            if uav.wing_area_m2:
                result_lines.extend(
                    [
                        f"Wing Area: {uav.wing_area_m2:.2f} m²",
                        f"Wing Loading: {uav.mass_kg * 9.81 / uav.wing_area_m2:.1f} N/m²",
                    ]
                )
            elif uav.disk_area_m2:
                result_lines.extend(
                    [
                        f"Rotor Disk Area: {uav.disk_area_m2:.2f} m²",
                        f"Disk Loading: {uav.mass_kg * 9.81 / uav.disk_area_m2:.1f} N/m²",
                    ]
                )
    
            result_lines.extend(
                [
                    "",
                    "Energy Analysis:",
                    f"  Battery Energy: {result.battery_energy_wh:.0f} Wh",
                    f"  Usable Energy: {result.energy_consumed_wh:.0f} Wh",
                    f"  Power Required: {result.power_required_w:.0f} W",
                    f"  System Efficiency: {result.efficiency_overall:.1%}",
                    "",
                    "Mission Performance:",
                    f"  Flight Time: {result.flight_time_min:.1f} minutes ({result.flight_time_min / 60:.1f} hours)",
                ]
            )
    
            if result.range_km:
                result_lines.append(f"  Range: {result.range_km:.1f} km")
    
            if result.hover_time_min:
                result_lines.append(f"  Hover Time: {result.hover_time_min:.1f} minutes")
    
            # Add recommendations
            result_lines.extend(["", "Recommendations:"])
    
            if result.flight_time_min < 10:
                result_lines.append(
                    "  ⚠ Very short flight time - consider larger battery or lighter aircraft"
                )
            elif result.flight_time_min < 20:
                result_lines.append(
                    "  ⚠ Short flight time - optimize for efficiency or add battery capacity"
                )
            elif result.flight_time_min > 120:
                result_lines.append(
                    "  ✓ Excellent endurance - well optimized configuration"
                )
            else:
                result_lines.append("  ✓ Good flight time for mission requirements")
    
            if result.efficiency_overall < 0.7:
                result_lines.append("  ⚠ Low system efficiency - check motor/ESC selection")
            else:
                result_lines.append("  ✓ Good system efficiency")
    
            # Add JSON data
            json_data = json.dumps(
                {
                    "flight_time_min": result.flight_time_min,
                    "range_km": result.range_km,
                    "hover_time_min": result.hover_time_min,
                    "power_required_w": result.power_required_w,
                    "energy_consumed_wh": result.energy_consumed_wh,
                    "battery_energy_wh": result.battery_energy_wh,
                    "efficiency_overall": result.efficiency_overall,
                },
                indent=2,
            )
            result_lines.extend(["", "JSON Data:", json_data])
    
            return "\n".join(result_lines)
    
        except ImportError:
            return "UAV energy analysis not available - install propulsion packages"
        except Exception as e:
            logger.error(f"UAV energy analysis error: {str(e)}", exc_info=True)
            return f"UAV energy analysis error: {str(e)}"
  • Registration of the uav_energy_estimate tool with the FastMCP server.
    mcp.tool(uav_energy_estimate)
  • Pydantic models defining input schemas (UAVConfiguration, BatteryConfiguration) and output schema (EnergyAnalysisResult) used for validation and type hints in the tool.
    class UAVConfiguration(BaseModel):
        """UAV configuration parameters."""
    
        mass_kg: float = Field(..., gt=0, description="Total UAV mass in kg")
        wing_area_m2: float | None = Field(
            None, gt=0, description="Wing area for fixed-wing"
        )
        disk_area_m2: float | None = Field(
            None, gt=0, description="Total rotor disk area for multirotor"
        )
        cd0: float = Field(0.03, ge=0, description="Zero-lift drag coefficient")
        cl_cruise: float | None = Field(
            None, description="Cruise lift coefficient for fixed-wing"
        )
        num_motors: int = Field(1, ge=1, le=8, description="Number of motors/propellers")
        motor_efficiency: float = Field(0.85, gt=0, le=1, description="Motor efficiency")
        esc_efficiency: float = Field(0.95, gt=0, le=1, description="ESC efficiency")
    
    
    class BatteryConfiguration(BaseModel):
        """Battery pack configuration."""
    
        capacity_ah: float = Field(..., gt=0, description="Battery capacity in Amp-hours")
        voltage_nominal_v: float = Field(..., gt=0, description="Nominal voltage")
        mass_kg: float = Field(..., gt=0, description="Battery mass in kg")
        energy_density_wh_kg: float = Field(
            150, gt=0, description="Energy density in Wh/kg"
        )
        discharge_efficiency: float = Field(
            0.95, gt=0, le=1, description="Discharge efficiency"
        )
    
    
    class EnergyAnalysisResult(BaseModel):
        """UAV energy analysis results."""
    
        flight_time_min: float = Field(..., description="Estimated flight time in minutes")
        range_km: float | None = Field(None, description="Range in km (for fixed-wing)")
        hover_time_min: float | None = Field(
            None, description="Hover time in minutes (for multirotor)"
        )
        power_required_w: float = Field(..., description="Average power required")
        energy_consumed_wh: float = Field(..., description="Energy consumed")
        battery_energy_wh: float = Field(..., description="Available battery energy")
        efficiency_overall: float = Field(..., description="Overall propulsive efficiency")
  • Core implementation of the energy estimation algorithm, performing atmospheric corrections, aircraft-specific power calculations (fixed-wing vs multirotor), battery energy assessment, and returning structured results. Called by the main handler.
    def uav_energy_estimate(
        uav_config: UAVConfiguration,
        battery_config: BatteryConfiguration,
        mission_profile: dict[str, float],
        propeller_geometry: PropellerGeometry | None = None,
    ) -> EnergyAnalysisResult:
        """
        Estimate UAV endurance and energy consumption.
    
        Args:
            uav_config: UAV configuration parameters
            battery_config: Battery configuration
            mission_profile: Mission parameters (velocity, altitude, etc.)
            propeller_geometry: Optional propeller geometry for detailed analysis
    
        Returns:
            EnergyAnalysisResult with flight time and energy analysis
        """
        velocity_ms = mission_profile.get("velocity_ms", 15.0)
        altitude_m = mission_profile.get("altitude_m", 100.0)
    
        # Calculate atmospheric conditions
        if altitude_m < 11000:
            temp = 288.15 - 0.0065 * altitude_m
            pressure = 101325 * (temp / 288.15) ** 5.256
        else:
            temp = 216.65
            pressure = 22632 * math.exp(-0.0001577 * (altitude_m - 11000))
    
        rho = pressure / (287.04 * temp)
    
        # Determine aircraft type and power requirements
        if uav_config.disk_area_m2:
            # Multirotor analysis
            power_required_w = _multirotor_power_analysis(uav_config, velocity_ms, rho)
        elif uav_config.wing_area_m2 and uav_config.cl_cruise:
            # Fixed-wing analysis
            power_required_w = _fixed_wing_power_analysis(uav_config, velocity_ms, rho)
        else:
            # Generic power estimation
            power_required_w = _generic_power_estimate(uav_config, velocity_ms)
    
        # Apply system efficiencies
        power_electrical_w = power_required_w / (
            uav_config.motor_efficiency * uav_config.esc_efficiency
        )
    
        # Battery analysis
        battery_energy_wh = battery_config.capacity_ah * battery_config.voltage_nominal_v
        usable_energy_wh = (
            battery_energy_wh * battery_config.discharge_efficiency * 0.9
        )  # 90% depth of discharge for UAV applications (more aggressive than automotive)
    
        # Flight time estimation
        flight_time_hours = usable_energy_wh / power_electrical_w
        flight_time_min = flight_time_hours * 60
    
        # Range estimation (for fixed-wing)
        range_km = None
        hover_time_min = None
    
        if uav_config.wing_area_m2:
            range_km = velocity_ms * flight_time_hours * 3.6  # Convert m/s·h to km
        else:
            hover_time_min = flight_time_min  # For multirotor, flight time = hover time
    
        return EnergyAnalysisResult(
            flight_time_min=flight_time_min,
            range_km=range_km,
            hover_time_min=hover_time_min,
            power_required_w=power_required_w,
            energy_consumed_wh=usable_energy_wh,
            battery_energy_wh=battery_energy_wh,
            efficiency_overall=uav_config.motor_efficiency * uav_config.esc_efficiency,
        )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool 'Estimates' and 'Returns a formatted string', but doesn't describe computational complexity, accuracy, assumptions, error handling, or side effects. For a tool with complex inputs and no annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and well-structured. It starts with a clear purpose statement, followed by labeled sections for 'Args' and 'Returns'. There's no unnecessary verbosity, though the parameter sections could be more informative given the lack of schema descriptions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (3 parameters with nested objects, no annotations, but has an output schema), the description is partially complete. It states the purpose and return format, but lacks details on parameter semantics, behavioral traits, and usage guidelines. The output schema existence means the description doesn't need to explain return values, but other gaps remain significant.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter documentation. The description lists parameter names ('uav_config', 'battery_config', 'mission_profile') and states they are 'configuration parameters' or 'mission profile parameters', but doesn't explain what these parameters contain, their expected structure, units, or typical values. This minimal information doesn't adequately compensate for the complete lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Estimate UAV flight time and energy consumption for mission planning.' It specifies the verb ('Estimate'), resource ('UAV flight time and energy consumption'), and context ('for mission planning'). However, it doesn't explicitly differentiate from sibling tools like 'plan_flight' or 'get_aircraft_performance', which might have overlapping aerospace applications.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'plan_flight' or 'get_aircraft_performance' that might be related, nor does it specify prerequisites, constraints, or typical use cases beyond the generic 'mission planning' context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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