Class SimulatorApp

    • Field Detail


        public static final java.lang.String SINGLETON_SERVICE_PID
        See Also:
        Constant Field Values

        public static final java.lang.String SINGLETON_COMPONENT_ID
        See Also:
        Constant Field Values
    • Constructor Detail

      • SimulatorApp

        public SimulatorApp()
    • Method Detail

      • handleEvent

        public void handleEvent​(org.osgi.service.event.Event event)
        Specified by:
        handleEvent in interface org.osgi.service.event.EventHandler
      • getClock

        public java.time.Clock getClock()
        Description copied from interface: ClockProvider
        Gets the Clock - real or mocked like TimeLeapClock.
        Specified by:
        getClock in interface ClockProvider
        the Clock
      • getValue

        public <T> T getValue​(OpenemsType type,
                              ChannelAddress channelAddress)
        Description copied from interface: SimulatorDatasource
        Gets the value for the given key (channelId) in the given type.
        Specified by:
        getValue in interface SimulatorDatasource
        Type Parameters:
        T - the type
        type - the expected type
        channelAddress - the Channel-Address
        the value, possibly null
      • queryHistoricEnergyPerPeriod

        public java.util.SortedMap<java.time.ZonedDateTime,​java.util.SortedMap<ChannelAddress,​>> queryHistoricEnergyPerPeriod​(java.lang.String edgeId,
                                                                                                                                                                     java.time.ZonedDateTime fromDate,
                                                                                                                                                                     java.time.ZonedDateTime toDate,
                                                                                                                                                                     java.util.Set<ChannelAddress> channels,
                                                                                                                                                                     int resolution)
                                                                                                                                                              throws OpenemsError.OpenemsNamedException
        Description copied from interface: CommonTimedataService
        Queries historic energy per period.

        This is for use-cases where you want to get the energy for each period (with length '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.

        Specified by:
        queryHistoricEnergyPerPeriod in interface CommonTimedataService
        edgeId - the Edge-ID; or null query all
        fromDate - the From-Date
        toDate - the To-Date
        channels - the Channels
        resolution - the Resolution in seconds
      • getLatestValue

        public java.util.concurrent.CompletableFuture<java.util.Optional<java.lang.Object>> getLatestValue​(ChannelAddress channelAddress)
        Description copied from interface: Timedata
        Gets the latest known value for the given ChannelAddress.
        Specified by:
        getLatestValue in interface Timedata
        channelAddress - the ChannelAddress to be queried
        the latest known value or Empty