Search in sources :

Example 1 with BitmaskMeasurementElement

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

the class DomainDistributionAutomationMapperTest method testBitmaskMeasurementElementMapping.

@Test
public void testBitmaskMeasurementElementMapping() {
    // Arrange
    final byte value = (byte) 40;
    final BitmaskMeasurementElement expected = new BitmaskMeasurementElement(value);
    final BitmaskMeasurementElementDto dtoMeasurementElement = new BitmaskMeasurementElementDto(value);
    // Act
    final BitmaskMeasurementElement actual = this.mapper.map(dtoMeasurementElement, BitmaskMeasurementElement.class);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : BitmaskMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Example 2 with BitmaskMeasurementElement

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

the class DomainMeasurementsFactory method gasFlowMeasurement.

public static Measurement gasFlowMeasurement(final float gasFlow) {
    final BitmaskMeasurementElement flags = new BitmaskMeasurementElement((byte) 96);
    final TimestampMeasurementElement from = new TimestampMeasurementElement(1546800000501l);
    final TimestampMeasurementElement until = new TimestampMeasurementElement(1546700000444l);
    final FloatMeasurementElement cubicMeters = new FloatMeasurementElement(gasFlow);
    final List<MeasurementElement> measurementElements = new ArrayList<>();
    measurementElements.add(flags);
    measurementElements.add(from);
    measurementElements.add(until);
    measurementElements.add(cubicMeters);
    return DomainMeasurementsFactory.measurementFrom(measurementElements);
}
Also used : BitmaskMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement) TimestampMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement) ArrayList(java.util.ArrayList) FloatMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.FloatMeasurementElement) BitmaskMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement) FloatMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.FloatMeasurementElement) TimestampMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement) MeasurementElement(org.opensmartgridplatform.domain.da.measurements.MeasurementElement)

Example 3 with BitmaskMeasurementElement

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

the class DomainMeasurementsFactory method gasFlowMeasurement.

public static Measurement gasFlowMeasurement(final float gasFlow) {
    final BitmaskMeasurementElement flags = new BitmaskMeasurementElement((byte) 96);
    final TimestampMeasurementElement from = new TimestampMeasurementElement(1546800000501l);
    final TimestampMeasurementElement until = new TimestampMeasurementElement(1546700000444l);
    final FloatMeasurementElement cubicMeters = new FloatMeasurementElement(gasFlow);
    final List<MeasurementElement> measurementElements = new ArrayList<>();
    measurementElements.add(flags);
    measurementElements.add(from);
    measurementElements.add(until);
    measurementElements.add(cubicMeters);
    return DomainMeasurementsFactory.measurementFrom(measurementElements);
}
Also used : BitmaskMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement) TimestampMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement) ArrayList(java.util.ArrayList) FloatMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.FloatMeasurementElement) BitmaskMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement) FloatMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.FloatMeasurementElement) TimestampMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement) MeasurementElement(org.opensmartgridplatform.domain.da.measurements.MeasurementElement)

Aggregations

BitmaskMeasurementElement (org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement)3 ArrayList (java.util.ArrayList)2 MeasurementElement (org.opensmartgridplatform.domain.da.measurements.MeasurementElement)2 FloatMeasurementElement (org.opensmartgridplatform.domain.da.measurements.elements.FloatMeasurementElement)2 TimestampMeasurementElement (org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement)2 Test (org.junit.jupiter.api.Test)1 BitmaskMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto)1