Skip to main content
All calculations in this module follow ASABE D497.7 standards and academic research from Prof. Chaparro’s agricultural engineering methodology.

Overview

The MaqAgr API implements sophisticated power loss calculations that determine the actual available power of a tractor under real working conditions. The system accounts for six major loss factors:
  • Altitude Loss: Reduced air density at higher elevations
  • Temperature Loss: Engine efficiency decrease in hot climates
  • Transmission Loss: Mechanical friction losses (default 13%)
  • Rolling Resistance: Soil-dependent friction forces
  • Slope Loss: Gravitational resistance on inclined terrain
  • Slippage Loss: Power lost to wheel slippage

The Physics Behind Power Loss

Conversion Factor

All calculations use the standard conversion factor:
1 HP = 274.4 kgf·m/s
This constant (from the source paper) converts mechanical work (force × velocity) to horsepower.

Loss Cascade

Power losses occur in a cascading sequence:
1

Atmospheric Losses

Altitude and temperature losses are applied first to the gross engine power:
P_atmospheric = P_gross - L_altitude - L_temperature
2

Transmission Loss

Mechanical losses reduce power at the wheels (default 13%):
P_wheels = P_atmospheric × (1 - 0.13)
3

Terrain Losses

Rolling resistance and slope forces consume additional power:
P_before_slip = P_wheels - L_rolling - L_slope
4

Slippage Loss

Final loss from wheel slippage:
P_net = P_before_slip × (1 - slippage%)

1. Altitude Loss

Engine power decreases with altitude due to lower air density (less oxygen). Formula:
L_altitude = P_gross × (altitude_m / 300) × 1%
Rule: Lose 1% power for every 300 meters above sea level. Example:
  • At 1500m altitude with 100 HP engine:
  • Loss = 100 × (1500/300) × 0.01 = 5 HP

2. Temperature Loss

High ambient temperatures reduce engine efficiency. Formula:
L_temp = P_gross × ((T - 15°C) / 5°C) × 1%
Rule: Lose 1% power for every 5°C above 15°C baseline. Example:
  • At 35°C with 100 HP engine:
  • Loss = 100 × ((35-15)/5) × 0.01 = 4 HP

3. Rolling Resistance

The most complex calculation, based on ASABE D497.7 soil cone index. Formula:
μ_r = 1.2/Cn + 0.04

F_rolling = μ_r × W × cos(θ)

P_rolling = (F_rolling × v) / 274.4
Where:
  • Cn = Soil cone index (penetration resistance)
  • W = Total tractor weight (kg)
  • θ = Slope angle (radians)
  • v = Speed (m/s)
Soil Cone Index Values:
Soil TypeCnCondition
Clay (Arcilla)45Hard, sticky
Loam (Franco)35Medium (default)
Sand (Arena)25Loose, low traction
Firm (Firme)50Compacted
Soft (Suave)20Very loose
Example Calculation: Given:
  • Weight: 5000 kg
  • Soil: Clay (Cn=45)
  • Slope: 0° (flat)
  • Speed: 8 km/h = 2.22 m/s
Calculation:
μ_r = 1.2/45 + 0.04 = 0.0667
F_rolling = 0.0667 × 5000 × cos(0°) = 333.5 kgf
P_rolling = (333.5 × 2.22) / 274.4 = 2.70 HP

4. Slope Loss

Gravitational component when climbing. Formula:
F_slope = W × sin(θ)

P_slope = (F_slope × v) / 274.4
Slope Conversion:
θ_degrees = arctan(slope_percent / 100) × (180/π)
Example:
  • Weight: 5000 kg
  • Slope: 10% → 5.71°
  • Speed: 6 km/h = 1.67 m/s
Calculation:
sin(5.71°) = 0.0995
F_slope = 5000 × 0.0995 = 497.5 kgf
P_slope = (497.5 × 1.67) / 274.4 = 3.02 HP
Slope loss is zero for downhill (negative slopes) as the tractor gains gravitational assistance.

5. Slippage Loss

Power wasted when wheels spin without full traction. Formula:
L_slip = P_available × (slippage% / 100)
Typical Slippage Values:
  • 8-12%: Normal conditions, good traction
  • 15-20%: Poor soil conditions
  • 25%+: Critical, indicates equipment mismatch
Example:
  • Available power: 80 HP
  • Slippage: 15%
  • Loss = 80 × 0.15 = 12 HP

