Class BatteryFeneconHomeImpl

All Implemented Interfaces:
Battery, BatteryFeneconHome, ModbusComponent, OpenemsComponent, ModbusSlave, StartStoppable, org.osgi.service.event.EventHandler

public class BatteryFeneconHomeImpl extends AbstractOpenemsModbusComponent implements ModbusComponent, OpenemsComponent, Battery, org.osgi.service.event.EventHandler, ModbusSlave, StartStoppable, BatteryFeneconHome
  • Field Details

  • Constructor Details

    • BatteryFeneconHomeImpl

      public BatteryFeneconHomeImpl()
  • Method Details

    • setModbus

      protected void setModbus(BridgeModbus modbus)
      Description copied from class: AbstractOpenemsModbusComponent
      Set the Modbus bridge. Should be called by @Reference
      Overrides:
      setModbus in class AbstractOpenemsModbusComponent
      Parameters:
      modbus - the BridgeModbus Reference
    • deactivate

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

      public void handleEvent(org.osgi.service.event.Event event)
      Specified by:
      handleEvent in interface org.osgi.service.event.EventHandler
    • defineModbusProtocol

      protected ModbusProtocol defineModbusProtocol() throws OpenemsException
      Description copied from class: AbstractOpenemsModbusComponent
      Defines the Modbus protocol.
      Specified by:
      defineModbusProtocol in class AbstractOpenemsModbusComponent
      Returns:
      the ModbusProtocol
      Throws:
      OpenemsException - on error
    • parseHardwareTypeFromRegisterValue

      public static BatteryFeneconHomeHardwareType parseHardwareTypeFromRegisterValue(int value)
      Get GoodWe hardware version from register value.
      Parameters:
      value - Register value not formated with SCALE_FACTOR_MINUS_1
      Returns:
      type as
      invalid reference
      GoodweHardwareType
      or null
    • 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
      Returns:
      the debug log output
    • getModbusSlaveTable

      public ModbusSlaveTable getModbusSlaveTable(AccessMode accessMode)
      Description copied from interface: ModbusSlave
      Gets the Modbus-Slave-Table for this OpenEMS-Component.
      Specified by:
      getModbusSlaveTable in interface ModbusSlave
      Parameters:
      accessMode - filters the Modbus-Records that should be shown
      Returns:
      the Modbus-Slave-Table
    • setStartStop

      public void setStartStop(StartStop value)
      Description copied from interface: StartStoppable
      Starts or stops the device or service represented by this OpenEMS Component.
      Specified by:
      setStartStop in interface StartStoppable
      Parameters:
      value - target StartStop state
    • getStartStopTarget

      public StartStop getStartStopTarget()
      Description copied from interface: BatteryFeneconHome
      Gets the target Start/Stop mode from config or StartStop-Channel.
      Specified by:
      getStartStopTarget in interface BatteryFeneconHome
      Returns:
      StartStop
    • updateNumberOfTowersAndModules

      protected void updateNumberOfTowersAndModules()
      Update Number of towers and modules; called on onChange event.

      Recalculate the number of towers and modules. Unfortunately the battery may report too small wrong values in the beginning, so we need to recalculate on every change.

      As an alternative, these channels may also be introduced in a record, and the associated channel value could be read with the aid of ChannelUtils.getValues(io.openems.edge.common.component.OpenemsComponent, java.lang.Class<T>). However, startup time is once again involved in this process. This indicates that the last callback will have been made before the record is set. Furthermore, there is no certainty that the "software version channel value change" will occur, making it unlikely for this to trigger a callback.

    • buildSerialNumber

      protected static String buildSerialNumber(String prefix, Integer value)
      Build the serial number with prefix.
      Parameters:
      prefix - the serial number prefix
      value - the serial number
      Returns:
      The serial number
    • generateCellVoltageChannelName

      public static String generateCellVoltageChannelName(int tower, int module, int cell)
      Generates Channel names for Cell Voltage Channel-IDs.

      "%03d" creates string number with leading zeros

      Parameters:
      tower - number to use
      module - number to use
      cell - number to user
      Returns:
      a Channel name e.g. "TOWER_1_MODULE_2_CELL_003_VOLTAGE"
    • generateTempSensorChannelName

      public static String generateTempSensorChannelName(int tower, int module, int sensor)
      Generates Channel names for Temperature Sensor Channel-IDs.
      Parameters:
      tower - number to use
      module - number to use
      sensor - number to user
      Returns:
      a Channel name e.g. "TOWER_1_MODULE_2_TEMPERATURE_SENSOR_2"
    • generateTempBalancingChannelName

      public static String generateTempBalancingChannelName(int tower, int module, int value)
      Generates Channel names for Temperature Balancing Channel-IDs.
      Parameters:
      tower - number to use
      module - number to use
      value - number to user
      Returns:
      a Channel name e.g. "TOWER_1_MODULE_2_TEMPERATURE_BALANCING_1"