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);
}
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);
}
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;
}
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;
}
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;
}
Aggregations