Pamoja.Power
0.1.17
dotnet add package Pamoja.Power --version 0.1.17
NuGet\Install-Package Pamoja.Power -Version 0.1.17
<PackageReference Include="Pamoja.Power" Version="0.1.17" />
<PackageVersion Include="Pamoja.Power" Version="0.1.17" />
<PackageReference Include="Pamoja.Power" />
paket add Pamoja.Power --version 0.1.17
#r "nuget: Pamoja.Power, 0.1.17"
#:package Pamoja.Power@0.1.17
#addin nuget:?package=Pamoja.Power&version=0.1.17
#tool nuget:?package=Pamoja.Power&version=0.1.17
Pamoja.Power
Duty cycling and an energy-aware governor that stretches work as the battery drains. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
dotnet add package Pamoja.Power
using Pamoja.Power;
This pulls in Pamoja.Native, the compiled engine. dotnet add package Pamoja is the whole framework in one package.
Example
The guide project's example, spliced here as it ran in CI.
From bindings/dotnet/samples/Pamoja.Guides/PowerGuide.cs:
// A solar node samples every minute while the charge is healthy, stretches to ten
// minutes to conserve, and to an hour once the battery is nearly flat. Durations
// cross the binding as microseconds.
PowerPlan plan = PowerPlan.Create(60_000_000, 600_000_000, 3_600_000_000);
// The default thresholds enter saver mode below 50% charge and critical below 20%.
foreach (float charge in new[] { 0.80f, 0.35f, 0.12f })
{
ulong every = plan.IntervalUs(charge) / 1_000_000;
Console.WriteLine(
$"at {charge * 100:F0}% charge: {plan.Mode(charge)}, sampling every {every}s");
}
// A panel that is delivering buys back one mode, so the same flat battery keeps
// reporting on the ten-minute saver cadence while the sun is on it.
PowerMode charging = plan.ModeWhileCharging(0.12f, true);
Console.WriteLine($"the same flat battery, while charging: {charging}");
// The work is the same two seconds whichever mode the node is in; stretching the
// cycle is what saves the energy. The duty fraction is the proxy for average draw,
// so the hourly cadence costs a sixtieth of what the one-minute cadence does.
const ulong AwakeUs = 2_000_000;
var healthy = new DutyCycle(AwakeUs, plan.IntervalUs(0.80f) - AwakeUs);
var flat = new DutyCycle(AwakeUs, plan.IntervalUs(0.12f) - AwakeUs);
Console.WriteLine($"awake {healthy.Fraction * 100:F2}% of the time when healthy");
Console.WriteLine($"awake {flat.Fraction * 100:F3}% of the time when flat");
// Stating the budget as a fraction instead gives the awake time directly.
DutyCycle quarter = DutyCycle.FromFraction(1_000_000, 0.25f);
Console.WriteLine($"a quarter-duty second is {quarter.ActiveUs / 1000}ms awake");
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-power |
reference, docs.rs, install |
| TypeScript | @pamoja/power |
reference, install |
| Python | pamoja-power |
reference, install |
| C# | Pamoja.Power |
reference, install |
Documentation
Pamoja.Powerreference, every type in this namespace.- The Power guide, with the same example in Rust, TypeScript, and Python.
- Every capability, and the install page.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Pamoja.Native (>= 0.1.17)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Pamoja.Power:
| Package | Downloads |
|---|---|
|
Pamoja.Profile
Named, ready-to-run device profiles from plain data or a JSON manifest. |
|
|
Pamoja
The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones. |
|
|
Pamoja.Trust
Trust and operation: Proving what a node did, saying it in confidence, fixing it in the field, and deciding how often it can afford to do any of that. |
GitHub repositories
This package is not used by any popular GitHub repositories.