Skip to main content

pamoja_power_plan_next_mode

Function pamoja_power_plan_next_mode 

Source
#[unsafe(no_mangle)]
pub extern "C" fn pamoja_power_plan_next_mode( plan: PamojaPowerPlan, current: PamojaPowerMode, soc: f32, ) -> PamojaPowerMode
Expand description

Returns the mode a node in a given mode moves to at a new state of charge.

The node drops to a lower mode as soon as the charge falls below its threshold, and climbs to a higher one only once the charge reaches the threshold plus the plan’s hysteresis, so a charge wandering around a threshold does not switch the mode on every reading.

§Arguments

  • plan - the power plan.
  • current - the mode the node is running in.
  • soc - the battery state of charge, from 0.0 through 1.0.

§Returns

The mode the node should run in next.