Search in sources :

Example 1 with FloatMeasurementElementDto

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

the class IeShortFloatConverterTest method shouldConvertIeShortFloatToFloatMeasurementElementDto.

@Test
public void shouldConvertIeShortFloatToFloatMeasurementElementDto() {
    // Arrange
    final float value = 10.0f;
    final FloatMeasurementElementDto expected = new FloatMeasurementElementDto(value);
    final IeShortFloat source = new IeShortFloat(value);
    // Act
    final FloatMeasurementElementDto actual = this.converter.convert(source, null, null);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : FloatMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto) IeShortFloat(org.openmuc.j60870.ie.IeShortFloat) Test(org.junit.jupiter.api.Test)

Example 2 with FloatMeasurementElementDto

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

the class DomainDistributionAutomationMapperTest method testFloatingPointMeasurementElementMapping.

@Test
public void testFloatingPointMeasurementElementMapping() {
    // Arrange
    final float value = 83.4999f;
    final FloatMeasurementElement expected = new FloatMeasurementElement(value);
    final FloatMeasurementElementDto dtoMeasurementElement = new FloatMeasurementElementDto(value);
    // Act
    final FloatMeasurementElement actual = this.mapper.map(dtoMeasurementElement, FloatMeasurementElement.class);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : FloatMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto) FloatMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.FloatMeasurementElement) Test(org.junit.jupiter.api.Test)

Example 3 with FloatMeasurementElementDto

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

FloatMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto)3 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1 IeShortFloat (org.openmuc.j60870.ie.IeShortFloat)1 FloatMeasurementElement (org.opensmartgridplatform.domain.da.measurements.elements.FloatMeasurementElement)1 MeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.MeasurementElementDto)1 BitmaskMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto)1 TimestampMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.TimestampMeasurementElementDto)1