diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/support/ws/smartmetering/adhoc/SetSpecificAttributeValueRequestFactory.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/support/ws/smartmetering/adhoc/SetSpecificAttributeValueRequestFactory.java index 5eba6bb7f74..29cfb5db097 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/support/ws/smartmetering/adhoc/SetSpecificAttributeValueRequestFactory.java +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/support/ws/smartmetering/adhoc/SetSpecificAttributeValueRequestFactory.java @@ -9,6 +9,7 @@ import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.AllowedObjectType; import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueAsyncRequest; import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueRequest; +import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.ValueToSet; import org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys; import org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.RequestFactoryHelper; @@ -23,10 +24,22 @@ public static SetSpecificAttributeValueRequest fromParameterMap( final SetSpecificAttributeValueRequest request = new SetSpecificAttributeValueRequest(); request.setDeviceIdentification( parameters.get(PlatformSmartmeteringKeys.DEVICE_IDENTIFICATION)); - request.setObjectType( + final ValueToSet valueToSet = new ValueToSet(); + valueToSet.setObjectType( AllowedObjectType.valueOf(parameters.get(PlatformSmartmeteringKeys.OBJECT_TYPE))); - request.setAttribute(new BigInteger(parameters.get(PlatformSmartmeteringKeys.ATTRIBUTE))); - request.setIntValue(new BigInteger(parameters.get(PlatformSmartmeteringKeys.INT_VALUE))); + valueToSet.setAttribute(new BigInteger(parameters.get(PlatformSmartmeteringKeys.ATTRIBUTE))); + valueToSet.setIntValue(new BigInteger(parameters.get(PlatformSmartmeteringKeys.INT_VALUE))); + request.getValuesToSet().add(valueToSet); + if (parameters.containsKey(PlatformSmartmeteringKeys.OBJECT_TYPE + "_2")) { + final ValueToSet valueToSet2 = new ValueToSet(); + valueToSet2.setObjectType( + AllowedObjectType.valueOf(parameters.get(PlatformSmartmeteringKeys.OBJECT_TYPE + "_2"))); + valueToSet2.setAttribute( + new BigInteger(parameters.get(PlatformSmartmeteringKeys.ATTRIBUTE + "_2"))); + valueToSet2.setIntValue( + new BigInteger(parameters.get(PlatformSmartmeteringKeys.INT_VALUE + "_2"))); + request.getValuesToSet().add(valueToSet2); + } return request; } diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/features/osgp-adapter-ws-smartmetering/ad-hoc/SetSpecificAttributeValue.feature b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/features/osgp-adapter-ws-smartmetering/ad-hoc/SetSpecificAttributeValue.feature index 50f595bfaa0..c8bdd37dba4 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/features/osgp-adapter-ws-smartmetering/ad-hoc/SetSpecificAttributeValue.feature +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/features/osgp-adapter-ws-smartmetering/ad-hoc/SetSpecificAttributeValue.feature @@ -35,3 +35,34 @@ Feature: SmartMetering AdHoc | TEST1028000000001 | SMR | 5.1 | OK | | TEST1029000000001 | SMR | 5.2 | OK | | TEST1030000000001 | SMR | 5.5 | OK | + + Scenario Outline: Set sag and swell settings for a device + Given a dlms device + | DeviceIdentification | | + | DeviceType | SMART_METER_E | + | Protocol | | + | ProtocolVersion | | + When the Set Specific Attribute Value request is received + | DeviceIdentification | | + | ObjectType | THRESHOLD_VOLTAGE_SWELL | + | Attribute | 2 | + | IntValue | 200 | + | ObjectType_2 | TIME_THRESHOLD_VOLTAGE_SWELL | + | Attribute_2 | 2 | + | IntValue_2 | 60 | + Then the Set Specific Attribute Value response should be returned + | DeviceIdentification | | + | Result | | + + Examples: + | deviceIdentification | protocol | version | response | + | TEST1024000000001 | DSMR | 4.2.2 | OK | + @NightlyBuildOnly + Examples: + | deviceIdentification | protocol | version | response | + | TEST1024000000001 | DSMR | 2.2 | OK | + | TEST1031000000001 | SMR | 4.3 | OK | + | TEST1027000000001 | SMR | 5.0.0 | OK | + | TEST1028000000001 | SMR | 5.1 | OK | + | TEST1029000000001 | SMR | 5.2 | OK | + | TEST1030000000001 | SMR | 5.5 | OK | diff --git a/osgp/platform/osgp-adapter-domain-smartmetering/src/main/java/org/opensmartgridplatform/adapter/domain/smartmetering/application/services/AdhocService.java b/osgp/platform/osgp-adapter-domain-smartmetering/src/main/java/org/opensmartgridplatform/adapter/domain/smartmetering/application/services/AdhocService.java index cacfd762345..533ac217eb8 100644 --- a/osgp/platform/osgp-adapter-domain-smartmetering/src/main/java/org/opensmartgridplatform/adapter/domain/smartmetering/application/services/AdhocService.java +++ b/osgp/platform/osgp-adapter-domain-smartmetering/src/main/java/org/opensmartgridplatform/adapter/domain/smartmetering/application/services/AdhocService.java @@ -5,6 +5,7 @@ package org.opensmartgridplatform.adapter.domain.smartmetering.application.services; import java.io.Serializable; +import java.util.List; import lombok.extern.slf4j.Slf4j; import ma.glasnost.orika.MapperFactory; import org.opensmartgridplatform.adapter.domain.smartmetering.application.mapping.ConfigurationMapper; @@ -27,6 +28,7 @@ import org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecificAttributeValueRequestDto; import org.opensmartgridplatform.dto.valueobjects.smartmetering.SynchronizeTimeRequestDto; import org.opensmartgridplatform.dto.valueobjects.smartmetering.TestAlarmSchedulerRequestDto; +import org.opensmartgridplatform.dto.valueobjects.smartmetering.ValueToSetDto; import org.opensmartgridplatform.shared.exceptionhandling.FunctionalException; import org.opensmartgridplatform.shared.exceptionhandling.OsgpException; import org.opensmartgridplatform.shared.infra.jms.MessageMetadata; @@ -264,9 +266,18 @@ public void setSpecificAttributeValue( final SmartMeter smartMeter = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification()); + final List valuesToSet = + request.getValuesToSet().stream() + .map( + valueToSet -> + new ValueToSetDto( + valueToSet.getObjectType(), + valueToSet.getAttribute(), + valueToSet.getIntValue())) + .toList(); + final SetSpecificAttributeValueRequestDto requestDto = - new SetSpecificAttributeValueRequestDto( - request.getObjectType(), request.getAttribute(), request.getIntValue()); + new SetSpecificAttributeValueRequestDto(valuesToSet); this.osgpCoreRequestMessageSender.send( requestDto, diff --git a/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequest.java b/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequest.java index 1c4c9bfc234..6d85c2c33b4 100644 --- a/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequest.java +++ b/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequest.java @@ -4,6 +4,8 @@ package org.opensmartgridplatform.domain.core.valueobjects.smartmetering; +import java.util.List; + public class SetSpecificAttributeValueRequest extends SetSpecificAttributeValueRequestData { private static final long serialVersionUID = 1; @@ -11,11 +13,8 @@ public class SetSpecificAttributeValueRequest extends SetSpecificAttributeValueR private final String deviceIdentification; public SetSpecificAttributeValueRequest( - final String objectType, - final int attribute, - final int intValue, - final String deviceIdentification) { - super(objectType, attribute, intValue); + final List valuesToSet, final String deviceIdentification) { + super(valuesToSet); this.deviceIdentification = deviceIdentification; } diff --git a/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequestData.java b/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequestData.java index 75abcc10429..4b5c0b2d482 100644 --- a/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequestData.java +++ b/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/SetSpecificAttributeValueRequestData.java @@ -5,6 +5,7 @@ package org.opensmartgridplatform.domain.core.valueobjects.smartmetering; import java.io.Serializable; +import java.util.List; import org.opensmartgridplatform.domain.core.valueobjects.DeviceFunction; import org.opensmartgridplatform.shared.exceptionhandling.FunctionalException; @@ -12,28 +13,15 @@ public class SetSpecificAttributeValueRequestData implements Serializable, Actio private static final long serialVersionUID = -7326169764207317011L; - private final String objectType; - private final int attribute; - private final int intValue; + private final List valuesToSet; - public SetSpecificAttributeValueRequestData( - final String objectType, final int attribute, final int intValue) { + public SetSpecificAttributeValueRequestData(final List valuesToSet) { super(); - this.objectType = objectType; - this.attribute = attribute; - this.intValue = intValue; + this.valuesToSet = valuesToSet; } - public String getObjectType() { - return this.objectType; - } - - public int getAttribute() { - return this.attribute; - } - - public int getIntValue() { - return this.intValue; + public List getValuesToSet() { + return this.valuesToSet; } @Override @@ -45,9 +33,9 @@ public void validate() throws FunctionalException { public int hashCode() { final int prime = 31; int result = 1; - result = (prime * result) + this.attribute; - result = (prime * result) + this.intValue; - result = (prime * result) + this.objectType.hashCode(); + for (final ValueToSet valueToSet : this.valuesToSet) { + result = (prime * result) + valueToSet.hashCode(); + } return result; } @@ -63,18 +51,10 @@ public boolean equals(final Object obj) { return false; } final SetSpecificAttributeValueRequestData other = (SetSpecificAttributeValueRequestData) obj; - if (this.attribute != other.attribute) { - return false; - } - if (this.intValue != other.intValue) { - return false; - } - if (this.objectType == null) { - if (other.objectType != null) { + for (int i = 0; i < this.valuesToSet.size(); i++) { + if (!this.valuesToSet.get(i).equals(other.valuesToSet.get(i))) { return false; } - } else if (!this.objectType.equals(other.objectType)) { - return false; } return true; } diff --git a/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/ValueToSet.java b/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/ValueToSet.java new file mode 100644 index 00000000000..e741b2c6755 --- /dev/null +++ b/osgp/platform/osgp-domain-core/src/main/java/org/opensmartgridplatform/domain/core/valueobjects/smartmetering/ValueToSet.java @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: Copyright Contributors to the GXF project +// +// SPDX-License-Identifier: Apache-2.0 + +package org.opensmartgridplatform.domain.core.valueobjects.smartmetering; + +import java.io.Serializable; + +public class ValueToSet implements Serializable { + + private static final long serialVersionUID = 3413354995054664052L; + + private final String objectType; + private final int attribute; + private final int intValue; + + public ValueToSet(final String objectType, final int attribute, final int intValue) { + super(); + this.objectType = objectType; + this.attribute = attribute; + this.intValue = intValue; + } + + public String getObjectType() { + return this.objectType; + } + + public int getAttribute() { + return this.attribute; + } + + public int getIntValue() { + return this.intValue; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + this.attribute; + result = (prime * result) + this.intValue; + result = (prime * result) + this.objectType.hashCode(); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (this.getClass() != obj.getClass()) { + return false; + } + final ValueToSet other = (ValueToSet) obj; + if (this.attribute != other.attribute) { + return false; + } + if (this.intValue != other.intValue) { + return false; + } + if (this.objectType == null) { + if (other.objectType != null) { + return false; + } + } else if (!this.objectType.equals(other.objectType)) { + return false; + } + return true; + } +} diff --git a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/java/org/opensmartgridplatform/dlms/objectconfig/DlmsObjectType.java b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/java/org/opensmartgridplatform/dlms/objectconfig/DlmsObjectType.java index 23137b43855..88bdba51719 100644 --- a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/java/org/opensmartgridplatform/dlms/objectconfig/DlmsObjectType.java +++ b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/java/org/opensmartgridplatform/dlms/objectconfig/DlmsObjectType.java @@ -57,9 +57,13 @@ public enum DlmsObjectType { AVERAGE_VOLTAGE_L3, NUMBER_OF_POWER_FAILURES, NUMBER_OF_LONG_POWER_FAILURES, + THRESHOLD_VOLTAGE_SAG, + TIME_THRESHOLD_VOLTAGE_SAG, NUMBER_OF_VOLTAGE_SAGS_FOR_L1, NUMBER_OF_VOLTAGE_SAGS_FOR_L2, NUMBER_OF_VOLTAGE_SAGS_FOR_L3, + THRESHOLD_VOLTAGE_SWELL, + TIME_THRESHOLD_VOLTAGE_SWELL, NUMBER_OF_VOLTAGE_SWELLS_FOR_L1, NUMBER_OF_VOLTAGE_SWELLS_FOR_L2, NUMBER_OF_VOLTAGE_SWELLS_FOR_L3, diff --git a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr22.json b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr22.json index b3cdccdcc84..7d5c5d19011 100644 --- a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr22.json +++ b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr22.json @@ -413,6 +413,66 @@ } ] }, + { + "tag": "THRESHOLD_VOLTAGE_SWELL", + "description": "Threshold for voltage swell", + "class-id": 3, + "version": 0, + "obis": "1.0.12.35.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 253, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, V", + "access": "R" + } + ] + }, + { + "tag": "TIME_THRESHOLD_VOLTAGE_SWELL", + "description": "Time threshold for voltage swell", + "class-id": 3, + "version": 0, + "obis": "1.0.12.44.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 30, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, s", + "access": "R" + } + ] + }, { "tag": "NUMBER_OF_VOLTAGE_SWELLS_FOR_L1", "description": "Number of voltage swells in phase L1", @@ -479,6 +539,66 @@ } ] }, + { + "tag": "THRESHOLD_VOLTAGE_SAG", + "description": "Threshold for voltage sag", + "class-id": 3, + "version": 0, + "obis": "1.0.12.31.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 207, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, V", + "access": "R" + } + ] + }, + { + "tag": "TIME_THRESHOLD_VOLTAGE_SAG", + "description": "Time threshold for voltage sag ", + "class-id": 3, + "version": 0, + "obis": "1.0.12.43.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 30, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, s", + "access": "R" + } + ] + }, { "tag": "NUMBER_OF_VOLTAGE_SAGS_FOR_L1", "description": "Number of voltage sags in phase L1", diff --git a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr422.json b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr422.json index bd5cbfa95ba..b433f65b92f 100644 --- a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr422.json +++ b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-dsmr422.json @@ -606,6 +606,66 @@ } ] }, + { + "tag": "THRESHOLD_VOLTAGE_SWELL", + "description": "Threshold for voltage swell", + "class-id": 3, + "version": 0, + "obis": "1.0.12.35.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 253, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, V", + "access": "R" + } + ] + }, + { + "tag": "TIME_THRESHOLD_VOLTAGE_SWELL", + "description": "Time threshold for voltage swell", + "class-id": 3, + "version": 0, + "obis": "1.0.12.44.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 30, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, s", + "access": "R" + } + ] + }, { "tag": "NUMBER_OF_VOLTAGE_SWELLS_FOR_L1", "description": "Number of voltage swells in phase L1", @@ -687,6 +747,66 @@ } ] }, + { + "tag": "THRESHOLD_VOLTAGE_SAG", + "description": "Threshold for voltage sag", + "class-id": 3, + "version": 0, + "obis": "1.0.12.31.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 207, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, V", + "access": "R" + } + ] + }, + { + "tag": "TIME_THRESHOLD_VOLTAGE_SAG", + "description": "Time threshold for voltage sag ", + "class-id": 3, + "version": 0, + "obis": "1.0.12.43.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 30, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, s", + "access": "R" + } + ] + }, { "tag": "NUMBER_OF_VOLTAGE_SAGS_FOR_L1", "description": "Number of voltage sags in phase L1", diff --git a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-smr500.json b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-smr500.json index d22ddd5b5c0..44610095baa 100644 --- a/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-smr500.json +++ b/osgp/protocol-adapter-dlms/osgp-dlms/src/main/resources/dlmsprofiles/dlmsprofile-smr500.json @@ -1845,6 +1845,66 @@ } ] }, + { + "tag": "THRESHOLD_VOLTAGE_SAG", + "description": "Threshold for voltage sag", + "class-id": 3, + "version": 0, + "obis": "1.0.12.31.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 207, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, V", + "access": "R" + } + ] + }, + { + "tag": "TIME_THRESHOLD_VOLTAGE_SAG", + "description": "Time threshold for voltage sag ", + "class-id": 3, + "version": 0, + "obis": "1.0.12.43.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 60, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, s", + "access": "R" + } + ] + }, { "tag": "NUMBER_OF_VOLTAGE_SAGS_FOR_L1", "description": "Number of voltage sags in phase L1", @@ -1911,6 +1971,66 @@ } ] }, + { + "tag": "THRESHOLD_VOLTAGE_SWELL", + "description": "Threshold for voltage swell", + "class-id": 3, + "version": 0, + "obis": "1.0.12.35.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 253, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, V", + "access": "R" + } + ] + }, + { + "tag": "TIME_THRESHOLD_VOLTAGE_SWELL", + "description": "Time threshold for voltage swell", + "class-id": 3, + "version": 0, + "obis": "1.0.12.44.0.255", + "group": "ELECTRICITY", + "meterTypes": [ + "SP", + "PP" + ], + "attributes": [ + { + "id": 2, + "description": "value", + "datatype": "long-unsigned", + "valuetype": "SET_BY_CLIENT", + "value": 60, + "access": "RW" + }, + { + "id": 3, + "description": "scaler_unit", + "datatype": "scal_unit_type", + "valuetype": "FIXED_IN_PROFILE", + "value": "0, s", + "access": "R" + } + ] + }, { "tag": "NUMBER_OF_VOLTAGE_SWELLS_FOR_L1", "description": "Number of voltage swells in phase L1", diff --git a/osgp/protocol-adapter-dlms/osgp-dlms/src/test/java/org/opensmartgridplatform/dlms/services/Protocol.java b/osgp/protocol-adapter-dlms/osgp-dlms/src/test/java/org/opensmartgridplatform/dlms/services/Protocol.java index 415631a406f..3b32d633cab 100644 --- a/osgp/protocol-adapter-dlms/osgp-dlms/src/test/java/org/opensmartgridplatform/dlms/services/Protocol.java +++ b/osgp/protocol-adapter-dlms/osgp-dlms/src/test/java/org/opensmartgridplatform/dlms/services/Protocol.java @@ -11,13 +11,13 @@ @Getter public enum Protocol { - DSMR_2_2("DSMR", "2.2", 52, 2, 4, 6, 14, 0, 0, 0, 0, false, false), - DSMR_4_2_2("DSMR", "4.2.2", 94, 11, 27, 6, 14, 6, 13, 5, 6, true, false), - SMR_4_3("SMR", "4.3", 95, 11, 27, 6, 14, 6, 13, 6, 7, true, false), - SMR_5_0_0("SMR", "5.0.0", 116, 11, 27, 6, 14, 6, 15, 9, 14, true, true), - SMR_5_1("SMR", "5.1", 120, 11, 27, 6, 14, 6, 15, 9, 14, true, true), - SMR_5_2("SMR", "5.2", 159, 11, 27, 6, 14, 6, 15, 10, 15, true, true), - SMR_5_5("SMR", "5.5", 163, 11, 27, 6, 14, 6, 15, 10, 15, true, true); + DSMR_2_2("DSMR", "2.2", 56, 2, 4, 6, 14, 0, 0, 0, 0, false, false), + DSMR_4_2_2("DSMR", "4.2.2", 98, 11, 27, 6, 14, 6, 13, 5, 6, true, false), + SMR_4_3("SMR", "4.3", 99, 11, 27, 6, 14, 6, 13, 6, 7, true, false), + SMR_5_0_0("SMR", "5.0.0", 120, 11, 27, 6, 14, 6, 15, 9, 14, true, true), + SMR_5_1("SMR", "5.1", 124, 11, 27, 6, 14, 6, 15, 9, 14, true, true), + SMR_5_2("SMR", "5.2", 163, 11, 27, 6, 14, 6, 15, 10, 15, true, true), + SMR_5_5("SMR", "5.5", 167, 11, 27, 6, 14, 6, 15, 10, 15, true, true); private final String name; private final String version; diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutor.java b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutor.java index cf61ae914db..849cc03c1c4 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutor.java +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutor.java @@ -4,17 +4,19 @@ package org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.misc; -import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import lombok.extern.slf4j.Slf4j; +import org.openmuc.jdlms.AccessResultCode; import org.openmuc.jdlms.AttributeAddress; import org.openmuc.jdlms.ObisCode; import org.openmuc.jdlms.SetParameter; import org.openmuc.jdlms.datatypes.DataObject; import org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.AbstractCommandExecutor; +import org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.utils.DlmsHelper; import org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.utils.JdlmsObjectToStringUtil; import org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice; import org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.DlmsConnectionManager; -import org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException; import org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException; import org.opensmartgridplatform.dlms.exceptions.ObjectConfigException; import org.opensmartgridplatform.dlms.objectconfig.Attribute; @@ -24,6 +26,7 @@ import org.opensmartgridplatform.dlms.services.ObjectConfigService; import org.opensmartgridplatform.dto.valueobjects.smartmetering.ActionResponseDto; import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetSpecificAttributeValueRequestDto; +import org.opensmartgridplatform.dto.valueobjects.smartmetering.ValueToSetDto; import org.opensmartgridplatform.shared.exceptionhandling.FunctionalException; import org.opensmartgridplatform.shared.infra.jms.MessageMetadata; import org.springframework.stereotype.Component; @@ -34,10 +37,13 @@ public class SetSpecificAttributeValueCommandExecutor extends AbstractCommandExecutor { private final ObjectConfigService objectConfigService; + private final DlmsHelper dlmsHelper; - public SetSpecificAttributeValueCommandExecutor(final ObjectConfigService objectConfigService) { + public SetSpecificAttributeValueCommandExecutor( + final ObjectConfigService objectConfigService, final DlmsHelper dlmsHelper) { super(SetSpecificAttributeValueRequestDto.class); this.objectConfigService = objectConfigService; + this.dlmsHelper = dlmsHelper; } @Override @@ -54,7 +60,45 @@ public Void execute( final MessageMetadata messageMetadata) throws FunctionalException, ProtocolAdapterException { - final DlmsObjectType objectType = DlmsObjectType.valueOf(requestData.getObjectType()); + final List setParameters = + this.getSetParameters(device, requestData.getValuesToSet()); + + conn.getDlmsMessageListener() + .setDescription( + "Setting value(s) in " + + JdlmsObjectToStringUtil.describeAttributes( + setParameters.stream() + .map(SetParameter::getAttributeAddress) + .toArray(AttributeAddress[]::new))); + + final List resultCodes = + this.dlmsHelper.setWithList(conn, device, setParameters); + + if (resultCodes.isEmpty()) { + throw new ProtocolAdapterException("No resultCodes received while setting values"); + } + + if (!resultCodes.stream().allMatch(code -> code.equals(AccessResultCode.SUCCESS))) { + log.debug("Result of set specific value is {}", resultCodes); + throw new ProtocolAdapterException("Set specific value resulted in: " + resultCodes); + } + + return null; + } + + private List getSetParameters( + final DlmsDevice device, final List valueToSetDtos) + throws ProtocolAdapterException { + final List setParameters = new ArrayList<>(); + for (final ValueToSetDto valueToSetDto : valueToSetDtos) { + setParameters.add(this.getSetParameter(device, valueToSetDto)); + } + return setParameters; + } + + private SetParameter getSetParameter(final DlmsDevice device, final ValueToSetDto valueToSetDto) + throws ProtocolAdapterException { + final DlmsObjectType objectType = DlmsObjectType.valueOf(valueToSetDto.getObjectType()); final CosemObject cosemObject; try { cosemObject = @@ -64,20 +108,27 @@ public Void execute( throw new ProtocolAdapterException(AbstractCommandExecutor.ERROR_IN_OBJECT_CONFIG, e); } - final Attribute attribute = cosemObject.getAttribute(requestData.getAttribute()); + log.debug( + "Set specific attribute value, class id: {}, obis code: {}, attribute id: {}, value: {}", + cosemObject.getClassId(), + cosemObject.getObis(), + valueToSetDto.getAttribute(), + valueToSetDto.getIntValue()); + + final Attribute attribute = cosemObject.getAttribute(valueToSetDto.getAttribute()); final DlmsDataType dataType = attribute.getDatatype(); final DataObject data = switch (dataType) { - case UNSIGNED -> DataObject.newUInteger8Data(requestData.getIntValue().shortValue()); - case LONG_UNSIGNED -> DataObject.newUInteger16Data(requestData.getIntValue()); - case DOUBLE_LONG_UNSIGNED -> DataObject.newUInteger32Data(requestData.getIntValue()); - case LONG64_UNSIGNED -> DataObject.newUInteger64Data(requestData.getIntValue()); - case INTEGER -> DataObject.newInteger8Data(requestData.getIntValue().byteValue()); - case LONG -> DataObject.newInteger16Data(requestData.getIntValue().shortValue()); - case DOUBLE_LONG -> DataObject.newInteger32Data(requestData.getIntValue()); - case LONG64 -> DataObject.newInteger64Data(requestData.getIntValue()); + case UNSIGNED -> DataObject.newUInteger8Data(valueToSetDto.getIntValue().shortValue()); + case LONG_UNSIGNED -> DataObject.newUInteger16Data(valueToSetDto.getIntValue()); + case DOUBLE_LONG_UNSIGNED -> DataObject.newUInteger32Data(valueToSetDto.getIntValue()); + case LONG64_UNSIGNED -> DataObject.newUInteger64Data(valueToSetDto.getIntValue()); + case INTEGER -> DataObject.newInteger8Data(valueToSetDto.getIntValue().byteValue()); + case LONG -> DataObject.newInteger16Data(valueToSetDto.getIntValue().shortValue()); + case DOUBLE_LONG -> DataObject.newInteger32Data(valueToSetDto.getIntValue()); + case LONG64 -> DataObject.newInteger64Data(valueToSetDto.getIntValue()); default -> throw new ProtocolAdapterException( "Datatype " + dataType.name() + " not supported for integer value"); @@ -87,29 +138,8 @@ public Void execute( new AttributeAddress( cosemObject.getClassId(), new ObisCode(cosemObject.getObis()), - requestData.getAttribute()); - final SetParameter setParameter = new SetParameter(attributeAddress, data); + valueToSetDto.getAttribute()); - conn.getDlmsMessageListener() - .setDescription( - "Setting value in " - + requestData.getObjectType() - + ", set attribute: " - + JdlmsObjectToStringUtil.describeAttributes(attributeAddress)); - - log.debug( - "Set specific attribute value, class id: {}, obis code: {}, attribute id: {}, value: {}", - cosemObject.getClassId(), - cosemObject.getObis(), - requestData.getAttribute(), - requestData.getIntValue()); - - try { - conn.getConnection().set(setParameter); - } catch (final IOException e) { - throw new ConnectionException(e); - } - - return null; + return new SetParameter(attributeAddress, data); } } diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/test/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutorTest.java b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/test/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutorTest.java index 8854ea56641..560c9fcf67b 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/test/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutorTest.java +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/test/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/misc/SetSpecificAttributeValueCommandExecutorTest.java @@ -10,6 +10,7 @@ import static org.mockito.Mockito.when; import java.io.IOException; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -24,6 +25,7 @@ import org.openmuc.jdlms.DlmsConnection; import org.openmuc.jdlms.SetParameter; import org.openmuc.jdlms.datatypes.DataObject; +import org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.utils.DlmsHelper; import org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice; import org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.Protocol; import org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.DlmsConnectionManager; @@ -31,6 +33,7 @@ import org.opensmartgridplatform.dlms.exceptions.ObjectConfigException; import org.opensmartgridplatform.dlms.services.ObjectConfigService; import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetSpecificAttributeValueRequestDto; +import org.opensmartgridplatform.dto.valueobjects.smartmetering.ValueToSetDto; import org.opensmartgridplatform.shared.infra.jms.MessageMetadata; @ExtendWith(MockitoExtension.class) @@ -44,18 +47,24 @@ class SetSpecificAttributeValueCommandExecutorTest { @Mock private DlmsConnection dlmsConnection; - @Captor private ArgumentCaptor setParameterArgumentCaptor; + @Captor private ArgumentCaptor> setParameterArgumentCaptor; private static final String WATCHDOG_OBJECT_TYPE = "WATCHDOG_TIMER"; - private static final String WATCHDOG_TIMER_OBIS = "0.1.94.31.2.255"; + private static final String WATCHDOG_OBIS = "0.1.94.31.2.255"; private static final int CLASS_ID = 1; private static final int ATTRIBUTE_ID = 2; private static final int VALUE = 25; + private static final String THRESHOLD_OBJECT_TYPE = "THRESHOLD_VOLTAGE_SWELL"; + private static final String THRESHOLD_OBIS = "1.0.12.35.0.255"; + private static final int CLASS_ID_THRESHOLD = 3; + private static final int ATTRIBUTE_ID_THRESHOLD = 2; + private static final int VALUE_THRESHOLD = 100; @BeforeEach void setUp() throws IOException, ObjectConfigException { final ObjectConfigService objectConfigService = new ObjectConfigService(); - this.executor = new SetSpecificAttributeValueCommandExecutor(objectConfigService); + final DlmsHelper dlmsHelper = new DlmsHelper(); + this.executor = new SetSpecificAttributeValueCommandExecutor(objectConfigService, dlmsHelper); } @ParameterizedTest @@ -63,35 +72,81 @@ void setUp() throws IOException, ObjectConfigException { value = Protocol.class, names = {"DSMR_2_2", "OTHER_PROTOCOL"}, mode = EnumSource.Mode.EXCLUDE) - void testExecute(final Protocol protocol) throws Exception { + void testExecuteOneObject(final Protocol protocol) throws Exception { final DlmsDevice testDevice = new DlmsDevice(); testDevice.setProtocol(protocol); testDevice.setWithListMax(1); final SetSpecificAttributeValueRequestDto requestData = - new SetSpecificAttributeValueRequestDto(WATCHDOG_OBJECT_TYPE, ATTRIBUTE_ID, VALUE); + new SetSpecificAttributeValueRequestDto( + List.of(new ValueToSetDto(WATCHDOG_OBJECT_TYPE, ATTRIBUTE_ID, VALUE))); final AttributeAddress attributeAddress = - new AttributeAddress(CLASS_ID, this.WATCHDOG_TIMER_OBIS, ATTRIBUTE_ID, null); + new AttributeAddress(CLASS_ID, this.WATCHDOG_OBIS, ATTRIBUTE_ID, null); final SetParameter expectedSetParameter = new SetParameter(attributeAddress, DataObject.newUInteger16Data(VALUE)); when(this.connectionManager.getDlmsMessageListener()).thenReturn(this.dlmsMessageListener); when(this.connectionManager.getConnection()).thenReturn(this.dlmsConnection); when(this.dlmsConnection.set(this.setParameterArgumentCaptor.capture())) - .thenReturn(AccessResultCode.SUCCESS); + .thenReturn(List.of(AccessResultCode.SUCCESS)); // CALL this.executor.execute( this.connectionManager, testDevice, requestData, mock(MessageMetadata.class)); // VERIFY - assertThat(this.setParameterArgumentCaptor.getValue()) + assertThat(this.setParameterArgumentCaptor.getValue().get(0)) .usingRecursiveComparison() .isEqualTo(expectedSetParameter); } + @ParameterizedTest + @EnumSource( + value = Protocol.class, + names = {"DSMR_2_2", "OTHER_PROTOCOL"}, + mode = EnumSource.Mode.EXCLUDE) + void testExecuteMultipleObjects(final Protocol protocol) throws Exception { + + final DlmsDevice testDevice = new DlmsDevice(); + testDevice.setProtocol(protocol); + testDevice.setWithListMax(2); + + final SetSpecificAttributeValueRequestDto requestData = + new SetSpecificAttributeValueRequestDto( + List.of( + new ValueToSetDto(WATCHDOG_OBJECT_TYPE, ATTRIBUTE_ID, VALUE), + new ValueToSetDto(THRESHOLD_OBJECT_TYPE, ATTRIBUTE_ID_THRESHOLD, VALUE_THRESHOLD))); + + final AttributeAddress attributeAddressWatchdog = + new AttributeAddress(CLASS_ID, this.WATCHDOG_OBIS, ATTRIBUTE_ID, null); + final SetParameter expectedSetParameterWatchdog = + new SetParameter(attributeAddressWatchdog, DataObject.newUInteger16Data(VALUE)); + + final AttributeAddress attributeAddressThreshold = + new AttributeAddress(CLASS_ID_THRESHOLD, this.THRESHOLD_OBIS, ATTRIBUTE_ID_THRESHOLD, null); + final SetParameter expectedSetParameterThreshold = + new SetParameter(attributeAddressThreshold, DataObject.newUInteger16Data(VALUE_THRESHOLD)); + + when(this.connectionManager.getDlmsMessageListener()).thenReturn(this.dlmsMessageListener); + when(this.connectionManager.getConnection()).thenReturn(this.dlmsConnection); + when(this.dlmsConnection.set(this.setParameterArgumentCaptor.capture())) + .thenReturn(List.of(AccessResultCode.SUCCESS)); + + // CALL + this.executor.execute( + this.connectionManager, testDevice, requestData, mock(MessageMetadata.class)); + + // VERIFY + assertThat(this.setParameterArgumentCaptor.getValue().get(0)) + .usingRecursiveComparison() + .isEqualTo(expectedSetParameterWatchdog); + assertThat(this.setParameterArgumentCaptor.getValue().get(1)) + .usingRecursiveComparison() + .isEqualTo(expectedSetParameterThreshold); + } + @Test void testExecuteNoObject() { @@ -99,7 +154,8 @@ void testExecuteNoObject() { testDevice.setProtocol(Protocol.DSMR_2_2); final SetSpecificAttributeValueRequestDto requestData = - new SetSpecificAttributeValueRequestDto(WATCHDOG_OBJECT_TYPE, ATTRIBUTE_ID, VALUE); + new SetSpecificAttributeValueRequestDto( + List.of(new ValueToSetDto(WATCHDOG_OBJECT_TYPE, ATTRIBUTE_ID, VALUE))); // CALL assertThrows( diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/simulator/dlms-device-simulator/src/main/java/org/opensmartgridplatform/simulator/protocol/dlms/server/profile/DefaultDeviceProfile.java b/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/simulator/dlms-device-simulator/src/main/java/org/opensmartgridplatform/simulator/protocol/dlms/server/profile/DefaultDeviceProfile.java index 309d3ee2817..7075cf9fd6f 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/simulator/dlms-device-simulator/src/main/java/org/opensmartgridplatform/simulator/protocol/dlms/server/profile/DefaultDeviceProfile.java +++ b/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/simulator/dlms-device-simulator/src/main/java/org/opensmartgridplatform/simulator/protocol/dlms/server/profile/DefaultDeviceProfile.java @@ -1197,6 +1197,26 @@ public LongUnsignedData numberOfVoltageSwellsInPhaseL3() { return new LongUnsignedData(NUMBER_OF_VOLTAGE_SWELLS_IN_PHASE_L3_LOGICAL_NAME, 1); } + @Bean + public LongUnsignedRegister thresholdVoltageSwellValue() { + return new LongUnsignedRegister("1.0.12.35.0.255", 253, 0, UnitType.VOLT); + } + + @Bean + public LongUnsignedRegister timeThresholdVoltageSwellValue() { + return new LongUnsignedRegister("1.0.12.44.0.255", 30, 0, UnitType.SECONDS); + } + + @Bean + public LongUnsignedRegister thresholdVoltageSagValue() { + return new LongUnsignedRegister("1.0.12.31.0.255", 207, 0, UnitType.VOLT); + } + + @Bean + public LongUnsignedRegister timeThresholdVoltageSagValue() { + return new LongUnsignedRegister("1.0.12.43.0.255", 30, 0, UnitType.SECONDS); + } + @Bean public LongUnsignedRegister instantaneousCurrentSumOfAllPhases() { return new LongUnsignedRegister("1.0.90.7.0.255", 1, 0, UnitType.AMPERE); diff --git a/osgp/shared/osgp-dto/src/main/java/org/opensmartgridplatform/dto/valueobjects/smartmetering/SetSpecificAttributeValueRequestDto.java b/osgp/shared/osgp-dto/src/main/java/org/opensmartgridplatform/dto/valueobjects/smartmetering/SetSpecificAttributeValueRequestDto.java index aa09864e6d1..07050c1be09 100644 --- a/osgp/shared/osgp-dto/src/main/java/org/opensmartgridplatform/dto/valueobjects/smartmetering/SetSpecificAttributeValueRequestDto.java +++ b/osgp/shared/osgp-dto/src/main/java/org/opensmartgridplatform/dto/valueobjects/smartmetering/SetSpecificAttributeValueRequestDto.java @@ -5,22 +5,20 @@ package org.opensmartgridplatform.dto.valueobjects.smartmetering; import java.io.Serial; -import lombok.Getter; +import java.util.ArrayList; +import java.util.List; -@Getter public class SetSpecificAttributeValueRequestDto implements ActionRequestDto { @Serial private static final long serialVersionUID = 6091630820323702494L; - private final String objectType; - private final int attribute; - private final Integer intValue; + private final List valuesToSet; - public SetSpecificAttributeValueRequestDto( - final String objectType, final int attribute, final Integer intValue) { - super(); - this.objectType = objectType; - this.attribute = attribute; - this.intValue = intValue; + public SetSpecificAttributeValueRequestDto(final List valuesToSet) { + this.valuesToSet = new ArrayList<>(valuesToSet); + } + + public List getValuesToSet() { + return new ArrayList<>(this.valuesToSet); } } diff --git a/osgp/shared/osgp-dto/src/main/java/org/opensmartgridplatform/dto/valueobjects/smartmetering/ValueToSetDto.java b/osgp/shared/osgp-dto/src/main/java/org/opensmartgridplatform/dto/valueobjects/smartmetering/ValueToSetDto.java new file mode 100644 index 00000000000..5e263f8c468 --- /dev/null +++ b/osgp/shared/osgp-dto/src/main/java/org/opensmartgridplatform/dto/valueobjects/smartmetering/ValueToSetDto.java @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: Copyright Contributors to the GXF project +// +// SPDX-License-Identifier: Apache-2.0 + +package org.opensmartgridplatform.dto.valueobjects.smartmetering; + +import java.io.Serial; +import java.io.Serializable; +import lombok.Getter; + +@Getter +public class ValueToSetDto implements Serializable { + + @Serial private static final long serialVersionUID = -2663395295387396979L; + + private final String objectType; + private final int attribute; + private final Integer intValue; + + public ValueToSetDto(final String objectType, final int attribute, final Integer intValue) { + this.objectType = objectType; + this.attribute = attribute; + this.intValue = intValue; + } +} diff --git a/osgp/shared/osgp-ws-smartmetering/src/main/resources/schemas/adhoc-ws-smartmetering.xsd b/osgp/shared/osgp-ws-smartmetering/src/main/resources/schemas/adhoc-ws-smartmetering.xsd index b7e86114ea5..9dc03f488ba 100644 --- a/osgp/shared/osgp-ws-smartmetering/src/main/resources/schemas/adhoc-ws-smartmetering.xsd +++ b/osgp/shared/osgp-ws-smartmetering/src/main/resources/schemas/adhoc-ws-smartmetering.xsd @@ -243,9 +243,7 @@ - - - + @@ -259,9 +257,20 @@ + + + + + + + + + + +