use of com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Rtu in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addRtuDevices.
private void addRtuDevices(final ServerModel serverModel) {
final String rtuPrefix = "RTU";
int i = 1;
String logicalDeviceName = rtuPrefix + i;
ModelNode rtuNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (rtuNode != null) {
this.logicalDevices.add(new Rtu(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = rtuPrefix + i;
rtuNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Rtu in project Protocol-Adapter-IEC61850 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(node);
if (actual == null) {
throw new AssertionError("RTU Simulator does not have expected node \"" + node + "\" on logical device \"" + logicalDeviceName + "\".");
}
if (!(actual instanceof BasicDataAttribute)) {
throw new AssertionError("RTU Simulator value has node \"" + node + "\" on logical device \"" + 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 + "\" on logical device \"" + logicalDeviceName + "\" - expected: [" + expected + "], actual: [" + actual + "]");
}
}
Aggregations