Search in sources :

Example 1 with Rtu

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);
    }
}
Also used : Rtu(com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Rtu) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 2 with Rtu

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 + "]");
    }
}
Also used : LogicalDevice(com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.LogicalDevice) BasicDataAttribute(org.openmuc.openiec61850.BasicDataAttribute) ModelNode(org.openmuc.openiec61850.ModelNode)

Aggregations

ModelNode (org.openmuc.openiec61850.ModelNode)2 LogicalDevice (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.LogicalDevice)1 Rtu (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Rtu)1 BasicDataAttribute (org.openmuc.openiec61850.BasicDataAttribute)1