100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Updated asset type definitions
Rich Turnerb14e9ba92094
diff --git a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.javaindex 9999fb3e0..5a712d4d9 100644--- a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java@@ -740,8 +740,8 @@ public abstract class AbstractManagerSetup implements Setup {return electricityStorageAsset;}- protected ElectricityProducerAsset createDemoElectricityProducerAsset(String name, Asset<?> area, GeoJSONPoint location) {- ElectricityProducerAsset electricityProducerAsset = new ElectricityProducerAsset(name);+ protected ElectricityProducerSolarAsset createDemoElectricitySolarProducerAsset(String name, Asset<?> area, GeoJSONPoint location) {+ ElectricityProducerSolarAsset electricityProducerAsset = new ElectricityProducerSolarAsset(name);electricityProducerAsset.setParent(area);electricityProducerAsset.getAttributes().addOrReplace(new Attribute<>(Asset.LOCATION, location).addMeta(diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.javaindex b2fcb19f7..0c63613c4 100644--- a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java@@ -191,7 +191,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {consumption1Asset.getAttributes().forEach(attr -> attr.addMeta(new MetaItem<>(RULE_STATE)));consumption1Asset = assetStorageService.merge(consumption1Asset);- ElectricityProducerAsset production1Asset = createDemoElectricityProducerAsset("Solar De Rotterdam", building1Asset, new GeoJSONPoint(4.488592, 51.907047));+ ElectricityProducerSolarAsset production1Asset = createDemoElectricitySolarProducerAsset("Solar De Rotterdam", building1Asset, new GeoJSONPoint(4.488592, 51.907047));production1Asset.setManufacturer("AEG");production1Asset.setModel("AS-P60");production1Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {@@ -233,7 +233,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {production1Asset.setEnergyTotal(152689d);production1Asset.setPowerCapacity(89.6);production1Asset.setEfficiency(93);- production1Asset.setPanelOrientation(ElectricityProducerAsset.PanelOrientation.EAST_WEST);+ production1Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.EAST_WEST);production1Asset.setId(UniqueIdentifierGenerator.generateId(production1Asset.getName()));production1Asset.getAttributes().forEach(attr -> attr.addMeta(new MetaItem<>(RULE_STATE)));production1Asset = assetStorageService.merge(production1Asset);@@ -300,7 +300,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {consumption2Asset.getAttributes().forEach(attr -> attr.addMeta(new MetaItem<>(RULE_STATE)));consumption2Asset = assetStorageService.merge(consumption2Asset);- ElectricityProducerAsset production2Asset = createDemoElectricityProducerAsset("Solar Stadhuis", building2Asset, new GeoJSONPoint(4.47945, 51.92301));+ ElectricityProducerSolarAsset production2Asset = createDemoElectricitySolarProducerAsset("Solar Stadhuis", building2Asset, new GeoJSONPoint(4.47945, 51.92301));production2Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {assetAttribute.addMeta(new MetaItem<>(STORE_DATA_POINTS));assetAttribute.addMeta(@@ -340,7 +340,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {production2Asset.setEnergyTotal(88961d);production2Asset.setPowerCapacity(19.2);production2Asset.setEfficiency(79);- production2Asset.setPanelOrientation(ElectricityProducerAsset.PanelOrientation.SOUTH);+ production2Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.SOUTH);production2Asset.setManufacturer("Solarwatt");production2Asset.setModel("EasyIn 60M");production2Asset.setId(UniqueIdentifierGenerator.generateId(production2Asset.getName()));@@ -366,7 +366,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {building3Asset.setId(UniqueIdentifierGenerator.generateId(building3Asset.getName() + "building"));building3Asset = assetStorageService.merge(building3Asset);- ElectricityProducerAsset production3Asset = createDemoElectricityProducerAsset("Solar Markthal", building3Asset, new GeoJSONPoint(4.47945, 51.92301));+ ElectricityProducerSolarAsset production3Asset = createDemoElectricitySolarProducerAsset("Solar Markthal", building3Asset, new GeoJSONPoint(4.47945, 51.92301));production3Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {assetAttribute.addMeta(new MetaItem<>(STORE_DATA_POINTS));assetAttribute.addMeta(@@ -406,7 +406,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {production3Asset.setEnergyTotal(24134d);production3Asset.setPowerCapacity(29.8);production3Asset.setEfficiency(91);- production3Asset.setPanelOrientation(ElectricityProducerAsset.PanelOrientation.SOUTH);+ production3Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.SOUTH);production3Asset.setManufacturer("Sunpower");production3Asset.setModel("E20-327");production3Asset.setId(UniqueIdentifierGenerator.generateId(production3Asset.getName()));@@ -414,9 +414,9 @@ public class ManagerDemoSetup extends AbstractManagerSetup {production3Asset = assetStorageService.merge(production3Asset);ElectricityChargerAsset charger1Asset = createDemoElectricityChargerAsset("Charger 1 Markthal", building3Asset, new GeoJSONPoint(4.486143, 51.920058));- charger1Asset.setPowerConsumption(0d);+ charger1Asset.setPowerTotal(0d);charger1Asset.getAttribute(ElectricityConsumerAsset.TARIFF_IMPORT).ifPresent(attr -> attr.setValue(0.15));- charger1Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_CONSUMPTION).addMeta(+ charger1Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL).addMeta(new MetaItem<>(AGENT_LINK,new SimulatorAgent.SimulatorAgentLink(smartcitySimulatorAgentId).setSimulatorReplayData(@@ -456,8 +456,8 @@ public class ManagerDemoSetup extends AbstractManagerSetup {charger1Asset = assetStorageService.merge(charger1Asset);ElectricityChargerAsset charger2Asset = createDemoElectricityChargerAsset("Charger 2 Markthal", building3Asset, new GeoJSONPoint(4.486188, 51.919957));- charger2Asset.setPowerConsumption(0d);- charger2Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_CONSUMPTION)+ charger2Asset.setPowerTotal(0d);+ charger2Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL).addMeta(new MetaItem<>(AGENT_LINK,@@ -498,8 +498,8 @@ public class ManagerDemoSetup extends AbstractManagerSetup {charger2Asset = assetStorageService.merge(charger2Asset);ElectricityChargerAsset charger3Asset = createDemoElectricityChargerAsset("Charger 3 Markthal", building3Asset, new GeoJSONPoint(4.486232, 51.919856));- charger3Asset.setPowerConsumption(0d);- charger3Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_CONSUMPTION)+ charger3Asset.setPowerTotal(0d);+ charger3Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL).addMeta(new MetaItem<>(AGENT_LINK,@@ -540,8 +540,8 @@ public class ManagerDemoSetup extends AbstractManagerSetup {charger3Asset = assetStorageService.merge(charger3Asset);ElectricityChargerAsset charger4Asset = createDemoElectricityChargerAsset("Charger 4 Markthal", building3Asset, new GeoJSONPoint(4.486286, 51.919733));- charger4Asset.setPowerConsumption(0d);- charger4Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_CONSUMPTION)+ charger4Asset.setPowerTotal(0d);+ charger4Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL).addMeta(new MetaItem<>(AGENT_LINK,@@ -692,7 +692,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {consumption5Asset.getAttributes().forEach(attr -> attr.addMeta(new MetaItem<>(RULE_STATE)));consumption5Asset = assetStorageService.merge(consumption5Asset);- ElectricityProducerAsset production5Asset = createDemoElectricityProducerAsset("Solar Zwembad", building5Asset, new GeoJSONPoint(4.498281, 51.925507));+ ElectricityProducerSolarAsset production5Asset = createDemoElectricitySolarProducerAsset("Solar Zwembad", building5Asset, new GeoJSONPoint(4.498281, 51.925507));production5Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {assetAttribute.addMeta(new MetaItem<>(STORE_DATA_POINTS));assetAttribute.addMeta(@@ -732,7 +732,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {production5Asset.setEnergyTotal(23461d);production5Asset.setPowerCapacity(76.2);production5Asset.setEfficiency(86);- production5Asset.setPanelOrientation(ElectricityProducerAsset.PanelOrientation.SOUTH);+ production5Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.SOUTH);production5Asset.setManufacturer("S-Energy");production5Asset.setModel("SN260P-10");production5Asset.setId(UniqueIdentifierGenerator.generateId(production5Asset.getName()));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.javaindex 176d82758..1564fe635 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,6 +29,7 @@ import java.util.Optional;import static org.openremote.model.Constants.*;+@SuppressWarnings("unchecked")@Entitypublic class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {@@ -47,9 +48,11 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {new MetaItem<>(MetaItemType.READ_ONLY));public static final AttributeDescriptor<ConnectorType> CHARGER_TYPE = new AttributeDescriptor<>("chargerType", CONNECTOR_TYPE_VALUE);- public static final AttributeDescriptor<Double> POWER_CAPACITY = new AttributeDescriptor<>("powerCapacity", ValueType.POSITIVE_NUMBER)+ public static final AttributeDescriptor<Double> POWER_CAPACITY_IMPORT = new AttributeDescriptor<>("powerCapacityImport", ValueType.POSITIVE_NUMBER).withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_0_DP());- public static final AttributeDescriptor<Double> POWER_CONSUMPTION = new AttributeDescriptor<>("powerConsumption", ValueType.POSITIVE_NUMBER,+ public static final AttributeDescriptor<Double> POWER_CAPACITY_EXPORT = new AttributeDescriptor<>("powerCapacityExport", ValueType.POSITIVE_NUMBER)+ .withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_0_DP());+ public static final AttributeDescriptor<Double> POWER_TOTAL = new AttributeDescriptor<>("powerTotal", ValueType.NUMBER,new MetaItem<>(MetaItemType.READ_ONLY)).withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_1_DP());public static final AttributeDescriptor<Double> POWER_SETPOINT = new AttributeDescriptor<>("powerSetpoint", ValueType.POSITIVE_NUMBER,@@ -79,7 +82,7 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {return getAttributes().getValue(STATUS);}- @SuppressWarnings("unchecked")+public <T extends ElectricityChargerAsset> T setStatus(String value) {getAttributes().getOrCreate(STATUS).setValue(value);return (T)this;@@ -89,29 +92,37 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {return getAttributes().getValue(CHARGER_TYPE);}- @SuppressWarnings("unchecked")+public <T extends ElectricityChargerAsset> T setChargerType(ConnectorType value) {getAttributes().getOrCreate(CHARGER_TYPE).setValue(value);return (T)this;}- public Optional<Double> getPowerCapacity() {- return getAttributes().getValue(POWER_CAPACITY);+ public Optional<Double> getPowerCapacityImport() {+ return getAttributes().getValue(POWER_CAPACITY_IMPORT);+ }+++ public <T extends ElectricityChargerAsset> T setPowerCapacityImport(Double value) {+ getAttributes().getOrCreate(POWER_CAPACITY_IMPORT).setValue(value);+ return (T)this;+ }++ public Optional<Double> getPowerCapacityExport() {+ return getAttributes().getValue(POWER_CAPACITY_EXPORT);}- @SuppressWarnings("unchecked")- public <T extends ElectricityChargerAsset> T setPowerCapacity(Double value) {- getAttributes().getOrCreate(POWER_CAPACITY).setValue(value);+ public <T extends ElectricityChargerAsset> T setPowerCapacityExport(Double value) {+ getAttributes().getOrCreate(POWER_CAPACITY_EXPORT).setValue(value);return (T)this;}- public Optional<Double> getPowerConsumption() {- return getAttributes().getValue(POWER_CONSUMPTION);+ public Optional<Double> getPowerTotal() {+ return getAttributes().getValue(POWER_TOTAL);}- @SuppressWarnings("unchecked")- public <T extends ElectricityChargerAsset> T setPowerConsumption(Double value) {- getAttributes().getOrCreate(POWER_CONSUMPTION).setValue(value);+ public <T extends ElectricityChargerAsset> T setPowerTotal(Double value) {+ getAttributes().getOrCreate(POWER_TOTAL).setValue(value);return (T)this;}@@ -119,7 +130,6 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {return getAttributes().getValue(POWER_SETPOINT);}- @SuppressWarnings("unchecked")public <T extends ElectricityChargerAsset> T setPowerSetpoint(Double value) {getAttributes().getOrCreate(POWER_SETPOINT).setValue(value);return (T)this;@@ -129,7 +139,6 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {return getAttributes().getValue(TARIFF_IMPORT);}- @SuppressWarnings("unchecked")public <T extends ElectricityChargerAsset> T setTariffImport(Double value) {getAttributes().getOrCreate(TARIFF_IMPORT).setValue(value);return (T)this;@@ -139,7 +148,6 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {return getAttributes().getValue(TARIFF_EXPORT);}- @SuppressWarnings("unchecked")public <T extends ElectricityChargerAsset> T setTariffExport(Double value) {getAttributes().getOrCreate(TARIFF_EXPORT).setValue(value);return (T)this;@@ -148,8 +156,7 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {public Optional<Double> getTariffStart() {return getAttributes().getValue(TARIFF_START);}-- @SuppressWarnings("unchecked")+public <T extends ElectricityChargerAsset> T setTariffStart(Double value) {getAttributes().getOrCreate(TARIFF_START).setValue(value);return (T)this;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.javaindex 3cd6828f3..19486707f 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@@ -19,12 +19,12 @@*/package org.openremote.model.asset.impl;-import org.openremote.model.Constants;import org.openremote.model.asset.Asset;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.ValueDescriptor;import org.openremote.model.value.ValueType;import javax.persistence.Entity;@@ -32,20 +32,29 @@ import java.util.Optional;import static org.openremote.model.Constants.*;+@SuppressWarnings("unchecked")@Entitypublic class ElectricityConsumerAsset extends Asset<ElectricityConsumerAsset> {+ public enum DemandResponseType {+ NONE,+ FORECAST,+ SETPOINT+ }++ public static final ValueDescriptor<DemandResponseType> DEMAND_RESPONSE_TYPE_VALUE = new ValueDescriptor<>("demandResponseType", DemandResponseType.class);+public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,new MetaItem<>(MetaItemType.READ_ONLY));- public static final AttributeDescriptor<String> DEMAND_RESPONSE_TYPE = new AttributeDescriptor<>("demandResponseType", ValueType.TEXT);+ public static final AttributeDescriptor<DemandResponseType> DEMAND_RESPONSE_TYPE = new AttributeDescriptor<>("demandResponseType", DEMAND_RESPONSE_TYPE_VALUE);public static final AttributeDescriptor<Double> TARIFF_IMPORT = new AttributeDescriptor<>("tariffImport", ValueType.NUMBER).withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);public static final AttributeDescriptor<Double> TARIFF_EXPORT = new AttributeDescriptor<>("tariffExport", ValueType.NUMBER).withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);- public static final AttributeDescriptor<Integer> CARBON_IMPORT = new AttributeDescriptor<>("carbonImport", ValueType.POSITIVE_INTEGER)+ public static final AttributeDescriptor<Integer> CARBON_IMPORT = new AttributeDescriptor<>("carbonTariffImport", ValueType.POSITIVE_INTEGER).withUnits(UNITS_KILO, UNITS_GRAM, UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);- public static final AttributeDescriptor<Integer> CARBON_EXPORT = new AttributeDescriptor<>("carbonExport", ValueType.POSITIVE_INTEGER)+ public static final AttributeDescriptor<Integer> CARBON_EXPORT = new AttributeDescriptor<>("carbonTariffExport", ValueType.POSITIVE_INTEGER).withUnits(UNITS_KILO, UNITS_GRAM, UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);public static final AttributeDescriptor<Double> POWER_TOTAL = new AttributeDescriptor<>("powerTotal", ValueType.POSITIVE_NUMBER,new MetaItem<>(MetaItemType.READ_ONLY)@@ -83,47 +92,107 @@ public class ElectricityConsumerAsset extends Asset<ElectricityConsumerAsset> {return getAttributes().getValue(STATUS);}- public Optional<String> getDemandResponseType() {+ public <T extends ElectricityConsumerAsset> T setStatus(String value) {+ getAttributes().getOrCreate(STATUS).setValue(value);+ return (T)this;+ }++ public Optional<DemandResponseType> getDemandResponseType() {return getAttributes().getValue(DEMAND_RESPONSE_TYPE);}+ public <T extends ElectricityConsumerAsset> T setDemandResponseType(DemandResponseType value) {+ getAttributes().getOrCreate(DEMAND_RESPONSE_TYPE).setValue(value);+ return (T)this;+ }+public Optional<Double> getTariffImport() {return getAttributes().getValue(TARIFF_IMPORT);}+ public <T extends ElectricityConsumerAsset> T setTariffImport(Double value) {+ getAttributes().getOrCreate(TARIFF_IMPORT).setValue(value);+ return (T)this;+ }+public Optional<Double> getTariffExport() {return getAttributes().getValue(TARIFF_EXPORT);}+ public <T extends ElectricityConsumerAsset> T setTariffExport(Double value) {+ getAttributes().getOrCreate(TARIFF_EXPORT).setValue(value);+ return (T)this;+ }+public Optional<Integer> getCarbonImport() {return getAttributes().getValue(CARBON_IMPORT);}+ public <T extends ElectricityConsumerAsset> T setCarbonImport(Integer value) {+ getAttributes().getOrCreate(CARBON_IMPORT).setValue(value);+ return (T)this;+ }+public Optional<Integer> getCarbonExport() {return getAttributes().getValue(CARBON_EXPORT);}+ public <T extends ElectricityConsumerAsset> T setCarbonExport(Integer value) {+ getAttributes().getOrCreate(CARBON_EXPORT).setValue(value);+ return (T)this;+ }+public Optional<Double> getPowerTotal() {return getAttributes().getValue(POWER_TOTAL);}+ public <T extends ElectricityConsumerAsset> T setPowerTotal(Double value) {+ getAttributes().getOrCreate(POWER_TOTAL).setValue(value);+ return (T)this;+ }+public Optional<Double> getPowerForecastDeviation() {return getAttributes().getValue(POWER_FORECAST_DEVIATION);}+ public <T extends ElectricityConsumerAsset> T setPowerForecastDeviation(Double value) {+ getAttributes().getOrCreate(POWER_FORECAST_DEVIATION).setValue(value);+ return (T)this;+ }+public Optional<Double> getPowerSetpoint() {return getAttributes().getValue(POWER_SETPOINT);}+ public <T extends ElectricityConsumerAsset> T setPowerSetpoint(Double value) {+ getAttributes().getOrCreate(POWER_SETPOINT).setValue(value);+ return (T)this;+ }+public Optional<Double> getPowerAvailableMax() {return getAttributes().getValue(POWER_AVAILABLE_MAX);}+ public <T extends ElectricityConsumerAsset> T setPowerAvailableMax(Double value) {+ getAttributes().getOrCreate(POWER_AVAILABLE_MAX).setValue(value);+ return (T)this;+ }+public Optional<Double> getPowerAvailableMin() {return getAttributes().getValue(POWER_AVAILABLE_MIN);}+ public <T extends ElectricityConsumerAsset> T setPowerAvailableMin(Double value) {+ getAttributes().getOrCreate(POWER_AVAILABLE_MIN).setValue(value);+ return (T)this;+ }+public Optional<Double> getEnergyTotal() {return getAttributes().getValue(ENERGY_TOTAL);}++ public <T extends ElectricityConsumerAsset> T setEnergyTotal(Double value) {+ getAttributes().getOrCreate(ENERGY_TOTAL).setValue(value);+ return (T)this;+ }}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.javaindex d9d0005ef..e0f5af26d 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,13 +32,6 @@ import static org.openremote.model.Constants.*;@Entitypublic class ElectricityProducerAsset extends Asset<ElectricityProducerAsset> {- public enum PanelOrientation {- SOUTH,- EAST_WEST- }-- public static final ValueDescriptor<PanelOrientation> PANEL_ORIENTATION_VALUE = new ValueDescriptor<>("panelOrientation", PanelOrientation.class);-public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,new MetaItem<>(MetaItemType.READ_ONLY));@@ -55,18 +48,8 @@ public class ElectricityProducerAsset extends Asset<ElectricityProducerAsset> {public static final AttributeDescriptor<Double> ENERGY_TOTAL = new AttributeDescriptor<>("energyTotal", ValueType.POSITIVE_NUMBER,new MetaItem<>(MetaItemType.READ_ONLY)).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);- public static final AttributeDescriptor<Double> INSTALLED_CAPACITY = new AttributeDescriptor<>("installedCapacity", ValueType.POSITIVE_NUMBER- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);-- public static final AttributeDescriptor<PanelOrientation> PANEL_ORIENTATION = new AttributeDescriptor<>("panelOrientation", PANEL_ORIENTATION_VALUE);-- public static final AttributeDescriptor<Double> PANEL_AZIMUTH = new AttributeDescriptor<>("panelAzimuth", ValueType.POSITIVE_NUMBER- ).withUnits(UNITS_DEGREE);- public static final AttributeDescriptor<Double> PANEL_PITCH = new AttributeDescriptor<>("panelPitch", ValueType.POSITIVE_NUMBER- ).withUnits(UNITS_DEGREE);-- public static final AssetDescriptor<ElectricityProducerAsset> DESCRIPTOR = new AssetDescriptor<>("white-balance-sunny", "8A293D", ElectricityProducerAsset.class);+ public static final AssetDescriptor<ElectricityProducerAsset> DESCRIPTOR = new AssetDescriptor<>("flash", "EABB4D", ElectricityProducerAsset.class);/*** For use by hydrators (i.e. JPA/Jackson)@@ -83,101 +66,53 @@ public class ElectricityProducerAsset extends Asset<ElectricityProducerAsset> {return getAttributes().getValue(STATUS);}- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setStatus(String value) {+ public ElectricityProducerAsset setStatus(String value) {getAttributes().getOrCreate(STATUS).setValue(value);- return (T)this;+ return this;}public Optional<Double> getPowerTotal() {return getAttributes().getValue(POWER_TOTAL);}- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setPowerTotal(Double value) {+ public ElectricityProducerAsset setPowerTotal(Double value) {getAttributes().getOrCreate(POWER_TOTAL).setValue(value);- return (T)this;+ return this;}public Optional<Double> getPowerForecastDeviation() {return getAttributes().getValue(POWER_FORECAST_DEVIATION);}- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setPowerForecastDeviation(Double value) {+ public ElectricityProducerAsset setPowerForecastDeviation(Double value) {getAttributes().getOrCreate(POWER_FORECAST_DEVIATION).setValue(value);- return (T)this;+ return this;}public Optional<Double> getPowerCapacity() {return getAttributes().getValue(POWER_CAPACITY);}- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setPowerCapacity(Double value) {+ public ElectricityProducerAsset setPowerCapacity(Double value) {getAttributes().getOrCreate(POWER_CAPACITY).setValue(value);- return (T)this;+ return this;}public Optional<Integer> getEfficiency() {return getAttributes().getValue(EFFICIENCY);}- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setEfficiency(Integer value) {+ public ElectricityProducerAsset setEfficiency(Integer value) {getAttributes().getOrCreate(EFFICIENCY).setValue(value);- return (T)this;+ return this;}public Optional<Double> getEnergyTotal() {return getAttributes().getValue(ENERGY_TOTAL);}- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setEnergyTotal(Double value) {+ public ElectricityProducerAsset setEnergyTotal(Double value) {getAttributes().getOrCreate(ENERGY_TOTAL).setValue(value);- return (T)this;- }-- public Optional<Double> getInstalledCapacity() {- return getAttributes().getValue(INSTALLED_CAPACITY);- }-- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setInstalledCapacity(Double value) {- getAttributes().getOrCreate(INSTALLED_CAPACITY).setValue(value);- return (T)this;- }-- public Optional<PanelOrientation> getPanelOrientation() {- return getAttributes().getValue(PANEL_ORIENTATION);- }-- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setPanelOrientation(PanelOrientation value) {- getAttributes().getOrCreate(PANEL_ORIENTATION).setValue(value);- return (T)this;- }-- @SuppressWarnings("unchecked")- public Optional<Double> getPanelAzimuth() {- return getAttributes().getValue(PANEL_AZIMUTH);- }-- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setPanelAzimuth(Double value) {- getAttributes().getOrCreate(PANEL_AZIMUTH).setValue(value);- return (T)this;- }-- @SuppressWarnings("unchecked")- public Optional<Double> getPanelPitch() {- return getAttributes().getValue(PANEL_PITCH);- }-- @SuppressWarnings("unchecked")- public <T extends ElectricityProducerAsset> T setPanelPitch(Double value) {- getAttributes().getOrCreate(PANEL_PITCH).setValue(value);- return (T)this;+ return this;}}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.javanew file mode 100644index 000000000..95c810b6e--- /dev/null+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java@@ -0,0 +1,117 @@+/*+ * Copyright 2020, 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.value.AttributeDescriptor;+import org.openremote.model.value.ValueDescriptor;+import org.openremote.model.value.ValueType;++import javax.persistence.Entity;+import java.util.Optional;++import static org.openremote.model.Constants.UNITS_DEGREE;++@Entity+public class ElectricityProducerSolarAsset extends ElectricityProducerAsset {++ public enum PanelOrientation {+ SOUTH,+ EAST_WEST+ }++ public static final ValueDescriptor<PanelOrientation> PANEL_ORIENTATION_VALUE = new ValueDescriptor<>("panelOrientation", PanelOrientation.class);++ public static final AttributeDescriptor<PanelOrientation> PANEL_ORIENTATION = new AttributeDescriptor<>("panelOrientation", PANEL_ORIENTATION_VALUE);+ public static final AttributeDescriptor<Double> PANEL_AZIMUTH = new AttributeDescriptor<>("panelAzimuth", ValueType.POSITIVE_NUMBER+ ).withUnits(UNITS_DEGREE);+ public static final AttributeDescriptor<Double> PANEL_PITCH = new AttributeDescriptor<>("panelPitch", ValueType.POSITIVE_NUMBER+ ).withUnits(UNITS_DEGREE);++ public static final AssetDescriptor<ElectricityProducerSolarAsset> DESCRIPTOR = new AssetDescriptor<>("white-balance-sunny", "8A293D", ElectricityProducerSolarAsset.class);++ /**+ * For use by hydrators (i.e. JPA/Jackson)+ */+ ElectricityProducerSolarAsset() {+ this(null);+ }++ public ElectricityProducerSolarAsset(String name) {+ super(name);+ }++ public ElectricityProducerSolarAsset setStatus(String value) {+ getAttributes().getOrCreate(STATUS).setValue(value);+ return this;+ }++ public ElectricityProducerSolarAsset setPowerTotal(Double value) {+ getAttributes().getOrCreate(POWER_TOTAL).setValue(value);+ return this;+ }++ public ElectricityProducerSolarAsset setPowerForecastDeviation(Double value) {+ getAttributes().getOrCreate(POWER_FORECAST_DEVIATION).setValue(value);+ return this;+ }++ public ElectricityProducerSolarAsset setPowerCapacity(Double value) {+ getAttributes().getOrCreate(POWER_CAPACITY).setValue(value);+ return this;+ }++ public ElectricityProducerSolarAsset setEfficiency(Integer value) {+ getAttributes().getOrCreate(EFFICIENCY).setValue(value);+ return this;+ }++ public ElectricityProducerSolarAsset setEnergyTotal(Double value) {+ getAttributes().getOrCreate(ENERGY_TOTAL).setValue(value);+ return this;+ }++ public Optional<PanelOrientation> getPanelOrientation() {+ return getAttributes().getValue(PANEL_ORIENTATION);+ }++ public ElectricityProducerSolarAsset setPanelOrientation(PanelOrientation value) {+ getAttributes().getOrCreate(PANEL_ORIENTATION).setValue(value);+ return this;+ }++ public Optional<Double> getPanelAzimuth() {+ return getAttributes().getValue(PANEL_AZIMUTH);+ }++ public ElectricityProducerSolarAsset setPanelAzimuth(Double value) {+ getAttributes().getOrCreate(PANEL_AZIMUTH).setValue(value);+ return this;+ }++ public Optional<Double> getPanelPitch() {+ return getAttributes().getValue(PANEL_PITCH);+ }++ public ElectricityProducerSolarAsset setPanelPitch(Double value) {+ getAttributes().getOrCreate(PANEL_PITCH).setValue(value);+ return this;+ }+}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.javanew file mode 100644index 000000000..c2412a01d--- /dev/null+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java@@ -0,0 +1,37 @@+/*+ * 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 javax.persistence.Entity;++@Entity+public class ElectricityProducerWindAsset extends ElectricityProducerAsset {++ public static final AssetDescriptor<ElectricityProducerWindAsset> DESCRIPTOR = new AssetDescriptor<>("wind-turbine", "4B87EA", ElectricityProducerWindAsset.class);++ ElectricityProducerWindAsset() {+ }++ public ElectricityProducerWindAsset(String name) {+ super(name);+ }+}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.javaindex ce1c973b6..3c990904a 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@@ -38,17 +38,18 @@ public class ElectricityStorageAsset extends Asset<ElectricityStorageAsset> {public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,new MetaItem<>(MetaItemType.READ_ONLY));- public static final AttributeDescriptor<Double> LEVELISED_COST_OF_STORAGE = new AttributeDescriptor<>("levelisedCostOfStorage", ValueType.POSITIVE_NUMBER).withUnits("EUR");+ public static final AttributeDescriptor<Double> LEVELISED_COST_OF_STORAGE = new AttributeDescriptor<>("levelisedCostOfStorage", ValueType.POSITIVE_NUMBER)+ .withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);public static final AttributeDescriptor<Double> ENERGY_CAPACITY = new AttributeDescriptor<>("energyCapacity", ValueType.POSITIVE_NUMBER,new MetaItem<>(MetaItemType.READ_ONLY)).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);- public static final AttributeDescriptor<Integer> ENERGY_AVAILABLE_PERCENTAGE = new AttributeDescriptor<>("energyAvailablePercentage", ValueType.POSITIVE_INTEGER)+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = new AttributeDescriptor<>("energyLevelPercentage", ValueType.POSITIVE_INTEGER).withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));-- public static final AttributeDescriptor<Double> ENERGY_AVAILABLE = new AttributeDescriptor<>("energyAvailable", ValueType.POSITIVE_NUMBER,- new MetaItem<>(MetaItemType.READ_ONLY)- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);- public static final AttributeDescriptor<Double> ENERGY_CAPACITY_REMAINING = new AttributeDescriptor<>("energyCapacityRemaining", ValueType.POSITIVE_NUMBER,+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_MAX_PERCENTAGE = new AttributeDescriptor<>("energyLevelMaxPercentage", ValueType.POSITIVE_INTEGER)+ .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_MIN_PERCENTAGE = new AttributeDescriptor<>("energyLevelMinPercentage", ValueType.POSITIVE_INTEGER)+ .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));+ 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_TOTAL_IMPORT = new AttributeDescriptor<>("energyTotalImport", ValueType.POSITIVE_NUMBER,@@ -58,7 +59,7 @@ public class ElectricityStorageAsset extends Asset<ElectricityStorageAsset> {new MetaItem<>(MetaItemType.READ_ONLY)).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);public static final AttributeDescriptor<Double> POWER_CAPACITY_IMPORT = new AttributeDescriptor<>("powerCapacityImport", ValueType.POSITIVE_NUMBER)- .withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);+ .withUnits(UNITS_KILO, UNITS_WATT);public static final AttributeDescriptor<Double> POWER_CAPACITY_EXPORT = new AttributeDescriptor<>("powerCapacityExport", ValueType.POSITIVE_NUMBER).withUnits(UNITS_KILO, UNITS_WATT);public static final AttributeDescriptor<Double> POWER_TOTAL = new AttributeDescriptor<>("powerTotal", ValueType.POSITIVE_NUMBER,@@ -99,16 +100,20 @@ public class ElectricityStorageAsset extends Asset<ElectricityStorageAsset> {return getAttributes().getValue(ENERGY_CAPACITY);}- public Optional<Integer> getEnergyAvailablePercentage() {- return getAttributes().getValue(ENERGY_AVAILABLE_PERCENTAGE);+ public Optional<Integer> getEnergyLevelPercentage() {+ return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE);+ }++ public Optional<Double> getEnergyLevel() {+ return getAttributes().getValue(ENERGY_LEVEL);}- public Optional<Double> getEnergyAvailable() {- return getAttributes().getValue(ENERGY_AVAILABLE);+ public Optional<Integer> getEnergyLevelMinPercentage() {+ return getAttributes().getValue(ENERGY_LEVEL_MIN_PERCENTAGE);}- public Optional<Double> getEnergyCapacityRemaining() {- return getAttributes().getValue(ENERGY_CAPACITY_REMAINING);+ public Optional<Integer> getEnergyLevelMaxPercentage() {+ return getAttributes().getValue(ENERGY_LEVEL_MAX_PERCENTAGE);}public Optional<Double> getEnergyTotalImport() {diff --git a/ui/component/core/tsconfig.json b/ui/component/core/tsconfig.jsonindex 34aa2fbd1..1e80c6e25 100644--- a/ui/component/core/tsconfig.json+++ b/ui/component/core/tsconfig.json@@ -6,11 +6,10 @@"rootDir": "src"},"include": [- "./src",- "./@types"+ "./src"],"references": [{ "path": "../model" },{ "path": "../rest" }]-}\ No newline at end of file+}