Search in sources :

Example 6 with IeSinglePointWithQuality

use of org.openmuc.j60870.ie.IeSinglePointWithQuality in project open-smart-grid-platform by OSGP.

the class LightMeasurementDeviceAsduFactory method createInformationElementWithTimetag.

private InformationElement[][] createInformationElementWithTimetag(final boolean value, final long timestamp) {
    final TimeZone timeZone = TimeZone.getTimeZone(this.timeZoneString);
    final boolean invalid = false;
    return new InformationElement[][] { { new IeSinglePointWithQuality(value, false, false, false, false), new IeTime56(timestamp, timeZone, invalid) } };
}
Also used : IeSinglePointWithQuality(org.openmuc.j60870.ie.IeSinglePointWithQuality) TimeZone(java.util.TimeZone) IeTime56(org.openmuc.j60870.ie.IeTime56) InformationElement(org.openmuc.j60870.ie.InformationElement)

Example 7 with IeSinglePointWithQuality

use of org.openmuc.j60870.ie.IeSinglePointWithQuality in project open-smart-grid-platform by OSGP.

the class AsduSteps method aLightMeasurementOccursForAddress.

@When("a light measurement event occurs for address {int} with value {string}")
public void aLightMeasurementOccursForAddress(final int informationObjectAddress, final String informationElementValue) {
    final boolean on = "ON".equalsIgnoreCase(informationElementValue);
    final InformationObject[] informationObjects = { new InformationObject(informationObjectAddress, new IeSinglePointWithQuality(on, false, false, false, false), new IeTime56(System.currentTimeMillis(), TimeZone.getDefault(), false)) };
    final ASdu asdu = new ASdu(ASduType.M_SP_TB_1, false, CauseOfTransmission.SPONTANEOUS, false, false, 0, 1, informationObjects);
    this.connectionSteps.getConnectionEventListener().newASdu(asdu);
}
Also used : IeSinglePointWithQuality(org.openmuc.j60870.ie.IeSinglePointWithQuality) IeTime56(org.openmuc.j60870.ie.IeTime56) InformationObject(org.openmuc.j60870.ie.InformationObject) ASdu(org.openmuc.j60870.ASdu) When(io.cucumber.java.en.When)

Example 8 with IeSinglePointWithQuality

use of org.openmuc.j60870.ie.IeSinglePointWithQuality in project open-smart-grid-platform by OSGP.

the class IeSinglePointWithQualityConverterTest method testConvertIeSinglePointWithQualityInvalid.

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

Example 9 with IeSinglePointWithQuality

use of org.openmuc.j60870.ie.IeSinglePointWithQuality in project open-smart-grid-platform by OSGP.

the class IeSinglePointWithQualityConverterTest method testConvertIeSinglePointWithQualityNotTopical.

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

Aggregations

IeSinglePointWithQuality (org.openmuc.j60870.ie.IeSinglePointWithQuality)9 Test (org.junit.jupiter.api.Test)7 BitmaskMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto)7 IeTime56 (org.openmuc.j60870.ie.IeTime56)2 When (io.cucumber.java.en.When)1 TimeZone (java.util.TimeZone)1 ASdu (org.openmuc.j60870.ASdu)1 InformationElement (org.openmuc.j60870.ie.InformationElement)1 InformationObject (org.openmuc.j60870.ie.InformationObject)1