handleSubmitSetupProtocolRequest(User user,
SubmitSetupProtocolRequest request) throws OpenemsNamedException {
- int protocolId = this.parent.metadata.submitSetupProtocol(user, request.getJsonObject());
+ var protocolId = this.parent.metadata.submitSetupProtocol(user, request.getJsonObject());
var response = JsonUtils.buildJsonObject() //
.addProperty("setupProtocolId", protocolId) //
diff --git a/io.openems.common/src/io/openems/common/channel/PersistencePriority.java b/io.openems.common/src/io/openems/common/channel/PersistencePriority.java
index 421cb3c953a..d59b1a2fb62 100644
--- a/io.openems.common/src/io/openems/common/channel/PersistencePriority.java
+++ b/io.openems.common/src/io/openems/common/channel/PersistencePriority.java
@@ -18,7 +18,7 @@ private PersistencePriority(int value) {
/**
* Is this {@link PersistencePriority} at least as high as the given
* {@link PersistencePriority}?.
- *
+ *
* @param other the given {@link PersistencePriority}
* @return true if this is equal or higher than other
*/
@@ -29,7 +29,7 @@ public boolean isAtLeast(PersistencePriority other) {
/**
* Is this {@link PersistencePriority} at lower than the given
* {@link PersistencePriority}?.
- *
+ *
* @param other the given {@link PersistencePriority}
* @return true if this is strictly lower than other
*/
diff --git a/io.openems.common/src/io/openems/common/channel/Unit.java b/io.openems.common/src/io/openems/common/channel/Unit.java
index 5f4d23d0e58..12bbe1d1a81 100644
--- a/io.openems.common/src/io/openems/common/channel/Unit.java
+++ b/io.openems.common/src/io/openems/common/channel/Unit.java
@@ -262,7 +262,7 @@ public Unit getBaseUnit() {
/**
* Gets the value in its base unit, e.g. converts [kW] to [W].
- *
+ *
* @param value the value
* @return the converted value
*/
@@ -276,11 +276,11 @@ public String getSymbol() {
/**
* Formats the value in the given type.
- *
+ *
*
* For most cases this adds the unit symbol to the value, like "123 kW".
* Booleans are converted to "ON" or "OFF".
- *
+ *
* @param value the value {@link Object}
* @param type the {@link OpenemsType}
* @return the formatted value as String
diff --git a/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java b/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java
index b5ab6f7fb2c..f151619768a 100644
--- a/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java
+++ b/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java
@@ -118,7 +118,7 @@ public String getRawMessage() {
/**
* Gets the formatted Error message.
- *
+ *
* @param params the error parameters
* @return the error message as String
*/
diff --git a/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java b/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java
index dee8fb4493a..04b1fc9fafa 100644
--- a/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java
+++ b/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java
@@ -14,7 +14,7 @@ public interface ThrowingRunnable {
* When an object implementing interface Runnable
is used to create
* a thread, starting the thread causes the object's run
method to
* be called in that separately executing thread.
- *
+ *
*
* The general contract of the method run
is that it may take any
* action whatsoever.
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java
index ee495898592..72acbaf6702 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java
@@ -25,7 +25,7 @@ public String getMethod() {
/**
* Gets the params {@link JsonObject} of the {@link JsonrpcRequest}.
- *
+ *
* @return the params as {@link JsonObject}
*/
public abstract JsonObject getParams();
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java
index 2fb014b81ed..69080267aa0 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java
@@ -23,7 +23,7 @@ public class GenericJsonrpcNotification extends JsonrpcNotification {
/**
* Parses a JSON String to a {@link GenericJsonrpcNotification}.
- *
+ *
* @param json the JSON String
* @return the {@link GenericJsonrpcNotification}
* @throws OpenemsNamedException on error
@@ -34,7 +34,7 @@ public static GenericJsonrpcNotification from(String json) throws OpenemsNamedEx
/**
* Parses a {@link JsonObject} to a {@link GenericJsonrpcNotification}.
- *
+ *
* @param j the {@link JsonObject}
* @return the {@link GenericJsonrpcNotification}
* @throws OpenemsNamedException on error
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java
index 5121fcf4ee0..2b4ad440394 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java
@@ -26,7 +26,7 @@ public abstract class JsonrpcMessage {
/**
* Parses a JSON String to a {@link JsonrpcMessage}.
- *
+ *
* @param json the JSON String
* @return the {@link JsonrpcMessage}
* @throws OpenemsNamedException on error
@@ -37,7 +37,7 @@ public static JsonrpcMessage from(String json) throws OpenemsNamedException {
/**
* Parses a {@link JsonObject} to a {@link JsonrpcMessage}.
- *
+ *
* @param j the {@link JsonObject}
* @return the {@link JsonrpcMessage}
* @throws OpenemsNamedException on error
@@ -46,15 +46,15 @@ public static JsonrpcMessage from(JsonObject j) throws OpenemsNamedException {
if (j.has("method") && j.has("params")) {
if (j.has("id")) {
return GenericJsonrpcRequest.from(j);
- } else {
- return GenericJsonrpcNotification.from(j);
}
+ return GenericJsonrpcNotification.from(j);
}
if (j.has("result")) {
return JsonrpcResponseSuccess.from(j);
- } else if (j.has("error")) {
+ }
+ if (j.has("error")) {
return JsonrpcResponseError.from(j);
}
throw new OpenemsException(
@@ -63,7 +63,7 @@ public static JsonrpcMessage from(JsonObject j) throws OpenemsNamedException {
/**
* Gets the {@link JsonObject} representation of this {@link JsonrpcMessage}.
- *
+ *
* @return a {@link JsonObject}
*/
public JsonObject toJsonObject() {
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java
index 1b1ebfba338..87bf060e807 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java
@@ -27,7 +27,7 @@ public abstract class JsonrpcResponse extends JsonrpcMessage {
/**
* Parses a JSON String to a {@link JsonrpcResponse}.
- *
+ *
* @param json the JSON String
* @return the {@link JsonrpcResponse}
* @throws OpenemsNamedException on error
@@ -38,7 +38,7 @@ public static JsonrpcResponse from(String json) throws OpenemsNamedException {
/**
* Parses a {@link JsonObject} to a {@link JsonrpcResponse}.
- *
+ *
* @param j the {@link JsonObject}
* @return the {@link JsonrpcResponse}
* @throws OpenemsNamedException on error
@@ -47,7 +47,8 @@ public static JsonrpcResponse from(JsonObject j) throws OpenemsNamedException {
var id = UUID.fromString(JsonUtils.getAsString(j, "id"));
if (j.has("result")) {
return new GenericJsonrpcResponseSuccess(id, JsonUtils.getAsJsonObject(j, "result"));
- } else if (j.has("error")) {
+ }
+ if (j.has("error")) {
return JsonrpcResponseError.from(j);
}
throw new OpenemsException("Unable to parse JsonrpcResponse from " + StringUtils.toShortString(j, 100));
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java
index 1a1d9e41a00..5514f047e87 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java
@@ -37,7 +37,7 @@ public class JsonrpcResponseError extends JsonrpcResponse {
/**
* Parses a JSON String to a {@link JsonrpcResponseError}.
- *
+ *
* @param json the JSON String
* @return the {@link JsonrpcResponseError}
* @throws OpenemsNamedException on error
@@ -48,7 +48,7 @@ public static JsonrpcResponseError from(String json) throws OpenemsNamedExceptio
/**
* Parses a {@link JsonObject} to a {@link JsonrpcResponseError}.
- *
+ *
* @param j the {@link JsonObject}
* @return the {@link JsonrpcResponseError}
* @throws OpenemsNamedException on error
@@ -136,7 +136,7 @@ public JsonArray getParams() {
/**
* Gets the error message parameters as Object array.
- *
+ *
* @return the array of error message parameters
*/
public Object[] getParamsAsObjectArray() {
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java
index f5f5ea35307..05dae9f3b4e 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java
@@ -52,7 +52,7 @@ public JsonObject toJsonObject() {
/**
* Gets the result of this {@link JsonrpcResponseSuccess}.
- *
+ *
* @return a JsonObject with the 'result' property of the response
*/
public abstract JsonObject getResult();
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java
index c413d92e88c..482e4007095 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java
@@ -36,7 +36,7 @@ public CurrentDataNotification() {
/**
* Add a Channel value.
- *
+ *
* @param channel the {@link ChannelAddress}
* @param value the value as {@link JsonElement}
*/
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java
index 381fa095206..9badf79766c 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java
@@ -24,7 +24,7 @@ public class EdgeConfigNotification extends JsonrpcNotification {
/**
* Parses a {@link JsonObject} to a {@link EdgeConfigNotification}.
- *
+ *
* @param j the {@link JsonObject}
* @return the {@link EdgeConfigNotification}
* @throws OpenemsNamedException on error
@@ -35,7 +35,7 @@ public static EdgeConfigNotification from(JsonObject j) throws OpenemsNamedExcep
/**
* Parses a {@link JsonrpcNotification} to a {@link EdgeConfigNotification}.
- *
+ *
* @param n the {@link JsonrpcNotification}
* @return the {@link EdgeConfigNotification}
* @throws OpenemsNamedException on error
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java
index ba9ad793684..34789641d75 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java
@@ -30,7 +30,7 @@ public class SystemLogNotification extends JsonrpcNotification {
/**
* Parses a {@link JsonrpcNotification} to a {@link SystemLogNotification}.
- *
+ *
* @param n the {@link JsonrpcNotification}
* @return the {@link SystemLogNotification}
* @throws OpenemsNamedException on error
@@ -43,7 +43,7 @@ public static SystemLogNotification from(JsonrpcNotification n) throws OpenemsNa
/**
* Creates a {@link SystemLogNotification} from a {@link PaxLoggingEvent}.
- *
+ *
* @param event the {@link PaxLoggingEvent}
* @return the {@link SystemLogNotification}
*/
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java
index b907dec4f19..3489fd6eec1 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java
@@ -33,7 +33,7 @@ public class TimestampedDataNotification extends JsonrpcNotification {
/**
* Parses a {@link JsonrpcNotification} to a
* {@link TimestampedDataNotification}.
- *
+ *
* @param n the {@link JsonrpcNotification}
* @return the {@link TimestampedDataNotification}
* @throws OpenemsNamedException on error
@@ -42,8 +42,8 @@ public static TimestampedDataNotification from(JsonrpcNotification n) throws Ope
var result = new TimestampedDataNotification();
var j = n.getParams();
for (Entry e1 : j.entrySet()) {
- long timestamp = Long.parseLong(e1.getKey());
- JsonObject jTime = JsonUtils.getAsJsonObject(e1.getValue());
+ var timestamp = Long.parseLong(e1.getKey());
+ var jTime = JsonUtils.getAsJsonObject(e1.getValue());
for (Entry e2 : jTime.entrySet()) {
result.add(timestamp, ChannelAddress.fromString(e2.getKey()), e2.getValue());
}
@@ -61,7 +61,7 @@ public TimestampedDataNotification() {
/**
* Add timestamped data.
- *
+ *
* @param timestamp the timestamp epoch in milliseconds
* @param data a map of {@link ChannelAddress} to {@link JsonElement} value
*/
@@ -73,7 +73,7 @@ public void add(long timestamp, Map data) {
/**
* Add a timestamped value.
- *
+ *
* @param timestamp the timestamp epoch in milliseconds
* @param address the {@link ChannelAddress}
* @param value the {@link JsonElement} value
@@ -88,8 +88,8 @@ public JsonObject getParams() {
for (Entry> e1 : this.data.rowMap().entrySet()) {
var jTime = new JsonObject();
for (Entry e2 : e1.getValue().entrySet()) {
- ChannelAddress address = e2.getKey();
- JsonElement value = e2.getValue();
+ var address = e2.getKey();
+ var value = e2.getValue();
jTime.add(address.toString(), value);
}
p.add(e1.getKey().toString(), jTime);
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java
index c72b223e55e..8ba66deae9a 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java
@@ -53,14 +53,14 @@ public class AuthenticatedRpcRequest extends JsonrpcR
* "role": {@link Role}
* }
*
- *
+ *
* @return the {@link AuthenticatedRpcRequest}
* @throws OpenemsNamedException on parse error
*/
public static AuthenticatedRpcRequest from(JsonrpcRequest r,
ThrowingFunction userFactory) throws OpenemsNamedException {
var p = r.getParams();
- USER user = userFactory.apply(JsonUtils.getAsJsonObject(p, "user"));
+ var user = userFactory.apply(JsonUtils.getAsJsonObject(p, "user"));
JsonrpcRequest payload = GenericJsonrpcRequest.from(JsonUtils.getAsJsonObject(p, "payload"));
return new AuthenticatedRpcRequest<>(r, Optional.empty(), user, payload);
}
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java
index 89132dcac96..665295456a0 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java
@@ -60,8 +60,7 @@ public static QueryHistoricTimeseriesEnergyPerPeriodRequest from(JsonrpcRequest
var fromDate = JsonUtils.getAsZonedDateTime(p, "fromDate", timezone);
var toDate = JsonUtils.getAsZonedDateTime(p, "toDate", timezone).plusDays(1);
var resolution = JsonUtils.getAsInt(p, "resolution");
- var result = new QueryHistoricTimeseriesEnergyPerPeriodRequest(r,
- fromDate, toDate, resolution);
+ var result = new QueryHistoricTimeseriesEnergyPerPeriodRequest(r, fromDate, toDate, resolution);
var channels = JsonUtils.getAsJsonArray(p, "channels");
for (JsonElement channel : channels) {
var address = ChannelAddress.fromString(JsonUtils.getAsString(channel));
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java
index 51db5ed9377..62f47bc51cd 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java
@@ -9,7 +9,7 @@
/**
* Updates the User Language.
- *
+ *
*
* {
* "jsonrpc": "2.0",
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java
index 01d8e1ccd0d..1c6e7bcbbd2 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java
@@ -26,7 +26,7 @@ public class AuthenticatedRpcResponse extends JsonrpcResponseSuccess {
/**
* Parses a {@link JsonrpcResponseSuccess} to a
* {@link AuthenticatedRpcResponse}.
- *
+ *
* @param r the {@link JsonrpcResponseSuccess}
* @return the {@link AuthenticatedRpcResponse}
* @throws OpenemsNamedException on error
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java
index d272193270b..43318065d8f 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java
@@ -60,9 +60,9 @@ public JsonObject getResult() {
var data = new JsonObject();
for (Entry> rowEntry : this.table.entrySet()) {
for (Entry colEntry : rowEntry.getValue().entrySet()) {
- String channelAddress = colEntry.getKey().toString();
- JsonElement value = colEntry.getValue();
- JsonElement channelValuesElement = data.get(channelAddress);
+ var channelAddress = colEntry.getKey().toString();
+ var value = colEntry.getValue();
+ var channelValuesElement = data.get(channelAddress);
JsonArray channelValues;
if (channelValuesElement != null) {
channelValues = channelValuesElement.getAsJsonArray();
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java
index 1a67899ae81..81767988916 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java
@@ -61,9 +61,9 @@ public JsonObject getResult() {
var data = new JsonObject();
for (Entry> rowEntry : this.table.entrySet()) {
for (Entry colEntry : rowEntry.getValue().entrySet()) {
- String channelAddress = colEntry.getKey().toString();
- JsonElement value = colEntry.getValue();
- JsonElement channelValuesElement = data.get(channelAddress);
+ var channelAddress = colEntry.getKey().toString();
+ var value = colEntry.getValue();
+ var channelValuesElement = data.get(channelAddress);
JsonArray channelValues;
if (channelValuesElement != null) {
channelValues = channelValuesElement.getAsJsonArray();
diff --git a/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java b/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java
index 544c9ddd906..83edab7f4ab 100644
--- a/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java
+++ b/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java
@@ -28,10 +28,10 @@ public interface CommonTimedataService {
*/
public default QueryHistoricTimeseriesExportXlsxResponse handleQueryHistoricTimeseriesExportXlxsRequest(
String edgeId, QueryHistoricTimeseriesExportXlxsRequest request) throws OpenemsNamedException {
- SortedMap> powerData = this.queryHistoricData(edgeId,
+ var powerData = this.queryHistoricData(edgeId,
request.getFromDate(), request.getToDate(), QueryHistoricTimeseriesExportXlsxResponse.POWER_CHANNELS,
15 * 60 /* 15 Minutes */);
- SortedMap energyData = this.queryHistoricEnergy(edgeId, request.getFromDate(),
+ var energyData = this.queryHistoricEnergy(edgeId, request.getFromDate(),
request.getToDate(), QueryHistoricTimeseriesExportXlsxResponse.ENERGY_CHANNELS);
try {
@@ -50,7 +50,7 @@ public default QueryHistoricTimeseriesExportXlsxResponse handleQueryHistoricTime
* @return the resolution in seconds
*/
public static int calculateResolution(ZonedDateTime fromDate, ZonedDateTime toDate) {
- int days = Period.between(fromDate.toLocalDate(), toDate.toLocalDate()).getDays();
+ var days = Period.between(fromDate.toLocalDate(), toDate.toLocalDate()).getDays();
int resolution;
if (days <= 1) {
resolution = 5 * 60; // 5 Minutes
diff --git a/io.openems.common/src/io/openems/common/types/ChannelAddress.java b/io.openems.common/src/io/openems/common/types/ChannelAddress.java
index a302955f8f7..1d0b4eef915 100644
--- a/io.openems.common/src/io/openems/common/types/ChannelAddress.java
+++ b/io.openems.common/src/io/openems/common/types/ChannelAddress.java
@@ -99,16 +99,18 @@ public boolean equals(Object obj) {
* @return an integer value representing the degree of matching
*/
public static int match(ChannelAddress source, ChannelAddress pattern) {
- int componentIdMatch = StringUtils.matchWildcard(source.componentId, pattern.componentId);
- int channelIdMatch = StringUtils.matchWildcard(source.channelId, pattern.channelId);
+ var componentIdMatch = StringUtils.matchWildcard(source.componentId, pattern.componentId);
+ var channelIdMatch = StringUtils.matchWildcard(source.channelId, pattern.channelId);
if (componentIdMatch < 0 || channelIdMatch < 0) {
return -1;
- } else if (componentIdMatch == 0 && channelIdMatch == 0) {
+ }
+ if (componentIdMatch == 0 && channelIdMatch == 0) {
return 0;
}
if (componentIdMatch == 0) {
return Integer.MAX_VALUE / 2 + channelIdMatch;
- } else if (channelIdMatch == 0) {
+ }
+ if (channelIdMatch == 0) {
return Integer.MAX_VALUE / 2 + componentIdMatch;
} else {
return componentIdMatch + channelIdMatch;
diff --git a/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java b/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java
index f98280a21c2..7f49d3c4fe7 100644
--- a/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java
+++ b/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java
@@ -21,7 +21,7 @@ public class ConfigurationProperty {
/**
* Creates a {@link ConfigurationProperty} object from a value.
- *
+ *
* @param the type of the value
* @param value the value
* @return the {@link ConfigurationProperty}
@@ -32,7 +32,7 @@ public static ConfigurationProperty of(T value) {
/**
* Creates a {@link ConfigurationProperty} object with 'null' value.
- *
+ *
* @param the type of the value
* @return the {@link ConfigurationProperty}
*/
@@ -42,7 +42,7 @@ public static ConfigurationProperty asNull() {
/**
* Creates a {@link ConfigurationProperty} object with 'not set' value.
- *
+ *
* @param the type of the value
* @return the {@link ConfigurationProperty}
*/
@@ -53,7 +53,7 @@ public static ConfigurationProperty asNotSet() {
/**
* Creates a {@link ConfigurationProperty} object from a {@link JsonElement}
* value.
- *
+ *
* @param the type of the value
* @param element the {@link JsonElement} value
* @param function conversion function from {@link JsonElement} to type T
@@ -64,7 +64,8 @@ public static ConfigurationProperty fromJsonElement(Optional
ThrowingFunction function) throws OpenemsNamedException {
if (!element.isPresent()) {
return ConfigurationProperty.asNotSet();
- } else if (element.get().isJsonNull()) {
+ }
+ if (element.get().isJsonNull()) {
return ConfigurationProperty.asNull();
} else {
return ConfigurationProperty.of(function.apply(element.get()));
diff --git a/io.openems.common/src/io/openems/common/types/EdgeConfig.java b/io.openems.common/src/io/openems/common/types/EdgeConfig.java
index 9c18c72948b..12f507aaa35 100644
--- a/io.openems.common/src/io/openems/common/types/EdgeConfig.java
+++ b/io.openems.common/src/io/openems/common/types/EdgeConfig.java
@@ -179,8 +179,8 @@ public static Channel fromJson(String channelId, JsonElement json) throws Openem
}
}
var text = JsonUtils.getAsOptionalString(json, "text").orElse("");
- Unit unit = JsonUtils.getAsOptionalEnum(Unit.class, json, "unit").orElse(Unit.NONE);
- ChannelCategory category = JsonUtils.getAsOptionalEnum(ChannelCategory.class, json, "category")
+ var unit = JsonUtils.getAsOptionalEnum(Unit.class, json, "unit").orElse(Unit.NONE);
+ var category = JsonUtils.getAsOptionalEnum(ChannelCategory.class, json, "category")
.orElse(ChannelCategory.OPENEMS_TYPE);
ChannelDetail detail = null;
switch (category) {
@@ -202,7 +202,7 @@ public static Channel fromJson(String channelId, JsonElement json) throws Openem
}
case STATE: {
- Level level = JsonUtils.getAsEnum(Level.class, json, "level");
+ var level = JsonUtils.getAsEnum(Level.class, json, "level");
detail = new ChannelDetailState(level);
break;
}
@@ -319,7 +319,7 @@ public Component(String servicePid, String id, String alias, String factoryId,
/**
* Constructor with NO_SERVICE_PID.
- *
+ *
* @param id the Component-ID
* @param alias the Alias
* @param factoryId the Factory-ID
@@ -333,7 +333,7 @@ public Component(String id, String alias, String factoryId, SortedMap getProperty(String propertyId) {
* @return the Property
*/
public JsonElement getPropertyOrError(String propertyId) throws InvalidValueException {
- JsonElement property = this.properties.get(propertyId);
+ var property = this.properties.get(propertyId);
if (property != null) {
return property;
}
@@ -758,44 +758,43 @@ private static JsonObject getSchema(AttributeDefinition ad) {
.build()) //
.build();
- } else {
- // generate schema from AttributeDefinition Type
- switch (ad.getType()) {
- case AttributeDefinition.STRING:
- case AttributeDefinition.CHARACTER:
- return JsonUtils.buildJsonObject() //
- .addProperty("type", "input") //
- .add("templateOptions", JsonUtils.buildJsonObject() //
- .addProperty("type", "text") //
- .build()) //
- .build();
-
- case AttributeDefinition.LONG:
- case AttributeDefinition.INTEGER:
- case AttributeDefinition.SHORT:
- case AttributeDefinition.DOUBLE:
- case AttributeDefinition.FLOAT:
- case AttributeDefinition.BYTE:
- return JsonUtils.buildJsonObject() //
- .addProperty("type", "input") //
- .add("templateOptions", JsonUtils.buildJsonObject() //
- .addProperty("type", "number") //
- .build()) //
- .build();
-
- case AttributeDefinition.PASSWORD:
- return JsonUtils.buildJsonObject() //
- .addProperty("type", "input") //
- .add("templateOptions", JsonUtils.buildJsonObject() //
- .addProperty("type", "password") //
- .build()) //
- .build();
-
- case AttributeDefinition.BOOLEAN:
- return JsonUtils.buildJsonObject() //
- .addProperty("type", "toggle") //
- .build();
- }
+ }
+ // generate schema from AttributeDefinition Type
+ switch (ad.getType()) {
+ case AttributeDefinition.STRING:
+ case AttributeDefinition.CHARACTER:
+ return JsonUtils.buildJsonObject() //
+ .addProperty("type", "input") //
+ .add("templateOptions", JsonUtils.buildJsonObject() //
+ .addProperty("type", "text") //
+ .build()) //
+ .build();
+
+ case AttributeDefinition.LONG:
+ case AttributeDefinition.INTEGER:
+ case AttributeDefinition.SHORT:
+ case AttributeDefinition.DOUBLE:
+ case AttributeDefinition.FLOAT:
+ case AttributeDefinition.BYTE:
+ return JsonUtils.buildJsonObject() //
+ .addProperty("type", "input") //
+ .add("templateOptions", JsonUtils.buildJsonObject() //
+ .addProperty("type", "number") //
+ .build()) //
+ .build();
+
+ case AttributeDefinition.PASSWORD:
+ return JsonUtils.buildJsonObject() //
+ .addProperty("type", "input") //
+ .add("templateOptions", JsonUtils.buildJsonObject() //
+ .addProperty("type", "password") //
+ .build()) //
+ .build();
+
+ case AttributeDefinition.BOOLEAN:
+ return JsonUtils.buildJsonObject() //
+ .addProperty("type", "toggle") //
+ .build();
}
return schema;
@@ -812,7 +811,7 @@ public static Property fromJson(JsonElement json) throws OpenemsNamedException {
var id = JsonUtils.getAsString(json, "id");
var name = JsonUtils.getAsString(json, "name");
var description = JsonUtils.getAsString(json, "description");
- OpenemsType type = JsonUtils.getAsOptionalEnum(OpenemsType.class, json, "type")
+ var type = JsonUtils.getAsOptionalEnum(OpenemsType.class, json, "type")
.orElse(OpenemsType.STRING);
var isRequired = JsonUtils.getAsBoolean(json, "isRequired");
boolean isPassword = JsonUtils.getAsOptionalBoolean(json, "isPassword").orElse(false);
@@ -1108,7 +1107,7 @@ public Optional getComponent(String componentId) {
* @return the {@link Component}
*/
public Component getComponentOrError(String componentId) throws InvalidValueException {
- Component component = this.components.get(componentId);
+ var component = this.components.get(componentId);
if (component != null) {
return component;
}
diff --git a/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java b/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java
index d1d90f9f0a8..9741d7cfd98 100644
--- a/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java
+++ b/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java
@@ -57,8 +57,8 @@ public static EdgeConfigDiff diff(EdgeConfig newConfig, EdgeConfig oldConfig) {
if (!diffComponents.entriesDiffering().isEmpty()) {
for (Entry> differingComponent : diffComponents
.entriesDiffering().entrySet()) {
- EdgeConfig.Component newComponent = differingComponent.getValue().leftValue();
- EdgeConfig.Component oldComponent = differingComponent.getValue().rightValue();
+ var newComponent = differingComponent.getValue().leftValue();
+ var oldComponent = differingComponent.getValue().rightValue();
MapDifference diffProperties = Maps.difference(newComponent.getProperties(),
oldComponent.getProperties());
@@ -192,12 +192,12 @@ public TreeMap getProperties() {
* @param properties the properties
*/
private void addCreated(String componentId, Component component, Map properties) {
- ComponentDiff.OldNewProperty lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+ var lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_BY)
.orElse(new JsonPrimitive("Apache Felix Webconsole")));
- ComponentDiff.OldNewProperty lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+ var lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_AT).orElse(JsonNull.INSTANCE));
- ComponentDiff diff = new ComponentDiff(component, Change.CREATED, lastChangeBy, lastChangeAt);
+ var diff = new ComponentDiff(component, Change.CREATED, lastChangeBy, lastChangeAt);
for (Entry entry : properties.entrySet()) {
diff.add(entry.getKey(), new ComponentDiff.OldNewProperty(JsonNull.INSTANCE, entry.getValue()));
}
@@ -212,14 +212,14 @@ private void addCreated(String componentId, Component component, Map properties) {
- ComponentDiff.OldNewProperty lastChangeBy = new ComponentDiff.OldNewProperty(
+ var lastChangeBy = new ComponentDiff.OldNewProperty(
component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_BY)
.orElse(new JsonPrimitive("Apache Felix Webconsole")),
JsonNull.INSTANCE);
- ComponentDiff.OldNewProperty lastChangeAt = new ComponentDiff.OldNewProperty(
+ var lastChangeAt = new ComponentDiff.OldNewProperty(
component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_AT).orElse(JsonNull.INSTANCE),
JsonNull.INSTANCE);
- ComponentDiff diff = new ComponentDiff(component, Change.DELETED, lastChangeBy, lastChangeAt);
+ var diff = new ComponentDiff(component, Change.DELETED, lastChangeBy, lastChangeAt);
for (Entry entry : properties.entrySet()) {
diff.add(entry.getKey(), new ComponentDiff.OldNewProperty(entry.getValue(), JsonNull.INSTANCE));
}
@@ -234,12 +234,12 @@ private void addDeleted(String componentId, Component component, Map properties) {
- ComponentDiff.OldNewProperty lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+ var lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_BY)
.orElse(new JsonPrimitive("Apache Felix Webconsole")));
- ComponentDiff.OldNewProperty lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+ var lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
JsonNull.INSTANCE);
- ComponentDiff diff = new ComponentDiff(component, Change.UPDATED, lastChangeBy, lastChangeAt);
+ var diff = new ComponentDiff(component, Change.UPDATED, lastChangeBy, lastChangeAt);
for (Entry property : properties.entrySet()) {
diff.add(property.getKey(), property.getValue());
}
@@ -265,8 +265,8 @@ public String getAsHtml() {
+ " " //
+ " ");
for (Entry componentEntry : this.components.entrySet()) {
- String componentId = componentEntry.getKey();
- ComponentDiff component = componentEntry.getValue();
+ var componentId = componentEntry.getKey();
+ var component = componentEntry.getValue();
b.append("");
// Change column
b.append(String.format("%s | ",
@@ -319,8 +319,8 @@ public String getAsHtml() {
public String getAsText() {
var b = new StringBuilder();
for (Entry componentEntry : this.components.entrySet()) {
- final ComponentDiff component = componentEntry.getValue();
- String change = component.properties.entrySet().stream() //
+ final var component = componentEntry.getValue();
+ var change = component.properties.entrySet().stream() //
.filter(e -> {
switch (e.getKey()) {
case "_lastChangeAt":
diff --git a/io.openems.common/src/io/openems/common/types/SemanticVersion.java b/io.openems.common/src/io/openems/common/types/SemanticVersion.java
index 3484f9c9624..ac1b7b9561e 100644
--- a/io.openems.common/src/io/openems/common/types/SemanticVersion.java
+++ b/io.openems.common/src/io/openems/common/types/SemanticVersion.java
@@ -99,7 +99,7 @@ public SemanticVersion(int major, int minor, int patch) {
/**
* Is this version at least as high as the given {@link SemanticVersion}?.
- *
+ *
* @param o the given version
* @return true if this version is greater or equal to the given version
*/
diff --git a/io.openems.common/src/io/openems/common/types/SystemLog.java b/io.openems.common/src/io/openems/common/types/SystemLog.java
index a796c0c95fb..b98ec62a2f6 100644
--- a/io.openems.common/src/io/openems/common/types/SystemLog.java
+++ b/io.openems.common/src/io/openems/common/types/SystemLog.java
@@ -58,8 +58,7 @@ public static Level fromPaxLevel(PaxLevel paxLevel) {
*/
public static SystemLog fromPaxLoggingEvent(PaxLoggingEvent event) {
var level = Level.fromPaxLevel(event.getLevel());
- var time = ZonedDateTime.ofInstant(Instant.ofEpochMilli(event.getTimeStamp()),
- ZoneId.systemDefault());
+ var time = ZonedDateTime.ofInstant(Instant.ofEpochMilli(event.getTimeStamp()), ZoneId.systemDefault());
var source = event.getLoggerName();
var message = event.getRenderedMessage();
return new SystemLog(time, level, source, message);
diff --git a/io.openems.common/src/io/openems/common/utils/EnumUtils.java b/io.openems.common/src/io/openems/common/utils/EnumUtils.java
index b96337222dd..c398d4a3b97 100644
--- a/io.openems.common/src/io/openems/common/utils/EnumUtils.java
+++ b/io.openems.common/src/io/openems/common/utils/EnumUtils.java
@@ -13,7 +13,7 @@ public class EnumUtils {
/**
* Gets the member of the {@link EnumMap} as {@link Optional} {@link Boolean}.
- *
+ *
* @param the type of the EnumMap key
* @param map the {@link EnumMap}
* @param member the member
@@ -31,7 +31,7 @@ public static > Optional getAsOptionalBoolean(E
/**
* Gets the member of the {@link EnumMap} as {@link Optional} {@link String}.
- *
+ *
* @param the type of the EnumMap key
* @param map the {@link EnumMap}
* @param member the member
@@ -49,7 +49,7 @@ public static > Optional getAsOptionalString(Enu
/**
* Gets the member of the {@link EnumMap} as {@link JsonPrimitive}.
- *
+ *
* @param the type of the EnumMap key
* @param map the {@link EnumMap}
* @param member the member
@@ -58,13 +58,13 @@ public static > Optional getAsOptionalString(Enu
*/
public static > JsonPrimitive getAsPrimitive(EnumMap map, ENUM member)
throws OpenemsNamedException {
- JsonElement jSubElement = getSubElement(map, member);
+ var jSubElement = getSubElement(map, member);
return JsonUtils.getAsPrimitive(jSubElement);
}
/**
* Gets the member of the {@link EnumMap} as {@link Boolean}.
- *
+ *
* @param the type of the EnumMap key
* @param map the {@link EnumMap}
* @param member the member
@@ -78,7 +78,7 @@ public static > Boolean getAsBoolean(EnumMap the type of the EnumMap key
* @param map the {@link EnumMap}
* @param member the member
@@ -92,7 +92,7 @@ public static > String getAsString(EnumMap the type of the EnumMap key
* @param map the {@link EnumMap}
* @param member the member
@@ -103,14 +103,14 @@ public static > JsonElement getSubElement(EnumMap the type of the EnumMap key
* @param map the {@link EnumMap}
* @param member the member
diff --git a/io.openems.common/src/io/openems/common/utils/JsonUtils.java b/io.openems.common/src/io/openems/common/utils/JsonUtils.java
index 0cefd17859a..efdf6ca7dd5 100644
--- a/io.openems.common/src/io/openems/common/utils/JsonUtils.java
+++ b/io.openems.common/src/io/openems/common/utils/JsonUtils.java
@@ -1,6 +1,7 @@
package io.openems.common.utils;
import java.net.Inet4Address;
+import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
@@ -342,8 +343,7 @@ public static JsonPrimitive getAsPrimitive(JsonElement jElement) throws OpenemsN
public static JsonPrimitive getAsPrimitive(JsonElement jElement, String memberName) throws OpenemsNamedException {
var jSubElement = getSubElement(jElement, memberName);
if (!jSubElement.isJsonPrimitive()) {
- throw OpenemsError.JSON_NO_PRIMITIVE_MEMBER.exception(memberName,
- jElement.toString().replaceAll("%", "%%"));
+ throw OpenemsError.JSON_NO_PRIMITIVE_MEMBER.exception(memberName, jElement.toString().replace("%", "%%"));
}
return jSubElement.getAsJsonPrimitive();
}
@@ -506,7 +506,7 @@ public static String getAsString(JsonElement jElement) throws OpenemsNamedExcept
/**
* Gets the {@link JsonPrimitive} as {@link String}.
- *
+ *
* @param jPrimitive the {@link JsonPrimitive}
* @return the {@link String} value
* @throws OpenemsNamedException on error
@@ -585,7 +585,7 @@ public static String[] getAsStringArray(JsonArray json) throws OpenemsNamedExcep
/**
* Gets the {@link JsonPrimitive} as {@link Boolean}.
- *
+ *
* @param jPrimitive the {@link JsonPrimitive}
* @return the {@link Boolean} value
* @throws OpenemsNamedException on error
@@ -598,7 +598,8 @@ public static boolean getAsBoolean(JsonPrimitive jPrimitive) throws OpenemsNamed
var element = jPrimitive.getAsString();
if (element.equalsIgnoreCase("false")) {
return false;
- } else if (element.equalsIgnoreCase("true")) {
+ }
+ if (element.equalsIgnoreCase("true")) {
return true;
}
}
@@ -607,7 +608,7 @@ public static boolean getAsBoolean(JsonPrimitive jPrimitive) throws OpenemsNamed
/**
* Gets the {@link JsonElement} as {@link Boolean}.
- *
+ *
* @param jElement the {@link JsonElement}
* @return the {@link Boolean} value
* @throws OpenemsNamedException on error
@@ -648,7 +649,7 @@ public static Optional getAsOptionalBoolean(JsonElement jElement, Strin
/**
* Gets the {@link JsonPrimitive} as short.
- *
+ *
* @param jPrimitive the {@link JsonPrimitive}
* @return the short value
* @throws OpenemsNamedException on error
@@ -656,7 +657,8 @@ public static Optional getAsOptionalBoolean(JsonElement jElement, Strin
public static short getAsShort(JsonPrimitive jPrimitive) throws OpenemsNamedException {
if (jPrimitive.isNumber()) {
return jPrimitive.getAsShort();
- } else if (jPrimitive.isString()) {
+ }
+ if (jPrimitive.isString()) {
var string = jPrimitive.getAsString();
return Short.parseShort(string);
}
@@ -665,7 +667,7 @@ public static short getAsShort(JsonPrimitive jPrimitive) throws OpenemsNamedExce
/**
* Gets the {@link JsonElement} as short.
- *
+ *
* @param jElement the {@link JsonElement}
* @return the short value
* @throws OpenemsNamedException on error
@@ -688,7 +690,7 @@ public static short getAsShort(JsonElement jElement, String memberName) throws O
/**
* Gets the {@link JsonPrimitive} as int.
- *
+ *
* @param jPrimitive the {@link JsonPrimitive}
* @return the int value
* @throws OpenemsNamedException on error
@@ -696,7 +698,8 @@ public static short getAsShort(JsonElement jElement, String memberName) throws O
public static int getAsInt(JsonPrimitive jPrimitive) throws OpenemsNamedException {
if (jPrimitive.isNumber()) {
return jPrimitive.getAsInt();
- } else if (jPrimitive.isString()) {
+ }
+ if (jPrimitive.isString()) {
var string = jPrimitive.getAsString();
return Integer.parseInt(string);
}
@@ -705,7 +708,7 @@ public static int getAsInt(JsonPrimitive jPrimitive) throws OpenemsNamedExceptio
/**
* Gets the {@link JsonElement} as int.
- *
+ *
* @param jElement the {@link JsonElement}
* @return the int value
* @throws OpenemsNamedException on error
@@ -775,7 +778,7 @@ public static Optional getAsOptionalInt(JsonElement jElement, String me
/**
* Gets the {@link JsonPrimitive} as long.
- *
+ *
* @param jPrimitive the {@link JsonPrimitive}
* @return the long value
* @throws OpenemsNamedException on error
@@ -783,7 +786,8 @@ public static Optional getAsOptionalInt(JsonElement jElement, String me
public static long getAsLong(JsonPrimitive jPrimitive) throws OpenemsNamedException {
if (jPrimitive.isNumber()) {
return jPrimitive.getAsLong();
- } else if (jPrimitive.isString()) {
+ }
+ if (jPrimitive.isString()) {
var string = jPrimitive.getAsString();
return Integer.parseInt(string);
}
@@ -792,7 +796,7 @@ public static long getAsLong(JsonPrimitive jPrimitive) throws OpenemsNamedExcept
/**
* Gets the {@link JsonElement} as long.
- *
+ *
* @param jElement the {@link JsonElement}
* @return the long value
* @throws OpenemsNamedException on error
@@ -831,7 +835,7 @@ public static Optional getAsOptionalLong(JsonElement jElement, String memb
/**
* Gets the {@link JsonPrimitive} as {@link Float}.
- *
+ *
* @param jPrimitive the {@link JsonPrimitive}
* @return the {@link Float} value
* @throws OpenemsNamedException on error
@@ -839,7 +843,8 @@ public static Optional getAsOptionalLong(JsonElement jElement, String memb
public static float getAsFloat(JsonPrimitive jPrimitive) throws OpenemsNamedException {
if (jPrimitive.isNumber()) {
return jPrimitive.getAsFloat();
- } else if (jPrimitive.isString()) {
+ }
+ if (jPrimitive.isString()) {
var string = jPrimitive.getAsString();
return Float.parseFloat(string);
}
@@ -848,7 +853,7 @@ public static float getAsFloat(JsonPrimitive jPrimitive) throws OpenemsNamedExce
/**
* Gets the {@link JsonElement} as {@link Float}.
- *
+ *
* @param jElement the {@link JsonElement}
* @return the {@link Float} value
* @throws OpenemsNamedException on error
@@ -871,7 +876,7 @@ public static float getAsFloat(JsonElement jElement, String memberName) throws O
/**
* Gets the {@link JsonPrimitive} as {@link Double}.
- *
+ *
* @param jPrimitive the {@link JsonPrimitive}
* @return the {@link Double} value
* @throws OpenemsNamedException on error
@@ -879,7 +884,8 @@ public static float getAsFloat(JsonElement jElement, String memberName) throws O
public static double getAsDouble(JsonPrimitive jPrimitive) throws OpenemsNamedException {
if (jPrimitive.isNumber()) {
return jPrimitive.getAsDouble();
- } else if (jPrimitive.isString()) {
+ }
+ if (jPrimitive.isString()) {
var string = jPrimitive.getAsString();
return Double.parseDouble(string);
}
@@ -888,7 +894,7 @@ public static double getAsDouble(JsonPrimitive jPrimitive) throws OpenemsNamedEx
/**
* Gets the {@link JsonElement} as {@link Double}.
- *
+ *
* @param jElement the {@link JsonElement}
* @return the {@link Double} value
* @throws OpenemsNamedException on error
@@ -922,7 +928,7 @@ public static > E getAsEnum(Class enumType, JsonElement jEl
throws OpenemsNamedException {
var element = getAsString(jElement);
try {
- return (E) Enum.valueOf(enumType, element);
+ return Enum.valueOf(enumType, element);
} catch (IllegalArgumentException e) {
throw OpenemsError.JSON_NO_ENUM.exception(element);
}
@@ -942,7 +948,7 @@ public static > E getAsEnum(Class enumType, JsonElement jEl
throws OpenemsNamedException {
var element = getAsString(jElement, memberName);
try {
- return (E) Enum.valueOf(enumType, element);
+ return Enum.valueOf(enumType, element);
} catch (IllegalArgumentException e) {
throw OpenemsError.JSON_NO_ENUM_MEMBER.exception(memberName, element);
}
@@ -980,7 +986,7 @@ public static > Optional getAsOptionalEnum(Class enumTyp
*/
public static Inet4Address getAsInet4Address(JsonElement jElement) throws OpenemsNamedException {
try {
- return (Inet4Address) Inet4Address.getByName(getAsString(jElement));
+ return (Inet4Address) InetAddress.getByName(getAsString(jElement));
} catch (UnknownHostException e) {
throw OpenemsError.JSON_NO_INET4ADDRESS.exception(jElement.toString().replace("%", "%%"));
}
@@ -997,7 +1003,7 @@ public static Inet4Address getAsInet4Address(JsonElement jElement) throws Openem
*/
public static Optional getAsOptionalInet4Address(JsonElement jElement, String memberName) {
try {
- return Optional.ofNullable((Inet4Address) Inet4Address.getByName(getAsString(jElement, memberName)));
+ return Optional.ofNullable((Inet4Address) InetAddress.getByName(getAsString(jElement, memberName)));
} catch (OpenemsNamedException | UnknownHostException e) {
return Optional.empty();
}
@@ -1032,7 +1038,7 @@ public static UUID getAsUUID(JsonElement jElement, String memberName) throws Ope
// CHECKSTYLE:OFF
public static Optional getAsOptionalUUID(JsonElement jElement, String memberName) {
// CHECKSTYLE:ON
- Optional uuid = getAsOptionalString(jElement, memberName);
+ var uuid = getAsOptionalString(jElement, memberName);
if (uuid.isPresent()) {
return Optional.ofNullable(UUID.fromString(uuid.get()));
}
@@ -1078,7 +1084,8 @@ public static Object getAsBestType(JsonElement j) throws OpenemsNamedException {
result[i] = jA.get(i).getAsBoolean();
}
return result;
- } else if (isInt) {
+ }
+ if (isInt) {
// convert to int array
var result = new int[jA.size()];
for (var i = 0; i < jA.size(); i++) {
@@ -1140,7 +1147,8 @@ public static JsonElement getAsJsonElement(Object value) {
* Number
*/
return new JsonPrimitive((Number) value);
- } else if (value instanceof String) {
+ }
+ if (value instanceof String) {
/*
* String
*/
@@ -1263,7 +1271,8 @@ public static Object getAsType(Class> type, JsonElement j) throws NotImplement
*/
return j.getAsInt();
- } else if (Long.class.isAssignableFrom(type)) {
+ }
+ if (Long.class.isAssignableFrom(type)) {
/*
* Asking for an Long
*/
@@ -1434,7 +1443,7 @@ public static JsonObject parseToJsonObject(String string) throws OpenemsNamedExc
/**
* Parses a string to a {@link JsonArray}.
- *
+ *
* @param string the String
* @return the {@link JsonArray}
* @throws OpenemsNamedException on error
diff --git a/io.openems.common/src/io/openems/common/utils/Mutex.java b/io.openems.common/src/io/openems/common/utils/Mutex.java
index 2d57055e547..f311bf8d40c 100644
--- a/io.openems.common/src/io/openems/common/utils/Mutex.java
+++ b/io.openems.common/src/io/openems/common/utils/Mutex.java
@@ -17,7 +17,7 @@ public Mutex(boolean initiallyPermitted) {
/**
* Wait for a {@link #release()}.
- *
+ *
* @throws InterruptedException on wait error
*/
public void await() throws InterruptedException {
@@ -29,7 +29,7 @@ public void await() throws InterruptedException {
/**
* Wait for a {@link #release()} with a timeout.
- *
+ *
* @param timeout the timeout value
* @param unit the timeout {@link TimeUnit}
* @throws InterruptedException on wait error
diff --git a/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java b/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java
index 4f8058ac100..dd3818e31c1 100644
--- a/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java
+++ b/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java
@@ -14,7 +14,7 @@ public class SecureRandomSingleton {
/**
* Gets the {@link SecureRandom} singleton instance.
- *
+ *
* @return the {@link SecureRandom} instance
*/
public static synchronized SecureRandom getInstance() {
diff --git a/io.openems.common/src/io/openems/common/utils/StringUtils.java b/io.openems.common/src/io/openems/common/utils/StringUtils.java
index 7db042b67b5..d7b87e53b0f 100644
--- a/io.openems.common/src/io/openems/common/utils/StringUtils.java
+++ b/io.openems.common/src/io/openems/common/utils/StringUtils.java
@@ -9,10 +9,10 @@ public class StringUtils {
/**
* Shortens a string to a given length.
- *
+ *
*
* Example: converts a string "hello world" to "hello w..."
- *
+ *
* @param s the string
* @param length the target string length
* @return the shortened string
@@ -26,10 +26,10 @@ public static String toShortString(String s, int length) {
/**
* Shortens a {@link JsonElement} string representation to a given length.
- *
+ *
*
* Example: converts a "{ 'foo': 'bar' }" to "{ 'foo': '..."
- *
+ *
* @param j the {@link JsonElement}
* @param length the target string length
* @return the shortened string
@@ -41,10 +41,10 @@ public static String toShortString(JsonElement j, int length) {
/**
* Convert the first letter of a string to Upper-Case.
- *
+ *
*
* Example: converts "hello world" to "Hello world"
- *
+ *
* @param s the string
* @return the converted string
*/
@@ -74,7 +74,8 @@ public static String capitalizeFirstLetter(String s) {
public static int matchWildcard(String source, String pattern) {
if (source.equals(pattern)) {
return 0;
- } else if (pattern.equals("*")) {
+ }
+ if (pattern.equals("*")) {
return 1;
} else if (pattern.startsWith("*") && source.endsWith(pattern.substring(1))) {
return pattern.length();
diff --git a/io.openems.common/src/io/openems/common/utils/XmlUtils.java b/io.openems.common/src/io/openems/common/utils/XmlUtils.java
index 59431251e9d..6431897bda9 100644
--- a/io.openems.common/src/io/openems/common/utils/XmlUtils.java
+++ b/io.openems.common/src/io/openems/common/utils/XmlUtils.java
@@ -15,7 +15,7 @@ public class XmlUtils {
/**
* Converts a {@link NamedNodeMap} to a string representative.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @return a string
*/
@@ -29,7 +29,7 @@ public static String namedNodeMapToString(NamedNodeMap attrs) {
/**
* Gets the Sub-Node of a {@link NamedNodeMap} with the given name.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @param name the name of the Sub-Node
* @return the {@link Node}
@@ -47,7 +47,7 @@ public static Node getSubNode(NamedNodeMap attrs, String name) throws OpenemsNam
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* String.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @param name the name of the Sub-Node
* @return the value of the {@link Node}
@@ -65,7 +65,7 @@ public static String getAsString(NamedNodeMap attrs, String name) throws Openems
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* String; otherwise the alternative value.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @param name the name of the Sub-Node
* @param def the alternative value
@@ -83,7 +83,7 @@ public static String getAsStringOrElse(NamedNodeMap attrs, String name, String d
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* Integer.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @param name the name of the Sub-Node
* @return the value of the {@link Node}
@@ -100,7 +100,7 @@ public static int getAsInt(NamedNodeMap attrs, String name) throws OpenemsNamedE
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* Integer; otherwise the alternative value.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @param name the name of the Sub-Node
* @param def the alternative value
@@ -118,7 +118,7 @@ public static int getAsIntOrElse(NamedNodeMap attrs, String name, int def) {
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* Enum.
- *
+ *
* @param the type of the {@link Enum}
* @param enumType the class of the {@link Enum}
* @param attrs the {@link NamedNodeMap}
@@ -130,7 +130,7 @@ public static > E getAsEnum(Class enumType, NamedNodeMap at
throws OpenemsNamedException {
var element = XmlUtils.getAsString(attrs, name);
try {
- return (E) Enum.valueOf(enumType, element.toUpperCase());
+ return Enum.valueOf(enumType, element.toUpperCase());
} catch (IllegalArgumentException e) {
throw new OpenemsException(e);
}
@@ -139,7 +139,7 @@ public static > E getAsEnum(Class enumType, NamedNodeMap at
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* Enum; otherwise the alternative value.
- *
+ *
* @param the type of the {@link Enum}
* @param enumType the class of the {@link Enum}
* @param attrs the {@link NamedNodeMap}
@@ -159,7 +159,7 @@ public static > E getAsEnumOrElse(Class enumType, NamedNode
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* Boolean.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @param name the name of the Sub-Node
* @return the value of the {@link Node}
@@ -173,7 +173,7 @@ public static boolean getAsBoolean(NamedNodeMap attrs, String name) throws Opene
/**
* Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as
* Boolean; otherwise the alternative value.
- *
+ *
* @param attrs the {@link NamedNodeMap}
* @param name the name of the Sub-Node
* @param def the alternative value
@@ -190,7 +190,7 @@ public static boolean getAsBooleanOrElse(NamedNodeMap attrs, String name, boolea
/**
* Gets the Content of a {@link Node}.
- *
+ *
* @param node the {@link Node}
* @return the text content as string
*/
@@ -200,7 +200,7 @@ public static String getContentAsString(Node node) {
/**
* Gets the Content of a {@link Node} as Integer.
- *
+ *
* @param node the {@link Node}
* @return the text content as string
*/
diff --git a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java
index 933de987884..28ea1de9ba6 100644
--- a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java
+++ b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java
@@ -167,7 +167,7 @@ protected OnInternalError getOnInternalError() {
/**
* Sends a {@link JsonrpcMessage}.
- *
+ *
* @param message the {@link JsonrpcMessage}
* @throws OpenemsException on error, e.g. if the websocket is not connected
*/
diff --git a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java
index 387b33e312c..f88a30d2f6c 100644
--- a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java
+++ b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java
@@ -46,7 +46,7 @@ public abstract class AbstractWebsocketServer extends Abstract
/**
* Construct an {@link AbstractWebsocketServer}.
- *
+ *
* @param name to identify this server
* @param port to listen on
* @param poolSize number of threads dedicated to handle the tasks
@@ -217,7 +217,7 @@ public void stop() {
ThreadPoolUtils.shutdownAndAwaitTermination(this.executor, 5);
ThreadPoolUtils.shutdownAndAwaitTermination(this.debugLogExecutor, 5);
- int tries = 3;
+ var tries = 3;
while (tries-- > 0) {
try {
this.ws.stop();
diff --git a/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java b/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java
index 487b821aa9b..5e23393a57a 100644
--- a/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java
+++ b/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java
@@ -25,7 +25,7 @@ private Builder() {
/**
* Sets the {@link OnOpen} callback.
- *
+ *
* @param onOpen the callback
* @return the {@link Builder}
*/
@@ -36,7 +36,7 @@ public DummyWebsocketServer.Builder onOpen(OnOpen onOpen) {
/**
* Sets the {@link OnRequest} callback.
- *
+ *
* @param onRequest the callback
* @return the {@link Builder}
*/
@@ -47,7 +47,7 @@ public DummyWebsocketServer.Builder onRequest(OnRequest onRequest) {
/**
* Sets the {@link OnNotification} callback.
- *
+ *
* @param onNotification the callback
* @return the {@link Builder}
*/
@@ -58,7 +58,7 @@ public DummyWebsocketServer.Builder onNotification(OnNotification onNotification
/**
* Sets the {@link OnError} callback.
- *
+ *
* @param onError the callback
* @return the {@link Builder}
*/
@@ -69,7 +69,7 @@ public DummyWebsocketServer.Builder onError(OnError onError) {
/**
* Sets the {@link OnClose} callback.
- *
+ *
* @param onClose the callback
* @return the {@link Builder}
*/
diff --git a/io.openems.common/src/io/openems/common/websocket/OnOpen.java b/io.openems.common/src/io/openems/common/websocket/OnOpen.java
index bfa1ea360e6..3851d7e4524 100644
--- a/io.openems.common/src/io/openems/common/websocket/OnOpen.java
+++ b/io.openems.common/src/io/openems/common/websocket/OnOpen.java
@@ -38,10 +38,10 @@ public interface OnOpen {
public static Optional getFieldFromHandshakeCookie(JsonObject handshake, String fieldname) {
for (Entry entry : handshake.entrySet()) {
if (entry.getKey().equalsIgnoreCase("cookie")) {
- Optional cookieOpt = JsonUtils.getAsOptionalString(entry.getValue());
+ var cookieOpt = JsonUtils.getAsOptionalString(entry.getValue());
if (cookieOpt.isPresent()) {
for (String cookieVariable : cookieOpt.get().split("; ")) {
- String[] keyValue = cookieVariable.split("=");
+ var keyValue = cookieVariable.split("=");
if (keyValue.length == 2) {
if (keyValue[0].equals(fieldname)) {
return Optional.ofNullable(keyValue[1]);
diff --git a/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java b/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java
index c225f32faf0..4883688c4da 100644
--- a/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java
+++ b/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java
@@ -75,7 +75,7 @@ public final void run() {
/**
* Simplifies a {@link JsonrpcMessage} by recursively removing unnecessary
* elements "jsonrpc" and "id".
- *
+ *
* @param j the {@link JsonrpcMessage#toJsonObject()}
* @return a simplified {@link JsonObject}
*/
diff --git a/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java b/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java
index 4f9f82b853e..e35024baabb 100644
--- a/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java
+++ b/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java
@@ -195,7 +195,7 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
.m(Battery.ChannelId.CURRENT, ElementToChannelConverter.SCALE_FACTOR_MINUS_1) // [A]
.build(), //
m(BatteryBoxC130.ChannelId.BATTERY_WORK_STATE, new UnsignedWordElement(0x2102)), //
- m(Battery.ChannelId.SOC, new UnsignedWordElement(0x2103)),
+ m(Battery.ChannelId.SOC, new UnsignedWordElement(0x2103)), //
m(new UnsignedWordElement(0x2104)) //
.m(BatteryBoxC130.ChannelId.CLUSTER_1_SOH, ElementToChannelConverter.DIRECT_1_TO_1) // [%]
.m(Battery.ChannelId.SOH, ElementToChannelConverter.DIRECT_1_TO_1) // [%]
@@ -212,16 +212,14 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
ElementToChannelConverter.DIRECT_1_TO_1) //
.m(Battery.ChannelId.MIN_CELL_VOLTAGE, ElementToChannelConverter.DIRECT_1_TO_1) //
.build(), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_MAX_CELL_TEMPERATURE_ID,
- new UnsignedWordElement(0x2109)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_MAX_CELL_TEMPERATURE_ID, new UnsignedWordElement(0x2109)), //
m(new SignedWordElement(0x210A)) //
.m(BatteryBoxC130.ChannelId.CLUSTER_1_MAX_CELL_TEMPERATURE,
ElementToChannelConverter.DIRECT_1_TO_1) //
.m(Battery.ChannelId.MAX_CELL_TEMPERATURE,
ElementToChannelConverter.SCALE_FACTOR_MINUS_1) //
.build(), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_MIN_CELL_TEMPERATURE_ID,
- new UnsignedWordElement(0x210B)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_MIN_CELL_TEMPERATURE_ID, new UnsignedWordElement(0x210B)), //
m(new SignedWordElement(0x210C)) //
.m(BatteryBoxC130.ChannelId.CLUSTER_1_MIN_CELL_TEMPERATURE,
ElementToChannelConverter.DIRECT_1_TO_1) //
@@ -596,102 +594,54 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_216_VOLTAGE, new UnsignedWordElement(0x28D7)) //
), //
new FC3ReadRegistersTask(0x2C00, Priority.LOW, //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_00_TEMPERATURE,
- new UnsignedWordElement(0x2C00)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_01_TEMPERATURE,
- new UnsignedWordElement(0x2C01)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_02_TEMPERATURE,
- new UnsignedWordElement(0x2C02)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_03_TEMPERATURE,
- new UnsignedWordElement(0x2C03)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_04_TEMPERATURE,
- new UnsignedWordElement(0x2C04)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_05_TEMPERATURE,
- new UnsignedWordElement(0x2C05)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_06_TEMPERATURE,
- new UnsignedWordElement(0x2C06)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_07_TEMPERATURE,
- new UnsignedWordElement(0x2C07)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_08_TEMPERATURE,
- new UnsignedWordElement(0x2C08)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_09_TEMPERATURE,
- new UnsignedWordElement(0x2C09)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_10_TEMPERATURE,
- new UnsignedWordElement(0x2C0A)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_11_TEMPERATURE,
- new UnsignedWordElement(0x2C0B)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_12_TEMPERATURE,
- new UnsignedWordElement(0x2C0C)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_13_TEMPERATURE,
- new UnsignedWordElement(0x2C0D)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_14_TEMPERATURE,
- new UnsignedWordElement(0x2C0E)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_15_TEMPERATURE,
- new UnsignedWordElement(0x2C0F)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_16_TEMPERATURE,
- new UnsignedWordElement(0x2C10)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_17_TEMPERATURE,
- new UnsignedWordElement(0x2C11)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_18_TEMPERATURE,
- new UnsignedWordElement(0x2C12)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_19_TEMPERATURE,
- new UnsignedWordElement(0x2C13)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_20_TEMPERATURE,
- new UnsignedWordElement(0x2C14)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_21_TEMPERATURE,
- new UnsignedWordElement(0x2C15)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_22_TEMPERATURE,
- new UnsignedWordElement(0x2C16)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_23_TEMPERATURE,
- new UnsignedWordElement(0x2C17)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_24_TEMPERATURE,
- new UnsignedWordElement(0x2C18)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_25_TEMPERATURE,
- new UnsignedWordElement(0x2C19)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_26_TEMPERATURE,
- new UnsignedWordElement(0x2C1A)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_27_TEMPERATURE,
- new UnsignedWordElement(0x2C1B)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_28_TEMPERATURE,
- new UnsignedWordElement(0x2C1C)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_29_TEMPERATURE,
- new UnsignedWordElement(0x2C1D)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_30_TEMPERATURE,
- new UnsignedWordElement(0x2C1E)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_31_TEMPERATURE,
- new UnsignedWordElement(0x2C1F)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_32_TEMPERATURE,
- new UnsignedWordElement(0x2C20)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_33_TEMPERATURE,
- new UnsignedWordElement(0x2C21)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_34_TEMPERATURE,
- new UnsignedWordElement(0x2C22)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_35_TEMPERATURE,
- new UnsignedWordElement(0x2C23)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_36_TEMPERATURE,
- new UnsignedWordElement(0x2C24)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_37_TEMPERATURE,
- new UnsignedWordElement(0x2C25)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_38_TEMPERATURE,
- new UnsignedWordElement(0x2C26)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_39_TEMPERATURE,
- new UnsignedWordElement(0x2C27)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_40_TEMPERATURE,
- new UnsignedWordElement(0x2C28)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_41_TEMPERATURE,
- new UnsignedWordElement(0x2C29)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_42_TEMPERATURE,
- new UnsignedWordElement(0x2C2A)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_43_TEMPERATURE,
- new UnsignedWordElement(0x2C2B)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_44_TEMPERATURE,
- new UnsignedWordElement(0x2C2C)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_45_TEMPERATURE,
- new UnsignedWordElement(0x2C2D)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_46_TEMPERATURE,
- new UnsignedWordElement(0x2C2E)), //
- m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_47_TEMPERATURE,
- new UnsignedWordElement(0x2C2F)) //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_00_TEMPERATURE, new UnsignedWordElement(0x2C00)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_01_TEMPERATURE, new UnsignedWordElement(0x2C01)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_02_TEMPERATURE, new UnsignedWordElement(0x2C02)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_03_TEMPERATURE, new UnsignedWordElement(0x2C03)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_04_TEMPERATURE, new UnsignedWordElement(0x2C04)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_05_TEMPERATURE, new UnsignedWordElement(0x2C05)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_06_TEMPERATURE, new UnsignedWordElement(0x2C06)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_07_TEMPERATURE, new UnsignedWordElement(0x2C07)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_08_TEMPERATURE, new UnsignedWordElement(0x2C08)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_09_TEMPERATURE, new UnsignedWordElement(0x2C09)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_10_TEMPERATURE, new UnsignedWordElement(0x2C0A)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_11_TEMPERATURE, new UnsignedWordElement(0x2C0B)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_12_TEMPERATURE, new UnsignedWordElement(0x2C0C)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_13_TEMPERATURE, new UnsignedWordElement(0x2C0D)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_14_TEMPERATURE, new UnsignedWordElement(0x2C0E)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_15_TEMPERATURE, new UnsignedWordElement(0x2C0F)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_16_TEMPERATURE, new UnsignedWordElement(0x2C10)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_17_TEMPERATURE, new UnsignedWordElement(0x2C11)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_18_TEMPERATURE, new UnsignedWordElement(0x2C12)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_19_TEMPERATURE, new UnsignedWordElement(0x2C13)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_20_TEMPERATURE, new UnsignedWordElement(0x2C14)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_21_TEMPERATURE, new UnsignedWordElement(0x2C15)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_22_TEMPERATURE, new UnsignedWordElement(0x2C16)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_23_TEMPERATURE, new UnsignedWordElement(0x2C17)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_24_TEMPERATURE, new UnsignedWordElement(0x2C18)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_25_TEMPERATURE, new UnsignedWordElement(0x2C19)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_26_TEMPERATURE, new UnsignedWordElement(0x2C1A)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_27_TEMPERATURE, new UnsignedWordElement(0x2C1B)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_28_TEMPERATURE, new UnsignedWordElement(0x2C1C)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_29_TEMPERATURE, new UnsignedWordElement(0x2C1D)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_30_TEMPERATURE, new UnsignedWordElement(0x2C1E)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_31_TEMPERATURE, new UnsignedWordElement(0x2C1F)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_32_TEMPERATURE, new UnsignedWordElement(0x2C20)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_33_TEMPERATURE, new UnsignedWordElement(0x2C21)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_34_TEMPERATURE, new UnsignedWordElement(0x2C22)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_35_TEMPERATURE, new UnsignedWordElement(0x2C23)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_36_TEMPERATURE, new UnsignedWordElement(0x2C24)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_37_TEMPERATURE, new UnsignedWordElement(0x2C25)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_38_TEMPERATURE, new UnsignedWordElement(0x2C26)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_39_TEMPERATURE, new UnsignedWordElement(0x2C27)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_40_TEMPERATURE, new UnsignedWordElement(0x2C28)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_41_TEMPERATURE, new UnsignedWordElement(0x2C29)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_42_TEMPERATURE, new UnsignedWordElement(0x2C2A)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_43_TEMPERATURE, new UnsignedWordElement(0x2C2B)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_44_TEMPERATURE, new UnsignedWordElement(0x2C2C)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_45_TEMPERATURE, new UnsignedWordElement(0x2C2D)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_46_TEMPERATURE, new UnsignedWordElement(0x2C2E)), //
+ m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_47_TEMPERATURE, new UnsignedWordElement(0x2C2F)) //
)//
); //
}
@@ -761,13 +711,11 @@ public StartStop getStartStopTarget() {
try {
this.getModbusProtocol().addTasks(//
new FC3ReadRegistersTask(0x210D, Priority.LOW, //
- m(BatteryBoxC130.ChannelId.MODULE_QTY,
- new UnsignedWordElement(0x210D)), //
+ m(BatteryBoxC130.ChannelId.MODULE_QTY, new UnsignedWordElement(0x210D)), //
m(BatteryBoxC130.ChannelId.TOTAL_VOLTAGE_OF_SINGLE_MODULE,
new UnsignedWordElement(0x210E))), //
new FC3ReadRegistersTask(0x216E, Priority.LOW, //
- m(Battery.ChannelId.CHARGE_MAX_VOLTAGE,
- new UnsignedWordElement(0x216E), //
+ m(Battery.ChannelId.CHARGE_MAX_VOLTAGE, new UnsignedWordElement(0x216E), //
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
m(Battery.ChannelId.DISCHARGE_MIN_VOLTAGE,
new UnsignedWordElement(0x216F), //
diff --git a/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java b/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java
index ae6e69866f3..9e2ed9a704c 100644
--- a/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java
+++ b/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java
@@ -115,8 +115,10 @@ protected void setModbus(BridgeModbus modbus) {
void activate(ComponentContext context, Config config) throws OpenemsException {
this.config = config;
- super.activate(context, config.id(), config.alias(), config.enabled(), config.modbusUnitId(), this.cm, "Modbus",
- config.modbus_id());
+ if (super.activate(context, config.id(), config.alias(), config.enabled(), config.modbusUnitId(), this.cm,
+ "Modbus", config.modbus_id())) {
+ return;
+ }
// Initialize Battery-Protection
this.batteryProtection = BatteryProtection.create(this) //
@@ -531,8 +533,10 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int
OpenemsType.BOOLEAN)) //
.bit(7, this.generateTowerChannel(tower, "PRE_ALARM_BCU_TEMP_DIFFERENCE",
OpenemsType.BOOLEAN)) //
- .bit(8, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOC", OpenemsType.BOOLEAN)) //
- .bit(9, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOH", OpenemsType.BOOLEAN)) //
+ .bit(8, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOC",
+ OpenemsType.BOOLEAN)) //
+ .bit(9, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOH",
+ OpenemsType.BOOLEAN)) //
.bit(10, this.generateTowerChannel(tower, "PRE_ALARM_OVER_CHARGING_POWER",
OpenemsType.BOOLEAN)) //
.bit(11, this.generateTowerChannel(tower, "PRE_ALARM_OVER_DISCHARGING_POWER",
@@ -558,8 +562,10 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int
OpenemsType.BOOLEAN)) //
.bit(7, this.generateTowerChannel(tower, "LEVEL_1_BCU_TEMP_DIFFERENCE",
OpenemsType.BOOLEAN)) //
- .bit(8, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOC", OpenemsType.BOOLEAN)) //
- .bit(9, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOH", OpenemsType.BOOLEAN)) //
+ .bit(8, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOC",
+ OpenemsType.BOOLEAN)) //
+ .bit(9, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOH",
+ OpenemsType.BOOLEAN)) //
.bit(10, this.generateTowerChannel(tower, "LEVEL_1_OVER_CHARGING_POWER",
OpenemsType.BOOLEAN)) //
.bit(11, this.generateTowerChannel(tower, "LEVEL_1_OVER_DISCHARGING_POWER",
@@ -591,22 +597,28 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int
Level.WARNING)) //
.bit(10, this.generateTowerChannel(tower, "LEVEL_2_EXTERNAL_COMMUNICATION",
Level.WARNING)) //
- .bit(11, this.generateTowerChannel(tower, "LEVEL_2_PRECHARGE_FAIL", Level.WARNING)) //
- .bit(12, this.generateTowerChannel(tower, "LEVEL_2_PARALLEL_FAIL", Level.WARNING)) //
+ .bit(11, this.generateTowerChannel(tower, "LEVEL_2_PRECHARGE_FAIL",
+ Level.WARNING)) //
+ .bit(12, this.generateTowerChannel(tower, "LEVEL_2_PARALLEL_FAIL",
+ Level.WARNING)) //
.bit(13, this.generateTowerChannel(tower, "LEVEL_2_SYSTEM_FAIL", Level.WARNING)) //
- .bit(14, this.generateTowerChannel(tower, "LEVEL_2_HARDWARE_FAIL", Level.WARNING)) //
+ .bit(14, this.generateTowerChannel(tower, "LEVEL_2_HARDWARE_FAIL",
+ Level.WARNING)) //
.bit(14, this.generateTowerChannel(tower, "LEVEL_2_BAT_UNDER_VOLTAGE",
Level.WARNING))), //
m(new BitsWordElement(towerOffset + 6, this)
.bit(0, this.generateTowerChannel(tower, "HW_AFE_COMMUNICAITON_FAULT",
Level.WARNING)) //
- .bit(1, this.generateTowerChannel(tower, "HW_ACTOR_DRIVER_FAULT", Level.WARNING)) //
+ .bit(1, this.generateTowerChannel(tower, "HW_ACTOR_DRIVER_FAULT",
+ Level.WARNING)) //
.bit(2, this.generateTowerChannel(tower, "HW_EEPROM_COMMUNICATION_FAULT",
Level.WARNING)) //
- .bit(3, this.generateTowerChannel(tower, "HW_VOLTAGE_DETECT_FAULT", Level.WARNING)) //
+ .bit(3, this.generateTowerChannel(tower, "HW_VOLTAGE_DETECT_FAULT",
+ Level.WARNING)) //
.bit(4, this.generateTowerChannel(tower, "HW_TEMPERATURE_DETECT_FAULT",
Level.WARNING)) //
- .bit(5, this.generateTowerChannel(tower, "HW_CURRENT_DETECT_FAULT", Level.WARNING)) //
+ .bit(5, this.generateTowerChannel(tower, "HW_CURRENT_DETECT_FAULT",
+ Level.WARNING)) //
.bit(6, this.generateTowerChannel(tower, "HW_ACTOR_NOT_CLOSE", Level.WARNING)) //
.bit(7, this.generateTowerChannel(tower, "HW_ACTOR_NOT_OPEN", Level.WARNING)) //
.bit(8, this.generateTowerChannel(tower, "HW_FUSE_BROKEN", Level.WARNING))), //
@@ -615,7 +627,8 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int
Level.WARNING)) //
.bit(1, this.generateTowerChannel(tower, "SYSTEM_AFE_UNDER_TEMPERATURE",
Level.WARNING)) //
- .bit(2, this.generateTowerChannel(tower, "SYSTEM_AFE_OVER_VOLTAGE", Level.WARNING)) //
+ .bit(2, this.generateTowerChannel(tower, "SYSTEM_AFE_OVER_VOLTAGE",
+ Level.WARNING)) //
.bit(3, this.generateTowerChannel(tower, "SYSTEM_AFE_UNDER_VOLTAGE",
Level.WARNING)) //
.bit(4, this.generateTowerChannel(tower,
@@ -626,7 +639,8 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int
"SYSTEM_HIGH_CELL_VOLTAGE_PERMANENT_FAILURE", Level.WARNING)) //
.bit(7, this.generateTowerChannel(tower,
"SYSTEM_LOW_CELL_VOLTAGE_PERMANENT_FAILURE", Level.WARNING)) //
- .bit(8, this.generateTowerChannel(tower, "SYSTEM_SHORT_CIRCUIT", Level.WARNING))), //
+ .bit(8, this.generateTowerChannel(tower, "SYSTEM_SHORT_CIRCUIT",
+ Level.WARNING))), //
m(this.generateTowerChannel(tower, "_SOC", OpenemsType.INTEGER),
new UnsignedWordElement(towerOffset + 8), // [%]
ElementToChannelConverter.SCALE_FACTOR_MINUS_1), //
diff --git a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java
index cb71904da74..017e6f59b3c 100644
--- a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java
+++ b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java
@@ -15,7 +15,7 @@ public class BatteryInverterConstraint {
public final Relationship relationship;
public final double value;
- public static BatteryInverterConstraint[] NO_CONSTRAINTS = new BatteryInverterConstraint[] {};
+ public static BatteryInverterConstraint[] NO_CONSTRAINTS = {};
public BatteryInverterConstraint(String description, Phase phase, Pwr pwr, Relationship relationship,
double value) {
diff --git a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java
index c437ec3d204..87edce970b1 100644
--- a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java
+++ b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java
@@ -24,7 +24,7 @@ public interface HybridManagedSymmetricBatteryInverter
public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
/**
* DC Discharge Power.
- *
+ *
*
* - Interface: HybridManagedSymmetricBatteryInverter
*
- Type: Integer
@@ -44,7 +44,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
),
/**
* DC Charge Energy.
- *
+ *
*
* - Interface: HybridEss
*
- Type: Long
@@ -57,7 +57,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
),
/**
* DC Discharge Energy.
- *
+ *
*
* - Interface: HybridEss
*
- Type: Long
@@ -75,6 +75,7 @@ private ChannelId(Doc doc) {
this.doc = doc;
}
+ @Override
public Doc doc() {
return this.doc;
}
@@ -83,7 +84,7 @@ public Doc doc() {
/**
* Gets the DC-PV Power, i.e. the sum of the {@link EssDcCharger}s of this
* {@link HybridManagedSymmetricBatteryInverter}.
- *
+ *
* @return the DC-PV power, or 'null' if there is no {@link EssDcCharger}
*/
public Integer getDcPvPower();
@@ -91,18 +92,18 @@ public Doc doc() {
/**
* Gets the Surplus Power of the {@link EssDcCharger}s of this
* {@link HybridManagedSymmetricBatteryInverter}.
- *
+ *
*
* This value is usually calculated from the
* {@link EssDcCharger#getActualPower()} when the battery is full
- *
+ *
* @return the surplus power, or 'null' if there is no surplus power
*/
public Integer getSurplusPower();
/**
* Gets the Channel for {@link ChannelId#DC_DISCHARGE_POWER}.
- *
+ *
* @return the Channel
*/
public default IntegerReadChannel getDcDischargePowerChannel() {
@@ -112,7 +113,7 @@ public default IntegerReadChannel getDcDischargePowerChannel() {
/**
* Gets the DC Discharge Power in [W]. Negative values for Charge; positive for
* Discharge. See {@link ChannelId#DC_DISCHARGE_POWER}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getDcDischargePower() {
@@ -122,7 +123,7 @@ public default Value getDcDischargePower() {
/**
* Internal method to set the 'nextValue' on
* {@link ChannelId#DC_DISCHARGE_POWER} Channel.
- *
+ *
* @param value the next value
*/
public default void _setDcDischargePower(Integer value) {
diff --git a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/ManagedSymmetricBatteryInverter.java b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/ManagedSymmetricBatteryInverter.java
index 1ff8ca536e7..1360667cf4d 100644
--- a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/ManagedSymmetricBatteryInverter.java
+++ b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/ManagedSymmetricBatteryInverter.java
@@ -12,11 +12,11 @@
/**
* Represents a Symmetric Battery-Inverter that can be controlled.
- *
+ *
*
* To indicate, that the Battery-Inverter is ready for charging/discharging, the
* following Channels need to be set:
- *
+ *
*
* - StartStoppable.ChannelId.START_STOP must be set to 'START'
*
- No 'Fault'-StateChannels are set (i.e. 'OpenemsComponent.ChannelId.STATE'
@@ -35,6 +35,7 @@ private ChannelId(Doc doc) {
this.doc = doc;
}
+ @Override
public Doc doc() {
return this.doc;
}
@@ -42,7 +43,7 @@ public Doc doc() {
/**
* Gets the {@link ModbusSlaveNatureTable} for Modbus/TCP Api.
- *
+ *
* @param accessMode the {@link AccessMode}
* @return the {@link ModbusSlaveNatureTable}
*/
@@ -53,16 +54,16 @@ public static ModbusSlaveNatureTable getModbusSlaveNatureTable(AccessMode access
/**
* Run the Battery-Inverter.
- *
+ *
*
* - bring the Battery-Inverter in the desired state
*
- apply information from {@link Battery} as required
*
- set the target Active and Reactive Power.
*
- *
+ *
*
* This is called on ManagedSymmetricEss::applyPower()
- *
+ *
* @param battery the {@link Battery}
* @param setActivePower the active power setpoint
* @param setReactivePower the reactive power setpoint
@@ -73,7 +74,7 @@ public static ModbusSlaveNatureTable getModbusSlaveNatureTable(AccessMode access
/**
* Gets static Constraints for this Battery-Inverter. Override this method to
* provide specific Constraints for this Battery-Inverter on every Cycle.
- *
+ *
* @return the Constraints
* @throws OpenemsException on error
*/
@@ -89,18 +90,18 @@ public default BatteryInverterConstraint[] getStaticConstraints() throws Openems
*
- KACO blueplanet gridsave 50 allows setting of power in 0.1 % of 52 VA. It
* should return 52 (= 52000 * 0.001)
*
- *
+ *
* @return the power precision
*/
public int getPowerPrecision();
/**
* Gets a boolean if the battery inverter is managed or not.
- *
+ *
*
* Returns false if the battery inverter itself is not managed or in a read only
* mode.
- *
+ *
* @return is managed or not
*/
public default boolean isManaged() {
@@ -110,10 +111,10 @@ public default boolean isManaged() {
/**
* Gets a boolean if the battery inverter is able to build a micro-grid in
* off-grid.
- *
+ *
*
* Returns false if the battery inverter is not able to build a micro-grid.
- *
+ *
* @return is managed or not
*/
public default boolean isOffGridPossible() {
diff --git a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/OffGridBatteryInverter.java b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/OffGridBatteryInverter.java
index 9e8c51920cd..f3c39876753 100644
--- a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/OffGridBatteryInverter.java
+++ b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/OffGridBatteryInverter.java
@@ -22,10 +22,10 @@ public interface OffGridBatteryInverter
public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
/**
* Off-Grid-Frequency.
- *
+ *
*
* In Off-Grid Mode the Battery-Inverter should generate this frequency.
- *
+ *
*
* - Interface: {@link OffGridBatteryInverter}
*
- Type: Integer
@@ -39,7 +39,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
/**
* Inverter-State.
- *
+ *
*
* - Interface: {@link OffGridBatteryInverter}
*
- Type: Boolean
@@ -112,7 +112,7 @@ public default IntegerWriteChannel getSetOffGridFrequencyChannel() {
/**
* Sets an Off Grid Frequency set point in [Hz]. See
* {@link ChannelId#SET_ACTIVE_POWER_EQUALS}.
- *
+ *
* @param value the next write value
* @throws OpenemsNamedException on error
*/
@@ -122,7 +122,7 @@ public default void setTargetOffGridFrequency(Integer value) throws OpenemsNamed
/**
* Gets the Channel for {@link ChannelId#STATE_ON}.
- *
+ *
* @return the Channel
*/
public default BooleanReadChannel getBatteryInverterStateChannel() {
@@ -131,7 +131,7 @@ public default BooleanReadChannel getBatteryInverterStateChannel() {
/**
* Gets the {@link StateChannel} for {@link ChannelId#STATE_ON}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getBatteryInverterState() {
@@ -145,7 +145,7 @@ public static enum TargetGridMode {
/**
* Tells the Battery-Inverter to go to ON_GRID or OFF_GRID mode. Be sure to call
* this method before you call {@link #start()}.
- *
+ *
* @param targetGridMode the {@link TargetGridMode}
*/
public void setTargetGridMode(TargetGridMode targetGridMode);
diff --git a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/SymmetricBatteryInverter.java b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/SymmetricBatteryInverter.java
index 6b86e6d54ce..3b99f49baa1 100644
--- a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/SymmetricBatteryInverter.java
+++ b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/SymmetricBatteryInverter.java
@@ -27,7 +27,7 @@ public interface SymmetricBatteryInverter extends OpenemsComponent {
public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
/**
* Grid-Mode.
- *
+ *
*
* - Interface: SymmetricBatteryInverter
*
- Type: Integer/Enum
@@ -39,7 +39,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
),
/**
* Active Power.
- *
+ *
*
* - Interface: SymmetricBatteryInverter
*
- Type: Integer
@@ -54,7 +54,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
),
/**
* Reactive Power.
- *
+ *
*
* - Interface: SymmetricBatteryInverter
*
- Type: Integer
@@ -70,7 +70,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
/**
* Holds the currently maximum possible apparent power. This value is commonly
* defined by the inverter limitations.
- *
+ *
*
* - Interface: SymmetricBatteryInverter
*
- Type: Integer
@@ -84,7 +84,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
),
/**
* Active Charge Energy.
- *
+ *
*
* - Interface: SymmetricBatteryInverter
*
- Type: Integer
@@ -97,7 +97,7 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
),
/**
* Active Discharge Energy.
- *
+ *
*
* - Interface: SymmetricBatteryInverter
*
- Type: Integer
@@ -125,7 +125,7 @@ public Doc doc() {
/**
* Gets the {@link ModbusSlaveNatureTable} for {@link SymmetricBatteryInverter}
* used by the Modbus/TCP Slave API.
- *
+ *
* @param accessMode the {@link AccessMode}
* @return the {@link ModbusSlaveNatureTable}
*/
@@ -138,7 +138,7 @@ public static ModbusSlaveNatureTable getModbusSlaveNatureTable(AccessMode access
/**
* Gets the Channel for {@link ChannelId#GRID_MODE}.
- *
+ *
* @return the Channel
*/
public default Channel getGridModeChannel() {
@@ -147,7 +147,7 @@ public default Channel getGridModeChannel() {
/**
* Is the Battery-Inverter On-Grid? See {@link ChannelId#GRID_MODE}.
- *
+ *
* @return the Channel {@link Value}
*/
public default GridMode getGridMode() {
@@ -157,7 +157,7 @@ public default GridMode getGridMode() {
/**
* Internal method to set the 'nextValue' on {@link ChannelId#GRID_MODE}
* Channel.
- *
+ *
* @param value the next value
*/
public default void _setGridMode(GridMode value) {
@@ -166,7 +166,7 @@ public default void _setGridMode(GridMode value) {
/**
* Gets the Channel for {@link ChannelId#ACTIVE_POWER}.
- *
+ *
* @return the Channel
*/
public default IntegerReadChannel getActivePowerChannel() {
@@ -176,7 +176,7 @@ public default IntegerReadChannel getActivePowerChannel() {
/**
* Gets the Active Power in [W]. Negative values for Charge; positive for
* Discharge. See {@link ChannelId#ACTIVE_POWER}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getActivePower() {
@@ -186,7 +186,7 @@ public default Value getActivePower() {
/**
* Internal method to set the 'nextValue' on {@link ChannelId#ACTIVE_POWER}
* Channel.
- *
+ *
* @param value the next value
*/
public default void _setActivePower(Integer value) {
@@ -196,7 +196,7 @@ public default void _setActivePower(Integer value) {
/**
* Internal method to set the 'nextValue' on {@link ChannelId#ACTIVE_POWER}
* Channel.
- *
+ *
* @param value the next value
*/
public default void _setActivePower(int value) {
@@ -205,7 +205,7 @@ public default void _setActivePower(int value) {
/**
* Gets the Channel for {@link ChannelId#REACTIVE_POWER}.
- *
+ *
* @return the Channel
*/
public default IntegerReadChannel getReactivePowerChannel() {
@@ -214,7 +214,7 @@ public default IntegerReadChannel getReactivePowerChannel() {
/**
* Gets the Reactive Power in [var]. See {@link ChannelId#REACTIVE_POWER}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getReactivePower() {
@@ -224,7 +224,7 @@ public default Value getReactivePower() {
/**
* Internal method to set the 'nextValue' on {@link ChannelId#REACTIVE_POWER}
* Channel.
- *
+ *
* @param value the next value
*/
public default void _setReactivePower(Integer value) {
@@ -234,7 +234,7 @@ public default void _setReactivePower(Integer value) {
/**
* Internal method to set the 'nextValue' on {@link ChannelId#REACTIVE_POWER}
* Channel.
- *
+ *
* @param value the next value
*/
public default void _setReactivePower(int value) {
@@ -243,7 +243,7 @@ public default void _setReactivePower(int value) {
/**
* Gets the Channel for {@link ChannelId#MAX_APPARENT_POWER}.
- *
+ *
* @return the Channel
*/
public default IntegerReadChannel getMaxApparentPowerChannel() {
@@ -253,7 +253,7 @@ public default IntegerReadChannel getMaxApparentPowerChannel() {
/**
* Gets the Maximum Apparent Power in [VA], range ">= 0". See
* {@link ChannelId#MAX_APPARENT_POWER}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getMaxApparentPower() {
@@ -263,7 +263,7 @@ public default Value getMaxApparentPower() {
/**
* Internal method to set the 'nextValue' on
* {@link ChannelId#MAX_APPARENT_POWER} Channel.
- *
+ *
* @param value the next value
*/
public default void _setMaxApparentPower(Integer value) {
@@ -273,7 +273,7 @@ public default void _setMaxApparentPower(Integer value) {
/**
* Internal method to set the 'nextValue' on
* {@link ChannelId#MAX_APPARENT_POWER} Channel.
- *
+ *
* @param value the next value
*/
public default void _setMaxApparentPower(int value) {
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/Config.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/Config.java
index ccacdf58560..58a6da69b5e 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/Config.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/Config.java
@@ -21,7 +21,7 @@
@AttributeDefinition(name = "Start/stop behaviour?", description = "Should this Component be forced to start or stop?")
StartStopConfig startStop() default StartStopConfig.AUTO;
-
+
@AttributeDefinition(name = "Activate watchdog", description = "Activate watchdog or not?")
boolean activateWatchdog() default true;
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsave.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsave.java
index ca99d015bc3..e7f2b545393 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsave.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsave.java
@@ -26,7 +26,8 @@ public interface KacoBlueplanetGridsave
*/
public static final int WATCHDOG_TIMEOUT_SECONDS = 60;
/**
- * The watchdog gets triggered every WATCHDOG_TRIGGER_CYCLES seconds. This must be less than WATCHDOG_TIMEOUT_SECONDS.
+ * The watchdog gets triggered every WATCHDOG_TRIGGER_CYCLES seconds. This must
+ * be less than WATCHDOG_TIMEOUT_SECONDS.
*/
public static final int WATCHDOG_TRIGGER_SECONDS = 10;
@@ -68,14 +69,14 @@ public Doc doc() {
/**
* Gets the target Start/Stop mode from config or StartStop-Channel.
- *
+ *
* @return {@link StartStop}
*/
public StartStop getStartStopTarget();
/**
* Get the Channel for the given Point or throw an error if it is not available.
- *
+ *
* @param the Channel type
* @param point the SunSpec Point
* @return the optional Channel
@@ -85,14 +86,14 @@ public Doc doc() {
/**
* Gets the Current State.
- *
+ *
* @return the {@link S64201CurrentState}
*/
public S64201CurrentState getCurrentState();
/**
* Gets the Channel for {@link ChannelId#MAX_START_ATTEMPTS}.
- *
+ *
* @return the Channel
*/
public default StateChannel getMaxStartAttemptsChannel() {
@@ -101,7 +102,7 @@ public default StateChannel getMaxStartAttemptsChannel() {
/**
* Gets the {@link StateChannel} for {@link ChannelId#MAX_START_ATTEMPTS}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getMaxStartAttempts() {
@@ -111,7 +112,7 @@ public default Value getMaxStartAttempts() {
/**
* Internal method to set the 'nextValue' on
* {@link ChannelId#MAX_START_ATTEMPTS} Channel.
- *
+ *
* @param value the next value
*/
public default void _setMaxStartAttempts(Boolean value) {
@@ -120,7 +121,7 @@ public default void _setMaxStartAttempts(Boolean value) {
/**
* Gets the Channel for {@link ChannelId#MAX_STOP_ATTEMPTS}.
- *
+ *
* @return the Channel
*/
public default StateChannel getMaxStopAttemptsChannel() {
@@ -129,7 +130,7 @@ public default StateChannel getMaxStopAttemptsChannel() {
/**
* Gets the {@link StateChannel} for {@link ChannelId#MAX_STOP_ATTEMPTS}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getMaxStopAttempts() {
@@ -139,7 +140,7 @@ public default Value getMaxStopAttempts() {
/**
* Internal method to set the 'nextValue' on {@link ChannelId#MAX_STOP_ATTEMPTS}
* Channel.
- *
+ *
* @param value the next value
*/
public default void _setMaxStopAttempts(Boolean value) {
@@ -148,7 +149,7 @@ public default void _setMaxStopAttempts(Boolean value) {
/**
* Gets the Channel for KacoSunSpecModel.S64201.REQUESTED_STATE.
- *
+ *
* @return the Channel
* @throws OpenemsException on error
*/
@@ -158,7 +159,7 @@ public default WriteChannel getRequestedStateChannel() thr
/**
* Writes the value to the KacoSunSpecModel.S64201.REQUESTED_STATE Register.
- *
+ *
* @param value the next value
* @throws OpenemsNamedException on error
*/
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveImpl.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveImpl.java
index 26a77f33d0e..748b9de6e28 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveImpl.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveImpl.java
@@ -148,6 +148,7 @@ public KacoBlueplanetGridsaveImpl() throws OpenemsException {
this._setGridMode(GridMode.ON_GRID);
}
+ @Override
@Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY)
protected void setModbus(BridgeModbus modbus) {
super.setModbus(modbus);
@@ -162,6 +163,7 @@ void activate(ComponentContext context, Config config) throws OpenemsException {
this.config = config;
}
+ @Override
@Deactivate
protected void deactivate() {
super.deactivate();
@@ -198,7 +200,7 @@ public void run(Battery battery, int setActivePower, int setReactivePower) throw
this.setStateChannels();
// Prepare Context
- Context context = new Context(this, battery, this.config, setActivePower, setReactivePower);
+ var context = new Context(this, battery, this.config, setActivePower, setReactivePower);
// Call the StateMachine
try {
@@ -217,27 +219,26 @@ public BatteryInverterConstraint[] getStaticConstraints() throws OpenemsExceptio
if (this.stateMachine.getCurrentState() == State.RUNNING) {
return BatteryInverterConstraint.NO_CONSTRAINTS;
- } else {
- // Block any power as long as we are not RUNNING
- return new BatteryInverterConstraint[] { //
- new BatteryInverterConstraint("KACO inverter not ready", Phase.ALL, Pwr.REACTIVE, //
- Relationship.EQUALS, 0d), //
- new BatteryInverterConstraint("KACO inverter not ready", Phase.ALL, Pwr.ACTIVE, //
- Relationship.EQUALS, 0d) //
- };
}
+ // Block any power as long as we are not RUNNING
+ return new BatteryInverterConstraint[] { //
+ new BatteryInverterConstraint("KACO inverter not ready", Phase.ALL, Pwr.REACTIVE, //
+ Relationship.EQUALS, 0d), //
+ new BatteryInverterConstraint("KACO inverter not ready", Phase.ALL, Pwr.ACTIVE, //
+ Relationship.EQUALS, 0d) //
+ };
}
/**
* Sets the Battery Limits.
- *
+ *
* @param battery the linked {@link Battery}
* @throws OpenemsNamedException on error
*/
private void setBatteryLimits(Battery battery) throws OpenemsNamedException {
// Discharge Min Voltage
FloatWriteChannel disMinVChannel = this.getSunSpecChannelOrError(KacoSunSpecModel.S64202.DIS_MIN_V_0);
- Integer dischargeMinVoltage = battery.getDischargeMinVoltage().get();
+ var dischargeMinVoltage = battery.getDischargeMinVoltage().get();
if (Objects.equal(dischargeMinVoltage, 0)) {
dischargeMinVoltage = null; // according to setup manual DIS_MIN_V must not be zero
}
@@ -245,7 +246,7 @@ private void setBatteryLimits(Battery battery) throws OpenemsNamedException {
// Charge Max Voltage
FloatWriteChannel chaMaxVChannel = this.getSunSpecChannelOrError(KacoSunSpecModel.S64202.CHA_MAX_V_0);
- Integer chargeMaxVoltage = battery.getChargeMaxVoltage().get();
+ var chargeMaxVoltage = battery.getChargeMaxVoltage().get();
if (Objects.equal(chargeMaxVoltage, 0)) {
chargeMaxVoltage = null; // according to setup manual CHA_MAX_V must not be zero
}
@@ -269,7 +270,7 @@ private void setBatteryLimits(Battery battery) throws OpenemsNamedException {
/**
* Sets the information that is shown on the Display, like State-of-Charge,
* State-of-Health and Max-Cell-Temperature.
- *
+ *
* @param battery the linked {@link Battery}
* @throws OpenemsNamedException on error
*/
@@ -293,11 +294,11 @@ private void setDisplayInformation(Battery battery) throws OpenemsNamedException
/**
* Triggers the Watchdog after WATCHDOG_TRIGGER passed.
- *
+ *
* @throws OpenemsNamedException on error
*/
private void triggerWatchdog() throws OpenemsNamedException {
- Instant now = Instant.now(this.componentManager.getClock());
+ var now = Instant.now(this.componentManager.getClock());
if (Duration.between(this.lastTriggerWatchdog, now)
.getSeconds() >= KacoBlueplanetGridsave.WATCHDOG_TRIGGER_SECONDS) {
IntegerWriteChannel watchdogChannel = this.getSunSpecChannelOrError(KacoSunSpecModel.S64201.WATCHDOG);
@@ -308,7 +309,7 @@ private void triggerWatchdog() throws OpenemsNamedException {
/**
* Sets the State-Channels, e.g. Warnings and Faults.
- *
+ *
* @throws OpenemsNamedException on error
*/
private void setStateChannels() throws OpenemsNamedException {
@@ -362,9 +363,8 @@ public S64201CurrentState getCurrentState() {
Optional channel = this.getSunSpecChannel(KacoSunSpecModel.S64201.CURRENT_STATE);
if (channel.isPresent()) {
return channel.get().value().asEnum();
- } else {
- return S64201CurrentState.UNDEFINED;
}
+ return S64201CurrentState.UNDEFINED;
}
@Override
@@ -382,8 +382,8 @@ public int getPowerPrecision() {
if (!scalefactorChannel.isPresent()) {
return 1;
}
- Value scalefactor = scalefactorChannel.get().value();
- Value maxApparentPower = this.getMaxApparentPower();
+ var scalefactor = scalefactorChannel.get().value();
+ var maxApparentPower = this.getMaxApparentPower();
if (!scalefactor.isDefined() || !maxApparentPower.isDefined()) {
return 1;
}
@@ -393,11 +393,11 @@ public int getPowerPrecision() {
@Override
public String debugLog() {
- return this.stateMachine.getCurrentState().asCamelCase() + //
- "|" + this.getCurrentState().asCamelCase();
+ return this.stateMachine.getCurrentState().asCamelCase() //
+ + "|" + this.getCurrentState().asCamelCase();
}
- private final AtomicReference startStopTarget = new AtomicReference(StartStop.UNDEFINED);
+ private final AtomicReference startStopTarget = new AtomicReference<>(StartStop.UNDEFINED);
@Override
public void setStartStop(StartStop value) {
@@ -430,14 +430,14 @@ public StartStop getStartStopTarget() {
/**
* Adds a Copy-Listener. It listens on setNextValue() and copies the value to
* the target channel.
- *
+ *
* @param the Channel type
* @param sourceChannel the source Channel
* @param targetChannelId the target ChannelId
*/
private void addCopyListener(Channel sourceChannel,
io.openems.edge.common.channel.ChannelId targetChannelId) {
- Consumer> callback = (value) -> {
+ Consumer> callback = value -> {
Channel targetChannel = this.channel(targetChannelId);
targetChannel.setNextValue(value);
};
@@ -455,7 +455,7 @@ public > T getSunSpecChannelOrError(SunSpecPoint point) thr
*/
private void calculateEnergy() {
// Calculate Energy
- Integer activePower = this.getActivePower().get();
+ var activePower = this.getActivePower().get();
if (activePower == null) {
// Not available
this.calculateChargeEnergy.update(null);
@@ -476,6 +476,7 @@ public Timedata getTimedata() {
return this.timedata;
}
+ @Override
protected void addBlock(int startAddress, SunSpecModel model, Priority priority) throws OpenemsException {
super.addBlock(startAddress, model, priority);
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyChannelId.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyChannelId.java
index 280013083f5..4b23dc4f1f4 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyChannelId.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyChannelId.java
@@ -11,6 +11,7 @@ private MyChannelId(Doc doc) {
this.doc = doc;
}
+ @Override
public Doc doc() {
return this.doc;
}
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/ErrorHandler.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/ErrorHandler.java
index 79c162789c2..5000e50caa6 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/ErrorHandler.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/ErrorHandler.java
@@ -4,7 +4,6 @@
import java.time.Instant;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.KacoBlueplanetGridsave;
import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.KacoSunSpecModel.S64201.S64201RequestedState;
import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -22,7 +21,7 @@ protected void onEntry(Context context) throws OpenemsNamedException {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
switch (inverter.getCurrentState()) {
case STANDBY:
case GRID_CONNECTED:
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoRunningHandler.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoRunningHandler.java
index 4504b35bc45..f93779a8161 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoRunningHandler.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoRunningHandler.java
@@ -18,13 +18,13 @@ public class GoRunningHandler extends StateHandler {
protected void onEntry(Context context) throws OpenemsNamedException {
this.lastAttempt = Instant.MIN;
this.attemptCounter = 0;
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
inverter._setMaxStartAttempts(false);
}
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
// Has Faults -> abort
if (inverter.hasFaults()) {
@@ -54,28 +54,24 @@ public State runAndGetNextState(Context context) throws OpenemsNamedException {
// Not yet running...
}
- boolean isMaxStartTimePassed = Duration.between(this.lastAttempt, Instant.now())
+ var isMaxStartTimePassed = Duration.between(this.lastAttempt, Instant.now())
.getSeconds() > KacoBlueplanetGridsave.RETRY_COMMAND_SECONDS;
- if (isMaxStartTimePassed) {
- // First try - or waited long enough for next try
-
- if (this.attemptCounter > KacoBlueplanetGridsave.RETRY_COMMAND_MAX_ATTEMPTS) {
- // Too many tries
- inverter._setMaxStartAttempts(true);
- return State.UNDEFINED;
-
- } else {
- // Trying to switch on
- inverter.setRequestedState(S64201RequestedState.GRID_CONNECTED);
- this.lastAttempt = Instant.now();
- this.attemptCounter++;
- return State.GO_RUNNING;
-
- }
+ if (!isMaxStartTimePassed) {
+ // Still waiting...
+ return State.GO_RUNNING;
+ }
+ if (this.attemptCounter > KacoBlueplanetGridsave.RETRY_COMMAND_MAX_ATTEMPTS) {
+ // Too many tries
+ inverter._setMaxStartAttempts(true);
+ return State.UNDEFINED;
} else {
- // Still waiting...
+ // Trying to switch on
+ inverter.setRequestedState(S64201RequestedState.GRID_CONNECTED);
+ this.lastAttempt = Instant.now();
+ this.attemptCounter++;
return State.GO_RUNNING;
+
}
}
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoStoppedHandler.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoStoppedHandler.java
index 2b1732c31d3..ac8d5aa7cdb 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoStoppedHandler.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/GoStoppedHandler.java
@@ -22,7 +22,7 @@ protected void onEntry(Context context) {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
switch (inverter.getCurrentState()) {
case OFF:
@@ -44,28 +44,24 @@ public State runAndGetNextState(Context context) throws OpenemsNamedException {
// Not yet running...
}
- boolean isMaxStartTimePassed = Duration.between(this.lastAttempt, Instant.now())
+ var isMaxStartTimePassed = Duration.between(this.lastAttempt, Instant.now())
.getSeconds() > KacoBlueplanetGridsave.RETRY_COMMAND_SECONDS;
- if (isMaxStartTimePassed) {
- // First try - or waited long enough for next try
-
- if (this.attemptCounter > KacoBlueplanetGridsave.RETRY_COMMAND_MAX_ATTEMPTS) {
- // Too many tries
- inverter._setMaxStopAttempts(true);
- return State.UNDEFINED;
-
- } else {
- // Trying to switch off
- inverter.setRequestedState(S64201RequestedState.OFF);
- this.lastAttempt = Instant.now();
- this.attemptCounter++;
- return State.GO_STOPPED;
-
- }
+ if (!isMaxStartTimePassed) {
+ // Still waiting...
+ return State.GO_STOPPED;
+ }
+ if (this.attemptCounter > KacoBlueplanetGridsave.RETRY_COMMAND_MAX_ATTEMPTS) {
+ // Too many tries
+ inverter._setMaxStopAttempts(true);
+ return State.UNDEFINED;
} else {
- // Still waiting...
+ // Trying to switch off
+ inverter.setRequestedState(S64201RequestedState.OFF);
+ this.lastAttempt = Instant.now();
+ this.attemptCounter++;
return State.GO_STOPPED;
+
}
}
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/RunningHandler.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/RunningHandler.java
index 7e4d59baffc..be6a05cb2d7 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/RunningHandler.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/RunningHandler.java
@@ -2,7 +2,6 @@
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.edge.batteryinverter.api.SymmetricBatteryInverter;
-import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.KacoBlueplanetGridsave;
import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.KacoSunSpecModel;
import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.statemachine.StateMachine.State;
import io.openems.edge.common.channel.FloatWriteChannel;
@@ -14,7 +13,7 @@ public class RunningHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
if (inverter.hasFaults()) {
return State.UNDEFINED;
@@ -53,12 +52,12 @@ public State runAndGetNextState(Context context) throws OpenemsNamedException {
/**
* Applies the Active and Reactive Power Set-Points.
- *
+ *
* @param context the {@link Context}
* @throws OpenemsNamedException on error
*/
private void applyPower(Context context) throws OpenemsNamedException {
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
IntegerReadChannel maxApparentPowerChannel = inverter
.channel(SymmetricBatteryInverter.ChannelId.MAX_APPARENT_POWER);
@@ -66,12 +65,12 @@ private void applyPower(Context context) throws OpenemsNamedException {
// Active Power Set-Point is set in % of maximum active power
FloatWriteChannel wSetPctChannel = inverter.getSunSpecChannelOrError(KacoSunSpecModel.S64201.W_SET_PCT);
- float wSetPct = context.setActivePower * 100F / maxApparentPower;
+ var wSetPct = context.setActivePower * 100F / maxApparentPower;
wSetPctChannel.setNextWriteValue(wSetPct);
// Reactive Power Set-Point is set in % of maximum active power
FloatWriteChannel varSetPctChannel = inverter.getSunSpecChannelOrError(KacoSunSpecModel.S64201.VAR_SET_PCT);
- float varSetPct = context.setReactivePower * 100F / maxApparentPower;
+ var varSetPct = context.setReactivePower * 100F / maxApparentPower;
varSetPctChannel.setNextWriteValue(varSetPct);
}
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/StoppedHandler.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/StoppedHandler.java
index fcb3c55a001..75a415711ed 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/StoppedHandler.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/StoppedHandler.java
@@ -1,6 +1,5 @@
package io.openems.edge.batteryinverter.kaco.blueplanetgridsave.statemachine;
-import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.KacoBlueplanetGridsave;
import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.statemachine.StateMachine.State;
import io.openems.edge.common.startstop.StartStop;
import io.openems.edge.common.statemachine.StateHandler;
@@ -10,7 +9,7 @@ public class StoppedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) {
// Mark as stopped
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
inverter._setStartStop(StartStop.STOP);
return State.STOPPED;
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/UndefinedHandler.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/UndefinedHandler.java
index a7f36a63128..bd6b4927bac 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/UndefinedHandler.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/src/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/statemachine/UndefinedHandler.java
@@ -1,6 +1,5 @@
package io.openems.edge.batteryinverter.kaco.blueplanetgridsave.statemachine;
-import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.KacoBlueplanetGridsave;
import io.openems.edge.batteryinverter.kaco.blueplanetgridsave.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -8,7 +7,7 @@ public class UndefinedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) {
- KacoBlueplanetGridsave inverter = context.getParent();
+ var inverter = context.getParent();
switch (inverter.getStartStopTarget()) {
case UNDEFINED:
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveTest.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveTest.java
index a9dcc82c603..94ed446106c 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveTest.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/KacoBlueplanetGridsaveTest.java
@@ -1,6 +1,5 @@
package io.openems.edge.batteryinverter.kaco.blueplanetgridsave;
-import java.lang.reflect.Method;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
@@ -65,10 +64,10 @@ protected void handleEvent(String topic) throws Exception {
@Before
public void prepareTest() throws Exception {
- final long start = 1577836800L;
+ final var start = 1577836800L;
clock = new TimeLeapClock(Instant.ofEpochSecond(start) /* starts at 1. January 2020 00:00:00 */,
ZoneOffset.UTC);
- KacoBlueplanetGridsaveImpl sut = new KacoBlueplanetGridsaveImpl();
+ var sut = new KacoBlueplanetGridsaveImpl();
test = new MyComponentTest(sut) //
.addReference("cycle", new DummyCycle(1000)) //
@@ -78,7 +77,7 @@ public void prepareTest() throws Exception {
// TODO implement proper Dummy-Modbus-Bridge with SunSpec support. Till then...
test.addReference("isSunSpecInitializationCompleted", true); //
- Method addChannel = AbstractOpenemsComponent.class.getDeclaredMethod("addChannel", ChannelId.class);
+ var addChannel = AbstractOpenemsComponent.class.getDeclaredMethod("addChannel", ChannelId.class);
addChannel.setAccessible(true);
addChannel.invoke(sut, KacoSunSpecModel.S64203.BAT_SOC_0.getChannelId());
addChannel.invoke(sut, KacoSunSpecModel.S64203.BAT_SOH_0.getChannelId());
diff --git a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyConfig.java b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyConfig.java
index 357955e558c..1f6daed8776 100644
--- a/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyConfig.java
+++ b/io.openems.edge.batteryinverter.kaco.blueplanetgridsave/test/io/openems/edge/batteryinverter/kaco/blueplanetgridsave/MyConfig.java
@@ -35,7 +35,7 @@ public Builder setActivateWatchdog(boolean activateWatchdog) {
this.activateWatchdog = activateWatchdog;
return this;
}
-
+
public MyConfig build() {
return new MyConfig(this);
}
@@ -43,7 +43,7 @@ public MyConfig build() {
/**
* Create a Config builder.
- *
+ *
* @return a {@link Builder}
*/
public static Builder create() {
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Config.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Config.java
index b65ebf63e7f..2e4bcf32279 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Config.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Config.java
@@ -5,11 +5,10 @@
import io.openems.edge.common.startstop.StartStopConfig;
-@ObjectClassDefinition( //
+@ObjectClassDefinition(//
name = "Battery-Inverter REFUstore88k", //
description = "Implements the REFUstore 88K Battery Inverter")
-public
-@interface Config {
+public @interface Config {
@AttributeDefinition(name = "Component-ID", description = "Unique ID of this Component")
String id() default "batteryInverter0";
@@ -27,7 +26,7 @@
@AttributeDefinition(name = "Time Limit", description = "Time no Power is applied")
int timeLimitNoPower() default 60;
-
+
@AttributeDefinition(name = "Start/stop behaviour?", description = "Should this Component be forced to start or stop?")
StartStopConfig startStop() default StartStopConfig.AUTO;
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Conn.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Conn.java
deleted file mode 100644
index 9e5c12c0650..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Conn.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum Conn implements OptionsEnum {
- UNDEFINED(-1, "Undefined"),
- DISCONNECT(0, "Disconnect"),
- CONNECT(1, "Connect")
- ;
-
- private final int value;
- private final String name;
-
- private Conn(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/DerTyp.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/DerTyp.java
deleted file mode 100644
index 6d64a458358..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/DerTyp.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum DerTyp implements OptionsEnum {
- UNDEFINED(-1, "Undefined"),
- PV(4, "PV"),
- PV_STOR(82, "PVStor")
- ;
-
- private final int value;
- private final String name;
-
- private DerTyp(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Event1.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Event1.java
deleted file mode 100644
index 9dda414daf6..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/Event1.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum Event1 implements OptionsEnum {
- UNDEFINED(-1, "Undefined"),
- GROUND_FAULT(0, "Ground fault"),
- DC_OVER_VOLTAGE(1, "Dc over voltage"),
- AC_DISCONNECT(2, "AC disconnect open"),
- DC_DISCONNECT(3, "DC disconnect open"),
- GRID_DISCONNECT(4, "Grid shutdown"),
- CABINET_OPEN(5, "Cabinet open"),
- MANUAL_SHUTDOWN(6, "Manual shutdown"),
- OVER_TEMP(7, "Over temperature"),
- OVER_FREQUENCY(8, "Frequency above limit"),
- UNDER_FREQUENCY(9, "Frequency under limit"),
- AC_OVER_VOLT(10, "AC Voltage above limit"),
- AC_UNDER_VOLT(11, "AC Voltage under limit"),
- BLOWN_STRING_FUSE(12, "Blown String fuse on input"),
- UNDER_TEMP(13, "Under temperature"),
- MEMORY_LOSS(14, "Generic Memory or Communication error (internal)"),
- HW_TEST_FAILURE(15, "Hardware test failure"),
- OTHER_ALARM(16, "Other alarm"), // When OTHER_ALARM is set, it indicates that some other alarm has occurred in the PCS (i.e. an alarm which does not map to one of the other alarm categories).
- OTHER_WARNING(17, "Other warning") // When OTHER_WARNING is set, it indicates that some other warning has occurred in the PCS (i.e. a warning which does not map to one of the other warning categories).
- ;
-
- private final int value;
- private final String name;
-
- private Event1 (int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-
-
-
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/LocRemCtl.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/LocRemCtl.java
deleted file mode 100644
index da1072109d1..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/LocRemCtl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum LocRemCtl implements OptionsEnum {
-
- UNDEFINED(-1, "Undefined"),
- REMOTE(0, "PCS Remote Control"),
- LOCAL(1, "PCS Local Control"),
- ;
-
- private final int value;
- private final String name;
-
- private LocRemCtl(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/OperatingState.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/OperatingState.java
deleted file mode 100644
index 364245d5a1f..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/OperatingState.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum OperatingState implements OptionsEnum {
- UNDEFINED(-1, "Undefined"),
- OFF(1, "Off"),
- SLEEPING(2, "Sleeping"),
- STARTING(3, "Starting"),
- MPPT(4, "MPPT"),
- THROTTLED(5, "Throttled"),
- SHUTTING_DOWN(6, "Shutting Down"),
- FAULT(7, "Fault"),
- STANDBY(8, "Standby"),
- STARTED(9, "Started")
- ;
-
- private final int value;
- private final String name;
-
- private OperatingState(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/OutPFSetEna.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/OutPFSetEna.java
deleted file mode 100644
index 1be819ce922..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/OutPFSetEna.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum OutPFSetEna implements OptionsEnum {
- UNDEFINED(-1, "Undefined"),
- DISABLED(0, "Disabled"),
- ENABLED(1, "Enabled")
- ;
-
- private final int value;
- private final String name;
-
- private OutPFSetEna(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/PCSSetOperation.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/PCSSetOperation.java
deleted file mode 100644
index 52751ba54ea..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/PCSSetOperation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum PCSSetOperation implements OptionsEnum {
-
- UNDEFINED(-1, "Undefined"),
- NO_COMMAND(0, "No Command"),
- START_PCS(1, "Connect to grid"),
- STOP_PCS(2, "Stop system"),
- ENTER_STANDBY_MODE(3, "Enter Standby Mode"),
- EXIT_STANDBY_MODE(4, "Exit Standby Mode"),
- ;
-
- private final int value;
- private final String name;
-
- private PCSSetOperation(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88k.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88k.java
index 63056f36210..b0b8ce2930b 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88k.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88k.java
@@ -5,7 +5,7 @@
import io.openems.edge.batteryinverter.api.ManagedSymmetricBatteryInverter;
import io.openems.edge.batteryinverter.api.SymmetricBatteryInverter;
import io.openems.edge.batteryinverter.refu88k.enums.OperatingState;
-import io.openems.edge.batteryinverter.refu88k.enums.PCSSetOperation;
+import io.openems.edge.batteryinverter.refu88k.enums.PcsSetOperation;
import io.openems.edge.batteryinverter.refu88k.statemachine.StateMachine;
import io.openems.edge.common.channel.Channel;
import io.openems.edge.common.channel.Doc;
@@ -59,14 +59,14 @@ public Doc doc() {
/**
* Gets the target Start/Stop mode from config or StartStop-Channel.
- *
+ *
* @return {@link StartStop}
*/
public StartStop getStartStopTarget();
/**
* Gets the Channel for {@link ChannelId#MAX_START_ATTEMPTS}.
- *
+ *
* @return the Channel
*/
public default StateChannel getMaxStartAttemptsChannel() {
@@ -75,7 +75,7 @@ public default StateChannel getMaxStartAttemptsChannel() {
/**
* Gets the {@link StateChannel} for {@link ChannelId#MAX_START_ATTEMPTS}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getMaxStartAttempts() {
@@ -85,7 +85,7 @@ public default Value getMaxStartAttempts() {
/**
* Internal method to set the 'nextValue' on
* {@link ChannelId#MAX_START_ATTEMPTS} Channel.
- *
+ *
* @param value the next value
*/
public default void _setMaxStartAttempts(Boolean value) {
@@ -94,7 +94,7 @@ public default void _setMaxStartAttempts(Boolean value) {
/**
* Gets the Channel for {@link ChannelId#MAX_STOP_ATTEMPTS}.
- *
+ *
* @return the Channel
*/
public default StateChannel getMaxStopAttemptsChannel() {
@@ -103,7 +103,7 @@ public default StateChannel getMaxStopAttemptsChannel() {
/**
* Gets the {@link StateChannel} for {@link ChannelId#MAX_STOP_ATTEMPTS}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getMaxStopAttempts() {
@@ -113,7 +113,7 @@ public default Value getMaxStopAttempts() {
/**
* Internal method to set the 'nextValue' on {@link ChannelId#MAX_STOP_ATTEMPTS}
* Channel.
- *
+ *
* @param value the next value
*/
public default void _setMaxStopAttempts(Boolean value) {
@@ -121,51 +121,47 @@ public default void _setMaxStopAttempts(Boolean value) {
}
/**
- *
- * Exit the STANDBY mode!
- *
+ * Exit the STANDBY mode.
+ *
* @throws OpenemsNamedException
- *
+ *
*/
public default void exitStandbyMode() throws OpenemsNamedException {
EnumWriteChannel pcsSetOperation = this.channel(RefuStore88kChannelId.PCS_SET_OPERATION);
- pcsSetOperation.setNextWriteValue(PCSSetOperation.EXIT_STANDBY_MODE);
+ pcsSetOperation.setNextWriteValue(PcsSetOperation.EXIT_STANDBY_MODE);
}
/**
- *
- * Enter the STARTED mode!
- *
+ * Enter the STARTED mode.
+ *
* @throws OpenemsNamedException
- *
+ *
*/
public default void enterStartedMode() throws OpenemsNamedException {
EnumWriteChannel pcsSetOperation = this.channel(RefuStore88kChannelId.PCS_SET_OPERATION);
- pcsSetOperation.setNextWriteValue(PCSSetOperation.STOP_PCS);
+ pcsSetOperation.setNextWriteValue(PcsSetOperation.STOP_PCS);
}
/**
- *
- * Enter the Throttled or MPPT mode!
- *
+ * Enter the Throttled or MPPT mode.
+ *
* @throws OpenemsNamedException
- *
+ *
*/
public default void enterThrottledMpptMode() throws OpenemsNamedException {
EnumWriteChannel pcsSetOperation = this.channel(RefuStore88kChannelId.PCS_SET_OPERATION);
- pcsSetOperation.setNextWriteValue(PCSSetOperation.START_PCS);
+ pcsSetOperation.setNextWriteValue(PcsSetOperation.START_PCS);
}
/**
- *
- * STOP the inverter by setting the power to zero and entering the STARTED mode!
- *
+ * STOP the inverter by setting the power to zero and entering the STARTED mode.
+ *
* @throws OpenemsNamedException
- *
+ *
*/
public default void stopInverter() throws OpenemsNamedException {
EnumWriteChannel pcsSetOperation = this.channel(RefuStore88kChannelId.PCS_SET_OPERATION);
- pcsSetOperation.setNextWriteValue(PCSSetOperation.ENTER_STANDBY_MODE);
+ pcsSetOperation.setNextWriteValue(PcsSetOperation.ENTER_STANDBY_MODE);
}
public default String getSerialNumber() {
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kChannelId.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kChannelId.java
index 80eb5f870b2..d82b60fa17f 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kChannelId.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kChannelId.java
@@ -8,8 +8,8 @@
import io.openems.edge.batteryinverter.refu88k.enums.DerTyp;
import io.openems.edge.batteryinverter.refu88k.enums.LocRemCtl;
import io.openems.edge.batteryinverter.refu88k.enums.OperatingState;
-import io.openems.edge.batteryinverter.refu88k.enums.OutPFSetEna;
-import io.openems.edge.batteryinverter.refu88k.enums.PCSSetOperation;
+import io.openems.edge.batteryinverter.refu88k.enums.OutPfSetEna;
+import io.openems.edge.batteryinverter.refu88k.enums.PcsSetOperation;
import io.openems.edge.batteryinverter.refu88k.enums.VArPctEna;
import io.openems.edge.batteryinverter.refu88k.enums.VendorOperatingState;
import io.openems.edge.batteryinverter.refu88k.enums.WMaxLimEna;
@@ -168,7 +168,7 @@ public enum RefuStore88kChannelId implements ChannelId {
W_MAX_LIM_PCT(Doc.of(OpenemsType.INTEGER).unit(Unit.NONE).accessMode(AccessMode.READ_WRITE)), // % WMax
W_MAX_LIM_ENA(Doc.of(WMaxLimEna.values()).accessMode(AccessMode.READ_WRITE)), //
OUT_PF_SET(Doc.of(OpenemsType.INTEGER).unit(Unit.NONE).accessMode(AccessMode.READ_WRITE)), // // cos()
- OUT_PF_SET_ENA(Doc.of(OutPFSetEna.values())), //
+ OUT_PF_SET_ENA(Doc.of(OutPfSetEna.values())), //
VAR_W_MAX_PCT(Doc.of(OpenemsType.INTEGER).unit(Unit.NONE).accessMode(AccessMode.READ_WRITE)), // // % WMax
VAR_PCT_ENA(Doc.of(VArPctEna.values()).accessMode(AccessMode.READ_WRITE)), //
W_MAX_LIM_PCT_SF(Doc.of(OpenemsType.INTEGER).unit(Unit.NONE).accessMode(AccessMode.READ_ONLY)), //
@@ -204,7 +204,7 @@ public enum RefuStore88kChannelId implements ChannelId {
LOC_REM_CTL(Doc.of(LocRemCtl.values()).accessMode(AccessMode.READ_WRITE)), //
PCS_HB(Doc.of(OpenemsType.INTEGER).unit(Unit.NONE).accessMode(AccessMode.READ_WRITE)), //
CONTROLLER_HB(Doc.of(OpenemsType.INTEGER).unit(Unit.NONE).accessMode(AccessMode.READ_WRITE)), //
- PCS_SET_OPERATION(Doc.of(PCSSetOperation.values()).accessMode(AccessMode.READ_WRITE)), //
+ PCS_SET_OPERATION(Doc.of(PcsSetOperation.values()).accessMode(AccessMode.READ_WRITE)), //
MAX_BAT_A_CHA(Doc.of(OpenemsType.INTEGER).unit(Unit.AMPERE).accessMode(AccessMode.READ_WRITE)), //
MAX_BAT_A_DISCHA(Doc.of(OpenemsType.INTEGER).unit(Unit.AMPERE).accessMode(AccessMode.READ_WRITE)), //
MAX_A(Doc.of(OpenemsType.INTEGER).unit(Unit.AMPERE).accessMode(AccessMode.READ_WRITE)), //
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kImpl.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kImpl.java
index d810dbb5573..96e0d676425 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kImpl.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/RefuStore88kImpl.java
@@ -61,7 +61,8 @@
name = "Battery-Inverter.Refu.REFUstore88k", //
immediate = true, //
configurationPolicy = ConfigurationPolicy.REQUIRE, //
- property = { EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_AFTER_PROCESS_IMAGE,//
+ property = { //
+ EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_AFTER_PROCESS_IMAGE,//
}
)
@@ -72,7 +73,6 @@ public class RefuStore88kImpl extends AbstractOpenemsModbusComponent implements
private Config config;
public static final int DEFAULT_UNIT_ID = 1;
- private int MAX_APPARENT_POWER = 0;
protected static final double EFFICIENCY_FACTOR = 0.98;
private final CalculateEnergyFromPower calculateChargeEnergy = new CalculateEnergyFromPower(this,
@@ -80,6 +80,8 @@ public class RefuStore88kImpl extends AbstractOpenemsModbusComponent implements
private final CalculateEnergyFromPower calculateDischargeEnergy = new CalculateEnergyFromPower(this,
SymmetricBatteryInverter.ChannelId.ACTIVE_DISCHARGE_ENERGY);
+ private int maxApparentPower = 0;
+
@Reference
private Power power;
@@ -106,6 +108,7 @@ public RefuStore88kImpl() {
this._setGridMode(GridMode.ON_GRID);
}
+ @Override
@Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY)
protected void setModbus(BridgeModbus modbus) {
super.setModbus(modbus);
@@ -120,21 +123,22 @@ void activate(ComponentContext context, Config config) throws OpenemsException {
this.config = config;
this.channel(SymmetricBatteryInverter.ChannelId.MAX_APPARENT_POWER).onChange((oldValue, newValue) -> {
@SuppressWarnings("unchecked")
- Optional valueOpt = (Optional) newValue.asOptional();
+ var valueOpt = (Optional) newValue.asOptional();
if (!valueOpt.isPresent()) {
return;
}
- MAX_APPARENT_POWER = valueOpt.get();
IntegerWriteChannel wMaxChannel = this.channel(RefuStore88kChannelId.W_MAX);
+ this.maxApparentPower = valueOpt.get();
try {
// Set WMax
- wMaxChannel.setNextWriteValue(MAX_APPARENT_POWER);
+ wMaxChannel.setNextWriteValue(this.maxApparentPower);
} catch (OpenemsNamedException e) {
- log.error(e.getMessage());
+ this.log.error(e.getMessage());
}
});
}
+ @Override
@Deactivate
protected void deactivate() {
super.deactivate();
@@ -155,7 +159,7 @@ public void run(Battery battery, int setActivePower, int setReactivePower) throw
this.calculateEnergy();
// Prepare Context
- Context context = new Context(this, battery, this.config, setActivePower, setReactivePower);
+ var context = new Context(this, battery, this.config, setActivePower, setReactivePower);
// Call the StateMachine
try {
@@ -171,21 +175,18 @@ public void run(Battery battery, int setActivePower, int setReactivePower) throw
@Override
public BatteryInverterConstraint[] getStaticConstraints() throws OpenemsException {
- BatteryInverterConstraint noReactivePower = new BatteryInverterConstraint("Reactive power is not allowed",
- Phase.ALL, Pwr.REACTIVE, Relationship.EQUALS, 0d);
+ var noReactivePower = new BatteryInverterConstraint("Reactive power is not allowed", Phase.ALL, Pwr.REACTIVE,
+ Relationship.EQUALS, 0d);
if (this.stateMachine.getCurrentState() == State.RUNNING) {
return new BatteryInverterConstraint[] { noReactivePower };
- } else {
- // Block any power as long as we are not RUNNING
- return new BatteryInverterConstraint[] { //
- noReactivePower, //
- new BatteryInverterConstraint("Refu inverter not ready", Phase.ALL, Pwr.ACTIVE, Relationship.EQUALS,
- 0d) //
- };
-
}
+ // Block any power as long as we are not RUNNING
+ return new BatteryInverterConstraint[] { //
+ noReactivePower, //
+ new BatteryInverterConstraint("Refu inverter not ready", Phase.ALL, Pwr.ACTIVE, Relationship.EQUALS, 0d) //
+ };
}
private void setBatteryLimits(Battery battery) throws OpenemsNamedException {
@@ -202,22 +203,22 @@ private void setBatteryLimits(Battery battery) throws OpenemsNamedException {
@Override
public int getPowerPrecision() {
- return MAX_APPARENT_POWER / 1000;
+ return this.maxApparentPower / 1000;
}
/*
* Supported Models First available Model = Start Address + 2 = 40002 Then 40002
* + Length of Model ....
*/
- private final static int START_ADDRESS = 40000;
- private final static int SUNSPEC_1 = START_ADDRESS + 2; // Common
- private final static int SUNSPEC_103 = 40070; // Inverter (Three Phase)
- private final static int SUNSPEC_120 = 40122; // Nameplate
- private final static int SUNSPEC_121 = 40150; // Basic Settings
- private final static int SUNSPEC_123 = 40182; // Immediate Controls
- private final static int SUNSPEC_64040 = 40208; // REFU Parameter
- private final static int SUNSPEC_64041 = 40213; // REFU Parameter Value
- private final static int SUNSPEC_64800 = 40225; // MESA-PCS Extensions
+ private static final int START_ADDRESS = 40000;
+ private static final int SUNSPEC_1 = START_ADDRESS + 2; // Common
+ private static final int SUNSPEC_103 = 40070; // Inverter (Three Phase)
+ private static final int SUNSPEC_120 = 40122; // Nameplate
+ private static final int SUNSPEC_121 = 40150; // Basic Settings
+ private static final int SUNSPEC_123 = 40182; // Immediate Controls
+ private static final int SUNSPEC_64040 = 40208; // REFU Parameter
+ private static final int SUNSPEC_64041 = 40213; // REFU Parameter Value
+ private static final int SUNSPEC_64800 = 40225; // MESA-PCS Extensions
@Override
protected ModbusProtocol defineModbusProtocol() throws OpenemsException { // Register
@@ -259,7 +260,6 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException { // Reg
ElementToChannelConverter.SCALE_FACTOR_MINUS_1),
m(RefuStore88kChannelId.V_SF, new UnsignedWordElement(SUNSPEC_103 + 13)), // 40083
m(SymmetricBatteryInverter.ChannelId.ACTIVE_POWER, new SignedWordElement(SUNSPEC_103 + 14), // 40084
- // //
ElementToChannelConverter.SCALE_FACTOR_1), // REFUStore88KChannelId.W//
m(RefuStore88kChannelId.W_SF, new SignedWordElement(SUNSPEC_103 + 15)), // 40085
m(RefuStore88kChannelId.HZ, new SignedWordElement(SUNSPEC_103 + 16), // 40086
@@ -269,7 +269,6 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException { // Reg
ElementToChannelConverter.SCALE_FACTOR_1),
m(RefuStore88kChannelId.VA_SF, new SignedWordElement(SUNSPEC_103 + 19)), // 40089
m(SymmetricBatteryInverter.ChannelId.REACTIVE_POWER, new SignedWordElement(SUNSPEC_103 + 20), // 40090
- // //
ElementToChannelConverter.SCALE_FACTOR_1), // REFUStore88KChannelId.VA_R
m(RefuStore88kChannelId.VA_R_SF, new SignedWordElement(SUNSPEC_103 + 21)), // 40091
new DummyRegisterElement(SUNSPEC_103 + 22, SUNSPEC_103 + 23),
@@ -459,7 +458,7 @@ public String debugLog() {
+ "|" + this.stateMachine.getCurrentState().asCamelCase();
}
- private AtomicReference startStopTarget = new AtomicReference(StartStop.UNDEFINED);
+ private final AtomicReference startStopTarget = new AtomicReference<>(StartStop.UNDEFINED);
@Override
public void setStartStop(StartStop value) {
@@ -494,7 +493,7 @@ public StartStop getStartStopTarget() {
*/
private void calculateEnergy() {
// Calculate Energy
- Integer activePower = this.getActivePower().get();
+ var activePower = this.getActivePower().get();
if (activePower == null) {
// Not available
this.calculateChargeEnergy.update(null);
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/VArPctEna.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/VArPctEna.java
deleted file mode 100644
index bdea8c31608..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/VArPctEna.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum VArPctEna implements OptionsEnum {
- UNDEFINED(-1, "Undefined"),
- DISABLED(0, "Disabled"),
- ENABLED(1, "Enabled")
- ;
-
- private final int value;
- private final String name;
-
- private VArPctEna(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/VendorOperatingState.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/VendorOperatingState.java
deleted file mode 100644
index b0dcf74ffbf..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/VendorOperatingState.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum VendorOperatingState implements OptionsEnum {
- UNDEFINED (-1, "Undefinded")
- ;
-
- private final int value;
- private final String name;
-
- private VendorOperatingState(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/WMaxLimEna.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/WMaxLimEna.java
deleted file mode 100644
index cf70df89ad7..00000000000
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/WMaxLimEna.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package io.openems.edge.batteryinverter.refu88k;
-
-import io.openems.common.types.OptionsEnum;
-
-public enum WMaxLimEna implements OptionsEnum {
-
- UNDEFINED(-1, "Undefined"),
- DISABLED(0, "Disabled"),
- ENABLED(1, "Enabled")
- ;
-
- private final int value;
- private final String name;
-
- private WMaxLimEna(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OptionsEnum getUndefined() {
- return UNDEFINED;
- }
-
-
-
-}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Conn.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Conn.java
index c884a52d93d..db5b1066130 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Conn.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Conn.java
@@ -17,12 +17,12 @@ private Conn(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/DerTyp.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/DerTyp.java
index bf72a352faa..cc728124306 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/DerTyp.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/DerTyp.java
@@ -17,12 +17,12 @@ private DerTyp(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Event1.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Event1.java
index a6d7568be52..cd7ff1538ba 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Event1.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/Event1.java
@@ -43,12 +43,12 @@ private Event1(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/LocRemCtl.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/LocRemCtl.java
index c5d714482be..fcc85562d66 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/LocRemCtl.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/LocRemCtl.java
@@ -17,12 +17,12 @@ private LocRemCtl(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OperatingState.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OperatingState.java
index 24c44a08d5d..6dd2dd87aa4 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OperatingState.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OperatingState.java
@@ -24,12 +24,12 @@ private OperatingState(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OutPFSetEna.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OutPfSetEna.java
similarity index 76%
rename from io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OutPFSetEna.java
rename to io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OutPfSetEna.java
index 55a280b5155..c92d05ff6ca 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OutPFSetEna.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/OutPfSetEna.java
@@ -2,7 +2,7 @@
import io.openems.common.types.OptionsEnum;
-public enum OutPFSetEna implements OptionsEnum {
+public enum OutPfSetEna implements OptionsEnum {
UNDEFINED(-1, "Undefined"), //
DISABLED(0, "Disabled"), //
ENABLED(1, "Enabled");
@@ -10,19 +10,19 @@ public enum OutPFSetEna implements OptionsEnum {
private final int value;
private final String name;
- private OutPFSetEna(int value, String name) {
+ private OutPfSetEna(int value, String name) {
this.value = value;
this.name = name;
}
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/PCSSetOperation.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/PcsSetOperation.java
similarity index 80%
rename from io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/PCSSetOperation.java
rename to io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/PcsSetOperation.java
index b9e8c8bcd4c..0cde35b42ff 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/PCSSetOperation.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/PcsSetOperation.java
@@ -2,7 +2,7 @@
import io.openems.common.types.OptionsEnum;
-public enum PCSSetOperation implements OptionsEnum {
+public enum PcsSetOperation implements OptionsEnum {
UNDEFINED(-1, "Undefined"), //
NO_COMMAND(0, "No Command"), //
START_PCS(1, "Connect to grid"), //
@@ -13,19 +13,19 @@ public enum PCSSetOperation implements OptionsEnum {
private final int value;
private final String name;
- private PCSSetOperation(int value, String name) {
+ private PcsSetOperation(int value, String name) {
this.value = value;
this.name = name;
}
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VArPctEna.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VArPctEna.java
index 39f80763e00..80c64e3b959 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VArPctEna.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VArPctEna.java
@@ -17,12 +17,12 @@ private VArPctEna(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VendorOperatingState.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VendorOperatingState.java
index 73041bdeafa..9d277150aec 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VendorOperatingState.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/VendorOperatingState.java
@@ -15,12 +15,12 @@ private VendorOperatingState(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/WMaxLimEna.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/WMaxLimEna.java
index cc0fbe27771..af194fe56fa 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/WMaxLimEna.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/enums/WMaxLimEna.java
@@ -17,12 +17,12 @@ private WMaxLimEna(int value, String name) {
@Override
public int getValue() {
- return value;
+ return this.value;
}
@Override
public String getName() {
- return name;
+ return this.name;
}
@Override
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/ErrorHandler.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/ErrorHandler.java
index 3190b3fb643..a522074b108 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/ErrorHandler.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/ErrorHandler.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.refu88k.statemachine;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.refu88k.RefuStore88k;
import io.openems.edge.batteryinverter.refu88k.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -9,7 +8,7 @@ public class ErrorHandler extends StateHandler {
@Override
public StateMachine.State runAndGetNextState(Context context) throws OpenemsNamedException {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
inverter._setActivePower(0);
inverter._setReactivePower(0);
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoRunningHandler.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoRunningHandler.java
index 5fbc1f44c43..4e28a0ab7fe 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoRunningHandler.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoRunningHandler.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.refu88k.statemachine;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.refu88k.RefuStore88k;
import io.openems.edge.batteryinverter.refu88k.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -9,14 +8,14 @@ public class GoRunningHandler extends StateHandler {
@Override
protected void onEntry(Context context) throws OpenemsNamedException {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
inverter._setMaxStartAttempts(false);
}
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
// Has Faults -> abort
if (inverter.hasFaults()) {
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoStoppedHandler.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoStoppedHandler.java
index d96d13b067b..c40457bc2f2 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoStoppedHandler.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/GoStoppedHandler.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.refu88k.statemachine;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.refu88k.RefuStore88k;
import io.openems.edge.batteryinverter.refu88k.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -9,7 +8,7 @@ public class GoStoppedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
switch (inverter.getOperatingState()) {
case STARTING:
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/RunningHandler.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/RunningHandler.java
index 500b59c6932..c2237c8fee8 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/RunningHandler.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/RunningHandler.java
@@ -4,7 +4,6 @@
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.edge.batteryinverter.api.SymmetricBatteryInverter;
-import io.openems.edge.batteryinverter.refu88k.RefuStore88k;
import io.openems.edge.batteryinverter.refu88k.RefuStore88kChannelId;
import io.openems.edge.batteryinverter.refu88k.enums.VArPctEna;
import io.openems.edge.batteryinverter.refu88k.enums.WMaxLimEna;
@@ -21,7 +20,7 @@ public class RunningHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
if (inverter.hasFaults()) {
return State.UNDEFINED;
@@ -53,61 +52,59 @@ public State runAndGetNextState(Context context) throws OpenemsNamedException {
/**
* Applies the Active and Reactive Power Set-Points.
- *
+ *
* @param context the {@link Context}
* @throws OpenemsNamedException on error
*/
-
private void applyPower(Context context) throws OpenemsNamedException {
- RefuStore88k inverter = context.getParent();
- doGridConnectedHandling(context, context.setActivePower, context.setReactivePower);
+ var inverter = context.getParent();
+ this.doGridConnectedHandling(context, context.setActivePower, context.setReactivePower);
IntegerReadChannel maxApparentPowerChannel = inverter
.channel(SymmetricBatteryInverter.ChannelId.MAX_APPARENT_POWER);
int maxApparentPower = maxApparentPowerChannel.value().getOrError();
- int wSetPct = 0;
- int varSetPct = 0;
+ var wSetPct = 0;
+ var varSetPct = 0;
// Calculate Active Power as a percentage of WMAX
- wSetPct = ((1000 * context.setActivePower) / maxApparentPower);
+ wSetPct = 1000 * context.setActivePower / maxApparentPower;
// Calculate Reactive Power as a percentage of WMAX
- varSetPct = ((100 * context.setReactivePower) / maxApparentPower);
+ varSetPct = 100 * context.setReactivePower / maxApparentPower;
IntegerWriteChannel wMaxLimPctChannel = inverter.channel(RefuStore88kChannelId.W_MAX_LIM_PCT);
- EnumWriteChannel wMaxLim_EnaChannel = inverter.channel(RefuStore88kChannelId.W_MAX_LIM_ENA);
-
- IntegerWriteChannel varMaxLimPctChannel = inverter.channel(RefuStore88kChannelId.VAR_W_MAX_PCT);
- EnumWriteChannel varMaxLim_EnaChannel = inverter.channel(RefuStore88kChannelId.VAR_PCT_ENA);
-
wMaxLimPctChannel.setNextWriteValue(wSetPct);
- wMaxLim_EnaChannel.setNextWriteValue(WMaxLimEna.ENABLED);
+ EnumWriteChannel wMaxLimEnaChannel = inverter.channel(RefuStore88kChannelId.W_MAX_LIM_ENA);
+ wMaxLimEnaChannel.setNextWriteValue(WMaxLimEna.ENABLED);
+
+ IntegerWriteChannel varMaxLimPctChannel = inverter.channel(RefuStore88kChannelId.VAR_W_MAX_PCT);
varMaxLimPctChannel.setNextWriteValue(varSetPct);
- varMaxLim_EnaChannel.setNextWriteValue(VArPctEna.ENABLED);
+
+ EnumWriteChannel varMaxLimEnaChannel = inverter.channel(RefuStore88kChannelId.VAR_PCT_ENA);
+ varMaxLimEnaChannel.setNextWriteValue(VArPctEna.ENABLED);
}
/**
+ * Checks if power is required from the system.
*
- * Checks if power is required from the system!
- *
- * @throws OpenemsNamedException
- *
+ * @param context the {@link Context}
+ * @param activePower the active power setpoint
+ * @param reactivePower the reactive power setpoint
*/
-
private void doGridConnectedHandling(Context context, int activePower, int reactivePower)
throws OpenemsNamedException {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
if (activePower == 0 && reactivePower == 0) {
- if (timeNoPower == null) {
- timeNoPower = LocalDateTime.now();
+ if (this.timeNoPower == null) {
+ this.timeNoPower = LocalDateTime.now();
}
- if ((timeNoPower.plusSeconds(context.config.timeLimitNoPower())).isBefore(LocalDateTime.now())) {
+ if (this.timeNoPower.plusSeconds(context.config.timeLimitNoPower()).isBefore(LocalDateTime.now())) {
inverter.enterStartedMode();
}
} else {
- timeNoPower = null;
+ this.timeNoPower = null;
inverter.enterThrottledMpptMode();
}
}
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/StoppedHandler.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/StoppedHandler.java
index aaf2f026aae..926e38adf9c 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/StoppedHandler.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/StoppedHandler.java
@@ -1,6 +1,5 @@
package io.openems.edge.batteryinverter.refu88k.statemachine;
-import io.openems.edge.batteryinverter.refu88k.RefuStore88k;
import io.openems.edge.batteryinverter.refu88k.statemachine.StateMachine.State;
import io.openems.edge.common.startstop.StartStop;
import io.openems.edge.common.statemachine.StateHandler;
@@ -9,7 +8,7 @@ public class StoppedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
switch (inverter.getOperatingState()) {
case STANDBY:
diff --git a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/UndefinedHandler.java b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/UndefinedHandler.java
index 98d462f915d..7a0c4b26780 100644
--- a/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/UndefinedHandler.java
+++ b/io.openems.edge.batteryinverter.refu88k/src/io/openems/edge/batteryinverter/refu88k/statemachine/UndefinedHandler.java
@@ -1,6 +1,5 @@
package io.openems.edge.batteryinverter.refu88k.statemachine;
-import io.openems.edge.batteryinverter.refu88k.RefuStore88k;
import io.openems.edge.batteryinverter.refu88k.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -8,7 +7,7 @@ public class UndefinedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) {
- RefuStore88k inverter = context.getParent();
+ var inverter = context.getParent();
switch (inverter.getStartStopTarget()) {
case UNDEFINED:
diff --git a/io.openems.edge.batteryinverter.refu88k/test/io/openems/edge/batteryinverter/refu88k/MyConfig.java b/io.openems.edge.batteryinverter.refu88k/test/io/openems/edge/batteryinverter/refu88k/MyConfig.java
index 72272861d60..96c6b434591 100644
--- a/io.openems.edge.batteryinverter.refu88k/test/io/openems/edge/batteryinverter/refu88k/MyConfig.java
+++ b/io.openems.edge.batteryinverter.refu88k/test/io/openems/edge/batteryinverter/refu88k/MyConfig.java
@@ -50,7 +50,7 @@ public MyConfig build() {
/**
* Create a Config builder.
- *
+ *
* @return a {@link Builder}
*/
public static Builder create() {
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/Sinexcel.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/Sinexcel.java
index 110534a63be..352754d5f0a 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/Sinexcel.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/Sinexcel.java
@@ -1,7 +1,5 @@
package io.openems.edge.batteryinverter.sinexcel;
-import java.util.Optional;
-
import io.openems.common.channel.AccessMode;
import io.openems.common.channel.Level;
import io.openems.common.channel.Unit;
@@ -107,18 +105,16 @@ public enum ChannelId implements io.openems.edge.common.channel.ChannelId {
INVERTER_GRID_MODE(Doc.of(OpenemsType.BOOLEAN) //
.text("On Grid") //
.onInit(c -> { //
- BooleanReadChannel channel = (BooleanReadChannel) c;
- Sinexcel self = (Sinexcel) channel.getComponent();
+ var channel = (BooleanReadChannel) c;
+ var self = (Sinexcel) channel.getComponent();
channel.onChange((oldValue, newValue) -> {
- Optional value = newValue.asOptional();
+ var value = newValue.asOptional();
if (!value.isPresent()) {
self._setGridMode(GridMode.UNDEFINED);
+ } else if (value.get()) {
+ self._setGridMode(GridMode.ON_GRID);
} else {
- if (value.get()) {
- self._setGridMode(GridMode.ON_GRID);
- } else {
- self._setGridMode(GridMode.OFF_GRID);
- }
+ self._setGridMode(GridMode.OFF_GRID);
}
});
})),
@@ -844,7 +840,7 @@ public default Value getSetOnGridMode() {
/**
* Sets a the On-Grid-Mode. See {@link ChannelId#SET_ON_GRID_MODE}.
- *
+ *
* @param value the next write value
* @throws OpenemsNamedException on error
*/
@@ -872,7 +868,7 @@ public default Value getSetOffGridMode() {
/**
* Sets a the Off-Grid-Mode. See {@link ChannelId#SET_OFF_GRID_MODE}.
- *
+ *
* @param value the next write value
* @throws OpenemsNamedException on error
*/
@@ -891,7 +887,7 @@ public default BooleanWriteChannel getStartInverterChannel() {
/**
* Sends a START command to the inverter. See {@link ChannelId#START_INVERTER}.
- *
+ *
* @throws OpenemsNamedException on error
*/
public default void setStartInverter() throws OpenemsNamedException {
@@ -909,7 +905,7 @@ public default BooleanWriteChannel getStopInverterChannel() {
/**
* Sends a STOP command to the inverter. See {@link ChannelId#STOP_INVERTER}.
- *
+ *
* @throws OpenemsNamedException on error
*/
public default void setStopInverter() throws OpenemsNamedException {
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/SinexcelImpl.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/SinexcelImpl.java
index 9950e953a51..1f29a8d0b08 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/SinexcelImpl.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/SinexcelImpl.java
@@ -48,7 +48,6 @@
import io.openems.edge.bridge.modbus.api.task.FC6WriteRegisterTask;
import io.openems.edge.common.channel.BooleanWriteChannel;
import io.openems.edge.common.channel.WriteChannel;
-import io.openems.edge.common.channel.value.Value;
import io.openems.edge.common.component.ComponentManager;
import io.openems.edge.common.component.OpenemsComponent;
import io.openems.edge.common.event.EdgeEventConstants;
@@ -115,6 +114,7 @@ public SinexcelImpl() throws OpenemsNamedException {
this._setMaxApparentPower(SinexcelImpl.MAX_APPARENT_POWER);
}
+ @Override
@Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY)
protected void setModbus(BridgeModbus modbus) {
super.setModbus(modbus);
@@ -129,6 +129,7 @@ protected void activate(ComponentContext context, Config config) throws OpenemsN
}
}
+ @Override
@Deactivate
protected void deactivate() {
super.deactivate();
@@ -149,7 +150,7 @@ public void run(Battery battery, int setActivePower, int setReactivePower) throw
this.setBatteryLimits(battery);
// Prepare Context
- Context context = new Context(this, this.config, this.targetGridMode.get(), setActivePower, setReactivePower);
+ var context = new Context(this, this.config, this.targetGridMode.get(), setActivePower, setReactivePower);
// Call the StateMachine
try {
@@ -165,7 +166,7 @@ public void run(Battery battery, int setActivePower, int setReactivePower) throw
/**
* Updates the Channel if its current value is not equal to the new value.
- *
+ *
* @param channelId Sinexcel Channel-Id
* @param newValue {@link OptionsEnum} value.
* @throws IllegalArgumentException on error
@@ -177,14 +178,14 @@ private void updateIfNotEqual(Sinexcel.ChannelId channelId, OptionsEnum value)
/**
* Updates the Channel if its current value is not equal to the new value.
- *
+ *
* @param channelId Sinexcel Channel-Id
* @param newValue Integer value.
* @throws IllegalArgumentException on error
*/
private void updateIfNotEqual(Sinexcel.ChannelId channelId, Integer newValue) throws IllegalArgumentException {
WriteChannel channel = this.channel(channelId);
- Value currentValue = channel.value();
+ var currentValue = channel.value();
if (currentValue.isDefined() && !Objects.equals(currentValue.get(), newValue)) {
try {
channel.setNextWriteValue(newValue);
@@ -198,7 +199,7 @@ private void updateIfNotEqual(Sinexcel.ChannelId channelId, Integer newValue) th
/**
* Sets some default settings on the inverter, like Timeout.
- *
+ *
* @throws OpenemsNamedException on error
*/
private void setDefaultSettings() throws OpenemsNamedException {
@@ -210,7 +211,7 @@ private void setDefaultSettings() throws OpenemsNamedException {
/**
* Sets the Battery Limits.
- *
+ *
* @param battery the linked {@link Battery}
* @throws OpenemsNamedException on error
*/
@@ -293,15 +294,14 @@ public BatteryInverterConstraint[] getStaticConstraints() throws OpenemsExceptio
if (this.stateMachine.getCurrentState() == State.RUNNING) {
return BatteryInverterConstraint.NO_CONSTRAINTS;
- } else {
- // Block any power as long as we are not RUNNING
- return new BatteryInverterConstraint[] { //
- new BatteryInverterConstraint("Sinexcel inverter not ready", Phase.ALL, Pwr.REACTIVE, //
- Relationship.EQUALS, 0d), //
- new BatteryInverterConstraint("Sinexcel inverter not ready", Phase.ALL, Pwr.ACTIVE, //
- Relationship.EQUALS, 0d) //
- };
}
+ // Block any power as long as we are not RUNNING
+ return new BatteryInverterConstraint[] { //
+ new BatteryInverterConstraint("Sinexcel inverter not ready", Phase.ALL, Pwr.REACTIVE, //
+ Relationship.EQUALS, 0d), //
+ new BatteryInverterConstraint("Sinexcel inverter not ready", Phase.ALL, Pwr.ACTIVE, //
+ Relationship.EQUALS, 0d) //
+ };
}
@Override
@@ -318,6 +318,7 @@ public ModbusSlaveTable getModbusSlaveTable(AccessMode accessMode) {
);
}
+ @Override
protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
return new ModbusProtocol(this, //
new FC3ReadRegistersTask(1, Priority.HIGH, //
@@ -1097,9 +1098,8 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
int value = (Short) obj;
if (Math.abs(value) < 100) {
return 0;
- } else {
- return value;
}
+ return value;
}, //
value -> value);
@@ -1116,6 +1116,6 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException {
*/
public void softStart(boolean switchOn) throws OpenemsNamedException {
BooleanWriteChannel setSoftStart = this.channel(Sinexcel.ChannelId.SET_SOFT_START);
- setSoftStart.setNextWriteValue(switchOn ? true : false);
+ setSoftStart.setNextWriteValue(switchOn == true);
}
}
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/enums/ReactivePowerControlMode.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/enums/ReactivePowerControlMode.java
index 1b5a15ea1d8..3d01ba612d9 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/enums/ReactivePowerControlMode.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/enums/ReactivePowerControlMode.java
@@ -5,11 +5,10 @@
public enum ReactivePowerControlMode implements OptionsEnum {
UNDEFINED(-1, "Undefined"), //
CONSTANT_REACTIVE_POWER(0, "Constant Reactive Power"), //
- VOLT_VAR_ENABLED(1, "Volt Var Enabled"),//
+ VOLT_VAR_ENABLED(1, "Volt Var Enabled"), //
CONSTANT_PF(2, "Constanr Power Factor"), //
WATT_PF_ENABLED(3, "Watt Power Factor Enabled"); //
-
-
+
private final int value;
private final String name;
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/ErrorHandler.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/ErrorHandler.java
index 9e244e83e85..7161d8698c4 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/ErrorHandler.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/ErrorHandler.java
@@ -5,7 +5,6 @@
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.edge.batteryinverter.sinexcel.Sinexcel;
-import io.openems.edge.batteryinverter.sinexcel.SinexcelImpl;
import io.openems.edge.batteryinverter.sinexcel.statemachine.StateMachine.State;
import io.openems.edge.common.channel.BooleanWriteChannel;
import io.openems.edge.common.statemachine.StateHandler;
@@ -24,7 +23,7 @@ protected void onEntry(Context context) throws OpenemsNamedException {
this.setClearFailureCommand(context);
// Try to stop systems
- final SinexcelImpl inverter = context.getParent();
+ final var inverter = context.getParent();
inverter.softStart(false);
inverter.setStopInverter();
}
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoRunningHandler.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoRunningHandler.java
index 63574e43c03..13769d96c5b 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoRunningHandler.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoRunningHandler.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.sinexcel.statemachine;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.sinexcel.SinexcelImpl;
import io.openems.edge.batteryinverter.sinexcel.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -9,13 +8,13 @@ public class GoRunningHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- final SinexcelImpl inverter = context.getParent();
+ final var inverter = context.getParent();
/*
* Be sure to set the correct target grid mode
*/
- Boolean setOnGridMode = inverter.getSetOnGridMode().get();
- Boolean setOffGridMode = inverter.getSetOffGridMode().get();
+ var setOnGridMode = inverter.getSetOnGridMode().get();
+ var setOffGridMode = inverter.getSetOffGridMode().get();
switch (context.targetGridMode) {
case GO_ON_GRID:
if (setOnGridMode == Boolean.FALSE || setOffGridMode == Boolean.TRUE) {
@@ -39,10 +38,9 @@ public State runAndGetNextState(Context context) throws OpenemsNamedException {
if (inverter.getBatteryInverterState().get() == Boolean.TRUE) {
// Inverter is ON
return State.RUNNING;
- } else {
- // Still waiting
- return State.GO_RUNNING;
}
+ // Still waiting
+ return State.GO_RUNNING;
}
}
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoStoppedHandler.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoStoppedHandler.java
index 7c51ce24738..3d486519b7f 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoStoppedHandler.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/GoStoppedHandler.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.sinexcel.statemachine;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.sinexcel.SinexcelImpl;
import io.openems.edge.batteryinverter.sinexcel.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -9,7 +8,7 @@ public class GoStoppedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- final SinexcelImpl inverter = context.getParent();
+ final var inverter = context.getParent();
inverter.softStart(false);
inverter.setStopInverter();
@@ -17,10 +16,9 @@ public State runAndGetNextState(Context context) throws OpenemsNamedException {
if (inverter.getBatteryInverterState().get() == Boolean.FALSE) {
// Inverter is OFF
return State.STOPPED;
- } else {
- // Still waiting
- return State.GO_STOPPED;
}
+ // Still waiting
+ return State.GO_STOPPED;
}
}
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/RunningHandler.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/RunningHandler.java
index 2de4e315942..af86a0decfb 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/RunningHandler.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/RunningHandler.java
@@ -2,7 +2,6 @@
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.edge.batteryinverter.sinexcel.Sinexcel;
-import io.openems.edge.batteryinverter.sinexcel.SinexcelImpl;
import io.openems.edge.batteryinverter.sinexcel.statemachine.StateMachine.State;
import io.openems.edge.common.channel.IntegerWriteChannel;
import io.openems.edge.common.startstop.StartStop;
@@ -12,7 +11,7 @@ public class RunningHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- final SinexcelImpl inverter = context.getParent();
+ final var inverter = context.getParent();
if (inverter.hasFaults() || inverter.getBatteryInverterState().get() == Boolean.FALSE) {
return State.UNDEFINED;
@@ -31,12 +30,12 @@ public State runAndGetNextState(Context context) throws OpenemsNamedException {
/**
* Applies the Active and Reactive Power Set-Points.
- *
+ *
* @param context the {@link Context}
* @throws OpenemsNamedException on error
*/
private void applyPower(Context context) throws OpenemsNamedException {
- final SinexcelImpl inverter = context.getParent();
+ final var inverter = context.getParent();
IntegerWriteChannel setActivePower = inverter.channel(Sinexcel.ChannelId.SET_ACTIVE_POWER);
setActivePower.setNextWriteValue(context.setActivePower);
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/StoppedHandler.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/StoppedHandler.java
index 6b4a30c65ff..1b5d0d4e84d 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/StoppedHandler.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/StoppedHandler.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.sinexcel.statemachine;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.sinexcel.SinexcelImpl;
import io.openems.edge.batteryinverter.sinexcel.statemachine.StateMachine.State;
import io.openems.edge.common.startstop.StartStop;
import io.openems.edge.common.statemachine.StateHandler;
@@ -10,7 +9,7 @@ public class StoppedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- final SinexcelImpl inverter = context.getParent();
+ final var inverter = context.getParent();
// Mark as stopped
inverter._setStartStop(StartStop.STOP);
diff --git a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/UndefinedHandler.java b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/UndefinedHandler.java
index 9a5e4bbc1c8..cb2346bc3fe 100644
--- a/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/UndefinedHandler.java
+++ b/io.openems.edge.batteryinverter.sinexcel/src/io/openems/edge/batteryinverter/sinexcel/statemachine/UndefinedHandler.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.sinexcel.statemachine;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
-import io.openems.edge.batteryinverter.sinexcel.SinexcelImpl;
import io.openems.edge.batteryinverter.sinexcel.statemachine.StateMachine.State;
import io.openems.edge.common.statemachine.StateHandler;
@@ -9,7 +8,7 @@ public class UndefinedHandler extends StateHandler {
@Override
public State runAndGetNextState(Context context) throws OpenemsNamedException {
- final SinexcelImpl inverter = context.getParent();
+ final var inverter = context.getParent();
switch (inverter.getStartStopTarget()) {
case UNDEFINED:
// Stuck in UNDEFINED State
diff --git a/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/MyConfig.java b/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/MyConfig.java
index d5c9037f981..76f5937afa9 100644
--- a/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/MyConfig.java
+++ b/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/MyConfig.java
@@ -1,7 +1,6 @@
package io.openems.edge.batteryinverter.sinexcel;
import io.openems.common.utils.ConfigUtils;
-import io.openems.edge.batteryinverter.sinexcel.Config;
import io.openems.edge.common.startstop.StartStopConfig;
import io.openems.edge.common.test.AbstractComponentConfig;
@@ -12,7 +11,6 @@ protected static class Builder {
private String id = null;
private String modbusId = null;
private StartStopConfig startStopConfig = null;
- private int modbusUnitId;
private Builder() {
}
@@ -39,7 +37,7 @@ public MyConfig build() {
/**
* Create a Config builder.
- *
+ *
* @return a {@link Builder}
*/
public static Builder create() {
diff --git a/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/SinexcelImplTest.java b/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/SinexcelImplTest.java
index 408d2582961..cc8a82b0637 100644
--- a/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/SinexcelImplTest.java
+++ b/io.openems.edge.batteryinverter.sinexcel/test/io/openems/edge/batteryinverter/sinexcel/SinexcelImplTest.java
@@ -58,8 +58,8 @@ protected void handleEvent(String topic) throws Exception {
@Test
public void testStart() throws Exception {
- final TimeLeapClock clock = new TimeLeapClock(
- Instant.ofEpochSecond(1577836800L) /* starts at 1. January 2020 00:00:00 */, ZoneOffset.UTC);
+ final var clock = new TimeLeapClock(Instant.ofEpochSecond(1577836800L) /* starts at 1. January 2020 00:00:00 */,
+ ZoneOffset.UTC);
new MyComponentTest(new SinexcelImpl()) //
.addReference("cm", new DummyConfigurationAdmin()) //
.addReference("componentManager", new DummyComponentManager(clock)) //
@@ -92,9 +92,9 @@ public void testStart() throws Exception {
@Test
public void testOffGrid() throws Exception {
- final TimeLeapClock clock = new TimeLeapClock(
- Instant.ofEpochSecond(1577836800L) /* starts at 1. January 2020 00:00:00 */, ZoneOffset.UTC);
- SinexcelImpl sut = new SinexcelImpl();
+ final var clock = new TimeLeapClock(Instant.ofEpochSecond(1577836800L) /* starts at 1. January 2020 00:00:00 */,
+ ZoneOffset.UTC);
+ var sut = new SinexcelImpl();
new MyComponentTest(sut) //
.addReference("cm", new DummyConfigurationAdmin()) //
.addReference("componentManager", new DummyComponentManager(clock)) //
diff --git a/io.openems.edge.batteryinverter.sunspec/src/io/openems/edge/batteryinverter/sunspec/AbstractSunSpecBatteryInverter.java b/io.openems.edge.batteryinverter.sunspec/src/io/openems/edge/batteryinverter/sunspec/AbstractSunSpecBatteryInverter.java
index 1cce13e82e5..646ca7f453b 100644
--- a/io.openems.edge.batteryinverter.sunspec/src/io/openems/edge/batteryinverter/sunspec/AbstractSunSpecBatteryInverter.java
+++ b/io.openems.edge.batteryinverter.sunspec/src/io/openems/edge/batteryinverter/sunspec/AbstractSunSpecBatteryInverter.java
@@ -29,7 +29,7 @@ public AbstractSunSpecBatteryInverter(Map activeModels,
/**
* Make sure to call this method from the inheriting OSGi Component.
- *
+ *
* @throws OpenemsException on error
*/
@Override
@@ -43,6 +43,7 @@ protected boolean activate(ComponentContext context, String id, String alias, bo
/**
* Make sure to call this method from the inheriting OSGi Component.
*/
+ @Override
@Deactivate
protected void deactivate() {
super.deactivate();
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridApiClient.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridApiClient.java
index bde63137db6..f43cc6ed482 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridApiClient.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridApiClient.java
@@ -6,15 +6,12 @@
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
-import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.util.StringContentProvider;
import org.eclipse.jetty.http.HttpHeader;
import org.jsoup.Jsoup;
-import org.jsoup.nodes.Document;
-import org.jsoup.nodes.Element;
-import io.openems.common.exceptions.OpenemsException;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
+import io.openems.common.exceptions.OpenemsException;
public class BoschBpts5HybridApiClient {
@@ -23,49 +20,47 @@ public class BoschBpts5HybridApiClient {
private static final String GET_VALUES_URL_PART = "/cgi-bin/ipcclient.fcgi?";
private static String BASE_URL;
private String wui_sid;
- private Integer pvLeistungWatt = Integer.valueOf(0);
+ private Integer pvLeistungWatt = Integer.valueOf(0);
private Integer soc = Integer.valueOf(0);
- private Integer einspeisung = Integer.valueOf(0);
+ private Integer einspeisung = Integer.valueOf(0);
private Integer batterieLadeStrom = Integer.valueOf(0);
private Integer verbrauchVonPv = Integer.valueOf(0);
private Integer verbrauchVonBatterie = Integer.valueOf(0);
private Integer strombezugAusNetz = Integer.valueOf(0);
- private HttpClient httpClient;
+ private final HttpClient httpClient;
public BoschBpts5HybridApiClient(String ipaddress) {
- BASE_URL = "http://"+ipaddress;
- httpClient = new HttpClient();
- httpClient.setConnectTimeout(5000);
- httpClient.setFollowRedirects(true);
+ BASE_URL = "http://" + ipaddress;
+ this.httpClient = new HttpClient();
+ this.httpClient.setConnectTimeout(5000);
+ this.httpClient.setFollowRedirects(true);
try {
- httpClient.start();
+ this.httpClient.start();
} catch (Exception e) {
e.printStackTrace();
}
- connect();
+ this.connect();
}
-
+
public void connect() {
try {
- wui_sid = getWuiSidRequest();
+ this.wui_sid = this.getWuiSidRequest();
} catch (OpenemsNamedException e) {
- wui_sid = "";
+ this.wui_sid = "";
e.printStackTrace();
}
}
private String getWuiSidRequest() throws OpenemsNamedException {
try {
- ContentResponse response = httpClient.GET(BASE_URL);
-
- int status = response.getStatus();
- if(status < 300) {
- String body = response.getContentAsString();
- return extractWuiSidFromBody(body);
- } else {
- throw new OpenemsException(
- "Error while reading from Bosch BPT-S 5. Response code: " + status);
+ var response = this.httpClient.GET(BASE_URL);
+
+ var status = response.getStatus();
+ if (status < 300) {
+ var body = response.getContentAsString();
+ return this.extractWuiSidFromBody(body);
}
+ throw new OpenemsException("Error while reading from Bosch BPT-S 5. Response code: " + status);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw new OpenemsException(
"Unable to read from Bosch BPT-S 5. " + e.getClass().getSimpleName() + ": " + e.getMessage());
@@ -73,61 +68,55 @@ private String getWuiSidRequest() throws OpenemsNamedException {
}
private String extractWuiSidFromBody(String body) throws OpenemsException {
- int index = body.indexOf("WUI_SID=");
-
- if(index < 0) {
- throw new OpenemsException(
- "Error while extracting WUI_SID. Body was= " + body);
+ var index = body.indexOf("WUI_SID=");
+
+ if (index < 0) {
+ throw new OpenemsException("Error while extracting WUI_SID. Body was= " + body);
}
-
+
return body.substring(index + 9, index + 9 + 15);
}
public void retreiveValues() throws OpenemsException {
- Request postRequest = httpClient.POST(BASE_URL+GET_VALUES_URL_PART+wui_sid);
+ var postRequest = this.httpClient.POST(BASE_URL + GET_VALUES_URL_PART + this.wui_sid);
postRequest.timeout(5, TimeUnit.SECONDS);
postRequest.header(HttpHeader.CONTENT_TYPE, "text/plain");
postRequest.content(new StringContentProvider(POST_REQUEST_DATA));
-
+
ContentResponse response;
-
+
try {
response = postRequest.send();
-
- int status = response.getStatus();
-
- if (status < 300) {
- extractValuesFromAnswer(response.getContentAsString());
- } else {
- throw new OpenemsException(
- "Error while reading from Bosch BPT-S 5. Response code: " + status);
+
+ var status = response.getStatus();
+
+ if (status >= 300) {
+ throw new OpenemsException("Error while reading from Bosch BPT-S 5. Response code: " + status);
}
+ this.extractValuesFromAnswer(response.getContentAsString());
} catch (InterruptedException | TimeoutException | ExecutionException | OpenemsNamedException e) {
throw new OpenemsException(
"Unable to read from Bosch BPT-S 5. " + e.getClass().getSimpleName() + ": " + e.getMessage());
}
}
-
+
public int retreiveBatterieStatus() throws OpenemsException {
try {
- ContentResponse response = httpClient.GET(BASE_URL+GET_VALUES_URL_PART+wui_sid+REQUEST_LOG_BOOK_VIEW);
-
- int status = response.getStatus();
- if(status < 300) {
- String content = response.getContentAsString();
- Document document = Jsoup.parse(content);
- Element tableNode = document.select("table").get(0);
- Element firstRow = tableNode.select("tr").get(0);
- String firstRowText = firstRow.text();
- if(firstRowText.contains("Störung") && !firstRowText.contains("Keine")) {
- return 1;
- }
- else {
- return 0;
- }
+ var response = this.httpClient.GET(BASE_URL + GET_VALUES_URL_PART + this.wui_sid + REQUEST_LOG_BOOK_VIEW);
+
+ var status = response.getStatus();
+ if (status >= 300) {
+ throw new OpenemsException("Error while reading from Bosch BPT-S 5. Response code: " + status);
+ }
+ var content = response.getContentAsString();
+ var document = Jsoup.parse(content);
+ var tableNode = document.select("table").get(0);
+ var firstRow = tableNode.select("tr").get(0);
+ var firstRowText = firstRow.text();
+ if (firstRowText.contains("Störung") && !firstRowText.contains("Keine")) {
+ return 1;
} else {
- throw new OpenemsException(
- "Error while reading from Bosch BPT-S 5. Response code: " + status);
+ return 0;
}
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw new OpenemsException(
@@ -136,77 +125,76 @@ public int retreiveBatterieStatus() throws OpenemsException {
}
private void extractValuesFromAnswer(String body) throws OpenemsNamedException {
- if(body.contains("session invalid")) {
- getWuiSidRequest();
+ if (body.contains("session invalid")) {
+ this.getWuiSidRequest();
return;
}
-
- String[] values = body.split("\\|");
-
+
+ var values = body.split("\\|");
+
// pvLeistungProzent = Integer.valueOf(values[1]);
-
- pvLeistungWatt = parseWattValue(values[2]);
-
- soc = Integer.valueOf(values[3]);
-
+
+ this.pvLeistungWatt = this.parseWattValue(values[2]);
+
+ this.soc = Integer.valueOf(values[3]);
+
// autarkieGrad = Float.valueOf(values[5]).floatValue();
-
+
// currentOverallConsumption = parseWattValue(values[6]);
-
+
// gridStatusString = values[7];
-
+
// systemStatusString = values[9];
-
- batterieLadeStrom = parseWattValue(values[10]);
-
- einspeisung = parseWattValue(values[11]);
-
- verbrauchVonPv = parseWattValue(values[12]);
-
- verbrauchVonBatterie = parseWattValue(values[13]);
-
- if(values.length<15) {
- strombezugAusNetz = 0;
- }
- else {
- strombezugAusNetz = parseWattValue(values[14]);
+
+ this.batterieLadeStrom = this.parseWattValue(values[10]);
+
+ this.einspeisung = this.parseWattValue(values[11]);
+
+ this.verbrauchVonPv = this.parseWattValue(values[12]);
+
+ this.verbrauchVonBatterie = this.parseWattValue(values[13]);
+
+ if (values.length < 15) {
+ this.strombezugAusNetz = 0;
+ } else {
+ this.strombezugAusNetz = this.parseWattValue(values[14]);
}
}
-
+
private Integer parseWattValue(String inputString) {
- if(inputString.trim().length() == 0 || inputString.contains("nbsp;")) {
+ if (inputString.trim().length() == 0 || inputString.contains("nbsp;")) {
return Integer.valueOf(0);
}
-
- String wattString = inputString.replace("kW", " ").replace("von"," ").trim();
+
+ var wattString = inputString.replace("kW", " ").replace("von", " ").trim();
return Integer.valueOf((int) (Float.parseFloat(wattString) * 1000.0f));
}
public Integer getCurrentSoc() {
- return soc;
+ return this.soc;
}
public Integer getCurrentChargePower() {
- return batterieLadeStrom;
+ return this.batterieLadeStrom;
}
public Integer getCurrentStromAusNetz() {
- return strombezugAusNetz;
+ return this.strombezugAusNetz;
}
public Integer getCurrentEinspeisung() {
- return einspeisung;
+ return this.einspeisung;
}
public Integer getCurrentDischargePower() {
- return verbrauchVonBatterie;
+ return this.verbrauchVonBatterie;
}
public Integer getCurrentPvProduction() {
- return pvLeistungWatt;
+ return this.pvLeistungWatt;
}
-
+
public Integer getCurrentVerbrauchVonPv() {
- return verbrauchVonPv;
+ return this.verbrauchVonPv;
}
}
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCore.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCore.java
index 043e0553529..054ab6cf48b 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCore.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCore.java
@@ -20,9 +20,9 @@ public interface BoschBpts5HybridCore extends OpenemsComponent {
public void setMeter(BoschBpts5HybridMeter boschBpts5HybridMeter);
public Optional getEss();
-
+
public Optional getPv();
-
+
public Optional getMeter();
public enum CoreChannelId implements io.openems.edge.common.channel.ChannelId {
@@ -42,7 +42,7 @@ public Doc doc() {
/**
* Gets the Channel for {@link ChannelId#SLAVE_COMMUNICATION_FAILED}.
- *
+ *
* @return the Channel
*/
public default StateChannel getSlaveCommunicationFailedChannel() {
@@ -52,7 +52,7 @@ public default StateChannel getSlaveCommunicationFailedChannel() {
/**
* Gets the Slave Communication Failed State. See
* {@link ChannelId#SLAVE_COMMUNICATION_FAILED}.
- *
+ *
* @return the Channel {@link Value}
*/
public default Value getSlaveCommunicationFailed() {
@@ -62,7 +62,7 @@ public default Value getSlaveCommunicationFailed() {
/**
* Internal method to set the 'nextValue' on
* {@link ChannelId#SLAVE_COMMUNICATION_FAILED} Channel.
- *
+ *
* @param value the next value
*/
public default void _setSlaveCommunicationFailed(boolean value) {
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCoreImpl.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCoreImpl.java
index 89e7ca15c00..ffb31f1e378 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCoreImpl.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridCoreImpl.java
@@ -41,9 +41,9 @@ public class BoschBpts5HybridCoreImpl extends AbstractOpenemsComponent
private BoschBpts5HybridReadWorker worker = null;
- private AtomicReference ess = new AtomicReference<>();
- private AtomicReference pv = new AtomicReference<>();
- private AtomicReference meter = new AtomicReference<>();
+ private final AtomicReference ess = new AtomicReference<>();
+ private final AtomicReference pv = new AtomicReference<>();
+ private final AtomicReference meter = new AtomicReference<>();
public BoschBpts5HybridCoreImpl() {
super(//
@@ -58,6 +58,7 @@ void activate(ComponentContext context, Config config) throws ConfigurationExcep
this.worker.activate(config.id());
}
+ @Override
@Deactivate
protected void deactivate() {
if (this.worker != null) {
@@ -79,12 +80,14 @@ public void handleEvent(Event event) {
}
}
+ @Override
public void setEss(BoschBpts5HybridEss boschBpts5HybridEss) {
this.ess.set(boschBpts5HybridEss);
}
+ @Override
public Optional getEss() {
- return Optional.ofNullable(ess.get());
+ return Optional.ofNullable(this.ess.get());
}
@Override
@@ -94,7 +97,7 @@ public void setPv(BoschBpts5HybridPv boschBpts5HybridPv) {
@Override
public Optional getPv() {
- return Optional.ofNullable(pv.get());
+ return Optional.ofNullable(this.pv.get());
}
@Override
@@ -104,6 +107,6 @@ public void setMeter(BoschBpts5HybridMeter boschBpts5HybridMeter) {
@Override
public Optional getMeter() {
- return Optional.ofNullable(meter.get());
+ return Optional.ofNullable(this.meter.get());
}
}
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridReadWorker.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridReadWorker.java
index 35cbb2076a4..3c10bd22457 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridReadWorker.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/BoschBpts5HybridReadWorker.java
@@ -8,74 +8,70 @@
import io.openems.common.exceptions.OpenemsException;
import io.openems.common.worker.AbstractCycleWorker;
-public class BoschBpts5HybridReadWorker extends AbstractCycleWorker{
-
+public class BoschBpts5HybridReadWorker extends AbstractCycleWorker {
+
private final Logger log = LoggerFactory.getLogger(BoschBpts5HybridReadWorker.class);
private final BoschBpts5HybridCoreImpl parent;
private final BoschBpts5HybridApiClient apiClient;
- private int refreshIntervalSeconds;
+ private final int refreshIntervalSeconds;
private LocalDateTime refreshTime;
-
+
public BoschBpts5HybridReadWorker(BoschBpts5HybridCoreImpl parent, String ipaddress, int interval) {
this.parent = parent;
this.refreshIntervalSeconds = interval;
this.apiClient = new BoschBpts5HybridApiClient(ipaddress);
}
-
+
@Override
public void activate(String name) {
super.activate(name);
this.refreshTime = LocalDateTime.now();
}
-
+
@Override
protected void forever() throws Throwable {
- if (this.refreshTime.plusSeconds(refreshIntervalSeconds).isBefore(LocalDateTime.now())) {
+ if (this.refreshTime.plusSeconds(this.refreshIntervalSeconds).isBefore(LocalDateTime.now())) {
this.refreshTime = LocalDateTime.now();
-
+
try {
this.apiClient.retreiveValues();
- int batterieStatus = this.apiClient.retreiveBatterieStatus();
- if(batterieStatus == 0) {
+ var batterieStatus = this.apiClient.retreiveBatterieStatus();
+ if (batterieStatus == 0) {
this.parent._setSlaveCommunicationFailed(false);
- }
- else {
+ } else {
this.parent._setSlaveCommunicationFailed(true);
}
} catch (OpenemsException e) {
- log.error(e.getMessage());
+ this.log.error(e.getMessage());
this.parent._setSlaveCommunicationFailed(true);
this.apiClient.connect();
return;
}
}
-
+
this.parent.getEss().ifPresent(ess -> {
- if(this.apiClient.getCurrentDischargePower() > 0) {
- ess._setActivePower(this.apiClient.getCurrentDischargePower() + this.apiClient.getCurrentVerbrauchVonPv());
- }
- else {
- int currentDirectUsageOfPv = this.apiClient.getCurrentVerbrauchVonPv() + this.apiClient.getCurrentEinspeisung();
+ if (this.apiClient.getCurrentDischargePower() > 0) {
+ ess._setActivePower(
+ this.apiClient.getCurrentDischargePower() + this.apiClient.getCurrentVerbrauchVonPv());
+ } else {
+ var currentDirectUsageOfPv = this.apiClient.getCurrentVerbrauchVonPv()
+ + this.apiClient.getCurrentEinspeisung();
ess._setActivePower(currentDirectUsageOfPv);
}
ess._setSoc(this.apiClient.getCurrentSoc());
});
-
+
this.parent.getPv().ifPresent(pv -> {
pv._setActualPower(this.apiClient.getCurrentPvProduction());
});
-
+
this.parent.getMeter().ifPresent(meter -> {
- if(this.apiClient.getCurrentStromAusNetz() > 0) {
+ if (this.apiClient.getCurrentStromAusNetz() > 0) {
meter._setActivePower(this.apiClient.getCurrentStromAusNetz());
- }
- else {
- if(this.apiClient.getCurrentEinspeisung() > 0) {
- meter._setActivePower(-1 * this.apiClient.getCurrentEinspeisung());
- }
- else{
- meter._setActivePower(0);
- }
+ } else if (this.apiClient.getCurrentEinspeisung() > 0) {
+ meter._setActivePower(-1 * this.apiClient.getCurrentEinspeisung());
+ } else {
+ meter._setActivePower(0);
}
});
}
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/Config.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/Config.java
index 877e909cc2a..fd4a55e848e 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/Config.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/core/Config.java
@@ -3,7 +3,6 @@
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
-
@ObjectClassDefinition(//
name = "Bosch BPT-S 5 Core", //
description = "Bosch BPT-S 5 Hybrid core component")
@@ -17,10 +16,10 @@
@AttributeDefinition(name = "Is enabled?", description = "Is this Component enabled?")
boolean enabled() default true;
-
+
@AttributeDefinition(name = "IP-Address", description = "IPv4 address of the Bosch BPT-S 5 Hybrid")
String ipaddress() default "192.168.178.22";
-
+
@AttributeDefinition(name = "Update Interval", description = "Update interval in seconds")
int interval() default 2;
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEss.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEss.java
index efadd0a58f2..09981e3a4aa 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEss.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEss.java
@@ -49,7 +49,7 @@ public BoschBpts5HybridEss() {
SymmetricEss.ChannelId.values(), //
ChannelId.values() //
);
- this._setCapacity(CAPACITY); // TODO: get from read worker
+ this._setCapacity(this.CAPACITY); // TODO: get from read worker
}
@Activate
@@ -64,6 +64,7 @@ void activate(ComponentContext context, Config config)
this.core.setEss(this);
}
+ @Override
@Deactivate
protected void deactivate() {
if (this.core != null) {
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeter.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeter.java
index 203b7e19877..ee55f1e2584 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeter.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeter.java
@@ -34,24 +34,25 @@
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_EXECUTE_WRITE //
} //
)
-public class BoschBpts5HybridMeter extends AbstractOpenemsComponent implements SymmetricMeter, OpenemsComponent{
-
+public class BoschBpts5HybridMeter extends AbstractOpenemsComponent implements SymmetricMeter, OpenemsComponent {
+
@Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY)
private BoschBpts5HybridCore core;
-
+
@Reference
private ConfigurationAdmin cm;
-
+
public BoschBpts5HybridMeter() {
super(//
OpenemsComponent.ChannelId.values(), //
- SymmetricMeter.ChannelId.values(),//
+ SymmetricMeter.ChannelId.values(), //
ChannelId.values() //
);
}
@Activate
- void activate(ComponentContext context, Config config) throws OpenemsNamedException, ConfigurationException, IOException {
+ void activate(ComponentContext context, Config config)
+ throws OpenemsNamedException, ConfigurationException, IOException {
super.activate(context, config.id(), config.alias(), config.enabled());
// update filter for 'core'
@@ -60,7 +61,8 @@ void activate(ComponentContext context, Config config) throws OpenemsNamedExcept
}
this.core.setMeter(this);
}
-
+
+ @Override
@Deactivate
protected void deactivate() {
if (this.core != null) {
diff --git a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPv.java b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPv.java
index 6d38cd186cb..da9c8e5727a 100644
--- a/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPv.java
+++ b/io.openems.edge.bosch.bpts5hybrid/src/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPv.java
@@ -1,5 +1,7 @@
package io.openems.edge.bosch.bpts5hybrid.pv;
+import java.io.IOException;
+
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.component.ComponentContext;
@@ -22,8 +24,6 @@
import io.openems.edge.common.event.EdgeEventConstants;
import io.openems.edge.ess.dccharger.api.EssDcCharger;
-import java.io.IOException;
-
@Designate(ocd = Config.class, factory = true)
@Component(//
name = "Bosch.BPTS5Hybrid.Pv", //
@@ -33,27 +33,28 @@
EventConstants.EVENT_TOPIC + "=" + EdgeEventConstants.TOPIC_CYCLE_EXECUTE_WRITE //
} //
)
-public class BoschBpts5HybridPv extends AbstractOpenemsComponent implements EssDcCharger, OpenemsComponent{
-
+public class BoschBpts5HybridPv extends AbstractOpenemsComponent implements EssDcCharger, OpenemsComponent {
+
private final int PEAK_POWER = 5_500;
-
+
@Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY)
private BoschBpts5HybridCore core;
-
+
@Reference
private ConfigurationAdmin cm;
-
+
public BoschBpts5HybridPv() {
super(//
OpenemsComponent.ChannelId.values(), //
- EssDcCharger.ChannelId.values(),//
+ EssDcCharger.ChannelId.values(), //
ChannelId.values() //
);
- this._setMaxActualPower(PEAK_POWER); //TODO: get from read worker
+ this._setMaxActualPower(this.PEAK_POWER); // TODO: get from read worker
}
@Activate
- void activate(ComponentContext context, Config config) throws OpenemsNamedException, ConfigurationException, IOException {
+ void activate(ComponentContext context, Config config)
+ throws OpenemsNamedException, ConfigurationException, IOException {
super.activate(context, config.id(), config.alias(), config.enabled());
// update filter for 'core'
@@ -62,7 +63,8 @@ void activate(ComponentContext context, Config config) throws OpenemsNamedExcept
}
this.core.setPv(this);
}
-
+
+ @Override
@Deactivate
protected void deactivate() {
if (this.core != null) {
diff --git a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/core/MyConfig.java b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/core/MyConfig.java
index cedfbf17dfb..4dad9074be8 100644
--- a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/core/MyConfig.java
+++ b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/core/MyConfig.java
@@ -7,7 +7,6 @@ public class MyConfig extends AbstractComponentConfig implements Config {
public static class Builder {
private String id = null;
- private String modbusId = null;
public String ipaddress;
public int interval;
@@ -36,7 +35,7 @@ public MyConfig build() {
/**
* Create a Config builder.
- *
+ *
* @return a {@link Builder}
*/
public static Builder create() {
diff --git a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEssTest.java b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEssTest.java
index 2cc138b0caf..6b452fa12b9 100644
--- a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEssTest.java
+++ b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/BoschBpts5HybridEssTest.java
@@ -13,7 +13,7 @@ public class BoschBpts5HybridEssTest {
@Test
public void test() throws Exception {
- BoschBpts5HybridCoreImpl core = new BoschBpts5HybridCoreImpl();
+ var core = new BoschBpts5HybridCoreImpl();
new ComponentTest(new BoschBpts5HybridCoreImpl()) //
.addReference("cm", new DummyConfigurationAdmin()) //
.activate(io.openems.edge.bosch.bpts5hybrid.core.MyConfig.create() //
diff --git a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/MyConfig.java b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/MyConfig.java
index 9bcff8f1db0..f749f6d8ed6 100644
--- a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/MyConfig.java
+++ b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/ess/MyConfig.java
@@ -30,7 +30,7 @@ public MyConfig build() {
/**
* Create a Config builder.
- *
+ *
* @return a {@link Builder}
*/
public static Builder create() {
diff --git a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeterTest.java b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeterTest.java
index 066a955a29b..9faee25108c 100644
--- a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeterTest.java
+++ b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/BoschBpts5HybridMeterTest.java
@@ -13,7 +13,7 @@ public class BoschBpts5HybridMeterTest {
@Test
public void test() throws Exception {
- BoschBpts5HybridCoreImpl core = new BoschBpts5HybridCoreImpl();
+ var core = new BoschBpts5HybridCoreImpl();
new ComponentTest(new BoschBpts5HybridCoreImpl()) //
.addReference("cm", new DummyConfigurationAdmin()) //
.activate(io.openems.edge.bosch.bpts5hybrid.core.MyConfig.create() //
diff --git a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/MyConfig.java b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/MyConfig.java
index d03ebf8e596..3dce8b0e8e3 100644
--- a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/MyConfig.java
+++ b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/meter/MyConfig.java
@@ -30,7 +30,7 @@ public MyConfig build() {
/**
* Create a Config builder.
- *
+ *
* @return a {@link Builder}
*/
public static Builder create() {
diff --git a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPvTest.java b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPvTest.java
index 21b71389758..f85686dfe02 100644
--- a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPvTest.java
+++ b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPvTest.java
@@ -13,7 +13,7 @@ public class BoschBpts5HybridPvTest {
@Test
public void test() throws Exception {
- BoschBpts5HybridCoreImpl core = new BoschBpts5HybridCoreImpl();
+ var core = new BoschBpts5HybridCoreImpl();
new ComponentTest(new BoschBpts5HybridCoreImpl()) //
.addReference("cm", new DummyConfigurationAdmin()) //
.activate(io.openems.edge.bosch.bpts5hybrid.core.MyConfig.create() //
diff --git a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/MyConfig.java b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/MyConfig.java
index 69e0d65e4e2..3c834f3da4e 100644
--- a/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/MyConfig.java
+++ b/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/MyConfig.java
@@ -30,7 +30,7 @@ public MyConfig build() {
/**
* Create a Config builder.
- *
+ *
* @return a {@link Builder}
*/
public static Builder create() {
diff --git a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/BridgeMbusImpl.java b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/BridgeMbusImpl.java
index b4997cd5e55..454df6d2eb0 100644
--- a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/BridgeMbusImpl.java
+++ b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/BridgeMbusImpl.java
@@ -7,7 +7,6 @@
import org.openmuc.jmbus.DecodingException;
import org.openmuc.jmbus.MBusConnection;
import org.openmuc.jmbus.MBusConnection.MBusSerialBuilder;
-import org.openmuc.jmbus.VariableDataStructure;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
@@ -61,6 +60,7 @@ protected void activate(ComponentContext context, Config config) {
this.builder = MBusConnection.newSerialBuilder(this.portName).setBaudrate(config.baudrate());
}
+ @Override
@Deactivate
protected void deactivate() {
super.deactivate();
@@ -80,6 +80,7 @@ public void handleEvent(Event event) {
}
}
+ @Override
public MBusConnection getmBusConnection() {
return this.mBusConnection;
}
@@ -94,7 +95,7 @@ protected void forever() throws OpenemsException, DecodingException {
for (MbusTask task : BridgeMbusImpl.this.tasks.values()) {
try {
- VariableDataStructure data = task.getRequest();
+ var data = task.getRequest();
data.decode();
// "Before accessing elements of a variable data structure it has to be decoded
// using the decode method." ??
@@ -107,7 +108,7 @@ protected void forever() throws OpenemsException, DecodingException {
BridgeMbusImpl.this.mBusConnection.close();
} catch (IOException e) {
BridgeMbusImpl.this.logError(BridgeMbusImpl.this.log,
- "Connection via [" + portName + "] failed: " + e.getMessage());
+ "Connection via [" + BridgeMbusImpl.this.portName + "] failed: " + e.getMessage());
}
}
}
diff --git a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/AbstractOpenemsMbusComponent.java b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/AbstractOpenemsMbusComponent.java
index 46aa10779f9..136b6eddee7 100644
--- a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/AbstractOpenemsMbusComponent.java
+++ b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/AbstractOpenemsMbusComponent.java
@@ -11,7 +11,7 @@
public abstract class AbstractOpenemsMbusComponent extends AbstractOpenemsComponent {
- protected final List channelDataRecordsList = new ArrayList();
+ protected final List channelDataRecordsList = new ArrayList<>();
private Integer primaryAddress = null;
@@ -30,7 +30,7 @@ public Integer getPrimaryAddress() {
/**
* Call this method from Component implementations activate().
- *
+ *
* @param context ComponentContext of this component. Receive it from
* parameter for @Activate
* @param id ID of this component. Typically 'config.id()'
diff --git a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelDataRecordMapper.java b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelDataRecordMapper.java
index a77d5635817..b29a514d949 100644
--- a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelDataRecordMapper.java
+++ b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelDataRecordMapper.java
@@ -17,13 +17,13 @@ public ChannelDataRecordMapper(VariableDataStructure data, List c
this.channelDataRecordsList = channelDataRecordsList;
for (ChannelRecord channelRecord : channelDataRecordsList) {
- mapDataToChannel(data, channelRecord.getdataRecordPosition(), channelRecord.getChannel(),
+ this.mapDataToChannel(data, channelRecord.getdataRecordPosition(), channelRecord.getChannel(),
channelRecord.getDataType());
}
}
public VariableDataStructure getData() {
- return data;
+ return this.data;
}
public void setData(VariableDataStructure data) {
@@ -31,7 +31,7 @@ public void setData(VariableDataStructure data) {
}
public List getChannelDataRecordsList() {
- return channelDataRecordsList;
+ return this.channelDataRecordsList;
}
public void setChannelDataRecordsList(List channelDataRecordsList) {
diff --git a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelRecord.java b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelRecord.java
index d26f5bc1d44..88468734dc6 100644
--- a/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelRecord.java
+++ b/io.openems.edge.bridge.mbus/src/io/openems/edge/bridge/mbus/api/ChannelRecord.java
@@ -16,7 +16,7 @@ public enum DataType {
/**
* In this case you will request secondary address values. eg. manufacturer,
* device id or meter type.
- *
+ *
* @param channel the Channel
* @param dataType the dataType
*/
@@ -27,7 +27,7 @@ public ChannelRecord(Channel> channel, DataType dataType) {
/**
* In this case you will request usage data.
- *
+ *
* @param channel the Channel
* @param dataRecordPosition the dataRecordPosition
*/
@@ -37,7 +37,7 @@ public ChannelRecord(Channel> channel, int dataRecordPosition) {
}
public Channel> getChannel() {
- return channel;
+ return this.channel;
}
public void setChannelId(Channel> channel) {
@@ -45,7 +45,7 @@ public void setChannelId(Channel> channel) {
}
public int getdataRecordPosition() {
- return dataRecordPosition;
+ return this.dataRecordPosition;
}
public void setdataRecordPosition(int dataRecordPosition) {
diff --git a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusSerialImpl.java b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusSerialImpl.java
index c34b61bcdbc..1660f9dd48d 100644
--- a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusSerialImpl.java
+++ b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusSerialImpl.java
@@ -91,6 +91,7 @@ void activate(ComponentContext context, ConfigSerial config) {
this.parity = config.parity();
}
+ @Override
@Deactivate
protected void deactivate() {
super.deactivate();
@@ -111,8 +112,8 @@ public void closeModbusConnection() {
@Override
public ModbusTransaction getNewModbusTransaction() throws OpenemsException {
- SerialConnection connection = this.getModbusConnection();
- ModbusSerialTransaction transaction = new ModbusSerialTransaction(connection);
+ var connection = this.getModbusConnection();
+ var transaction = new ModbusSerialTransaction(connection);
transaction.setRetries(AbstractModbusBridge.DEFAULT_RETRIES);
return transaction;
}
@@ -124,7 +125,7 @@ private synchronized SerialConnection getModbusConnection() throws OpenemsExcept
/*
* create new connection
*/
- SerialParameters params = new SerialParameters();
+ var params = new SerialParameters();
params.setPortName(this.portName);
params.setBaudRate(this.baudrate);
params.setDatabits(this.databits);
@@ -132,7 +133,7 @@ private synchronized SerialConnection getModbusConnection() throws OpenemsExcept
params.setParity(this.parity.getValue());
params.setEncoding(Modbus.SERIAL_ENCODING_RTU);
params.setEcho(false);
- SerialConnection connection = new SerialConnection(params);
+ var connection = new SerialConnection(params);
this._connection = connection;
}
if (!this._connection.isOpen()) {
diff --git a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusTcpImpl.java b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusTcpImpl.java
index 6b82fcfd90f..813be89f7c1 100644
--- a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusTcpImpl.java
+++ b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/BridgeModbusTcpImpl.java
@@ -65,6 +65,7 @@ protected void activate(ComponentContext context, ConfigTcp config) throws Unkno
this.port = config.port();
}
+ @Override
@Deactivate
protected void deactivate() {
super.deactivate();
@@ -85,8 +86,8 @@ public void closeModbusConnection() {
@Override
public ModbusTransaction getNewModbusTransaction() throws OpenemsException {
- TCPMasterConnection connection = this.getModbusConnection();
- ModbusTCPTransaction transaction = new ModbusTCPTransaction(connection);
+ var connection = this.getModbusConnection();
+ var transaction = new ModbusTCPTransaction(connection);
transaction.setRetries(AbstractModbusBridge.DEFAULT_RETRIES);
return transaction;
}
@@ -98,7 +99,7 @@ private synchronized TCPMasterConnection getModbusConnection() throws OpenemsExc
/*
* create new connection
*/
- TCPMasterConnection connection = new TCPMasterConnection(this.getIpAddress());
+ var connection = new TCPMasterConnection(this.getIpAddress());
connection.setPort(this.port);
this._connection = connection;
}
@@ -114,8 +115,9 @@ private synchronized TCPMasterConnection getModbusConnection() throws OpenemsExc
return this._connection;
}
+ @Override
public InetAddress getIpAddress() {
- return ipAddress;
+ return this.ipAddress;
}
public void setIpAddress(InetAddress ipAddress) {
diff --git a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractModbusBridge.java b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractModbusBridge.java
index a735044f333..74b68106c99 100644
--- a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractModbusBridge.java
+++ b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractModbusBridge.java
@@ -19,7 +19,7 @@ public abstract class AbstractModbusBridge extends AbstractOpenemsComponent impl
/**
* Default Modbus timeout in [ms].
- *
+ *
*
* Modbus library default is 3000 ms
*/
@@ -27,7 +27,7 @@ public abstract class AbstractModbusBridge extends AbstractOpenemsComponent impl
/**
* Default Modbus retries.
- *
+ *
*
* Modbus library default is 5
*/
@@ -55,6 +55,7 @@ protected void activate(ComponentContext context, String id, String alias, boole
}
}
+ @Override
protected void deactivate() {
super.deactivate();
this.worker.deactivate();
@@ -65,19 +66,21 @@ protected void deactivate() {
/**
* Adds the protocol.
- *
+ *
* @param sourceId Component-ID of the source
* @param protocol the ModbusProtocol
*/
+ @Override
public void addProtocol(String sourceId, ModbusProtocol protocol) {
this.worker.addProtocol(sourceId, protocol);
}
/**
* Removes the protocol.
- *
+ *
* @param sourceId Component-ID of the source
*/
+ @Override
public void removeProtocol(String sourceId) {
this.worker.removeProtocol(sourceId);
}
@@ -99,7 +102,7 @@ public void handleEvent(Event event) {
/**
* Creates a new Modbus Transaction on an open Modbus connection.
- *
+ *
* @return the Modbus Transaction
* @throws OpenemsException on error
*/
@@ -131,7 +134,7 @@ protected void logError(Logger log, String message) {
/**
* After how many errors should a element be invalidated?.
- *
+ *
* @return value
*/
public int invalidateElementsAfterReadErrors() {
diff --git a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractOpenemsModbusComponent.java b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractOpenemsModbusComponent.java
index ea893270706..20f2e224c44 100644
--- a/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractOpenemsModbusComponent.java
+++ b/io.openems.edge.bridge.modbus/src/io/openems/edge/bridge/modbus/api/AbstractOpenemsModbusComponent.java
@@ -39,20 +39,20 @@ public abstract class AbstractOpenemsModbusComponent extends AbstractOpenemsComp
/**
* Default constructor for AbstractOpenemsModbusComponent.
- *
+ *
*
* Automatically initializes (i.e. creates {@link Channel} instances for each
* given ChannelId using the Channel-{@link Doc}.
- *
+ *
*
* It is important to list all Channel-ID enums of all inherited
* OpenEMS-Natures, i.e. for every OpenEMS Java interface you are implementing,
* you need to list the interface' ChannelID-enum here like
* Interface.ChannelId.values().
- *
+ *
*
* Use as follows:
- *
+ *
*
* public YourPhantasticOpenemsComponent() {
* super(//
@@ -60,17 +60,17 @@ public abstract class AbstractOpenemsModbusComponent extends AbstractOpenemsComp
* YourPhantasticOpenemsComponent.ChannelId.values());
* }
*
- *
+ *
*
* Note: the separation in firstInitialChannelIds and furtherInitialChannelIds
* is only there to enforce that calling the constructor cannot be forgotten.
* This way it needs to be called with at least one parameter - which is always
* at least "OpenemsComponent.ChannelId.values()". Just use it as if it was:
- *
+ *
*
* AbstractOpenemsComponent(ChannelId[]... channelIds)
*
- *
+ *
* @param firstInitialChannelIds the Channel-IDs to initialize.
* @param furtherInitialChannelIds the Channel-IDs to initialize.
*/
@@ -85,7 +85,7 @@ protected void activate(String id) {
/**
* Call this method from Component implementations activate().
- *
+ *
* @param context ComponentContext of this component. Receive it from
* parameter for @Activate
* @param id ID of this component. Typically 'config.id()'
@@ -116,7 +116,7 @@ protected boolean activate(ComponentContext context, String id, String alias, bo
return true;
}
this.unitId = unitId;
- BridgeModbus modbus = this.modbus.get();
+ var modbus = this.modbus.get();
if (this.isEnabled() && modbus != null) {
modbus.addProtocol(this.id(), this.getModbusProtocol());
}
@@ -130,7 +130,7 @@ protected void activate(ComponentContext context, String id, String alias, boole
/**
* Call this method from Component implementations activate().
- *
+ *
* @param context ComponentContext of this component. Receive it from
* parameter for @Activate
* @param id ID of this component. Typically 'config.id()'
@@ -158,7 +158,7 @@ protected boolean modified(ComponentContext context, String id, String alias, bo
return true;
}
this.unitId = unitId;
- BridgeModbus modbus = this.modbus.get();
+ var modbus = this.modbus.get();
modbus.removeProtocol(this.id());
if (this.isEnabled() && modbus != null) {
modbus.addProtocol(this.id(), this.getModbusProtocol());
@@ -174,7 +174,7 @@ protected void modified(ComponentContext context, String id, String alias, boole
@Override
protected void deactivate() {
super.deactivate();
- BridgeModbus modbus = this.modbus.getAndSet(null);
+ var modbus = this.modbus.getAndSet(null);
if (modbus != null) {
modbus.removeProtocol(this.id());
}
@@ -182,18 +182,18 @@ protected void deactivate() {
/**
* Gets the Modbus Unit-ID.
- *
+ *
* @return the Modbus Unit-ID
*/
public Integer getUnitId() {
return this.unitId;
}
- private AtomicReference modbus = new AtomicReference