Class SimulatedEvcs
- java.lang.Object
-
- io.openems.edge.common.component.AbstractOpenemsComponent
-
- io.openems.edge.evcs.api.AbstractManagedEvcsComponent
-
- io.openems.edge.simulator.evcs.SimulatedEvcs
-
- All Implemented Interfaces:
OpenemsComponent
,Evcs
,ManagedEvcs
,AsymmetricMeter
,SymmetricMeter
,org.osgi.service.event.EventHandler
public class SimulatedEvcs extends AbstractManagedEvcsComponent implements SymmetricMeter, AsymmetricMeter, ManagedEvcs, Evcs, OpenemsComponent, org.osgi.service.event.EventHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimulatedEvcs.ChannelId
-
Field Summary
Fields Modifier and Type Field Description protected org.osgi.service.cm.ConfigurationAdmin
cm
-
Fields inherited from interface io.openems.edge.meter.api.AsymmetricMeter
POWER_DOC_TEXT
-
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
Constructors Constructor Description SimulatedEvcs()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
_setActiveConsumptionEnergy(long value)
Internal method to set the 'nextValue' onSymmetricMeter.ChannelId.ACTIVE_CONSUMPTION_ENERGY
Channel.void
_setActiveConsumptionEnergy(java.lang.Long value)
Internal method to set the 'nextValue' onSymmetricMeter.ChannelId.ACTIVE_CONSUMPTION_ENERGY
Channel.boolean
applyChargePowerLimit(int power)
Command to send the given power, to the EVCS.boolean
applyDisplayText(java.lang.String text)
Command to send the specified text to the EVCS display, if supportedprotected void
deactivate()
Handles @Deactivate of implementations.java.lang.String
debugLog()
Gets some output that is suitable for a continuous Debug log.Value<java.lang.Long>
getActiveConsumptionEnergy()
Gets the Active Consumption Energy in [Wh].LongReadChannel
getActiveConsumptionEnergyChannel()
Gets the Channel forSymmetricMeter.ChannelId.ACTIVE_CONSUMPTION_ENERGY
.boolean
getConfiguredDebugMode()
Configuration if the debug mode is active or not.int
getConfiguredMaximumHardwarePower()
Maximum hardware limit in W given by the configuration.int
getConfiguredMinimumHardwarePower()
Minimum hardware limit in W given by the configuration.EvcsPower
getEvcsPower()
Get theEvcsPower
.MeterType
getMeterType()
Gets the type of this Meter.int
getMinimumTimeTillChargingLimitTaken()
Minimum time till a charging limit is taken by the EVCS in seconds.void
handleEvent(org.osgi.service.event.Event event)
boolean
pauseChargeProcess()
Command to pause a charge process of the EVCS.-
Methods inherited from class io.openems.edge.evcs.api.AbstractManagedEvcsComponent
activate, getChargeStateHandler, logDebug, logDebug, logInfo, logWarn
-
Methods inherited from class io.openems.edge.common.component.AbstractOpenemsComponent
_channel, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logError, 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.meter.api.AsymmetricMeter
_setActiveConsumptionEnergyL1, _setActiveConsumptionEnergyL1, _setActiveConsumptionEnergyL2, _setActiveConsumptionEnergyL2, _setActiveConsumptionEnergyL3, _setActiveConsumptionEnergyL3, _setActivePowerL1, _setActivePowerL1, _setActivePowerL2, _setActivePowerL2, _setActivePowerL3, _setActivePowerL3, _setActiveProductionEnergyL1, _setActiveProductionEnergyL1, _setActiveProductionEnergyL2, _setActiveProductionEnergyL2, _setActiveProductionEnergyL3, _setActiveProductionEnergyL3, _setCurrentL1, _setCurrentL1, _setCurrentL2, _setCurrentL2, _setCurrentL3, _setCurrentL3, _setReactivePowerL1, _setReactivePowerL1, _setReactivePowerL2, _setReactivePowerL2, _setReactivePowerL3, _setReactivePowerL3, _setVoltageL1, _setVoltageL1, _setVoltageL2, _setVoltageL2, _setVoltageL3, _setVoltageL3, getActiveConsumptionEnergyL1, getActiveConsumptionEnergyL1Channel, getActiveConsumptionEnergyL2, getActiveConsumptionEnergyL2Channel, getActiveConsumptionEnergyL3, getActiveConsumptionEnergyL3Channel, getActivePowerL1, getActivePowerL1Channel, getActivePowerL2, getActivePowerL2Channel, getActivePowerL3, getActivePowerL3Channel, getActiveProductionEnergyL1, getActiveProductionEnergyL1Channel, getActiveProductionEnergyL2, getActiveProductionEnergyL2Channel, getActiveProductionEnergyL3, getActiveProductionEnergyL3Channel, getCurrentL1, getCurrentL1Channel, getCurrentL2, getCurrentL2Channel, getCurrentL3, getCurrentL3Channel, getReactivePowerL1, getReactivePowerL1Channel, getReactivePowerL2, getReactivePowerL2Channel, getReactivePowerL3, getReactivePowerL3Channel, getVoltageL1, getVoltageL1Channel, getVoltageL2, getVoltageL2Channel, getVoltageL3, getVoltageL3Channel
-
Methods inherited from interface io.openems.edge.evcs.api.Evcs
_setChargePower, _setChargePower, _setChargingstationCommunicationFailed, _setChargingType, _setEnergySession, _setEnergySession, _setFixedMaximumHardwarePower, _setFixedMaximumHardwarePower, _setFixedMinimumHardwarePower, _setFixedMinimumHardwarePower, _setMaximumPower, _setMaximumPower, _setMinimumPower, _setMinimumPower, _setPhases, _setPhases, _setStatus, 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, getIsClustered, getIsClusteredChannel, 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.meter.api.SymmetricMeter
_setActivePower, _setActivePower, _setActiveProductionEnergy, _setActiveProductionEnergy, _setCurrent, _setCurrent, _setFrequency, _setFrequency, _setMaxActivePower, _setMaxActivePower, _setMinActivePower, _setMinActivePower, _setReactivePower, _setReactivePower, _setVoltage, _setVoltage, getActivePower, getActivePowerChannel, getActiveProductionEnergy, getActiveProductionEnergyChannel, getCurrent, getCurrentChannel, getFrequency, getFrequencyChannel, getMaxActivePower, getMaxActivePowerChannel, getMinActivePower, getMinActivePowerChannel, getReactivePower, getReactivePowerChannel, getVoltage, getVoltageChannel
-
-
-
-
Method Detail
-
deactivate
protected void deactivate()
Description copied from class:AbstractOpenemsComponent
Handles @Deactivate of implementations. Prints log output.- Overrides:
deactivate
in classAbstractOpenemsComponent
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event)
- Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
- Overrides:
handleEvent
in classAbstractManagedEvcsComponent
-
debugLog
public java.lang.String 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
-
getEvcsPower
public EvcsPower getEvcsPower()
Description copied from interface:ManagedEvcs
Get theEvcsPower
.- Specified by:
getEvcsPower
in interfaceManagedEvcs
- Returns:
- the
EvcsPower
-
getConfiguredMaximumHardwarePower
public int getConfiguredMaximumHardwarePower()
Description copied from interface:ManagedEvcs
Maximum hardware limit in W given by the configuration.This value is taken as a fallback for the
ChannelId#FIXED_MAXIMUM_HARDWARE_POWER
channel. As the configuration property should be in mA for AC chargers, make sure that the value is converted to W. Example: Math.round(current / 1000f) * DEFAULT_VOLTAGE * Phases.THREE_PHASE.getValue();- Specified by:
getConfiguredMaximumHardwarePower
in interfaceManagedEvcs
- Returns:
- maximum hardware limit in W
-
getConfiguredMinimumHardwarePower
public int getConfiguredMinimumHardwarePower()
Description copied from interface:ManagedEvcs
Minimum hardware limit in W given by the configuration.This value is taken as a fallback for the
ChannelId#FIXED_MINIMUM_HARDWARE_POWER
channel. As the configuration property should be in mA for AC chargers, make sure that the value is converted to W. Example: Math.round(current / 1000f) * DEFAULT_VOLTAGE * Phases.THREE_PHASE.getValue();- Specified by:
getConfiguredMinimumHardwarePower
in interfaceManagedEvcs
- Returns:
- minimum hardware limit in W
-
getConfiguredDebugMode
public boolean getConfiguredDebugMode()
Description copied from interface:ManagedEvcs
Configuration if the debug mode is active or not.- Specified by:
getConfiguredDebugMode
in interfaceManagedEvcs
- Returns:
- boolean
-
applyChargePowerLimit
public boolean applyChargePowerLimit(int power) throws OpenemsException
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
public boolean pauseChargeProcess() throws OpenemsException
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
-
getMinimumTimeTillChargingLimitTaken
public int getMinimumTimeTillChargingLimitTaken()
Description copied from interface:ManagedEvcs
Minimum time till a charging limit is taken by the EVCS in seconds.- Specified by:
getMinimumTimeTillChargingLimitTaken
in interfaceManagedEvcs
- Returns:
- time in seconds
-
applyDisplayText
public boolean applyDisplayText(java.lang.String text) throws OpenemsException
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
-
getActiveConsumptionEnergy
public Value<java.lang.Long> getActiveConsumptionEnergy()
Description copied from interface:SymmetricMeter
Gets the Active Consumption Energy in [Wh]. This relates to negative ACTIVE_POWER. SeeSymmetricMeter.ChannelId.ACTIVE_CONSUMPTION_ENERGY
.- Specified by:
getActiveConsumptionEnergy
in interfaceEvcs
- Specified by:
getActiveConsumptionEnergy
in interfaceSymmetricMeter
- Returns:
- the Channel
Value
-
_setActiveConsumptionEnergy
public void _setActiveConsumptionEnergy(long value)
Description copied from interface:SymmetricMeter
Internal method to set the 'nextValue' onSymmetricMeter.ChannelId.ACTIVE_CONSUMPTION_ENERGY
Channel.- Specified by:
_setActiveConsumptionEnergy
in interfaceEvcs
- Specified by:
_setActiveConsumptionEnergy
in interfaceSymmetricMeter
- Parameters:
value
- the next value
-
_setActiveConsumptionEnergy
public void _setActiveConsumptionEnergy(java.lang.Long value)
Description copied from interface:SymmetricMeter
Internal method to set the 'nextValue' onSymmetricMeter.ChannelId.ACTIVE_CONSUMPTION_ENERGY
Channel.- Specified by:
_setActiveConsumptionEnergy
in interfaceEvcs
- Specified by:
_setActiveConsumptionEnergy
in interfaceSymmetricMeter
- Parameters:
value
- the next value
-
getActiveConsumptionEnergyChannel
public LongReadChannel getActiveConsumptionEnergyChannel()
Description copied from interface:SymmetricMeter
Gets the Channel forSymmetricMeter.ChannelId.ACTIVE_CONSUMPTION_ENERGY
.- Specified by:
getActiveConsumptionEnergyChannel
in interfaceEvcs
- Specified by:
getActiveConsumptionEnergyChannel
in interfaceSymmetricMeter
- Returns:
- the Channel
-
getMeterType
public MeterType getMeterType()
Description copied from interface:SymmetricMeter
Gets the type of this Meter.- Specified by:
getMeterType
in interfaceSymmetricMeter
- Returns:
- the MeterType
-
-