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
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.openems.edge.controller.api.Controller
Controller.ChannelId
Nested classes/interfaces inherited from interface io.openems.edge.controller.ess.fixstateofcharge.api.FixStateOfCharge
FixStateOfCharge.ChannelId
Nested classes/interfaces inherited from interface io.openems.edge.common.component.OpenemsComponent
OpenemsComponent.ChannelId
-
Field Summary
Modifier and TypeFieldDescriptionstatic final float
Boundaries power factor is applied to the maximum allowed charge power of the ess, to avoid very low charge power.static final int
Dead band to stay in "AT_TARGET_SOC" even if the SoC drops or rises by one.static final float
Default power factor is applied to the maximum allowed charge power of the ess, to avoid very low charge power (Default 50%).static final int
State of charge boundaries, to reduce the charge/discharge power when the target SoC is almost reached. -
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractFixStateOfCharge
(ChannelId[] firstInitialChannelIds, ChannelId[]... furtherInitialChannelIds) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
activate
(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled) Handles @Activate of implementations.protected void
activate
(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled, ConfigProperties config) static Integer
calculateRequiredTime
(int soc, int targetSoc, int capacity, int power, Clock clock) Calculate required time to charge/discharge.static Integer
calculateTargetPower
(int soc, int targetSoc, int capacity, Clock clock, ZonedDateTime targetTime) Calculate the target power.protected void
Handles @Deactivate of implementations.abstract ComponentManager
Get theComponentManager
reference.abstract org.osgi.service.cm.ConfigurationAdmin
Get theConfigurationAdmin
reference.abstract ManagedSymmetricEss
getEss()
Get theManagedSymmetricEss
reference.static OptionalInt
getLastValidValue
(IntegerReadChannel channel) Get last defined value of anIntegerReadChannel
as anOptionalInt
.static OptionalLong
getLastValidValue
(LongReadChannel channel) Get last defined value of anLongReadChannel
as anOptionalInt
.abstract Sum
getSum()
Get theSum
reference.abstract Timedata
Get theTimedata
reference.protected void
modified
(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled, ConfigProperties config) void
Updating the configuration property isRunning to false.void
run()
Executes the Controller logic.Methods inherited from class io.openems.edge.common.component.AbstractOpenemsComponent
_channel, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logDebug, logError, logInfo, logWarn, modified, removeChannel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.openems.edge.controller.api.Controller
_setRunFailed, getRunFailed, getRunFailedChannel
Methods inherited from interface io.openems.edge.controller.ess.fixstateofcharge.api.FixStateOfCharge
_setAtTargetEpochSeconds, _setAtTargetEpochSeconds, _setCtrlIsBlockingEss, _setCtrlIsChargingEss, _setCtrlIsDischargingEss, _setCtrlWasSelfTerminated, _setDebugRampPower, _setDebugRampPower, _setDebugSetActivePower, _setDebugSetActivePower, _setDebugSetActivePowerRaw, _setDebugSetActivePowerRaw, _setEssCapacity, _setEssCapacity, _setExpectedStartEpochSeconds, _setExpectedStartEpochSeconds, _setStateMachine, getAtTargetEpochSeconds, getAtTargetEpochSecondsChannel, getCtrlIsBlockingEss, getCtrlIsBlockingEssChannel, getCtrlIsChargingEss, getCtrlIsChargingEssChannel, getCtrlIsDischargingEss, getCtrlIsDischargingEssChannel, getCtrlWasSelfTerminated, getCtrlWasSelfTerminatedChannel, getDebugRampPower, getDebugRampPowerChannel, getDebugSetActivePower, getDebugSetActivePowerChannel, getDebugSetActivePowerRaw, getDebugSetActivePowerRawChannel, getEssCapacity, getEssCapacityChannel, getExpectedStartEpochSeconds, getExpectedStartEpochSecondsChannel, getStateMachine, getStateMachineChannel
Methods inherited from interface io.openems.edge.common.component.OpenemsComponent
_channel, _getChannelAs, alias, channel, channel, channels, debugLog, getComponentContext, getState, getStateChannel, hasFaults, id, isEnabled, serviceFactoryPid, servicePid
-
Field Details
-
DEFAULT_POWER_FACTOR
public static final float DEFAULT_POWER_FACTORDefault 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_BOUNDARIESState 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_DIFFERENCEDead 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_FACTORBoundaries 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
-
-
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 classAbstractOpenemsComponent
- Parameters:
context
- the OSGi ComponentContextid
- the unique OpenEMS Component IDalias
- Human-readable name of this Component. Typically 'config.alias()'. Defaults to 'id' if emptyenabled
- 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 -
deactivate
protected void deactivate()Description copied from class:AbstractOpenemsComponent
Handles @Deactivate of implementations. Prints log output.- Overrides:
deactivate
in classAbstractOpenemsComponent
-
run
Description copied from interface:Controller
Executes the Controller logic.- Specified by:
run
in interfaceController
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
resetController
public void resetController()Updating the configuration property isRunning to false. -
getLastValidValue
Get last defined value of anIntegerReadChannel
as anOptionalInt
.- Parameters:
channel
-IntegerReadChannel
to get values- Returns:
- Last defined value from given
IntegerReadChannel
-
getLastValidValue
Get last defined value of anLongReadChannel
as anOptionalInt
.- Parameters:
channel
-LongReadChannel
to get values- Returns:
- Last defined value from given
LongReadChannel
-
getComponentManager
Get theComponentManager
reference.- Returns:
- Current
ComponentManager
-
getSum
Get theSum
reference.- Returns:
- Current
Sum
-
getEss
Get theManagedSymmetricEss
reference.- Returns:
- Current
ManagedSymmetricEss
-
getTimedata
Get theTimedata
reference.- Returns:
- Current
Timedata
-
getConfigurationAdmin
public abstract org.osgi.service.cm.ConfigurationAdmin getConfigurationAdmin()Get theConfigurationAdmin
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 chargetargetSoc
- target state of chargecapacity
- ess capacityclock
- clocktargetTime
- 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 chargetargetSoc
- target state of chargecapacity
- ess capacitypower
- power in wattclock
- clock- Returns:
- required time in seconds
-