Battery

constructor(capacity: Double, chargePerDistance: Double, chargePerTime: Double = 0.0, chargingRate: Double = capacity, initialCharge: Double = capacity)(source)

Parameters

capacity

how much charge the battery holds when full. Must be > 0.

chargePerDistance

charge drawn per unit of distance travelled -- traction. Must be >= 0.

chargePerTime

charge drawn per unit of elapsed time, whatever the vehicle is doing -- hotel load. Zero by default, which recovers a model with no idle draw exactly, so adding this class to a subsystem cannot silently change an existing model.

chargingRate

charge added per unit of time while charging. Must exceed chargePerTime: a charger that cannot outpace the hotel load never fills the battery, and a model configured that way would wait forever rather than fail.

initialCharge

what the battery holds at the start of every replication. Full by default.