use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class RtuSimulator method assertValue.
public void assertValue(final String logicalDeviceName, final String node, final String value) {
final LogicalDevice logicalDevice = this.getLogicalDevice(logicalDeviceName);
// Get a new model copy to see values that have been set on the server.
logicalDevice.refreshServerModel(this.server.getModelCopy());
final ModelNode actual = logicalDevice.getBasicDataAttribute(LogicalDeviceNode.fromDescription(node));
final String onLogicalDevice = "\" on logical device \"";
if (actual == null) {
throw new AssertionError("RTU Simulator does not have expected node \"" + node + onLogicalDevice + logicalDeviceName + "\".");
}
if (!(actual instanceof BasicDataAttribute)) {
throw new AssertionError("RTU Simulator value has node \"" + node + onLogicalDevice + logicalDeviceName + "\", but it is not a BasicDataAttribute: " + actual.getClass().getName());
}
final BasicDataAttribute expected = this.getCopyWithNewValue((BasicDataAttribute) actual, value);
if (!BasicDataAttributesHelper.attributesEqual(expected, (BasicDataAttribute) actual)) {
throw new AssertionError("RTU Simulator attribute for node \"" + node + onLogicalDevice + logicalDeviceName + "\" - expected: [" + expected + "], actual: [" + actual + "]");
}
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addHeatBufferDevices.
private void addHeatBufferDevices(final ServerModel serverModel) {
final String heatBufferPrefix = "HEAT_BUFFER";
int i = 1;
String logicalDeviceName = heatBufferPrefix + i;
ModelNode heatBufferNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (heatBufferNode != null) {
this.logicalDevices.add(new HeatBuffer(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = heatBufferPrefix + i;
heatBufferNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850DeviceConnectionService method getModelNode.
private FcModelNode getModelNode(final String logicalDevice, final Iec61850Connection iec61850Connection, final String description) throws ProtocolAdapterException {
final ServerModel serverModel = iec61850Connection.getServerModel();
if (serverModel == null) {
final String msg = String.format("ServerModel is null for logicalDevice {%s}", logicalDevice);
throw new ProtocolAdapterException(msg);
}
final String objRef = description + logicalDevice + "/" + LogicalNode.LOGICAL_NODE_ZERO.getDescription() + "." + DataAttribute.NAME_PLATE.getDescription();
final FcModelNode modelNode = (FcModelNode) serverModel.findModelNode(objRef, Fc.DC);
if (modelNode == null) {
final String msg = String.format("ModelNode is null for {%s}", objRef);
throw new ProtocolAdapterException(msg);
}
return modelNode;
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class Node method getChangedTimestampAttributeForNode.
private BasicDataAttribute getChangedTimestampAttributeForNode(final ModelNode node) {
final BdaTimestamp bda = (BdaTimestamp) node;
bda.setCurrentTime();
return bda;
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform 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<>());
}
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;
}
Aggregations