Search in sources :

Example 16 with BitmaskMeasurementElementDto

use of org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto in project open-smart-grid-platform by OSGP.

the class IeQualityConverterTest method shouldConvertIeQualityNoneToByte.

@Test
public void shouldConvertIeQualityNoneToByte() {
    // Arrange
    final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_NONE);
    final IeQuality source = new IeQuality(false, false, false, false, false);
    // Act
    final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : IeQuality(org.openmuc.j60870.ie.IeQuality) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Example 17 with BitmaskMeasurementElementDto

use of org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto in project open-smart-grid-platform by OSGP.

the class IeQualityConverterTest method shouldConvertIeQualityAllToByte.

@Test
public void shouldConvertIeQualityAllToByte() {
    // Arrange
    final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_ALL);
    final IeQuality source = new IeQuality(true, true, true, true, true);
    // Act
    final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : IeQuality(org.openmuc.j60870.ie.IeQuality) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Example 18 with BitmaskMeasurementElementDto

use of org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto in project open-smart-grid-platform by OSGP.

the class DtoMeasurementsFactory method gasFlowMeasurement.

public static MeasurementDto gasFlowMeasurement(final float gasFlow) {
    final BitmaskMeasurementElementDto flags = new BitmaskMeasurementElementDto((byte) 96);
    final TimestampMeasurementElementDto from = new TimestampMeasurementElementDto(1546800000501L);
    final TimestampMeasurementElementDto until = new TimestampMeasurementElementDto(1546700000444L);
    final FloatMeasurementElementDto cubicMeters = new FloatMeasurementElementDto(gasFlow);
    final List<MeasurementElementDto> measurementElements = new ArrayList<>();
    measurementElements.add(flags);
    measurementElements.add(from);
    measurementElements.add(until);
    measurementElements.add(cubicMeters);
    return DtoMeasurementsFactory.measurementFrom(measurementElements);
}
Also used : TimestampMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.TimestampMeasurementElementDto) FloatMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) TimestampMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.TimestampMeasurementElementDto) FloatMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto) MeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.MeasurementElementDto) ArrayList(java.util.ArrayList) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto)

Aggregations

BitmaskMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto)18 Test (org.junit.jupiter.api.Test)15 IeQuality (org.openmuc.j60870.ie.IeQuality)7 IeSinglePointWithQuality (org.openmuc.j60870.ie.IeSinglePointWithQuality)7 MeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.MeasurementElementDto)3 MeasurementDto (org.opensmartgridplatform.dto.da.measurements.MeasurementDto)2 MeasurementGroupDto (org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto)2 ArrayList (java.util.ArrayList)1 BitmaskMeasurementElement (org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement)1 FloatMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto)1 TimestampMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.TimestampMeasurementElementDto)1