Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor updates to electricity asset types

Rich Turner63ace3b8c3c7
diff --git a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
index 99be033dc..18e7bfcb7 100644
--- a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
@@ -721,7 +721,7 @@ public abstract class AbstractManagerSetup implements Setup {
}
protected ElectricityStorageAsset createDemoElectricityStorageAsset(String name, Asset<?> area, GeoJSONPoint location) {
- ElectricityStorageAsset electricityStorageAsset = new ElectricityStorageAsset(name);
+ ElectricityStorageAsset electricityStorageAsset = new ElectricityBatteryAsset(name);
electricityStorageAsset.setParent(area);
electricityStorageAsset.getAttributes().addOrReplace(
new Attribute<>(Asset.LOCATION, location)
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java
index 406578a67..18aae0b63 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java
@@ -36,7 +36,7 @@ import java.util.Optional;
import static org.openremote.model.Constants.*;
@Entity
-public class ElectricVehicleAsset extends ElectricityStorageAsset {
+public class ElectricVehicleAsset extends ElectricityBatteryAsset {
public static final AttributeDescriptor<ElectricityChargerAsset.ConnectorType> CONNECTOR_TYPE = new AttributeDescriptor<>("connectorType", ElectricityChargerAsset.CONNECTOR_TYPE_VALUE);
public static final AttributeDescriptor<Integer> ODOMETER = new AttributeDescriptor<>("odometer", ValueType.POSITIVE_INTEGER,
@@ -55,8 +55,6 @@ public class ElectricVehicleAsset extends ElectricityStorageAsset {
.withUnits(UNITS_KILO, UNITS_METRE);
public static final AttributeDescriptor<String> VEHICLE_CATEGORY = new AttributeDescriptor<>("vehicleCategory", ValueType.TEXT);
- public static final AttributeDescriptor<Integer> CHARGE_CYCLES = ElectricityStorageAsset.CHARGE_CYCLES.withOptional(true);
-
public static final AssetDescriptor<ElectricVehicleAsset> DESCRIPTOR = new AssetDescriptor<>("car-electric", "49B0D8", ElectricVehicleAsset.class);
/**
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java
index f819e666e..1726d427e 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java
@@ -27,6 +27,7 @@ import java.util.Optional;
import static org.openremote.model.Constants.*;
+@SuppressWarnings("unchecked")
public abstract class ElectricityAsset<T extends ElectricityAsset<?>> extends Asset<T> {
public static final AttributeDescriptor<Double> POWER = new AttributeDescriptor<>("power", ValueType.NUMBER,
@@ -50,18 +51,6 @@ public abstract class ElectricityAsset<T extends ElectricityAsset<?>> extends As
public static final AttributeDescriptor<Double> ENERGY_EXPORT_TOTAL = new AttributeDescriptor<>("energyExportTotal", ValueType.POSITIVE_NUMBER,
new MetaItem<>(MetaItemType.READ_ONLY)
).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> ENERGY_LEVEL = new AttributeDescriptor<>("energyLevel", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> ENERGY_CAPACITY = new AttributeDescriptor<>("energyCapacity", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = new AttributeDescriptor<>("energyLevelPercentage", ValueType.POSITIVE_INTEGER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MAX = new AttributeDescriptor<>("energyLevelPercentageMax", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MIN = new AttributeDescriptor<>("energyLevelPercentageMin", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
public static final AttributeDescriptor<Integer> EFFICIENCY_IMPORT = new AttributeDescriptor<>("efficiencyImport", ValueType.POSITIVE_INTEGER)
.withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
public static final AttributeDescriptor<Integer> EFFICIENCY_EXPORT = new AttributeDescriptor<>("efficiencyExport", ValueType.POSITIVE_INTEGER)
@@ -166,51 +155,6 @@ public abstract class ElectricityAsset<T extends ElectricityAsset<?>> extends As
return (T)this;
}
- public Optional<Double> getEnergyCapacity() {
- return getAttributes().getValue(ENERGY_CAPACITY);
- }
-
- public T setEnergyCapacity(Double value) {
- getAttributes().getOrCreate(ENERGY_CAPACITY).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getEnergyLevel() {
- return getAttributes().getValue(ENERGY_LEVEL);
- }
-
- public T setEnergyLevel(Double value) {
- getAttributes().getOrCreate(ENERGY_LEVEL).setValue(value);
- return (T)this;
- }
-
- public Optional<Integer> getEnergyLevelPercentage() {
- return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE);
- }
-
- public T setEnergyLevelPercentage(Integer value) {
- getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE).setValue(value);
- return (T)this;
- }
-
- public Optional<Integer> getEnergyLevelPercentageMin() {
- return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE_MIN);
- }
-
- public T setEnergyLevelPercentageMin(Integer value) {
- getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE_MIN).setValue(value);
- return (T)this;
- }
-
- public Optional<Integer> getEnergyLevelPercentageMax() {
- return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE_MAX);
- }
-
- public T setEnergyLevelPercentageMax(Integer value) {
- getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE_MAX).setValue(value);
- return (T)this;
- }
-
public Optional<Integer> getEfficiencyImport() {
return getAttributes().getValue(EFFICIENCY_IMPORT);
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityBatteryAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityBatteryAsset.java
new file mode 100644
index 000000000..257cec392
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityBatteryAsset.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2021, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.asset.impl;
+
+import org.openremote.model.asset.AssetDescriptor;
+import org.openremote.model.attribute.MetaItem;
+import org.openremote.model.value.AttributeDescriptor;
+import org.openremote.model.value.MetaItemType;
+import org.openremote.model.value.ValueType;
+
+import javax.persistence.Entity;
+import java.util.Optional;
+
+@Entity
+public class ElectricityBatteryAsset extends ElectricityStorageAsset {
+
+ public static final AttributeDescriptor<Integer> CHARGE_CYCLES = new AttributeDescriptor<>("chargeCycles", ValueType.POSITIVE_INTEGER,
+ new MetaItem<>(MetaItemType.READ_ONLY)
+ ).withOptional(true);
+
+ public static final AssetDescriptor<ElectricityBatteryAsset> DESCRIPTOR = new AssetDescriptor<>("battery-charging", "1B7C89", ElectricityBatteryAsset.class);
+
+ ElectricityBatteryAsset() {
+ }
+
+ public ElectricityBatteryAsset(String name) {
+ super(name);
+ }
+
+ public Optional<Integer> getChargeCycles() {
+ return getAttributes().getValue(CHARGE_CYCLES);
+ }
+
+ public ElectricityStorageAsset setChargeCycles(Integer value) {
+ getAttributes().getOrCreate(CHARGE_CYCLES).setValue(value);
+ return this;
+ }
+}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java
index 2894d9d4f..2c3b8e21e 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java
@@ -29,9 +29,8 @@ import org.openremote.model.value.ValueType;
import javax.persistence.Entity;
import java.util.Optional;
-@SuppressWarnings("unchecked")
@Entity
-public class ElectricityChargerAsset extends ElectricityAsset<ElectricityChargerAsset> {
+public class ElectricityChargerAsset extends ElectricityStorageAsset {
public enum ConnectorType {
YAZAKI,
@@ -53,11 +52,11 @@ public class ElectricityChargerAsset extends ElectricityAsset<ElectricityCharger
public static final AttributeDescriptor<Double> POWER_IMPORT_MIN = ElectricityAsset.POWER_IMPORT_MIN.withOptional(true);
public static final AttributeDescriptor<Double> POWER_EXPORT_MIN = ElectricityAsset.POWER_EXPORT_MIN.withOptional(true);
public static final AttributeDescriptor<Double> ENERGY_EXPORT_TOTAL = ElectricityAsset.ENERGY_EXPORT_TOTAL.withOptional(true);
- public static final AttributeDescriptor<Double> ENERGY_LEVEL = ElectricityAsset.ENERGY_LEVEL.withOptional(true);
- public static final AttributeDescriptor<Double> ENERGY_CAPACITY = ElectricityAsset.ENERGY_CAPACITY.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MAX = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE_MAX.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MIN = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE_MIN.withOptional(true);
+ public static final AttributeDescriptor<Double> ENERGY_LEVEL = ElectricityStorageAsset.ENERGY_LEVEL.withOptional(true);
+ public static final AttributeDescriptor<Double> ENERGY_CAPACITY = ElectricityStorageAsset.ENERGY_CAPACITY.withOptional(true);
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = ElectricityStorageAsset.ENERGY_LEVEL_PERCENTAGE.withOptional(true);
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MAX = ElectricityStorageAsset.ENERGY_LEVEL_PERCENTAGE_MAX.withOptional(true);
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MIN = ElectricityStorageAsset.ENERGY_LEVEL_PERCENTAGE_MIN.withOptional(true);
public static final AttributeDescriptor<Integer> EFFICIENCY_IMPORT = ElectricityAsset.EFFICIENCY_IMPORT.withOptional(true);
public static final AttributeDescriptor<Integer> EFFICIENCY_EXPORT = ElectricityAsset.EFFICIENCY_EXPORT.withOptional(true);
public static final AttributeDescriptor<Double> TARIFF_IMPORT = ElectricityAsset.TARIFF_IMPORT.withOptional(true);
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java
index 87b424694..1f6588e04 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java
@@ -39,11 +39,6 @@ public class ElectricityConsumerAsset extends ElectricityAsset<ElectricityConsum
public static final AttributeDescriptor<Double> POWER_EXPORT_MIN = ElectricityAsset.POWER_EXPORT_MIN.withOptional(true);
public static final AttributeDescriptor<Double> POWER_EXPORT_MAX = ElectricityAsset.POWER_EXPORT_MAX.withOptional(true);
public static final AttributeDescriptor<Double> ENERGY_EXPORT_TOTAL = ElectricityAsset.ENERGY_EXPORT_TOTAL.withOptional(true);
- public static final AttributeDescriptor<Double> ENERGY_LEVEL = ElectricityAsset.ENERGY_LEVEL.withOptional(true);
- public static final AttributeDescriptor<Double> ENERGY_CAPACITY = ElectricityAsset.ENERGY_CAPACITY.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MAX = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE_MAX.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MIN = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE_MIN.withOptional(true);
public static final AttributeDescriptor<Integer> EFFICIENCY_IMPORT = ElectricityAsset.EFFICIENCY_IMPORT.withOptional(true);
public static final AttributeDescriptor<Integer> EFFICIENCY_EXPORT = ElectricityAsset.EFFICIENCY_EXPORT.withOptional(true);
public static final AttributeDescriptor<Double> TARIFF_IMPORT = ElectricityAsset.TARIFF_IMPORT.withOptional(true);
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java
index 2de275146..af613fa4f 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java
@@ -32,11 +32,6 @@ public class ElectricityProducerAsset extends ElectricityAsset<ElectricityProduc
public static final AttributeDescriptor<Double> POWER_IMPORT_MAX = ElectricityAsset.POWER_IMPORT_MAX.withOptional(true);
public static final AttributeDescriptor<Double> POWER_EXPORT_MIN = ElectricityAsset.POWER_EXPORT_MIN.withOptional(true);
public static final AttributeDescriptor<Double> ENERGY_IMPORT_TOTAL = ElectricityAsset.ENERGY_IMPORT_TOTAL.withOptional(true);
- public static final AttributeDescriptor<Double> ENERGY_LEVEL = ElectricityAsset.ENERGY_LEVEL.withOptional(true);
- public static final AttributeDescriptor<Double> ENERGY_CAPACITY = ElectricityAsset.ENERGY_CAPACITY.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MAX = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE_MAX.withOptional(true);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MIN = ElectricityAsset.ENERGY_LEVEL_PERCENTAGE_MIN.withOptional(true);
public static final AttributeDescriptor<Integer> EFFICIENCY_IMPORT = ElectricityAsset.EFFICIENCY_IMPORT.withOptional(true);
public static final AttributeDescriptor<Integer> EFFICIENCY_EXPORT = ElectricityAsset.EFFICIENCY_EXPORT.withOptional(true);
public static final AttributeDescriptor<Double> TARIFF_IMPORT = ElectricityAsset.TARIFF_IMPORT.withOptional(true);
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java
index 23374f551..f3a6e072e 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java
@@ -138,36 +138,6 @@ public class ElectricityProducerSolarAsset extends ElectricityProducerAsset {
return this;
}
- @Override
- public ElectricityProducerSolarAsset setEnergyCapacity(Double value) {
- super.setEnergyCapacity(value);
- return this;
- }
-
- @Override
- public ElectricityProducerSolarAsset setEnergyLevel(Double value) {
- super.setEnergyLevel(value);
- return this;
- }
-
- @Override
- public ElectricityProducerSolarAsset setEnergyLevelPercentage(Integer value) {
- super.setEnergyLevelPercentage(value);
- return this;
- }
-
- @Override
- public ElectricityProducerSolarAsset setEnergyLevelPercentageMin(Integer value) {
- super.setEnergyLevelPercentageMin(value);
- return this;
- }
-
- @Override
- public ElectricityProducerSolarAsset setEnergyLevelPercentageMax(Integer value) {
- super.setEnergyLevelPercentageMax(value);
- return this;
- }
-
@Override
public ElectricityProducerSolarAsset setEfficiencyImport(Integer value) {
super.setEfficiencyImport(value);
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java
index 436f58ab2..db7bd6940 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java
@@ -100,36 +100,6 @@ public class ElectricityProducerWindAsset extends ElectricityProducerAsset {
return this;
}
- @Override
- public ElectricityProducerWindAsset setEnergyCapacity(Double value) {
- super.setEnergyCapacity(value);
- return this;
- }
-
- @Override
- public ElectricityProducerWindAsset setEnergyLevel(Double value) {
- super.setEnergyLevel(value);
- return this;
- }
-
- @Override
- public ElectricityProducerWindAsset setEnergyLevelPercentage(Integer value) {
- super.setEnergyLevelPercentage(value);
- return this;
- }
-
- @Override
- public ElectricityProducerWindAsset setEnergyLevelPercentageMin(Integer value) {
- super.setEnergyLevelPercentageMin(value);
- return this;
- }
-
- @Override
- public ElectricityProducerWindAsset setEnergyLevelPercentageMax(Integer value) {
- super.setEnergyLevelPercentageMax(value);
- return this;
- }
-
@Override
public ElectricityProducerWindAsset setEfficiencyImport(Integer value) {
super.setEfficiencyImport(value);
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java
index 996176268..5a01caa22 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java
@@ -19,21 +19,35 @@
*/
package org.openremote.model.asset.impl;
-import org.openremote.model.asset.AssetDescriptor;
+import org.openremote.model.Constants;
import org.openremote.model.attribute.MetaItem;
import org.openremote.model.value.AttributeDescriptor;
import org.openremote.model.value.MetaItemType;
+import org.openremote.model.value.ValueConstraint;
import org.openremote.model.value.ValueType;
-import javax.persistence.Entity;
import java.util.Optional;
-@Entity
-public class ElectricityStorageAsset extends ElectricityAsset<ElectricityStorageAsset> {
+import static org.openremote.model.Constants.*;
- public static final AttributeDescriptor<Integer> CHARGE_CYCLES = new AttributeDescriptor<>("chargeCycles", ValueType.POSITIVE_INTEGER,
+public abstract class ElectricityStorageAsset extends ElectricityAsset<ElectricityStorageAsset> {
+
+
+ public static final AttributeDescriptor<Boolean> SUPPORTS_EXPORT = new AttributeDescriptor<>("supportsExport", ValueType.BOOLEAN);
+ public static final AttributeDescriptor<Double> ENERGY_LEVEL = new AttributeDescriptor<>("energyLevel", ValueType.POSITIVE_NUMBER,
+ new MetaItem<>(MetaItemType.READ_ONLY)
+ ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+ public static final AttributeDescriptor<Double> ENERGY_CAPACITY = new AttributeDescriptor<>("energyCapacity", ValueType.POSITIVE_NUMBER)
+ .withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = new AttributeDescriptor<>("energyLevelPercentage", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.READ_ONLY)
- );
+ ).withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MAX = new AttributeDescriptor<>("energyLevelPercentageMax", ValueType.POSITIVE_INTEGER)
+ .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MIN = new AttributeDescriptor<>("energyLevelPercentageMin", ValueType.POSITIVE_INTEGER)
+ .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
+ public static final AttributeDescriptor<Integer[][]> ENERGY_LEVEL_SCHEDULE = new AttributeDescriptor<>("energyLevelSchedule", ValueType.POSITIVE_INTEGER.asArray().asArray())
+ .withOptional(true);
public static final AttributeDescriptor<Double> POWER_IMPORT_MIN = ElectricityAsset.POWER_IMPORT_MIN.withOptional(true);
public static final AttributeDescriptor<Double> POWER_EXPORT_MIN = ElectricityAsset.POWER_EXPORT_MIN.withOptional(true);
@@ -42,8 +56,6 @@ public class ElectricityStorageAsset extends ElectricityAsset<ElectricityStorage
public static final AttributeDescriptor<Integer> CARBON_IMPORT_TOTAL = ElectricityAsset.CARBON_IMPORT_TOTAL.withOptional(true);
public static final AttributeDescriptor<Integer> CARBON_EXPORT_TOTAL = ElectricityAsset.CARBON_EXPORT_TOTAL.withOptional(true);
- public static final AssetDescriptor<ElectricityStorageAsset> DESCRIPTOR = new AssetDescriptor<>("battery-charging", "1B7C89", ElectricityStorageAsset.class);
-
/**
* For use by hydrators (i.e. JPA/Jackson)
*/
@@ -55,12 +67,66 @@ public class ElectricityStorageAsset extends ElectricityAsset<ElectricityStorage
super(name);
}
- public Optional<Integer> getChargeCycles() {
- return getAttributes().getValue(CHARGE_CYCLES);
+ public Optional<Boolean> isSupportsExport() {
+ return getAttributes().getValue(SUPPORTS_EXPORT);
+ }
+
+ public ElectricityStorageAsset setSupportsExport(Boolean value) {
+ getAttributes().getOrCreate(SUPPORTS_EXPORT).setValue(value);
+ return this;
+ }
+
+ public Optional<Double> getEnergyCapacity() {
+ return getAttributes().getValue(ENERGY_CAPACITY);
+ }
+
+ public ElectricityStorageAsset setEnergyCapacity(Double value) {
+ getAttributes().getOrCreate(ENERGY_CAPACITY).setValue(value);
+ return this;
+ }
+
+ public Optional<Double> getEnergyLevel() {
+ return getAttributes().getValue(ENERGY_LEVEL);
+ }
+
+ public ElectricityStorageAsset setEnergyLevel(Double value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL).setValue(value);
+ return this;
+ }
+
+ public Optional<Integer> getEnergyLevelPercentage() {
+ return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE);
+ }
+
+ public ElectricityStorageAsset setEnergyLevelPercentage(Integer value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE).setValue(value);
+ return this;
+ }
+
+ public Optional<Integer> getEnergyLevelPercentageMin() {
+ return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE_MIN);
+ }
+
+ public ElectricityStorageAsset setEnergyLevelPercentageMin(Integer value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE_MIN).setValue(value);
+ return this;
+ }
+
+ public Optional<Integer> getEnergyLevelPercentageMax() {
+ return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE_MAX);
+ }
+
+ public ElectricityStorageAsset setEnergyLevelPercentageMax(Integer value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE_MAX).setValue(value);
+ return this;
+ }
+
+ public Optional<Integer[][]> getEnergyLevelSchedule() {
+ return getAttributes().getValue(ENERGY_LEVEL_SCHEDULE);
}
- public ElectricityStorageAsset setChargeCycles(Integer value) {
- getAttributes().getOrCreate(CHARGE_CYCLES).setValue(value);
+ public ElectricityStorageAsset setEnergyLevelSchedule(Integer[][] value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL_SCHEDULE).setValue(value);
return this;
}
}