Class TimedataManagerImpl
java.lang.Object
io.openems.backend.common.component.AbstractOpenemsBackendComponent
io.openems.backend.core.timedatamanager.TimedataManagerImpl
- All Implemented Interfaces:
BackendTimedata
,TimedataManager
,CommonTimedataService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(io.openems.backend.core.timedatamanager.Config config) Activates the component.protected void
addTimedata
(Timedata timedata) SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryFirstValueBefore
(String edgeId, ZonedDateTime date, Set<ChannelAddress> channels) Queries the latest values which are before the givenZonedDateTime
.SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricData
(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) Queries historic data.SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryHistoricEnergy
(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) Queries historic energy.SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricEnergyPerPeriod
(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) Queries historic energy per period.protected void
removeTimedata
(Timedata timedata) void
write
(String edgeId, AggregatedDataNotification data) Sends the data points to the Timedata service.void
write
(String edgeId, ResendDataNotification data) Sends the data points to the Timedata service.void
write
(String edgeId, TimestampedDataNotification data) Sends the data points to the Timedata service.Methods inherited from class io.openems.backend.common.component.AbstractOpenemsBackendComponent
getName, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarn, logWarn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.openems.common.timedata.CommonTimedataService
handleQueryHistoricTimeseriesExportXlxsRequest, queryHistoricData
-
Constructor Details
-
TimedataManagerImpl
public TimedataManagerImpl()
-
-
Method Details
-
addTimedata
-
removeTimedata
-
activate
public void activate(io.openems.backend.core.timedatamanager.Config config) Activates the component.- Parameters:
config
- theConfiguration
-
queryHistoricData
public SortedMap<ZonedDateTime,SortedMap<ChannelAddress, queryHistoricDatacom.google.gson.JsonElement>> (String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsError.OpenemsNamedException Queries historic data.The
TimedataManager
implementation never returns null, but throws an Exception instead- Specified by:
queryHistoricData
in interfaceCommonTimedataService
- Parameters:
edgeId
- the Edge-ID; or null query allfromDate
- the From-DatetoDate
- the To-Datechannels
- the Channelsresolution
- theResolution
- Returns:
- the query result; possibly null
- Throws:
OpenemsError.OpenemsNamedException
-
queryHistoricEnergy
public SortedMap<ChannelAddress,com.google.gson.JsonElement> queryHistoricEnergy(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) throws OpenemsError.OpenemsNamedException Queries historic energy.The
TimedataManager
implementation never returns null, but throws an Exception instead- Specified by:
queryHistoricEnergy
in interfaceCommonTimedataService
- Parameters:
edgeId
- the Edge-ID; or null query allfromDate
- the From-DatetoDate
- the To-Datechannels
- the Channels- Returns:
- the query result; possibly null
- Throws:
OpenemsError.OpenemsNamedException
-
queryHistoricEnergyPerPeriod
public SortedMap<ZonedDateTime,SortedMap<ChannelAddress, queryHistoricEnergyPerPeriodcom.google.gson.JsonElement>> (String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsError.OpenemsNamedException Queries historic energy per period.This is for use-cases where you want to get the energy for each period (with
Resolution
) per Channel, e.g. to visualize energy in a histogram chart. For each period the energy is calculated by subtracting first value of the period from the last value of the period.The
TimedataManager
implementation never returns null, but throws an Exception instead- Specified by:
queryHistoricEnergyPerPeriod
in interfaceCommonTimedataService
- Parameters:
edgeId
- the Edge-ID; or null query allfromDate
- the From-DatetoDate
- the To-Datechannels
- the Channelsresolution
- theResolution
- Returns:
- the query result; possibly null
- Throws:
OpenemsError.OpenemsNamedException
-
queryFirstValueBefore
public SortedMap<ChannelAddress,com.google.gson.JsonElement> queryFirstValueBefore(String edgeId, ZonedDateTime date, Set<ChannelAddress> channels) throws OpenemsError.OpenemsNamedException Description copied from interface:BackendTimedata
Queries the latest values which are before the givenZonedDateTime
.- Specified by:
queryFirstValueBefore
in interfaceBackendTimedata
- Parameters:
edgeId
- the id of the edgedate
- the bounding date exclusivechannels
- the channels- Returns:
- the channel values
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
write
Description copied from interface:BackendTimedata
Sends the data points to the Timedata service.- Specified by:
write
in interfaceBackendTimedata
- Parameters:
edgeId
- The unique Edge-IDdata
- Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as AggregatedData. Sorted by timestamp.
-
write
Description copied from interface:BackendTimedata
Sends the data points to the Timedata service.- Specified by:
write
in interfaceBackendTimedata
- Parameters:
edgeId
- The unique Edge-IDdata
- Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as JsonElement. Sorted by timestamp.
-
write
Description copied from interface:BackendTimedata
Sends the data points to the Timedata service.- Specified by:
write
in interfaceBackendTimedata
- Parameters:
edgeId
- The unique Edge-IDdata
- Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as ResendData. Sorted by timestamp.
-