Skip to content

Commit

Permalink
Merge branch 'release/2021.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Feb 11, 2021
2 parents 58f8190 + af39b6d commit a839f90
Show file tree
Hide file tree
Showing 22 changed files with 990 additions and 1,061 deletions.
10 changes: 6 additions & 4 deletions cnf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<!-- HikariCP A solid, high-performance, JDBC connection pool at last. -->
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
<version>4.0.1</version>
</dependency>
<!-- commons -->
<dependency>
Expand Down Expand Up @@ -143,9 +143,11 @@
<version>4.1.4</version>
</dependency>
<dependency>
<!-- Apache Felix Metatype Service -->
<!-- Changelog: https://github.com/apache/felix-dev/blob/master/metatype/changelog.txt -->
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.metatype</artifactId>
<version>1.2.2</version>
<version>1.2.4</version>
</dependency>
<dependency>
<!-- Apache Felix Service Component Runtime (SCR) -->
Expand Down Expand Up @@ -179,12 +181,12 @@
<dependency>
<groupId>org.dhatim</groupId>
<artifactId>fastexcel</artifactId>
<version>0.10.18</version>
<version>0.12.3</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.15.300</version>
<version>3.16.100</version>
</dependency>
<dependency>
<groupId>org.influxdb</groupId>
Expand Down
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/single_document.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= OpenEMS - Open Energy Management System
ifndef::toc[]
(c) 2020 OpenEMS Association e.V.
Version 2021.2.0
Version 2021.3.0
:sectnums:
:sectnumlevels: 4
:toc:
Expand Down
4 changes: 2 additions & 2 deletions io.openems.backend.application/BackendApp.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
com.google.gson;version='[2.8.5,2.8.6)',\
com.google.guava;version='[29.0.0,29.0.1)',\
com.google.guava.failureaccess;version='[1.0.1,1.0.2)',\
com.zaxxer.HikariCP;version='[3.4.5,3.4.6)',\
com.zaxxer.HikariCP;version='[4.0.1,4.0.2)',\
io.openems.backend.application;version=snapshot,\
io.openems.backend.b2brest;version=snapshot,\
io.openems.backend.b2bwebsocket;version=snapshot,\
Expand Down Expand Up @@ -65,7 +65,7 @@
org.apache.felix.http.jetty;version='[4.1.4,4.1.5)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.inventory;version='[1.0.6,1.0.7)',\
org.apache.felix.metatype;version='[1.2.2,1.2.3)',\
org.apache.felix.metatype;version='[1.2.4,1.2.5)',\
org.apache.felix.scr;version='[2.1.20,2.1.21)',\
org.apache.felix.webconsole;version='[4.6.0,4.6.1)',\
org.apache.felix.webconsole.plugins.ds;version='[2.1.0,2.1.1)',\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class OpenemsConstants {
*
* This is usually the number of the sprint within the year
*/
public final static short VERSION_MINOR = 2;
public final static short VERSION_MINOR = 3;

