Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEMS Backports #1658

Merged
merged 3 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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