Skip to main content

Overview

The tire degradation system models how tire performance deteriorates over race distance, affecting lap times and pit stop strategy. The system includes degradation rates, tire cliff effects, and compound-specific characteristics used in race simulations and ML predictions. Sources: race_engine.py:22-42, feature_engineering_v2.py:26-30

Tire Degradation Constants

TIRE_DEG

Degradation rate in seconds added per lap for each tire compound. Source: race_engine.py:29
TIRE_DEG = {
    "SOFT":   0.085,
    "MEDIUM": 0.050,
    "HARD":   0.028,
    "INTER":  0.060,
    "WET":    0.035,
}
SOFT
float
default:"0.085"
Soft compound: Highest degradation, fastest initial pace
MEDIUM
float
default:"0.050"
Medium compound: Balanced degradation and pace
HARD
float
default:"0.028"
Hard compound: Lowest degradation, slowest initial pace
INTER
float
default:"0.060"
Intermediate: For light rain conditions
WET
float
default:"0.035"
Full wet: For heavy rain, lower degradation due to water cooling
Usage Example:
from race_engine import TIRE_DEG

tire = "SOFT"
laps_on_tire = 15
degradation = TIRE_DEG[tire] * laps_on_tire

print(f"After {laps_on_tire} laps on {tire} tires:")
print(f"Added lap time: +{degradation:.3f}s")
Output:
After 15 laps on SOFT tires:
Added lap time: +1.275s

TIRE_PACE

Base lap time offset (in seconds) compared to optimal pace for each compound. Source: race_engine.py:22
TIRE_PACE = {
    "SOFT":   0.0,
    "MEDIUM": 0.4,
    "HARD":   0.8,
    "INTER":  1.5,
    "WET":    3.0,
}
SOFT
float
default:"0.0"
Optimal pace (baseline)
MEDIUM
float
default:"0.4"
+0.4s slower than soft compound
HARD
float
default:"0.8"
+0.8s slower than soft compound
INTER
float
default:"1.5"
+1.5s slower (in wet conditions)
WET
float
default:"3.0"
+3.0s slower (in heavy rain)
Usage Example:
from race_engine import TIRE_PACE

base_lap_time = 90.0  # seconds
tire = "MEDIUM"

lap_time = base_lap_time + TIRE_PACE[tire]
print(f"Lap time on {tire}: {lap_time:.3f}s")
Output:
Lap time on MEDIUM: 90.400s

TIRE_CLIFF

Lap number after which degradation accelerates exponentially. Source: race_engine.py:36
TIRE_CLIFF = {
    "SOFT":   18,
    "MEDIUM": 28,
    "HARD":   40,
    "INTER":  22,
    "WET":    30,
}
SOFT
int
default:"18"
Soft tires hit performance cliff after 18 laps
MEDIUM
int
default:"28"
Medium tires hit performance cliff after 28 laps
HARD
int
default:"40"
Hard tires hit performance cliff after 40 laps
INTER
int
default:"22"
Intermediate tires hit cliff after 22 laps
WET
int
default:"30"
Wet tires hit cliff after 30 laps
Cliff Effect: After reaching the cliff lap, degradation rate increases by 2.2x.
# From race_engine.py:147-148
cliff = TIRE_CLIFF.get(tire, 25)
age_factor = tire_age if tire_age < cliff else cliff + (tire_age - cliff) * 2.2
Usage Example:
from race_engine import TIRE_DEG, TIRE_CLIFF

tire = "SOFT"
base_deg = TIRE_DEG[tire]
cliff_lap = TIRE_CLIFF[tire]

# Before cliff (lap 15)
lap_15_deg = base_deg * 15
print(f"Lap 15 total degradation: +{lap_15_deg:.3f}s")

# After cliff (lap 25)
laps_past_cliff = 25 - cliff_lap
age_factor = cliff_lap + (laps_past_cliff * 2.2)
lap_25_deg = base_deg * age_factor
print(f"Lap 25 total degradation: +{lap_25_deg:.3f}s")
Output:
Lap 15 total degradation: +1.275s
Lap 25 total degradation: +2.377s

Tire Degradation for Feature Engineering

TIRE_DEGRADATION (V2)

Simplified degradation rates used in machine learning feature engineering. Source: feature_engineering_v2.py:26
TIRE_DEGRADATION = {
    'SOFT': 0.08,
    'MEDIUM': 0.05,
    'HARD': 0.03
}
SOFT
float
default:"0.08"
Soft compound degradation rate for ML features
MEDIUM
float
default:"0.05"
Medium compound degradation rate for ML features
HARD
float
default:"0.03"
Hard compound degradation rate for ML features

Tire Strategy Features

These features are computed in feature_engineering_v2.py for machine learning models.

Starting_Tire

The tire compound used at race start.
Starting_Tire
string
One of: ‘SOFT’, ‘MEDIUM’, ‘HARD’
Distribution:
  • SOFT: 50% probability
  • MEDIUM: 40% probability
  • HARD: 10% probability

Tire_Degradation_Rate

Expected degradation rate in seconds per lap based on starting tire.
Tire_Degradation_Rate
float
Value from TIRE_DEGRADATION dict based on Starting_Tire
Example:
starting_tire = "SOFT"
degradation_rate = TIRE_DEGRADATION[starting_tire]  # 0.08

Optimal_Pit_Lap

