Table of Contents

Struct DutyCycle

Namespace
Pamoja.Power
Assembly
Pamoja.Power.dll

The split between the time a node works and the time it sleeps.

public readonly record struct DutyCycle : IEquatable<DutyCycle>
Implements
Inherited Members

Constructors

DutyCycle(ulong, ulong)

The split between the time a node works and the time it sleeps.

public DutyCycle(ulong ActiveUs, ulong SleepUs)

Parameters

ActiveUs ulong

How long the node stays awake each period, in microseconds.

SleepUs ulong

How long it sleeps each period, in microseconds.

Properties

ActiveUs

How long the node stays awake each period, in microseconds.

public ulong ActiveUs { get; init; }

Property Value

ulong

Fraction

Gets the share of the period spent awake, from 0 through 1.

public float Fraction { get; }

Property Value

float

PeriodUs

Gets the whole period, awake plus asleep, in microseconds.

public ulong PeriodUs { get; }

Property Value

ulong

SleepUs

How long it sleeps each period, in microseconds.

public ulong SleepUs { get; init; }

Property Value

ulong

Methods

FromFraction(ulong, float)

Creates a duty cycle that spends a fraction of a period awake.

public static DutyCycle FromFraction(ulong periodUs, float fraction)

Parameters

periodUs ulong

The whole period, in microseconds.

fraction float

The share spent awake, clamped to 0 through 1.

Returns

DutyCycle

The duty cycle.