API Endpoints

Calculate Power Loss

Calculates all power losses for a tractor-terrain combination.
POST /api/calculations/power-loss
Authentication Required: Bearer token

Request Body

{
  "tractor_id": 1,
  "terrain_id": 1,
  "working_speed_kmh": 7.5,
  "carried_objects_weight_kg": 500,
  "slippage_percent": 10
}
ParameterTypeRequiredDescription
tractor_idintegerYesID of the tractor
terrain_idintegerYesID of the terrain
working_speed_kmhnumberYesOperating speed (km/h)
carried_objects_weight_kgnumberNoAdditional load weight (default: 0)
slippage_percentnumberNoWheel slippage percentage (default: 10)

Response

{
  "success": true,
  "message": "Cálculo realizado con éxito",
  "data": {
    "queryId": 42,
    "tractor": {
      "brand": "John Deere",
      "model": "5075E"
    },
    "terrain": {
      "name": "Parcela Norte",
      "soil_type": "clay"
    },
    "losses": {
      "slope_loss_hp": 3.52,
      "altitude_loss_hp": 2.40,
      "rolling_resistance_loss_hp": 4.18,
      "slippage_loss_hp": 6.23,
      "total_loss_hp": 22.73
    },
    "net_power_hp": 52.27,
    "engine_power_hp": 75.0,
    "efficiency_percentage": 69.69
  }
}
The queryId is stored in the database for historical tracking and can be retrieved later via the history endpoint.

Error Responses

400 Bad Request - Missing required fields:
{
  "success": false,
  "message": "Faltan campos requeridos: tractor_id, terrain_id, working_speed_kmh"
}
404 Not Found - Tractor or terrain not found:
{
  "success": false,
  "message": "Tractor no encontrado"
}

Calculate Minimum Power

Calculates the minimum power required for an implement and classifies tractors by compatibility.
POST /api/calculations/minimum-power
Authentication Required: Bearer token

Request Body

{
  "implement_id": 2,
  "terrain_id": 1,
  "working_depth_m": 0.3
}
ParameterTypeRequiredDescription
implement_idintegerYesID of the implement
terrain_idintegerYesID of the terrain
working_depth_mnumberNoWorking depth override (meters)

Formula

HP_min = HP_base × F_soil × F_slope × F_depth × 1.15
Where:
  • F_soil: Clay=1.3, Loam=1.0, Sandy=0.8, Rocky=1.5
  • F_slope: 1 + (slope_percent / 100) × 0.5
  • F_depth: working_depth_m / 0.25
  • 1.15: 15% safety margin

Tractor Classification

CategoryPower RangeColorDescription
OPTIMAL100-125%🟢 GreenPerfect power match
OVERPOWERED>125%🟡 YellowExcess power, less efficient
INSUFFICIENT<100%🔴 RedNot compatible

Response

{
  "success": true,
  "message": "Cálculo de potencia mínima realizado con éxito",
  "data": {
    "queryId": 43,
    "implement": {
      "id": 2,
      "name": "Arado de discos",
      "brand": "Baldan",
      "type": "plow",
      "power_requirement_hp": 80
    },
    "terrain": {
      "id": 1,
      "name": "Parcela Norte",
      "soil_type": "clay",
      "slope_percentage": 15
    },
    "powerRequirement": {
      "minimum_power_hp": 150.70,
      "calculated_power_hp": 131.04,
      "factors": {
        "basePowerHP": 80,
        "soilFactor": 1.3,
        "slopeFactor": 1.075,
        "depthFactor": 1.2,
        "safetyMargin": 0.15
      }
    },
    "tractorAnalysis": {
      "total_evaluated": 25,
      "summary": {
        "optimal": 3,
        "overpowered": 5,
        "insufficient": 17
      }
    },
    "recommendations": {
      "top_5": [
        {
          "rank": 1,
          "tractor_id": 8,
          "name": "Massey Ferguson 6713",
          "brand": "Massey Ferguson",
          "model": "6713",
          "engine_power_hp": 165,
          "suitability": {
            "score": "OPTIMAL",
            "label": "Óptimo",
            "color": "green",
            "utilizationPercent": 91,
            "isCompatible": true
          }
        }
      ],
      "best_match": {
        "tractor_id": 8,
        "name": "Massey Ferguson 6713",
        "suitability": { "score": "OPTIMAL" }
      }
    }
  }
}

