Search in sources :

Example 6 with BdaFloat32

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

the class NodeContainer method writeFloatArray.

public void writeFloatArray(final SubDataAttribute child, final Float[] values) throws NodeWriteException {
    final Array array = (Array) this.parent.getChild(child.getDescription());
    if (array.size() != values.length) {
        throw new NodeWriteException(String.format("Invalid array size %d. Size on device is %d", values.length, array.size()));
    }
    for (int i = 0; i < values.length; i++) {
        final BdaFloat32 bdaFloat = (BdaFloat32) array.getChild(i);
        bdaFloat.setFloat(values[i]);
        this.writeNode(bdaFloat);
    }
// Unfortunately writing an array using "this.writeNode(array);"
// doesn't seem to work...
// Therefore the items are written in individual calls...
}
Also used : Array(org.openmuc.openiec61850.Array) NodeWriteException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException) 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