Class AbstractManagedOcppEvcsComponent
- All Implemented Interfaces:
OpenemsComponent
,Evcs
,ManagedEvcs
,MeasuringEvcs
,TimedataProvider
,org.osgi.service.event.EventHandler
- Direct Known Subclasses:
EvcsOcppAblImpl
,EvcsOcppIesKeywattSingleImpl
Includes the logic for the write handler - that is sending the limits depending on the 'send' logic of each implementation. The SET_CHARGE_POWER_LIMIT or SET_CHARGE_POWER_LIMIT_WITH_FILTER Channel are usually set by the evcs Controller.
Please ensure to add the event topics at in the properties of the subclass:
@EventTopics({ //
EdgeEventConstants.TOPIC_CYCLE_AFTER_PROCESS_IMAGE, //
EdgeEventConstants.TOPIC_CYCLE_EXECUTE_WRITE //
})
and also call "super.handleEvent(event)" in the subclass: @Override public void handleEvent(Event event) { super.handleEvent(event); }
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OcppServer
protected final Set<OcppProfileType>
protected UUID
Fields inherited from interface io.openems.edge.evcs.api.Evcs
DEFAULT_MAXIMUM_HARDWARE_CURRENT, DEFAULT_MAXIMUM_HARDWARE_POWER, DEFAULT_MINIMUM_HARDWARE_CURRENT, DEFAULT_MINIMUM_HARDWARE_POWER, DEFAULT_POWER_RECISION, DEFAULT_VOLTAGE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractManagedOcppEvcsComponent
(OcppProfileType[] profileTypes, 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.boolean
applyChargePowerLimit
(int power) Command to send the given power, to the EVCS.boolean
applyDisplayText
(String text) Command to send the specified text to the EVCS display, if supportedprotected void
Handles @Deactivate of implementations.debugLog()
Gets some output that is suitable for a continuous Debug log.abstract Integer
Get configured Connector-ID.abstract String
Get the configured OCPP ID.abstract List<eu.chargetime.ocpp.model.Request>
Required requests that should be sent after a connection was established.abstract List<eu.chargetime.ocpp.model.Request>
Required requests that should be sent permanently during a session.abstract OcppStandardRequests
Default requests that every OCPP EVCS should have.abstract Set<OcppInformations>
Get the supported measurements.void
handleEvent
(org.osgi.service.event.Event event) protected void
Log an info message including the Component ID.protected void
Log a warn message including the Component ID.void
Lost the current Session.protected void
modified
(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled) Handles @Modified of implementations.void
newSession
(OcppServer server, UUID sessionId) New session started.boolean
Command to pause a charge process of the EVCS.abstract boolean
Returns session energy.void
setLastChargingProperty
(ChargingProperty chargingProperty) Methods inherited from class io.openems.edge.evcs.api.AbstractManagedEvcsComponent
getChargeStateHandler, logDebug, logDebug
Methods inherited from class io.openems.edge.common.component.AbstractOpenemsComponent
_channel, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logError, 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.evcs.api.Evcs
_setActiveConsumptionEnergy, _setActiveConsumptionEnergy, _setChargePower, _setChargePower, _setChargingstationCommunicationFailed, _setChargingType, _setEnergySession, _setEnergySession, _setFixedMaximumHardwarePower, _setFixedMaximumHardwarePower, _setFixedMinimumHardwarePower, _setFixedMinimumHardwarePower, _setMaximumPower, _setMaximumPower, _setMinimumPower, _setMinimumPower, _setPhases, _setPhases, _setStatus, getActiveConsumptionEnergy, getActiveConsumptionEnergyChannel, getChargePower, getChargePowerChannel, getChargingstationCommunicationFailed, getChargingstationCommunicationFailedChannel, getChargingType, getChargingTypeChannel, getEnergySession, getEnergySessionChannel, getFixedMaximumHardwarePower, getFixedMaximumHardwarePowerChannel, getFixedMinimumHardwarePower, getFixedMinimumHardwarePowerChannel, getMaximumHardwarePower, getMaximumHardwarePowerChannel, getMaximumPower, getMaximumPowerChannel, getMinimumHardwarePower, getMinimumHardwarePowerChannel, getMinimumPower, getMinimumPowerChannel, getPhases, getPhasesAsInt, getPhasesChannel, getStatus, getStatusChannel
Methods inherited from interface io.openems.edge.evcs.api.ManagedEvcs
_setChargeMode, _setIsClustered, _setPowerPrecision, _setPowerPrecision, _setSetChargePowerLimit, _setSetChargePowerLimit, _setSetChargePowerLimitWithFilter, _setSetChargePowerLimitWithFilter, _setSetChargePowerRequest, _setSetChargePowerRequest, _setSetDisplayText, _setSetEnergyLimit, _setSetEnergyLimit, getChargeMode, getChargeModeChannel, getChargeState, getChargeStateChannel, getChargeStateHandler, getConfiguredDebugMode, getConfiguredMaximumHardwarePower, getConfiguredMinimumHardwarePower, getEvcsPower, getIsClustered, getIsClusteredChannel, getMinimumTimeTillChargingLimitTaken, getPowerPrecision, getPowerPrecisionChannel, getSetChargePowerLimit, getSetChargePowerLimitChannel, getSetChargePowerLimitWithFilter, getSetChargePowerLimitWithFilterChannel, getSetChargePowerRequest, getSetChargePowerRequestChannel, getSetDisplayText, getSetDisplayTextChannel, getSetEnergyLimit, getSetEnergyLimitChannel, getWriteInterval, logDebug, setChargePowerLimit, setChargePowerLimitWithFilter, setChargePowerRequest, setDisplayText, setEnergyLimit
Methods inherited from interface io.openems.edge.common.component.OpenemsComponent
_channel, _getChannelAs, alias, channel, channel, channels, getComponentContext, getState, getStateChannel, hasFaults, id, isEnabled, serviceFactoryPid, servicePid
Methods inherited from interface io.openems.edge.timedata.api.TimedataProvider
getTimedata
-
Field Details
-
profileTypes
-
ocppServer
-
sessionId
-
-
Constructor Details
-
AbstractManagedOcppEvcsComponent
protected AbstractManagedOcppEvcsComponent(OcppProfileType[] profileTypes, 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 classAbstractManagedEvcsComponent
- 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?
-
modified
protected void modified(org.osgi.service.component.ComponentContext context, String id, String alias, boolean enabled) Description copied from class:AbstractOpenemsComponent
Handles @Modified of implementations.- Overrides:
modified
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?
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event) - Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
- Overrides:
handleEvent
in classAbstractManagedEvcsComponent
-
deactivate
protected void deactivate()Description copied from class:AbstractOpenemsComponent
Handles @Deactivate of implementations. Prints log output.- Overrides:
deactivate
in classAbstractOpenemsComponent
-
newSession
New session started.This is called in the OcppServer if this EVCS matches the appeared EVCS in the server.
- Parameters:
server
- theOcppServer
sessionId
- the referring sessionUUID
-
lostSession
public void lostSession()Lost the current Session.This is called in the OcppServer if this EVCS disappeared from the server connections.
-
getSupportedMeasurements
Get the supported measurements.- Returns:
- supported measurements as a Set of
OcppInformations
-
getConfiguredOcppId
Get the configured OCPP ID.- Returns:
- OCPP ID
-
getConfiguredConnectorId
Get configured Connector-ID.Every OCPP-EVCS Component requires the corresponding Connector-ID of the charger. This is especially important for an EVCS with two or more connectors.
- Returns:
- configured Connector-ID
-
returnsSessionEnergy
public abstract boolean returnsSessionEnergy()Returns session energy.Is the EVCS supporting SessionEnergy or only a meter with the total energy.
- Returns:
- boolean
-
getRequiredRequestsAfterConnection
Required requests that should be sent after a connection was established.- Returns:
- List of requests
-
getRequiredRequestsDuringConnection
Required requests that should be sent permanently during a session.- Returns:
- List of requests
-
getStandardRequests
Default requests that every OCPP EVCS should have.- Returns:
- OcppRequests
-
getSessionId
-
getLastChargingProperty
-
setLastChargingProperty
-
getSessionStart
-
getSessionEnd
-
logInfo
Description copied from class:AbstractOpenemsComponent
Log an info message including the Component ID.- Overrides:
logInfo
in classAbstractManagedEvcsComponent
- Parameters:
log
- the Logger instancemessage
- the message
-
logWarn
Description copied from class:AbstractOpenemsComponent
Log a warn message including the Component ID.- Overrides:
logWarn
in classAbstractManagedEvcsComponent
- Parameters:
log
- the Logger instancemessage
- the message
-
debugLog
Description copied from interface:OpenemsComponent
Gets some output that is suitable for a continuous Debug log. Returns 'null' by default which causes no output.- Specified by:
debugLog
in interfaceOpenemsComponent
- Overrides:
debugLog
in classAbstractManagedEvcsComponent
- Returns:
- the debug log output
-
applyDisplayText
Description copied from interface:ManagedEvcs
Command to send the specified text to the EVCS display, if supportedWrites to the display of the charging station, if the EVCS supports that feature - if not, return false.
- Specified by:
applyDisplayText
in interfaceManagedEvcs
- Parameters:
text
- Text to display- Returns:
- boolean if it was sent or not
- Throws:
OpenemsException
- on error
-
applyChargePowerLimit
Description copied from interface:ManagedEvcs
Command to send the given power, to the EVCS.Example:
// Format the power to the required format and unit String raw = "currtime " + current + " 1"; byte[] raw = s.getBytes(); DatagramPacket packet = new DatagramPacket(raw, raw.length, ip, KebaKeContact.UDP_PORT); DatagramSocket datagrammSocket = null; try { datagrammSocket = new DatagramSocket(); datagrammSocket.send(packet); return true; } catch (SocketException e) { this.logError(this.log, "Unable to open UDP socket for sending [" + s + "] to [" + ip.getHostAddress() + "]: " + e.getMessage()); } catch (IOException e) { this.logError(this.log, "Unable to send [" + s + "] UDP message to [" + ip.getHostAddress() + "]: " + e.getMessage()); } finally { if (datagrammSocket != null) { datagrammSocket.close(); } } return false;
- Specified by:
applyChargePowerLimit
in interfaceManagedEvcs
- Parameters:
power
- Power that should be send in watt- Returns:
- boolean if the power was applied to the EVCS
- Throws:
OpenemsException
- on error
-
pauseChargeProcess
Description copied from interface:ManagedEvcs
Command to pause a charge process of the EVCS.In most of the cases, it is sufficient to call the method
#applyChargePowerLimit(Integer)
with 0 as power but sometimes it needs extra commands to initiate a pause of charging.- Specified by:
pauseChargeProcess
in interfaceManagedEvcs
- Returns:
- boolean if the command was applied to the EVCS
- Throws:
OpenemsException
- on error
-