Skip to main content

Module power

Module power 

Source
Expand description

The C ABI for power-aware scheduling.

These functions wrap [pamoja_power] for callers that reach the SDK through the flat C boundary: the split between working and sleeping that a duty cycle describes, and the plan that stretches a work interval as a battery falls.

Everything here is arithmetic over scalars, so both types cross by value and nothing allocates. Durations cross as microseconds, which covers intervals from a radio burst to weeks of deep sleep in a 64-bit unsigned integer.

Structs§

PamojaDutyCycle
The split between the time a node works and the time it sleeps.
PamojaPowerPlan
The work intervals a node uses in each mode, and where the modes change.

Enums§

PamojaPowerMode
What a node should be doing at the current state of charge.

Functions§

pamoja_duty_cycle_fraction
Returns the share of a period a duty cycle spends awake.
pamoja_duty_cycle_from_fraction
Creates a duty cycle that spends a fraction of each period awake.
pamoja_duty_cycle_new
Creates a duty cycle from the time awake and the time asleep.
pamoja_duty_cycle_period_us
Returns the whole period of a duty cycle, awake plus asleep.
pamoja_power_plan_interval_for_us
Returns the work interval a plan uses in a mode.
pamoja_power_plan_interval_us
Returns the work interval a plan calls for at a state of charge.
pamoja_power_plan_mode
Returns the mode a plan calls for at a state of charge.
pamoja_power_plan_mode_while_charging
Returns the mode a plan calls for, easing off one step while charging.
pamoja_power_plan_new
Creates a power plan from its three work intervals, with default thresholds.
pamoja_power_plan_with_thresholds
Returns a plan with the state-of-charge thresholds moved.