Calculated optimal lap to pit based on tire degradation.
Optimal_Pit_Lap
int
Lap number when tire loses approximately 1.6 seconds of pace
Formula:
optimal_pit_lap = int(20 / expected_degradation)
Examples:
  • SOFT (0.08): Lap 250 → Pit around lap 20
  • MEDIUM (0.05): Lap 400 → Pit around lap 28
  • HARD (0.03): Lap 666 → Pit around lap 40
Source: feature_engineering_v2.py:81

Tire_Advantage

Normalized tire performance advantage at race start.
Tire_Advantage
float
Performance multiplier: 1.0 (SOFT), 0.8 (MEDIUM), 0.6 (HARD)
Source: feature_engineering_v2.py:115
tire_advantage = {
    'SOFT': 1.0,
    'MEDIUM': 0.8,
    'HARD': 0.6
}[starting_tire]

Lap Time Calculation

base_lap_time Method

Calculates the lap time for a car considering tire degradation and other factors. Source: race_engine.py:130
def base_lap_time(self, lap, weather, sc_active):
    """Calculate lap time for this lap"""
    base = 90.0   # base lap time in seconds
    
    # Car performance
    base -= (self.car - 0.85) * 12.0
    
    # Driver skill
    eff_skill = self.wet_skill if weather in ["LIGHT_RAIN","HEAVY_RAIN"] else self.skill
    base -= (eff_skill - 0.85) * 8.0
    
    # Tire compound offset
    base += TIRE_PACE.get(self.tire, 0.8)
    
    # Tire degradation
    deg = TIRE_DEG.get(self.tire, 0.05)
    cliff = TIRE_CLIFF.get(self.tire, 25)
    age_factor = self.tire_age if self.tire_age < cliff else cliff + (self.tire_age - cliff) * 2.2
    base += deg * age_factor
    
    # Safety car
    if sc_active:
        base = max(base, 115.0)
    
    # Random variation (±0.4s)
    base += random.gauss(0, 0.4)
    
    return max(base, 82.0)
lap
int
Current lap number
weather
string
Weather condition: “DRY”, “LIGHT_RAIN”, or “HEAVY_RAIN”
sc_active
bool
Whether safety car is deployed
lap_time
float
Calculated lap time in seconds
Example:
from race_engine import CarState

car = CarState("VER", strategy, grid_pos=1, weather="DRY")
car.tire = "SOFT"
car.tire_age = 12

lap_time = car.base_lap_time(lap=12, weather="DRY", sc_active=False)
print(f"Lap {12} time: {lap_time:.3f}s (tire age: {car.tire_age})")
Output:
Lap 12 time: 85.276s (tire age: 12)

Complete Usage Examples

from race_engine import TIRE_DEG, TIRE_PACE, TIRE_CLIFF

def analyze_stint(tire_compound, stint_laps):
    """Analyze tire performance over a stint"""
    base_pace = TIRE_PACE[tire_compound]
    deg_rate = TIRE_DEG[tire_compound]
    cliff = TIRE_CLIFF[tire_compound]
    
    print(f"\n{tire_compound} Tire Analysis ({stint_laps} laps):")
    print(f"Base pace offset: +{base_pace}s")
    print(f"Degradation rate: {deg_rate}s/lap")
    print(f"Performance cliff: Lap {cliff}\n")
    
    for lap in [1, 10, 15, 20, 25]:
        if lap > stint_laps:
            break
        
        if lap < cliff:
            age_factor = lap
        else:
            age_factor = cliff + (lap - cliff) * 2.2
        
        total_deg = deg_rate * age_factor
        lap_time = 90.0 + base_pace + total_deg
        
        print(f"Lap {lap:2d}: {lap_time:.3f}s (deg: +{total_deg:.3f}s)")

# Compare compounds
analyze_stint("SOFT", 20)
analyze_stint("MEDIUM", 28)
analyze_stint("HARD", 35)

Tire Strategy Presets

Predefined race strategies used in simulations. Source: race_engine.py:84
STRATEGIES = {
    "S-M":  {"start": "SOFT",   "pits": [18],       "compounds": ["SOFT",   "MEDIUM"]},
    "M-H":  {"start": "MEDIUM", "pits": [26],       "compounds": ["MEDIUM", "HARD"]},
    "H-M":  {"start": "HARD",   "pits": [34],       "compounds": ["HARD",   "MEDIUM"]},
    "S-M-H":{"start": "SOFT",   "pits": [15, 32],   "compounds": ["SOFT",   "MEDIUM", "HARD"]},
    "M-M":  {"start": "MEDIUM", "pits": [28],       "compounds": ["MEDIUM", "MEDIUM"]},
}

Performance Comparison

Tire Compound Trade-offs:
CompoundBase PaceDeg RateCliff LapBest For
SOFT0.0s0.085s/lapLap 18Qualifying, short stints
MEDIUM+0.4s0.050s/lapLap 28Balanced race strategy
HARD+0.8s0.028s/lapLap 40Long stints, one-stop
INTER+1.5s0.060s/lapLap 22Light rain
WET+3.0s0.035s/lapLap 30Heavy rain

Notes

  • Tire degradation is non-linear: accelerates after the cliff lap
  • Weather conditions significantly impact tire choice and degradation patterns
  • Safety car periods are ideal for pit stops (no time loss relative to field)
  • Undercut strategy: Pitting earlier to gain track position with fresh tires
  • Overcut strategy: Staying out longer to gain time while others pit
  • Real F1 degradation varies by circuit (high/low severity tracks)

Build docs developers (and LLMs) love