node-anemometer
    Preparing search index...

    Class Anemometer

    Represents an Anemometer device for measuring wind speed using a PCF8583 real-time clock module. This class allows you to read wind speed data, calculate wind speed values, and maintain a history of pulse counts to determine wind speed over time.

    Index

    Constructors

    • Creates an instance of the Anemometer class, which interfaces with a PCF8583 module.

      Parameters

      • calc: (pulses: number, time: number) => WindSpeed

        A function that calculates WindSpeed based on pulse count and time.

      • opts: AnemometerOptions = {}

        Optional configuration options for the Anemometer.

      Returns Anemometer

    Accessors

    • get isReady(): boolean

      Indicator of whether a connection has been established and the data is being read..

      Returns boolean

      true if the connection is ready; otherwise, false.

    Methods

    • Closes the i2c connection and stops the reading process.

      Returns Promise<void>

      A promise that resolves when the connection is successfully closed.

    • Calculates the average wind speed over a specified time period. The average wind speed is computed from the total pulses and the time span of the data records.

      Parameters

      • conditions: TimeCondition = {}

        Optional time conditions to filter the data.

      Returns WindSpeed

      The average wind speed calculated from the data records.

    • Calculates the average wind speed of the past x seconds.

      Parameters

      • time: number

        The offset for which to retrieve wind speed data.

      Returns WindSpeed

      The average WindSpeed data for the specified time.

      Use .getAverageWindSpeed() instead of .getData()

    • Finds the peak wind gust within a specified time period. The peak wind gust is determined by finding the largest increase in pulse values and the corresponding time span.

      Parameters

      • conditions: TimeCondition = {}

        Optional time conditions to filter the data.

      Returns WindSpeed

      The peak wind gust calculated from the data records.

    • Opens the i2c connection and start the reading data.

      Returns Promise<void>

      A promise that resolves when the connection is successfully opened.