Struct DutyCycle
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
ActiveUsulongHow long the node stays awake each period, in microseconds.
SleepUsulongHow 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
Fraction
Gets the share of the period spent awake, from 0 through 1.
public float Fraction { get; }
Property Value
PeriodUs
Gets the whole period, awake plus asleep, in microseconds.
public ulong PeriodUs { get; }
Property Value
SleepUs
How long it sleeps each period, in microseconds.
public ulong SleepUs { get; init; }
Property Value
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
periodUsulongThe whole period, in microseconds.
fractionfloatThe share spent awake, clamped to 0 through 1.
Returns
- DutyCycle
The duty cycle.