/**
* The patch version of OpenEMS.
Expand Down
2 changes: 1 addition & 1 deletion io.openems.edge.application/EdgeApp.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
org.apache.felix.http.jetty;version='[4.1.4,4.1.5)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.inventory;version='[1.0.6,1.0.7)',\
org.apache.felix.metatype;version='[1.2.2,1.2.3)',\
org.apache.felix.metatype;version='[1.2.4,1.2.5)',\
org.apache.felix.scr;version='[2.1.20,2.1.21)',\
org.apache.felix.webconsole;version='[4.6.0,4.6.1)',\
org.apache.felix.webconsole.plugins.ds;version='[2.1.0,2.1.1)',\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.openems.common.exceptions.NotImplementedException;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.edge.battery.api.Battery;
import io.openems.edge.common.component.AbstractOpenemsComponent;
import io.openems.edge.common.component.OpenemsComponent;
import io.openems.edge.common.startstop.StartStop;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.openems.edge.battery.api;

import io.openems.edge.battery.api.CellCharacteristic;

public class DummyCellCharacteristic implements CellCharacteristic {

public static final int FINAL_CELL_CHARGE_VOLTAGE_MV = 3_650;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import org.junit.Before;
import org.junit.Test;

import io.openems.edge.battery.api.SetAllowedCurrents;
import io.openems.edge.battery.api.Settings;

public class SetAllowedCurrentsTest {

private DummyBattery battery;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.openems.edge.battery.api;

import io.openems.edge.battery.api.Settings;

public class SettingsImpl implements Settings {

private int toleranceMilliVolt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import org.slf4j.LoggerFactory;

import io.openems.common.channel.AccessMode;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.exceptions.OpenemsException;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.edge.battery.api.Battery;
import io.openems.edge.battery.bmw.enums.BmsState;
import io.openems.edge.battery.bmw.enums.State;
Expand All @@ -48,7 +48,7 @@
import io.openems.edge.common.taskmanager.Priority;

@Designate(ocd = Config.class, factory = true)
@Component( //
@Component(//
name = "Bmw.Battery", //
immediate = true, //
configurationPolicy = ConfigurationPolicy.REQUIRE, //
Expand Down Expand Up @@ -85,14 +85,14 @@ protected void setModbus(BridgeModbus modbus) {
public BmwBatteryImpl() {
super(//
OpenemsComponent.ChannelId.values(), //
StartStoppable.ChannelId.values(), //
Battery.ChannelId.values(), //
StartStoppable.ChannelId.values(), //
BMWChannelId.values() //
);
}

@Activate
void activate(ComponentContext context, Config config) throws OpenemsException {
void activate(ComponentContext context, Config config) throws OpenemsNamedException {
this.config = config;
if (super.activate(context, config.id(), config.alias(), config.enabled(), config.modbusUnitId(), this.cm,
"Modbus", config.modbus_id())) {
Expand All @@ -106,12 +106,12 @@ private void handleStateMachine() {
case ERROR:
this.clearError();
// TODO Reset BMS? anything else?
errorDelayIsOver = LocalDateTime.now().plusSeconds(this.config.errorDelay());
setStateMachineState(State.ERRORDELAY);
this.errorDelayIsOver = LocalDateTime.now().plusSeconds(this.config.errorDelay());
this.setStateMachineState(State.ERRORDELAY);
break;
case ERRORDELAY:
if (LocalDateTime.now().isAfter(errorDelayIsOver)) {
errorDelayIsOver = null;
if (LocalDateTime.now().isAfter(this.errorDelayIsOver)) {
this.errorDelayIsOver = null;
if (this.isError()) {
this.setStateMachineState(State.ERROR);
} else {
Expand All @@ -122,28 +122,28 @@ private void handleStateMachine() {
case INIT:
if (this.isSystemRunning()) {
this.setStateMachineState(State.RUNNING);
unsuccessfulStarts = 0;
startAttemptTime = null;
this.unsuccessfulStarts = 0;
this.startAttemptTime = null;
} else {
if (startAttemptTime.plusSeconds(config.maxStartTime()).isBefore(LocalDateTime.now())) {
startAttemptTime = null;
unsuccessfulStarts++;
if (this.startAttemptTime.plusSeconds(this.config.maxStartTime()).isBefore(LocalDateTime.now())) {
this.startAttemptTime = null;
this.unsuccessfulStarts++;
this.stopSystem();
this.setStateMachineState(State.STOPPING);
if (unsuccessfulStarts >= this.config.maxStartAttempts()) {
errorDelayIsOver = LocalDateTime.now().plusSeconds(this.config.startUnsuccessfulDelay());
if (this.unsuccessfulStarts >= this.config.maxStartAttempts()) {
this.errorDelayIsOver = LocalDateTime.now().plusSeconds(this.config.startUnsuccessfulDelay());
this.setStateMachineState(State.ERRORDELAY);
unsuccessfulStarts = 0;
this.unsuccessfulStarts = 0;
}
}
}
break;
case OFF:
log.debug("in case 'OFF'; try to start the system");
this.logDebug(this.log, "in case 'OFF'; try to start the system");
this.startSystem();
log.debug("set state to 'INIT'");
this.logDebug(this.log, "set state to 'INIT'");
this.setStateMachineState(State.INIT);
startAttemptTime = LocalDateTime.now();
this.startAttemptTime = LocalDateTime.now();
break;
case RUNNING:
if (this.isError()) {
Expand Down Expand Up @@ -215,7 +215,7 @@ private void clearError() {
clearErrorChannel.setNextWriteValue(true);
} catch (OpenemsNamedException e) {
// TODO should Fault state channel, but after start stop feature
log.error("Error while trying to reset the system!");
this.logError(this.log, "Error while trying to reset the system!");
}
}

Expand All @@ -239,13 +239,13 @@ public void handleEvent(Event event) {
private void handleBatteryState() {
switch (this.config.batteryState()) {
case DEFAULT:
handleStateMachine();
this.handleStateMachine();
break;
case OFF:
stopSystem();
this.stopSystem();
break;
case ON:
startSystem();
this.startSystem();
break;
}
}
Expand Down Expand Up @@ -287,10 +287,12 @@ private boolean isSystemStopped() {
}

/**
* Checks whether system has an undefined state
* Checks whether system has an undefined state.
*
* @return true if system is neither running nor stopped
*/
private boolean isSystemStatePending() {
return !isSystemRunning() && !isSystemStopped();
return !this.isSystemRunning() && !this.isSystemStopped();
}

