Skip to content

Commit

Permalink
Add Modbus-Slave definition for ESS Sinexcel #1132
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier authored May 6, 2020
2 parents 28b2bf0 + 8a7b605 commit 33d7589
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.openems.common.channel.AccessMode;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.edge.battery.api.Battery;
import io.openems.edge.bridge.modbus.api.AbstractOpenemsModbusComponent;
Expand All @@ -41,6 +42,8 @@
import io.openems.edge.common.component.ComponentManager;
import io.openems.edge.common.component.OpenemsComponent;
import io.openems.edge.common.event.EdgeEventConstants;
import io.openems.edge.common.modbusslave.ModbusSlave;
import io.openems.edge.common.modbusslave.ModbusSlaveTable;
import io.openems.edge.common.taskmanager.Priority;
import io.openems.edge.ess.api.ManagedSymmetricEss;
import io.openems.edge.ess.api.SymmetricEss;
Expand All @@ -59,7 +62,7 @@
property = {EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_AFTER_PROCESS_IMAGE , //
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_BEFORE_PROCESS_IMAGE}) //
public class EssSinexcel extends AbstractOpenemsModbusComponent
implements SymmetricEss, ManagedSymmetricEss, EventHandler, OpenemsComponent {
implements SymmetricEss, ManagedSymmetricEss, EventHandler, OpenemsComponent, ModbusSlave {

private final Logger log = LoggerFactory.getLogger(EssSinexcel.class);

Expand Down Expand Up @@ -807,4 +810,13 @@ public IntegerWriteChannel getMinimalCellVoltage() {
public IntegerWriteChannel getVoltage() {
return this.channel(SinexcelChannelId.BAT_VOLTAGE);
}

@Override
public ModbusSlaveTable getModbusSlaveTable(AccessMode accessMode) {
return new ModbusSlaveTable( //
OpenemsComponent.getModbusSlaveNatureTable(accessMode), //
SymmetricEss.getModbusSlaveNatureTable(accessMode), //
ManagedSymmetricEss.getModbusSlaveNatureTable(accessMode) //
);
}
}

0 comments on commit 33d7589

Please sign in to comment.