Search in sources :

Example 1 with DataSampleDto

use of org.osgpfoundation.osgp.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.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto in project Protocol-Adapter-IEC61850 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.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto) ArrayList(java.util.ArrayList) FcModelNode(org.openmuc.openiec61850.FcModelNode) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 3 with DataSampleDto

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

the class DistributionAutomationGetPQValuesRequestMessageProcessor method processPQValueNodeChildren.

private List<DataSampleDto> processPQValueNodeChildren(final LogicalNode node) {
    final List<DataSampleDto> data = new ArrayList<>();
    final Collection<ModelNode> children = node.getChildren();
    final Map<String, Set<Fc>> childMap = new HashMap<>();
    for (final ModelNode child : children) {
        if (!childMap.containsKey(child.getName())) {
            childMap.put(child.getName(), new HashSet<Fc>());
        }
        childMap.get(child.getName()).add(((FcModelNode) child).getFc());
    }
    for (final Map.Entry<String, Set<Fc>> childEntry : childMap.entrySet()) {
        final List<DataSampleDto> childData = this.processPQValuesFunctionalConstraintObject(node, childEntry.getKey(), childEntry.getValue());
        if (!childData.isEmpty()) {
            data.addAll(childData);
        }
    }
    return data;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DataSampleDto(org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto) FcModelNode(org.openmuc.openiec61850.FcModelNode) ModelNode(org.openmuc.openiec61850.ModelNode) Fc(org.openmuc.openiec61850.Fc) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

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