Search in sources :

Example 1 with DataSampleDto

use of org.opensmartgridplatform.dto.da.iec61850.DataSampleDto in project Protocol-Adapter-IEC61850 by OSGP.

the class DistributionAutomationGetPQValuesRequestMessageProcessor method processPQValue.

private DataSampleDto processPQValue(final ModelNode node) {
    Date ts = null;
    String type = null;
    BigDecimal value = null;
    if (node.getChildren() != null) {
        ts = this.findBdaTimestampNodeValue(node);
        final ModelNode floatNode = this.findBdaFloat32NodeInConstructedDataAttribute(node);
        if (floatNode != null) {
            type = node.getName() + "." + floatNode.getParent().getName() + "." + floatNode.getName();
            value = new BigDecimal(((BdaFloat32) floatNode).getFloat(), new MathContext(3, RoundingMode.HALF_EVEN));
        }
    }
    return new DataSampleDto(type, ts, value);
}
Also used : DataSampleDto(org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto) BdaFloat32(org.openmuc.openiec61850.BdaFloat32) FcModelNode(org.openmuc.openiec61850.FcModelNode) ModelNode(org.openmuc.openiec61850.ModelNode) Date(java.util.Date) BigDecimal(java.math.BigDecimal) MathContext(java.math.MathContext)

Example 2 with DataSampleDto

use of org.opensmartgridplatform.dto.da.iec61850.DataSampleDto in project open-smart-grid-platform by OSGP.

the class DistributionAutomationGetPQValuesRequestMessageProcessor method processPQValue.

private DataSampleDto processPQValue(final ModelNode node) {
    Date ts = null;
    String type = null;
    BigDecimal value = null;
    if (node.getChildren() != null) {
        ts = this.findBdaTimestampNodeValue(node);
        final ModelNode floatNode = this.findBdaFloat32NodeInConstructedDataAttribute(node);
        if (floatNode != null) {
            type = node.getName() + "." + floatNode.getParent().getName() + "." + floatNode.getName();
            value = new BigDecimal(((BdaFloat32) floatNode).getFloat(), new MathContext(3, RoundingMode.HALF_EVEN));
        }
    }
    return new DataSampleDto(type, ts, value);
}
Also used : DataSampleDto(org.opensmartgridplatform.dto.da.iec61850.DataSampleDto) BdaFloat32(com.beanit.openiec61850.BdaFloat32) FcModelNode(com.beanit.openiec61850.FcModelNode) ModelNode(com.beanit.openiec61850.ModelNode) Date(java.util.Date) BigDecimal(java.math.BigDecimal) MathContext(java.math.MathContext)

Example 3 with DataSampleDto

use of org.opensmartgridplatform.dto.da.iec61850.DataSampleDto in project open-smart-grid-platform by OSGP.

the class DistributionAutomationGetPQValuesRequestMessageProcessor method processPQValuesFunctionalChildConstraintObject.

private List<DataSampleDto> processPQValuesFunctionalChildConstraintObject(final LogicalNode parentNode, final String childName, final Fc constraint) {
    final List<DataSampleDto> data = new ArrayList<>();
    final ModelNode node = parentNode.getChild(childName, constraint);
    if (Fc.MX == constraint && node.getChildren() != null) {
        if (this.nodeHasBdaQualityChild(node)) {
            data.add(this.processPQValue(node));
        } else {
            for (final ModelNode subNode : node.getChildren()) {
                data.add(this.processPQValue(node, subNode));
            }
        }
    }
    return data;
}
Also used : DataSampleDto(org.opensmartgridplatform.dto.da.iec61850.DataSampleDto) ArrayList(java.util.ArrayList) FcModelNode(com.beanit.openiec61850.FcModelNode) ModelNode(com.beanit.openiec61850.ModelNode)

Example 4 with DataSampleDto

use of org.opensmartgridplatform.dto.da.iec61850.DataSampleDto in project open-smart-grid-platform by OSGP.

the class Iec61850ClientDaRTUEventListener method processSingleMeasurementNode.

private void processSingleMeasurementNode(final FcModelNode member, final LogicalNode logicalNode, final ModelNode childNode) {
    final BdaFloat32 singleMeasurement = this.getSingleMeasurementModelNode(childNode);
    final BdaTimestamp timestampMeasurement = this.getTimestampModelNode(childNode);
    String type = member.getName() + "." + childNode.getName();
    type += "." + singleMeasurement.getParent().getParent().getName() + "." + singleMeasurement.getParent().getName() + "." + singleMeasurement.getName();
    final BigDecimal value = new BigDecimal(singleMeasurement.getFloat(), new MathContext(3, RoundingMode.HALF_EVEN));
    final DataSampleDto sample = new DataSampleDto(type, timestampMeasurement.getDate(), value);
    logicalNode.getDataSamples().add(sample);
}
Also used : DataSampleDto(org.opensmartgridplatform.dto.da.iec61850.DataSampleDto) BdaTimestamp(com.beanit.openiec61850.BdaTimestamp) BdaFloat32(com.beanit.openiec61850.BdaFloat32) BigDecimal(java.math.BigDecimal) MathContext(java.math.MathContext)

Example 5 with DataSampleDto

use of org.opensmartgridplatform.dto.da.iec61850.DataSampleDto in project open-smart-grid-platform by OSGP.

the class Iec61850ClientDaRTUEventListener method processTotalMeasurementNode.

private void processTotalMeasurementNode(final FcModelNode member, final LogicalNode logicalNode) {
    final BdaFloat32 totalMeasurement = this.getTotalMeasurementModelNode(member);
    final BdaTimestamp timestampMeasurement = this.getTimestampModelNode(member);
    String type = member.getName();
    type += "." + totalMeasurement.getParent().getName() + "." + totalMeasurement.getName();
    final BigDecimal value = new BigDecimal(totalMeasurement.getFloat(), new MathContext(3, RoundingMode.HALF_EVEN));
    final DataSampleDto sample = new DataSampleDto(type, timestampMeasurement.getDate(), value);
    logicalNode.getDataSamples().add(sample);
}
Also used : DataSampleDto(org.opensmartgridplatform.dto.da.iec61850.DataSampleDto) BdaTimestamp(com.beanit.openiec61850.BdaTimestamp) BdaFloat32(com.beanit.openiec61850.BdaFloat32) BigDecimal(java.math.BigDecimal) MathContext(java.math.MathContext)

Aggregations

DataSampleDto (org.opensmartgridplatform.dto.da.iec61850.DataSampleDto)5 BigDecimal (java.math.BigDecimal)4 MathContext (java.math.MathContext)4 ArrayList (java.util.ArrayList)4 BdaFloat32 (com.beanit.openiec61850.BdaFloat32)3 FcModelNode (com.beanit.openiec61850.FcModelNode)3 ModelNode (com.beanit.openiec61850.ModelNode)3 FcModelNode (org.openmuc.openiec61850.FcModelNode)3 ModelNode (org.openmuc.openiec61850.ModelNode)3 DataSampleDto (org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto)3 BdaTimestamp (com.beanit.openiec61850.BdaTimestamp)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 BdaFloat32 (org.openmuc.openiec61850.BdaFloat32)1 Fc (org.openmuc.openiec61850.Fc)1