ChargeWhenLowDisposition

class ChargeWhenLowDisposition @JvmOverloads constructor(val threshold: Double = 0.25, val otherwise: DispositionPolicyIfc = ReturnToHomeBaseDisposition()) : DispositionPolicyIfc(source)

Send the vehicle to charge when it is low, and otherwise do whatever another policy says.

A decorator rather than a rule of its own, because "charge when low" is orthogonal to what a vehicle does with itself the rest of the time: a fleet that gathers at a staging point and a fleet that returns to its own home base both need it, and neither should have to reimplement the other's parking rule to get it.

This is not the guard against running flat. It is consulted only when the dispatcher has no work for the vehicle, so a fleet that is busy enough never reaches it -- and a busy fleet is exactly the one that empties its batteries. Pair it with ChargeReservePolicy, which is what stops a vehicle accepting work it cannot finish.

Parameters

threshold

the fraction of capacity at or below which the vehicle goes to charge

otherwise

what it does when it is not low, or when no charger is reachable

Constructors

Link copied to clipboard
constructor(threshold: Double = 0.25, otherwise: DispositionPolicyIfc = ReturnToHomeBaseDisposition())

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun disposition(vehicle: FleetVehicle): Disposition
Link copied to clipboard
open override fun toString(): String