Class AbstractManagedOcppEvcsComponent

All Implemented Interfaces:
OpenemsComponent, Evcs, ManagedEvcs, MeasuringEvcs, TimedataProvider, org.osgi.service.event.EventHandler
Direct Known Subclasses:
EvcsOcppAblImpl, EvcsOcppIesKeywattSingleImpl

public abstract class AbstractManagedOcppEvcsComponent extends AbstractManagedEvcsComponent implements Evcs, ManagedEvcs, MeasuringEvcs, org.osgi.service.event.EventHandler, TimedataProvider
Abstract Managed Ocpp EVCS Component.

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);
        }
 
  • Field Details

  • 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 class AbstractManagedEvcsComponent
      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?
    • 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 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?
    • handleEvent

      public void handleEvent(org.osgi.service.event.Event event)
      Specified by:
      handleEvent in interface org.osgi.service.event.EventHandler
      Overrides:
      handleEvent in class AbstractManagedEvcsComponent
    • deactivate

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

      public void newSession(OcppServer server, UUID sessionId)
      New session started.

      This is called in the OcppServer if this EVCS matches the appeared EVCS in the server.

      Parameters:
      server - the OcppServer
      sessionId - the referring session UUID
    • lostSession

      public void lostSession()
      Lost the current Session.

      This is called in the OcppServer if this EVCS disappeared from the server connections.

    • getSupportedMeasurements

      public abstract Set<OcppInformations> getSupportedMeasurements()
      Get the supported measurements.
      Returns:
      supported measurements as a Set of OcppInformations
    • getConfiguredOcppId

      public abstract String getConfiguredOcppId()
      Get the configured OCPP ID.
      Returns:
      OCPP ID
    • getConfiguredConnectorId

      public abstract Integer 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

      public abstract List<eu.chargetime.ocpp.model.Request> getRequiredRequestsAfterConnection()
      Required requests that should be sent after a connection was established.
      Returns:
      List of requests
    • getRequiredRequestsDuringConnection

      public abstract List<eu.chargetime.ocpp.model.Request> getRequiredRequestsDuringConnection()
      Required requests that should be sent permanently during a session.
      Returns:
      List of requests
    • getStandardRequests

      public abstract OcppStandardRequests getStandardRequests()
      Default requests that every OCPP EVCS should have.
      Returns:
      OcppRequests
    • getSessionId

      public UUID getSessionId()
    • getLastChargingProperty

      public ChargingProperty getLastChargingProperty()
    • setLastChargingProperty

      public void setLastChargingProperty(ChargingProperty chargingProperty)
    • getSessionStart

      public ChargeSessionStamp getSessionStart()
    • getSessionEnd

      public ChargeSessionStamp getSessionEnd()
    • logInfo

      protected void logInfo(org.slf4j.Logger log, String message)
      Description copied from class: AbstractOpenemsComponent
      Log an info message including the Component ID.
      Overrides:
      logInfo in class AbstractManagedEvcsComponent
      Parameters:
      log - the Logger instance
      message - the message
    • logWarn

      protected void logWarn(org.slf4j.Logger log, String message)
      Description copied from class: AbstractOpenemsComponent
      Log a warn message including the Component ID.
      Overrides:
      logWarn in class AbstractManagedEvcsComponent
      Parameters:
      log - the Logger instance
      message - the message
    • debugLog

      public 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 interface OpenemsComponent
      Overrides:
      debugLog in class AbstractManagedEvcsComponent
      Returns:
      the debug log output
    • applyDisplayText

      public boolean applyDisplayText(String text) throws OpenemsException
      Description copied from interface: ManagedEvcs
      Command to send the specified text to the EVCS display, if supported

      Writes to the display of the charging station, if the EVCS supports that feature - if not, return false.

      Specified by:
      applyDisplayText in interface ManagedEvcs
      Parameters:
      text - Text to display
      Returns:
      boolean if it was sent or not
      Throws:
      OpenemsException - on error
    • 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 interface ManagedEvcs
      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

      invalid reference
      #applyChargePowerLimit(Integer)
      with 0 as power but sometimes it needs extra commands to initiate a pause of charging.
      Specified by:
      pauseChargeProcess in interface ManagedEvcs
      Returns:
      boolean if the command was applied to the EVCS
      Throws:
      OpenemsException - on error