Skip to content

Commit

Permalink
FEMS Backports (#1658)
Browse files Browse the repository at this point in the history
- Improvements for Time-Of-User Tariffs (#162)
  - Implement generic  Time-of-Use tariff service.
  - Implement Awattar TOU tariff provider implementation.
  - Implement Corrently by STROMDAO TOU tariff
- Checkstyle: do not required Javadoc for build() method in builder pattern
- Add System-Update feature (if OpenEMS Edge is installed via Debian package)
  - Add ExecuteSystemUpdateRequest and GetSystemUpdateStateRequest
- Add Password-only sudo authentication for system execute
- Add `exitcode` to ExecuteSystemCommandResponse
- Add global .gitignore patterns
- Update gradle bnd version to 6.0.0
- Increase number of Threads in ThreadPools to avoid pending tasks
- Add handling of BundleContext in activate (without DummyBundleContext, because that had caused Resolve errors)
- UI: improve detection of isOnline
- Set default port 8085 in edge-dev.ts
- TypeUtils: fix conversion from Double to Float
  - This fixes a bug where a double "0.0" could not be converted to float, with following error: "Cannot convert. Double [0.0] is not fitting in Float range."
  - Also applied Checkstyle on TypeUtils.
- Keba KeContact: trim configured IP address
  - This avoids "evcs0[Failed activation java.net.UnknownHostException: xxx.xxx.xxx.xxx]
- Introduce OpenemsOEM class which simplifies creating custom distributions of OpenEMS
- Soltaro Battery Improvement
- Sinexcel Battery Inverter New Modbus Protocol Implementation
- Allow SymmetricEss in EvcsClusterPeakshaving
  - EvcsClusterPeakshaving was not able to start with a SymmetricEss like Fenecon Dess. (No Reference for component ess0 ...)
- UI register: Remove zip validator
  - Austria has only 4 digits; other countries... who knows?!
- PQ Plus UMD96 Meter Implementation
- Remove Predictive Delay Charge Controller
  - It was replaced by the more advanced "ESS Grid Optimized Charge" Controller (io.openems.edge.controller.ess.gridoptimizedcharge).
- Hardy Barth Salia: implementation improvements
  - Small things like heartbeat were changed in the hardy barth software especially for the newer salia cpµ pro 2 (single charger).
  - Another problem was the external meter that is used internally in the hardy barth to provide the current charge values.
  - This meter also measures the standby consumption of the salia itself and is disabled by default - The function to enable it automatically is on hold for now, as we need a proper update process first.
- GoodWe: add missing Write-Registers
  • Loading branch information
sfeilmeier authored Nov 8, 2021
1 parent 29810c2 commit f53b5f2
Show file tree
Hide file tree
Showing 297 changed files with 8,890 additions and 3,300 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,7 @@ gradle-app.setting
/tools/docker/openems-edge/build
/tools/docker/openems-ui/build
.atom-build.yml

# OpenEMS temp files
io.openems.edge.controller.api.mqtt/edge0
io.openems.edge.application/c:/
1 change: 1 addition & 0 deletions cnf/build.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ testpath: \
Edge_Scheduler;member=${filter;${p};io\.openems\.edge\.scheduler\..*},\
Edge_Thermometer;member=${filter;${p};io\.openems\.edge\.onewire\.thermometer|io\.openems\.edge\.thermometer\..*},\
Edge_Timedata;member=${filter;${p};io\.openems\.edge\.timedata\..*},\
Edge_TimeOfUseTariff;member=${filter;${p};io\.openems\.edge\.timeofusetariff\..*},\

javac.source: 1.8
javac.target: 1.8
4 changes: 2 additions & 2 deletions cnf/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@
<module name="MissingJavadocMethod">
<property name="allowedAnnotations" value="Before,Test,After,Override"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="ignoreMethodNamesRegex" value="doc|set.+"/>
<property name="tokens" value="METHOD_DEF,ANNOTATION_FIELD_DEF"/>
<property name="ignoreMethodNamesRegex" value="doc|set.+|build"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
</module>
<module name="LineLength">
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bnd_version=5.0.0
bnd_version=6.0.0
bnd_snapshots=https://bndtools.jfrog.io/bndtools/libs-snapshot-local
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class B2bWebsocket extends AbstractOpenemsBackendComponent {
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC)
protected volatile Timedata timeData;

protected final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1,
protected final ScheduledExecutorService executor = Executors.newScheduledThreadPool(10,
new ThreadFactoryBuilder().setNameFormat("B2bWebsocket-%d").build());

public B2bWebsocket() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ public boolean isQuery() {
public enum StockProductionLot implements Field {
SERIAL_NUMBER("name", true), //
PRODUCT("product_id", true);

public static final String ODOO_MODEL = "stock.production.lot";
public static final String ODOO_TABLE = ODOO_MODEL.replace(".", "_");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ private void sendRegistrationMail(int odooUserId, String password) throws Openem
/**
* Update language for the given user.
*
* @param user {@link MyUser} the current user
* @param user {@link MyUser} the current user
* @param language to set
* @throws OpenemsException on error
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class PeriodicWriteWorker {
/**
* Executor for subscriptions task.
*/
private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1,
private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(10,
new ThreadFactoryBuilder().setNameFormat("Metadata.Odoo.PGPeriodic-%d").build());

public PeriodicWriteWorker(PostgresHandler parent, HikariDataSource dataSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
import io.openems.backend.common.metadata.Metadata;
import io.openems.backend.common.timedata.EdgeCache;
import io.openems.backend.common.timedata.Timedata;
import io.openems.common.OpenemsOEM;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.exceptions.OpenemsException;
import io.openems.common.types.ChannelAddress;
import io.openems.common.types.EdgeConfig;
import io.openems.common.types.SemanticVersion;
import io.openems.common.utils.StringUtils;
import io.openems.shared.influxdb.InfluxConnector;
import io.openems.shared.influxdb.InfluxConstants;

@Designate(ocd = Config.class, factory = false)
@Component(//
Expand Down Expand Up @@ -148,7 +148,7 @@ private void writeData(int influxEdgeId, TreeBasedTable<Long, ChannelAddress, Js
// this builds an InfluxDB record ("point") for a given timestamp
Point.Builder builder = Point //
.measurement(InfluxConnector.MEASUREMENT) //
.tag(InfluxConstants.TAG, String.valueOf(influxEdgeId)) //
.tag(OpenemsOEM.INFLUXDB_TAG, String.valueOf(influxEdgeId)) //
.time(timestamp, TimeUnit.MILLISECONDS);
for (Entry<ChannelAddress, JsonElement> channelEntry : channelEntries) {
this.addValue(builder, channelEntry.getKey().toString(), channelEntry.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class OpenemsConstants {
*
* Note: this should be max. 32 ASCII characters long
*/
public final static String MANUFACTURER = "OpenEMS Association e.V.";
public final static String MANUFACTURER = OpenemsOEM.MANUFACTURER;

/**
* The model identifier of the device
Expand Down
35 changes: 35 additions & 0 deletions io.openems.common/src/io/openems/common/OpenemsOEM.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.openems.common;

/**
* Adjustments for OpenEMS OEM distributions.
*/
// CHECKSTYLE:OFF
public class OpenemsOEM {
// CHECKSTYLE:ON

/*
* General.
*/
public final static String MANUFACTURER = "OpenEMS Association e.V.";

/*
* Backend-Api Controller
*/
public final static String BACKEND_API_URI = "ws://localhost:8081";

/*
* System-Update.
*/
/**
* Name of the Debian package.
*/
public static final String SYSTEM_UPDATE_PACKAGE = "none";
public static final String SYSTEM_UPDATE_LATEST_VERSION_URL = "none";
public static final String SYSTEM_UPDATE_SCRIPT_URL = "none";

/*
* Backend InfluxDB.
*/
public static final String INFLUXDB_TAG = "edge";

}
9 changes: 9 additions & 0 deletions io.openems.common/src/io/openems/common/channel/Unit.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ public enum Unit {
*/
VOLT_AMPERE_HOURS("VAh"),

// ##########
// Energy Tariff
// ##########
/**
* Unit of Energy Price [€/MWh].
*/
EUROS_PER_MEGAWATT_HOUR("€/MWh"),

// ##########
// Frequency
// ##########
Expand Down Expand Up @@ -267,6 +275,7 @@ public String format(Object value, OpenemsType type) {
case AMPERE:
case DEGREE_CELSIUS:
case DEZIDEGREE_CELSIUS:
case EUROS_PER_MEGAWATT_HOUR:
case HERTZ:
case MILLIAMPERE:
case MILLIHERTZ:
Expand Down
9 changes: 7 additions & 2 deletions io.openems.edge.application/EdgeApp.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
bnd.identity;id='io.openems.edge.meter.discovergy',\
bnd.identity;id='io.openems.edge.meter.janitza',\
bnd.identity;id='io.openems.edge.meter.microcare.sdm630',\
bnd.identity;id='io.openems.edge.meter.pqplus.umd97',\
bnd.identity;id='io.openems.edge.meter.pqplus',\
bnd.identity;id='io.openems.edge.meter.schneider.acti9.smartlink',\
bnd.identity;id='io.openems.edge.meter.sma.shm20',\
bnd.identity;id='io.openems.edge.meter.socomec',\
Expand All @@ -148,6 +148,8 @@
bnd.identity;id='io.openems.edge.tesla.powerwall2',\
bnd.identity;id='io.openems.edge.timedata.influxdb',\
bnd.identity;id='io.openems.edge.timedata.rrd4j',\
bnd.identity;id='io.openems.edge.timeofusetariff.awattar',\
bnd.identity;id='io.openems.edge.timeofusetariff.corrently',\

-runbundles: \
Java-WebSocket;version='[1.5.2,1.5.3)',\
Expand Down Expand Up @@ -263,7 +265,7 @@
io.openems.edge.meter.discovergy;version=snapshot,\
io.openems.edge.meter.janitza;version=snapshot,\
io.openems.edge.meter.microcare.sdm630;version=snapshot,\
io.openems.edge.meter.pqplus.umd97;version=snapshot,\
io.openems.edge.meter.pqplus;version=snapshot,\
io.openems.edge.meter.schneider.acti9.smartlink;version=snapshot,\
io.openems.edge.meter.sma.shm20;version=snapshot,\
io.openems.edge.meter.socomec;version=snapshot,\
Expand Down Expand Up @@ -291,6 +293,9 @@
io.openems.edge.timedata.api;version=snapshot,\
io.openems.edge.timedata.influxdb;version=snapshot,\
io.openems.edge.timedata.rrd4j;version=snapshot,\
io.openems.edge.timeofusetariff.api;version=snapshot,\
io.openems.edge.timeofusetariff.awattar;version=snapshot,\
io.openems.edge.timeofusetariff.corrently;version=snapshot,\
io.openems.shared.influxdb;version=snapshot,\
io.openems.wrapper.eu.chargetime.ocpp;version=snapshot,\
io.openems.wrapper.fastexcel;version=snapshot,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ public enum ClusterVersionBChannelId implements io.openems.edge.common.channel.C
.unit(Unit.OHM) //
.accessMode(AccessMode.READ_WRITE)), //

RACK_1_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_2_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_3_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_4_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_5_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_1_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_2_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_3_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_4_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //
RACK_5_POSITIVE_CONTACTOR(Doc.of(ContactorControl.values()) //
.accessMode(AccessMode.READ_WRITE)), //

// StateChannels
MASTER_ALARM_COMMUNICATION_ERROR_WITH_SUBMASTER(Doc.of(Level.FAULT) //
.text("Communication error with submaster")),
Expand Down Expand Up @@ -115,9 +115,8 @@ public enum ClusterVersionBChannelId implements io.openems.edge.common.channel.C
RACK_5_CYCLE_OVER_CURRENT(Doc.of(Level.FAULT) //
.text("Rack 1 Cycle over current")),
RACK_5_VOLTAGE_DIFFERENCE(Doc.of(Level.FAULT) //
.text("Rack 1 Voltage difference")),
;

.text("Rack 1 Voltage difference")),;

private final Doc doc;

private ClusterVersionBChannelId(Doc doc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@interface Config {

@AttributeDefinition(name = "Component-ID", description = "Unique ID of this Component")
String id() default "bms0";
String id() default "battery0";

@AttributeDefinition(name = "Alias", description = "Human-readable name of this Component; defaults to Component-ID")
String alias() default "";
Expand All @@ -31,7 +31,7 @@

@AttributeDefinition(name = "Number of slaves", description = "The number of slaves in this battery rack (max. 20)", min = "1", max = "20")
int numberOfSlaves() default 20;

@AttributeDefinition(name = "Module type", description = "The type of modules in the rack")
ModuleType moduleType() default ModuleType.MODULE_3_KWH;

Expand All @@ -46,7 +46,7 @@

@AttributeDefinition(name = "Max Start Time", description = "Max Time in seconds allowed for starting the system")
int maxStartTime() default 20;

@AttributeDefinition(name = "Pending Tolerance", description = "time in seconds, that is waited if system status cannot be determined e.g. in case of reading errors")
int pendingTolerance() default 15;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
*/
public class SingleRack {
private static final String KEY_VOLTAGE = "VOLTAGE";
private static final String KEY_VOLTAGE = "VOLTAGE";
private static final String KEY_CURRENT = "CURRENT";
private static final String KEY_CHARGE_INDICATION = "CHARGE_INDICATION";
private static final String KEY_SOC = "SOC";
Expand Down Expand Up @@ -296,7 +296,7 @@ protected Collection<Task> getTasks() {

return tasks;
}

private int getIntFromChannel(String key, int defaultValue) {
@SuppressWarnings("unchecked")
Optional<Integer> opt = (Optional<Integer>) this.channelMap.get(key).value().asOptional();
Expand Down Expand Up @@ -438,15 +438,19 @@ private Map<String, ChannelId> createChannelIdMap() {
this.addEntry(map, KEY_MIN_CELL_TEMPERATURE_ID, new IntegerDoc().unit(Unit.NONE));
this.addEntry(map, KEY_MIN_CELL_TEMPERATURE, new IntegerDoc().unit(Unit.DEZIDEGREE_CELSIUS));
this.addEntry(map, KEY_ALARM_LEVEL_2_CELL_DISCHA_TEMP_LOW,
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Discharge Temperature Low Alarm Level 2")); // Bit 15
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Discharge Temperature Low Alarm Level 2")); // Bit
// 15
this.addEntry(map, KEY_ALARM_LEVEL_2_CELL_DISCHA_TEMP_HIGH,
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Discharge Temperature High Alarm Level 2")); // Bit 14
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Discharge Temperature High Alarm Level 2")); // Bit
// 14
this.addEntry(map, KEY_ALARM_LEVEL_2_GR_TEMPERATURE_HIGH,
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " GR Temperature High Alarm Level 2")); // Bit 10
this.addEntry(map, KEY_ALARM_LEVEL_2_CELL_CHA_TEMP_LOW,
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Charge Temperature Low Alarm Level 2")); // Bit 7
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Charge Temperature Low Alarm Level 2")); // Bit
// 7
this.addEntry(map, KEY_ALARM_LEVEL_2_CELL_CHA_TEMP_HIGH,
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Charge Temperature High Alarm Level 2")); // Bit 6
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Charge Temperature High Alarm Level 2")); // Bit
// 6
this.addEntry(map, KEY_ALARM_LEVEL_2_DISCHA_CURRENT_HIGH,
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Discharge Current High Alarm Level 2")); // Bit 5
this.addEntry(map, KEY_ALARM_LEVEL_2_TOTAL_VOLTAGE_LOW,
Expand All @@ -460,25 +464,32 @@ private Map<String, ChannelId> createChannelIdMap() {
this.addEntry(map, KEY_ALARM_LEVEL_2_CELL_VOLTAGE_HIGH,
Doc.of(Level.FAULT).text("Rack" + this.rackNumber + " Cell Voltage High Alarm Level 2")); // Bit 0
this.addEntry(map, KEY_ALARM_LEVEL_1_CELL_DISCHA_TEMP_LOW,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Discharge Temperature Low Alarm Level 1")); // Bit 15
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Discharge Temperature Low Alarm Level 1")); // Bit
// 15
this.addEntry(map, KEY_ALARM_LEVEL_1_CELL_DISCHA_TEMP_HIGH, Doc.of(Level.WARNING)
.text("Rack" + this.rackNumber + " Cell Discharge Temperature High Alarm Level 1")); // Bit 14
this.addEntry(map, KEY_ALARM_LEVEL_1_TOTAL_VOLTAGE_DIFF_HIGH,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Total Voltage Diff High Alarm Level 1")); // Bit 13
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Total Voltage Diff High Alarm Level 1")); // Bit
// 13
this.addEntry(map, KEY_ALARM_LEVEL_1_CELL_VOLTAGE_DIFF_HIGH,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Voltage Diff High Alarm Level 1")); // Bit 11
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Voltage Diff High Alarm Level 1")); // Bit
// 11
this.addEntry(map, KEY_ALARM_LEVEL_1_GR_TEMPERATURE_HIGH,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " GR Temperature High Alarm Level 1")); // Bit 10
this.addEntry(map, KEY_ALARM_LEVEL_1_CELL_TEMP_DIFF_HIGH,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell temperature Diff High Alarm Level 1")); // Bit 9
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell temperature Diff High Alarm Level 1")); // Bit
// 9
this.addEntry(map, KEY_ALARM_LEVEL_1_SOC_LOW,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " SOC Low Alarm Level 1")); // Bit 8
this.addEntry(map, KEY_ALARM_LEVEL_1_CELL_CHA_TEMP_LOW,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Charge Temperature Low Alarm Level 1")); // Bit 7
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Charge Temperature Low Alarm Level 1")); // Bit
// 7
this.addEntry(map, KEY_ALARM_LEVEL_1_CELL_CHA_TEMP_HIGH,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Charge Temperature High Alarm Level 1")); // Bit 6
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Cell Charge Temperature High Alarm Level 1")); // Bit
// 6
this.addEntry(map, KEY_ALARM_LEVEL_1_DISCHA_CURRENT_HIGH,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Discharge Current High Alarm Level 1")); // Bit 5
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Discharge Current High Alarm Level 1")); // Bit
// 5
this.addEntry(map, KEY_ALARM_LEVEL_1_TOTAL_VOLTAGE_LOW,
Doc.of(Level.WARNING).text("Rack" + this.rackNumber + " Total Voltage Low Alarm Level 1")); // Bit 4
this.addEntry(map, KEY_ALARM_LEVEL_1_CELL_VOLTAGE_LOW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ public static enum ChannelId implements io.openems.edge.common.channel.ChannelId
.text("The maximum number of start attempts failed")), //
MAX_STOP_ATTEMPTS(Doc.of(Level.FAULT) //
.text("The maximum number of stop attempts failed")), //
NUMBER_OF_MODULES_PER_TOWER(Doc.of(OpenemsType.INTEGER) //
.text("Number Modules per Tower")), //
NUMBER_OF_TOWERS(Doc.of(OpenemsType.INTEGER) //
.text("Number of Towers")), //

;

private final Doc doc;
Expand Down
Loading

0 comments on commit f53b5f2

Please sign in to comment.