Models#

Generation of static (i.e. time-invariant) discrete cost models for energy consumption.

Terminology Mapping#

The model uses abstract terminology that maps to domain-specific concepts:

Model term

Aircraft

UAV

AUV

Ground vehicle

height

Flight level

Altitude

Depth

Terrain elevation

weight

Fuel remaining

Battery charge

Battery charge

Fuel/battery level

track point

Distance segment

Distance segment

Distance segment

Road segment

up / down

Climb / descent

Climb / descent

Ascent / descent

Uphill / downhill

speed ratio

Mach number

Airspeed ratio

Water-speed ratio

Vehicle-speed ratio

The “height” dimension represents any discrete state variable that affects energy consumption (altitude, depth, elevation, etc.). The “weight” dimension represents remaining energy (fuel mass, battery charge, etc.) which may itself affect consumption efficiency.

The public API historically used waypoint, mac and climb_matrix. The canonical names are now track_point, unit_speed and up_matrix. The previous public names remain available during a transition period through deprecated aliases.

smart_cruise.models.CLIMB_COST = 100.0#

Deprecated alias for UP_COST.

smart_cruise.models.CRUISE_COST = 20.0#

Default base cost

class smart_cruise.models.CostModel(timings: ndarray, speed_array: ndarray, cruise_matrix: ndarray, up_matrix: ndarray, down_matrix: ndarray, height_gain: float, weight_cost: float)[source]#

Energy consumption and time cost(s) depending on various parameters. All values are expressed in units per track point.

The model is generic and applies to any vehicle with state-dependent energy costs. “Height” represents any discrete state dimension (altitude, depth, elevation, etc.), and “weight” represents remaining energy (fuel, battery charge, etc.).

timings#

Time to travel the track point w.r.t. speed index.

Type:

ndarray

speed_array#

Energy cost to travel the track point w.r.t. speed index.

Type:

ndarray

cruise_matrix#

Base cost w.r.t. track point and height indices.

Type:

ndarray

up_matrix#

Cost to increase height w.r.t. track point and height indices.

Type:

ndarray

down_matrix#

Gain from decreasing height w.r.t. track point and height indices.

Type:

ndarray

height_gain#

Cost reduction w.r.t. height index.

Type:

float

weight_cost#

Cost modifier w.r.t. remaining energy (spare weight).

Type:

float

class smart_cruise.models.CostRandom(n_h=8, n_d=600, n_s=7, s_min=0.6, s_max=0.9, track_point=10.0, unit_speed=0.3403, speed_cost=50.0, cruise_cost=20.0, up_cost=100.0, down_gain=25.0, height_gain=3.0, inverse_weight=4000.0, seed=None, *, waypoint=None, mac=None, climb_cost=None)[source]#

A simple cost model with global parameters and randomized terrain.

Default parameters are tuned for aircraft cruise, but the model generalizes to any vehicle. Adapt parameters for your domain.

Parameters:
  • n_h (int, optional) – Number of height/state steps.

  • n_d (int, optional) – Number of track points.

  • n_s (int, optional) – Number of speed levels.

  • s_min (float, optional) – Minimum speed ratio relative to the reference speed unit.

  • s_max (float, optional) – Maximum speed ratio relative to the reference speed unit.

  • track_point (float, optional) – Track point length (in km).

  • unit_speed (float, optional) – Reference speed unit (Mach 1 in km/s for aircraft).

  • speed_cost (float, optional) – Energy cost coefficient for speed.

  • cruise_cost (float, optional) – Base energy cost per track point.

  • up_cost (float, optional) – Energy cost for increasing height/state.

  • down_gain (float, optional) – Energy recovered when decreasing height/state.

  • height_gain (float, optional) – Efficiency improvement from higher states.

  • inverse_weight (float, optional) – Energy level at which cost increases by 1 unit.

  • waypoint (float, optional) – Deprecated alias for track_point.

  • mac (float, optional) – Deprecated alias for unit_speed.

  • climb_cost (float, optional) – Deprecated alias for up_cost.

  • seed (int, optional) – Random seed for reproducible terrain generation.

smart_cruise.models.DOWN_GAIN = 25.0#

Default downward maneuver gain

smart_cruise.models.HEIGHT_GAIN = 3.0#

Default cost reduction due to height

smart_cruise.models.INVERSE_WEIGHT = 4000.0#

Default weight that increases cost by 1

smart_cruise.models.MAC = 0.3403#

Deprecated alias for UNIT_SPEED.

smart_cruise.models.N_D = 600#

Default number of track points

smart_cruise.models.N_H = 8#

Default number of heights

smart_cruise.models.N_S = 7#

Default number of speeds

smart_cruise.models.SPEED_COST = 50.0#

Default speed cost (additional speed cost is \(S * s^2\))

smart_cruise.models.S_MAX = 0.9#

Default max speed ratio (relative to the reference speed unit)

smart_cruise.models.S_MIN = 0.6#

Default min speed ratio (relative to the reference speed unit)

smart_cruise.models.TRACK_POINT = 10.0#

Default track-point length (in km)

smart_cruise.models.UNIT_SPEED = 0.3403#

Default reference speed unit (Mach 1 for aircraft, in km/s)

smart_cruise.models.UP_COST = 100.0#

Default upward maneuver cost

smart_cruise.models.WAYPOINT = 10.0#

Deprecated alias for TRACK_POINT.