Package io.openems.edge.timedata.rrd4j
Class Rrd4jSupplier
java.lang.Object
io.openems.edge.timedata.rrd4j.Rrd4jSupplier
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ChannelDef
getDsDefForChannel
(Unit channelUnit) Defines the datasource properties for a given Channel, i.e.org.rrd4j.core.RrdDb
getExistingUpdatedRrdDb
(String rrdDbId, ChannelAddress channelAddress, Unit channelUnit) Gets an existing and updatedRrdDb
.org.rrd4j.core.RrdDb
getRrdDb
(String rrdDbId, ChannelAddress channelAddress, Unit channelUnit, long startTime) Gets the RRD4j database for the given Channel-Address.static double[]
postProcessData
(org.rrd4j.core.FetchData data, long resolution) Post-Process the received data.
-
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 databasechannelAddress
- the Channel-AddresschannelUnit
- theUnit
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 updatedRrdDb
. If the foundRrdDb
is not on the current version it gets updated.- Parameters:
rrdDbId
- the id of the RrdDbchannelAddress
- the address of theRrdDb
channelUnit
- the unit of the channel- Returns:
- the
RrdDb
or null if not existing - Throws:
IOException
- on IO-Error
-
getDsDefForChannel
Defines the datasource properties for a given Channel, i.e. min/max allowed value and GAUGE vs. COUNTER type.- Parameters:
channelUnit
- theUnit
- 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 RRD4jFetchData
resolution
- the resolution in seconds- Returns:
- the result array
- Throws:
IOException
- on errorIllegalArgumentException
- on error
-