Class AbstractFixStateOfCharge

java.lang.Object
io.openems.edge.common.component.AbstractOpenemsComponent
io.openems.edge.controller.ess.fixstateofcharge.api.AbstractFixStateOfCharge
All Implemented Interfaces:
OpenemsComponent, Controller, FixStateOfCharge
Direct Known Subclasses:
ControllerEssFixStateOfChargeImpl, ControllerEssPrepareBatteryExtensionImpl

public abstract class AbstractFixStateOfCharge extends AbstractOpenemsComponent implements FixStateOfCharge, Controller, OpenemsComponent
  • Field Details

    • DEFAULT_POWER_FACTOR

      public static final float DEFAULT_POWER_FACTOR
      Default power factor is applied to the maximum allowed charge power of the ess, to avoid very low charge power (Default 50%).
      See Also:
    • DEFAULT_TARGET_SOC_BOUNDARIES

      public static final int DEFAULT_TARGET_SOC_BOUNDARIES
      State of charge boundaries, to reduce the charge/discharge power when the target SoC is almost reached.
      See Also:
    • DEFAULT_DEAD_BAND_SOC_DIFFERENCE

      public static final int DEFAULT_DEAD_BAND_SOC_DIFFERENCE
      Dead band to stay in "AT_TARGET_SOC" even if the SoC drops or rises by one.
      See Also:
    • BOUNDARIES_POWER_FACTOR

      public static final float BOUNDARIES_POWER_FACTOR
      Boundaries power factor is applied to the maximum allowed charge power of the ess, to avoid very low charge power. (Default 25%).
      See Also:
  • Constructor Details

    • AbstractFixStateOfCharge

      protected AbstractFixStateOfCharge(ChannelId[] firstInitialChannelIds, ChannelId[]... furtherInitialChannelIds)
  • Method Details

    • activate

      protected void activate(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled)
      Description copied from class: AbstractOpenemsComponent
      Handles @Activate of implementations. Prints log output.
      Overrides:
      activate in class AbstractOpenemsComponent
      Parameters:
      context - the OSGi ComponentContext
      id - the unique OpenEMS Component ID
      alias - Human-readable name of this Component. Typically 'config.alias()'. Defaults to 'id' if empty
      enabled - is the Component enabled?
    • activate

      protected void activate(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled, ConfigProperties config)
    • modified

      protected void modified(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled, ConfigProperties config) throws OpenemsError.OpenemsNamedException
      Throws:
      OpenemsError.OpenemsNamedException
    • deactivate

      protected void deactivate()
      Description copied from class: AbstractOpenemsComponent
      Handles @Deactivate of implementations. Prints log output.
      Overrides:
      deactivate in class AbstractOpenemsComponent
    • run

      public void run() throws OpenemsError.OpenemsNamedException
      Description copied from interface: Controller
      Executes the Controller logic.
      Specified by:
      run in interface Controller
      Throws:
      OpenemsError.OpenemsNamedException - on error
    • resetController

      public void resetController()
      Updating the configuration property isRunning to false.
    • getLastValidValue

      public static OptionalInt getLastValidValue(IntegerReadChannel channel)
      Get last defined value of an IntegerReadChannel as an OptionalInt.
      Parameters:
      channel - IntegerReadChannel to get values
      Returns:
      Last defined value from given IntegerReadChannel
    • getLastValidValue

      public static OptionalLong getLastValidValue(LongReadChannel channel)
      Get last defined value of an LongReadChannel as an OptionalInt.
      Parameters:
      channel - LongReadChannel to get values
      Returns:
      Last defined value from given LongReadChannel
    • getComponentManager

      public abstract ComponentManager getComponentManager()
      Get the ComponentManager reference.
      Returns:
      Current ComponentManager
    • getSum

      public abstract Sum getSum()
      Get the Sum reference.
      Returns:
      Current Sum
    • getEss

      public abstract ManagedSymmetricEss getEss()
      Get the ManagedSymmetricEss reference.
      Returns:
      Current ManagedSymmetricEss
    • getTimedata

      public abstract Timedata getTimedata()
      Get the Timedata reference.
      Returns:
      Current Timedata
    • getConfigurationAdmin

      public abstract org.osgi.service.cm.ConfigurationAdmin getConfigurationAdmin()
      Get the ConfigurationAdmin reference.
      Returns:
      Current ConfigurationAdmin
    • calculateTargetPower

      public static Integer calculateTargetPower(int soc, int targetSoc, int capacity, Clock clock, ZonedDateTime targetTime)
      Calculate the target power.

      Calculate the target power based on the given properties, to reach the target soc at the target time.

      Parameters:
      soc - current state of charge
      targetSoc - target state of charge
      capacity - ess capacity
      clock - clock
      targetTime - target time
      Returns:
      charge power as negative value, discharge power as positive value
    • calculateRequiredTime

      public static Integer calculateRequiredTime(int soc, int targetSoc, int capacity, int power, Clock clock)
      Calculate required time to charge/discharge.

      Calculate the required time to reach the target SoC based on the given properties.

      Parameters:
      soc - current state of charge
      targetSoc - target state of charge
      capacity - ess capacity
      power - power in watt
      clock - clock
      Returns:
      required time in seconds