Class CalculateEnergyFromPower

  • public class CalculateEnergyFromPower
    extends java.lang.Object
    Calculates the value for energy channels in [Wh] from Power values in [W].

    This is commonly used to calculate SymmetricEss or SymmetricMeter ActiveChargePower and ActiveDischargePower from ActivePower channels. To use it, you have to:

    1. Make your OpenemsComponent implement TimedataProvider:
       public class ComponentImpl extends AbstractOpenemsComponent implements
       OpenemsComponent, TimedataProvider, EventHandler {
    2. Add a @Reference to Timedata. It's a good idea to make this reference 'dynamic', otherwise your component will not start if there is no Timedata service configured.
       @Reference(policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.OPTIONAL)
       private volatile Timedata timedata = null;
    3. Add a private instance of CalculateEnergyFromPower for each energy channel:
       private final CalculateEnergyFromPower calculateEnergy = new CalculateEnergyFromPower(this,
    4. Call the update(Integer) method on each cycle - e.g. via an EventHandler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void update​(java.lang.Integer power)
      Calculate the Energy and update the Channel.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • update

        public void update​(java.lang.Integer power)
        Calculate the Energy and update the Channel.
        power - the latest power value in [W]