Search in sources :

Example 1 with TimestampMeasurementElement

use of org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement 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 2 with TimestampMeasurementElement

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

the class DomainDistributionAutomationMapperTest method testTimestampMeasurementElementMapping.

@Test
public void testTimestampMeasurementElementMapping() {
    // Arrange
    final long value = 1556808340428l;
    final TimestampMeasurementElement expected = new TimestampMeasurementElement(value);
    final TimestampMeasurementElementDto dtoMeasurementElement = new TimestampMeasurementElementDto(value);
    // Act
    final TimestampMeasurementElement actual = this.mapper.map(dtoMeasurementElement, TimestampMeasurementElement.class);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : TimestampMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.TimestampMeasurementElementDto) TimestampMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement) Test(org.junit.jupiter.api.Test)

Example 3 with TimestampMeasurementElement

use of org.opensmartgridplatform.domain.da.measurements.elements.TimestampMeasurementElement 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

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