Class Rrd4jSupplier

java.lang.Object
io.openems.edge.timedata.rrd4j.Rrd4jSupplier

public class Rrd4jSupplier extends Object
  • Constructor Details

    • Rrd4jSupplier

      protected Rrd4jSupplier(org.rrd4j.core.RrdBackendFactory factory)
    • Rrd4jSupplier

      public Rrd4jSupplier()
  • Method Details

    • getRrdDb

      public org.rrd4j.core.RrdDb getRrdDb(String rrdDbId, ChannelAddress channelAddress, Unit channelUnit, long startTime) throws IOException
      Gets the RRD4j database for the given Channel-Address.

      The predefined RRD4J archives match the requirements of CommonTimedataService.calculateResolution(ZonedDateTime, ZonedDateTime)

      Parameters:
      rrdDbId - the id of the rrd4j database
      channelAddress - the Channel-Address
      channelUnit - the Unit
      startTime - the starttime for newly created RrdDbs
      Returns:
      the RrdDb
      Throws:
      IOException - on error
    • getExistingUpdatedRrdDb

      public org.rrd4j.core.RrdDb getExistingUpdatedRrdDb(String rrdDbId, ChannelAddress channelAddress, Unit channelUnit) throws IOException
      Gets an existing and updated RrdDb. If the found RrdDb is not on the current version it gets updated.
      Parameters:
      rrdDbId - the id of the RrdDb
      channelAddress - the address of the RrdDb
      channelUnit - the unit of the channel
      Returns:
      the RrdDb or null if not existing
      Throws:
      IOException - on IO-Error
    • getDsDefForChannel

      public static ChannelDef getDsDefForChannel(Unit channelUnit)
      Defines the datasource properties for a given Channel, i.e. min/max allowed value and GAUGE vs. COUNTER type.
      Parameters:
      channelUnit - the Unit
      Returns:
      the DsDef
    • postProcessData

      public static double[] postProcessData(org.rrd4j.core.FetchData data, long resolution) throws IOException, IllegalArgumentException
      Post-Process the received data.

      This mainly makes sure the data has the correct resolution.

      Parameters:
      data - the RRD4j FetchData
      resolution - the resolution in seconds
      Returns:
      the result array
      Throws:
      IOException - on error
      IllegalArgumentException - on error