Calculation History

Retrieve the user’s calculation history with pagination and filtering.
GET /api/calculations/history?page=1&limit=10&type=power_loss
Authentication Required: Bearer token

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger10Records per page (max: 100)
typestringallFilter: power_loss, minimum_power, recommendation

Response

{
  "success": true,
  "message": "Historial de cálculos recuperado con éxito",
  "data": {
    "history": [
      {
        "history_id": 12,
        "query_id": 42,
        "action_date": "2026-03-11T14:30:00Z",
        "action_type": "calculation",
        "description": "Cálculo de potencia: John Deere 5075E en Parcela Norte",
        "query_type": "power_loss",
        "status": "completed",
        "entities": {
          "tractor": {
            "name": "John Deere 5075E",
            "brand": "John Deere",
            "model": "5075E"
          },
          "terrain": {
            "name": "Parcela Norte"
          }
        },
        "result_summary": {
          "queryId": 42,
          "netPower": 52.27,
          "efficiency": 69.69
        }
      }
    ],
    "pagination": {
      "current_page": 1,
      "records_per_page": 10,
      "total_records": 47,
      "total_pages": 5,
      "has_next_page": true,
      "has_previous_page": false
    },
    "filters": {
      "user_id": 3,
      "type": "power_loss"
    }
  }
}

Real-World Example

Let’s calculate the net power for a John Deere 6130M (130 HP) operating in challenging conditions: Scenario:
  • Location: Highland farm at 2100m altitude
  • Temperature: 28°C
  • Terrain: 12% slope, clay soil
  • Tractor weight: 6200 kg + 800 kg implement
  • Speed: 6.5 km/h
  • Slippage: 12%
Step-by-Step Calculation:
1

Altitude Loss

L_alt = 130 × (2100/300) × 0.01 = 9.10 HP
2

Temperature Loss

L_temp = 130 × ((28-15)/5) × 0.01 = 3.38 HP
Power after atmospheric losses: 117.52 HP
3

Transmission Loss

L_trans = 117.52 × 0.13 = 15.28 HP
Power at wheels: 102.24 HP
4

Rolling Resistance

Cn = 45 (clay)
μ_r = 1.2/45 + 0.04 = 0.0667
θ = arctan(0.12) = 6.84°
W_total = 6200 + 800 = 7000 kg
v = 6.5/3.6 = 1.81 m/s

F_roll = 0.0667 × 7000 × cos(6.84°) = 463.8 kgf
L_roll = (463.8 × 1.81) / 274.4 = 3.06 HP
5

Slope Loss

F_slope = 7000 × sin(6.84°) = 833.5 kgf
L_slope = (833.5 × 1.81) / 274.4 = 5.50 HP
Power before slippage: 93.68 HP
6

Slippage Loss

L_slip = 93.68 × 0.12 = 11.24 HP
Final Net Power: 82.44 HP
Result Summary:
ComponentHP Lost% of Gross
Altitude9.107.0%
Temperature3.382.6%
Transmission15.2811.8%
Rolling3.062.4%
Slope5.504.2%
Slippage11.248.6%
Total Loss47.5636.6%
Net Power82.4463.4%
This tractor loses over 36% of its rated power under these conditions! Always account for real-world losses when sizing equipment.

Code Reference

The power loss calculation engine is implemented in:
  • Controller: src/controllers/calculationController.js:25 (calculatePowerLoss)
  • Service: src/services/powerLossService.js:294 (calculateTotalLoss)
  • Model: src/models/PowerLoss.js
  • Routes: src/routes/calculation.routes.js:89
Key Functions:
// Calculate all losses in cascade
calculateTotalLoss({
  enginePower: 130,
  altitudeMeters: 2100,
  temperatureC: 28,
  totalWeightKg: 7000,
  soilCn: 45,
  slopePercent: 12,
  speedKmh: 6.5,
  slippagePercent: 12
});
Soil Cone Index Mapping (src/controllers/calculationController.js:15):
const cn = {
  arcilla: 45, clay: 45,
  franco: 35, loam: 35,
  arena: 25, sand: 25,
  firme: 50, firm: 50,
  suave: 20, soft: 20
};

Recommendations

Smart tractor recommendation algorithm

Terrains API

Manage terrain profiles

Tractors API

Tractor catalog operations

ASABE Standards

Official agricultural engineering standards

Build docs developers (and LLMs) love