Search in sources :

Example 1 with BdaFloat32

use of org.openmuc.openiec61850.BdaFloat32 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 BdaFloat32

use of org.openmuc.openiec61850.BdaFloat32 in project Protocol-Adapter-IEC61850 by OSGP.

the class NodeContainer method writeFloat.

public void writeFloat(final SubDataAttribute child, final Float value) throws NodeWriteException {
    final BdaFloat32 bdaFloat = (BdaFloat32) this.parent.getChild(child.getDescription());
    bdaFloat.setFloat(value);
    this.writeNode(bdaFloat);
}
Also used : BdaFloat32(org.openmuc.openiec61850.BdaFloat32)

Example 3 with BdaFloat32

use of org.openmuc.openiec61850.BdaFloat32 in project Protocol-Adapter-IEC61850 by OSGP.

the class NodeContainer method getFloatArray.

public Float[] getFloatArray(final SubDataAttribute child) {
    final Array array = (Array) this.parent.getChild(child.getDescription());
    final int size = array.size();
    final Float[] result = new Float[size];
    for (int i = 0; i < size; i++) {
        result[i] = ((BdaFloat32) array.getChild(i)).getFloat();
    }
    return result;
}
Also used : Array(org.openmuc.openiec61850.Array)

Example 4 with BdaFloat32

use of org.openmuc.openiec61850.BdaFloat32 in project Protocol-Adapter-IEC61850 by OSGP.

the class LogicalDevice method setFixedFloat.

protected BasicDataAttribute setFixedFloat(final String node, final Fc fc, final float val) {
    final BdaFloat32 value = (BdaFloat32) this.serverModel.findModelNode(this.createNodeName(node), fc);
    value.setFloat(val);
    return value;
}
Also used : BdaFloat32(org.openmuc.openiec61850.BdaFloat32)

Example 5 with BdaFloat32

use of org.openmuc.openiec61850.BdaFloat32 in project Protocol-Adapter-IEC61850 by OSGP.

the class LogicalDevice method setRandomFloat.

protected BasicDataAttribute setRandomFloat(final String node, final Fc fc, final int min, final int max) {
    final BdaFloat32 value = (BdaFloat32) this.serverModel.findModelNode(this.createNodeName(node), fc);
    value.setFloat((float) ThreadLocalRandom.current().nextInt(min, max));
    return value;
}
Also used : BdaFloat32(org.openmuc.openiec61850.BdaFloat32)

Aggregations

BdaFloat32 (org.openmuc.openiec61850.BdaFloat32)5 Array (org.openmuc.openiec61850.Array)2 NodeWriteException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException)1 BigDecimal (java.math.BigDecimal)1 MathContext (java.math.MathContext)1 Date (java.util.Date)1 FcModelNode (org.openmuc.openiec61850.FcModelNode)1 ModelNode (org.openmuc.openiec61850.ModelNode)1 DataSampleDto (org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto)1