ChargeReservePolicy

class ChargeReservePolicy @JvmOverloads constructor(val inner: AssignmentPolicyIfc, val safetyFactor: Double = 1.25) : AssignmentPolicyIfc(source)

Refuses any assignment a vehicle could not finish and still reach a charger.

A decorator: it does not decide anything, it removes proposals another policy made. That keeps the reserve orthogonal to the dispatching rule, which is what it has to be -- nearest-vehicle, least-used and an auction all need the same guard, and none of them should have to know about batteries to get it.

Why this ships with the battery rather than being left to the modeller. A vehicle that runs flat on a guide path does not merely stop working: it stands on the zones it holds for the rest of the replication and obstructs everything routed through them. That is a permanent, silent change to the layout, and a fleet can lose its throughput to it without anything raising.

The reserve covers time as well as distance, and that is the whole difficulty. Reaching a charger costs both traction energy and hotel load, so a reserve computed from distance alone under-reserves exactly when the trip is slow -- which on a guide path means exactly when it is congested. A reserve that was correct for a model with no idle draw becomes incorrect the moment one is added, and it fails in the direction that strands vehicles.

The estimate is a free-running one: distance along the guide path, at the vehicle's last sampled velocity, with no allowance for blocking, re-routing, or a queue at the charger. safetyFactor is what covers all of that, which is why its default is generous rather than tight. A study that wants it tighter should check FleetVehicle.numTimesStranded is still zero.

Parameters

inner

the policy that actually decides

safetyFactor

multiplies the estimated draw. Must be >= 1.0.

Constructors

Link copied to clipboard
constructor(inner: AssignmentPolicyIfc, safetyFactor: Double = 1.25)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun KSLProcessBuilder.assign(context: DispatchContext): List<AssignmentProposal>
Link copied to clipboard
open override fun toString(): String