Class CalculateEnergyFromPower


public class CalculateEnergyFromPower extends Object
Calculates the value for energy channels in [Wh_Σ] from Power values in [W].

This is commonly used by SymmetricEss or ElectricityMeter to calculate energy channels from power 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.
  • Constructor Details

  • Method Details

    • update

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