private boolean isError() {
Expand All @@ -315,7 +317,7 @@ private void startSystem() {
commandChannel.setNextWriteValue(CLOSE_CONTACTORS);
} catch (OpenemsNamedException e) {
// TODO Auto-generated catch block
log.error("Problem occurred during send start command");
this.logError(this.log, "Problem occurred during send start command");
}
}

Expand All @@ -326,12 +328,12 @@ private void stopSystem() {
try {
commandChannel.setNextWriteValue(OPEN_CONTACTORS);
} catch (OpenemsNamedException e) {
log.error("Problem occurred during send stopping command");
this.logError(this.log, "Problem occurred during send stopping command");
}
}

private State getStateMachineState() {
return state;
return this.state;
}

private void setStateMachineState(State state) {
Expand Down Expand Up @@ -360,20 +362,22 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
),

new FC4ReadInputRegistersTask(999, Priority.HIGH,
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.LIFE_SIGN, new UnsignedWordElement(999)),
m(BMWChannelId.BMS_STATE, new UnsignedWordElement(1000)), //
m(BMWChannelId.ERROR_BITS_1, new UnsignedWordElement(1001)), //
m(BMWChannelId.ERROR_BITS_2, new UnsignedWordElement(1002)), //
m(BMWChannelId.WARNING_BITS_1, new UnsignedWordElement(1003)), //
m(BMWChannelId.WARNING_BITS_2, new UnsignedWordElement(1004)), //
m(BMWChannelId.INFO_BITS, new UnsignedWordElement(1005)), //
m(BMWChannelId.MAXIMUM_OPERATING_CURRENT, new UnsignedWordElement(1006)), //
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.INFO_BITS, new UnsignedWordElement(1005)),
m(BMWChannelId.MAXIMUM_OPERATING_CURRENT, new SignedWordElement(1006)), //
m(BMWChannelId.MINIMUM_OPERATING_CURRENT, new SignedWordElement(1007)), //
m(Battery.ChannelId.CHARGE_MAX_VOLTAGE, new UnsignedWordElement(1008),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
m(Battery.ChannelId.DISCHARGE_MIN_VOLTAGE, new UnsignedWordElement(1009),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
m(Battery.ChannelId.DISCHARGE_MAX_CURRENT, new UnsignedWordElement(1010)), //
m(Battery.ChannelId.DISCHARGE_MAX_CURRENT, new SignedWordElement(1010)), //
m(Battery.ChannelId.CHARGE_MAX_CURRENT, new SignedWordElement(1011),
ElementToChannelConverter.INVERT), //
m(BMWChannelId.MAXIMUM_LIMIT_DYNAMIC_VOLTAGE, new UnsignedWordElement(1012),
Expand Down Expand Up @@ -401,53 +405,61 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
m(BMWChannelId.DC_VOLTAGE_AVERAGE, new UnsignedWordElement(1028),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1)), //
new FC4ReadInputRegistersTask(1029, Priority.HIGH, //
m(new UnsignedWordElement(1029)) //
m(new SignedWordElement(1029)) //
.m(BMWChannelId.DC_CURRENT, ElementToChannelConverter.SCALE_FACTOR_MINUS_1) //
.m(Battery.ChannelId.CURRENT, ElementToChannelConverter.SCALE_FACTOR_3) //
.m(Battery.ChannelId.CURRENT, ElementToChannelConverter.SCALE_FACTOR_MINUS_1) //
.build()), //
new FC4ReadInputRegistersTask(1030, Priority.HIGH, //
m(BMWChannelId.AVERAGE_TEMPERATURE, new UnsignedWordElement(1030))), //
m(BMWChannelId.AVERAGE_TEMPERATURE, new SignedWordElement(1030))), //
new FC4ReadInputRegistersTask(1031, Priority.HIGH, //
m(new UnsignedWordElement(1031)) //
m(new SignedWordElement(1031)) //
.m(BMWChannelId.MINIMUM_TEMPERATURE, ElementToChannelConverter.DIRECT_1_TO_1) //
.m(Battery.ChannelId.MIN_CELL_TEMPERATURE, ElementToChannelConverter.DIRECT_1_TO_1) //
.build()), //
new FC4ReadInputRegistersTask(1032, Priority.HIGH, //
m(new UnsignedWordElement(1032)) //
m(new SignedWordElement(1032)) //
.m(BMWChannelId.MAXIMUM_TEMPERATURE, ElementToChannelConverter.DIRECT_1_TO_1) //
.m(Battery.ChannelId.MAX_CELL_TEMPERATURE, ElementToChannelConverter.DIRECT_1_TO_1) //
.build()), //
new FC4ReadInputRegistersTask(1033, Priority.HIGH,
m(Battery.ChannelId.MIN_CELL_VOLTAGE, new UnsignedWordElement(1033)), //
m(Battery.ChannelId.MAX_CELL_VOLTAGE, new UnsignedWordElement(1034)), //
m(BMWChannelId.AVERAGE_CELL_VOLTAGE, new UnsignedWordElement(1035)), //
m(BMWChannelId.INTERNAL_RESISTANCE, new UnsignedWordElement(1036)), //
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.INTERNAL_RESISTANCE, new UnsignedWordElement(1036)),
m(BMWChannelId.INSULATION_RESISTANCE, new UnsignedWordElement(1037),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
ElementToChannelConverter.DIRECT_1_TO_1), //
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.CONTAINER_TEMPERATURE, new UnsignedWordElement(1038),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
ElementToChannelConverter.SCALE_FACTOR_MINUS_1),
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.AMBIENT_TEMPERATURE, new UnsignedWordElement(1039),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
ElementToChannelConverter.SCALE_FACTOR_MINUS_1),
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.HUMIDITY_CONTAINER, new UnsignedWordElement(1040),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
m(BMWChannelId.MAXIMUM_LIMIT_DYNAMIC_CURRENT_HIGH_RES, new UnsignedWordElement(1041),
ElementToChannelConverter.SCALE_FACTOR_MINUS_1),
m(BMWChannelId.MAXIMUM_LIMIT_DYNAMIC_CURRENT_HIGH_RES, new SignedWordElement(1041),
ElementToChannelConverter.SCALE_FACTOR_2), //
m(BMWChannelId.MINIMUM_LIMIT_DYNAMIC_CURRENT_HIGH_RES, new UnsignedWordElement(1042),
m(BMWChannelId.MINIMUM_LIMIT_DYNAMIC_CURRENT_HIGH_RES, new SignedWordElement(1042),
ElementToChannelConverter.SCALE_FACTOR_2), //
m(BMWChannelId.FULL_CYCLE_COUNT, new UnsignedWordElement(1043)), //
m(BMWChannelId.OPERATING_TIME_COUNT, new UnsignedDoublewordElement(1044)), //
m(BMWChannelId.COM_PRO_VERSION, new UnsignedDoublewordElement(1046)), //
m(BMWChannelId.SERIAL_NUMBER, new UnsignedDoublewordElement(1048)), //
m(BMWChannelId.SERIAL_NUMBER, new UnsignedDoublewordElement(1050)), //
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.OPERATING_TIME_COUNT, new UnsignedDoublewordElement(1044)),
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.COM_PRO_VERSION, new UnsignedDoublewordElement(1046)),
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.SERIAL_NUMBER, new UnsignedDoublewordElement(1048)),
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.SERIAL_NUMBER, new UnsignedDoublewordElement(1050)),
// not defined by "BCS_HL-SW_Operating-Instructions_V1.0.2_under_work_ChL.pdf"
m(BMWChannelId.SOFTWARE_VERSION, new UnsignedDoublewordElement(1052)) //
)

);
));
}

@Override
public ModbusSlaveTable getModbusSlaveTable(AccessMode accessMode) {
return new ModbusSlaveTable( //
return new ModbusSlaveTable(//
OpenemsComponent.getModbusSlaveNatureTable(accessMode), //
Battery.getModbusSlaveNatureTable(accessMode) //
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import io.openems.edge.battery.soltaro.cluster.SoltaroCluster;
import io.openems.edge.battery.soltaro.cluster.enums.ClusterStartStop;
import io.openems.edge.battery.soltaro.cluster.enums.RackUsage;
import io.openems.edge.battery.soltaro.cluster.versionb.Config;
import io.openems.edge.bridge.modbus.api.AbstractOpenemsModbusComponent;
import io.openems.edge.bridge.modbus.api.BridgeModbus;
import io.openems.edge.bridge.modbus.api.ElementToChannelConverter;
Expand Down
Loading

0 comments on commit a839f90

Please sign in to comment.