ChannelState

data class ChannelState(val id: String, val pollPeriod: Int, val energy: Long = 0, val maxVoltage: Int? = null, val minVoltage: Int? = null, val cumulativeVoltage: Long = 0, val maxCurrent: Int? = null, val minCurrent: Int? = null, val cumulativeCurrent: Long = 0, val maxPower: Int? = null, val minPower: Int? = null, val cumulativePower: Long = 0, val errorCount: Long = 0, val readCount: Long = 0, val latestEvent: MeterReading? = null)

Keeps track of channel state. Units in millis mW, mV, mA Units in micros: µJ

Note that the energy reading is signed and can store up to 2^63-1 µJ. Another limitation comes from the fact that numbers in JavaScript are represented by 64-bit floats with a 53-bit mantissa. The fractions of a joule consume 20 bits. There's 33 bits left. Thus, we can measure a 2000W device up to 24 days.

Constructors

Link copied to clipboard
constructor(id: String, pollPeriod: Int, energy: Long = 0, maxVoltage: Int? = null, minVoltage: Int? = null, cumulativeVoltage: Long = 0, maxCurrent: Int? = null, minCurrent: Int? = null, cumulativeCurrent: Long = 0, maxPower: Int? = null, minPower: Int? = null, cumulativePower: Long = 0, errorCount: Long = 0, readCount: Long = 0, latestEvent: MeterReading? = null)

Properties

Link copied to clipboard

Cumulative current reading

Link copied to clipboard

Cumulative power reading

Link copied to clipboard

Cumulative voltage, used for calculating averages

Link copied to clipboard
val energy: Long = 0

Cumulative energy reading during the observation period (µJ)

Link copied to clipboard
val errorCount: Long = 0

Number of observed read errors during the observation period

Link copied to clipboard
val id: String

Channel id, must be equal to one of channel ids in PowerMeter metadata

Link copied to clipboard

Latest meter event for this channel during the observation period

Link copied to clipboard
val maxCurrent: Int? = null

Highest encountered current value during this observation period if any

Link copied to clipboard
val maxPower: Int? = null

Highest encountered power value during this observation period if any

Link copied to clipboard
val maxVoltage: Int? = null

Highest encountered voltage value during this observation period if any

Link copied to clipboard
val minCurrent: Int? = null

Lowest encountered current value during this observation period if any

Link copied to clipboard
val minPower: Int? = null

Lowest encountered power value during this observation period if any

Link copied to clipboard
val minVoltage: Int? = null

Lowest encountered voltage value during this observation period if any

Link copied to clipboard

Meter's poll period

Link copied to clipboard
val readCount: Long = 0

Number of observed events during the observation period

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard