Search in sources :

Example 6 with ModelNode

use of org.openmuc.openiec61850.ModelNode 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 7 with ModelNode

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

the class RtuSimulator method addEngineDevices.

private void addEngineDevices(final ServerModel serverModel) {
    final String enginePrefix = "ENGINE";
    int i = 1;
    String logicalDeviceName = enginePrefix + i;
    ModelNode engineNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    while (engineNode != null) {
        this.logicalDevices.add(new Engine(this.getDeviceName(), logicalDeviceName, serverModel));
        i += 1;
        logicalDeviceName = enginePrefix + i;
        engineNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    }
}
Also used : ModelNode(org.openmuc.openiec61850.ModelNode) Engine(com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Engine)

Example 8 with ModelNode

use of org.openmuc.openiec61850.ModelNode 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)

Example 9 with ModelNode

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

the class RtuSimulator method addGasFurnaceDevices.

private void addGasFurnaceDevices(final ServerModel serverModel) {
    final String gasFurnacePrefix = "GAS_FURNACE";
    int i = 1;
    String logicalDeviceName = gasFurnacePrefix + i;
    ModelNode gasFurnaceNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    while (gasFurnaceNode != null) {
        this.logicalDevices.add(new GasFurnace(this.getDeviceName(), logicalDeviceName, serverModel));
        i += 1;
        logicalDeviceName = gasFurnacePrefix + i;
        gasFurnaceNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    }
}
Also used : GasFurnace(com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.GasFurnace) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 10 with ModelNode

use of org.openmuc.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 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);
    }
}
Also used : ModelNode(org.openmuc.openiec61850.ModelNode) HeatBuffer(com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.HeatBuffer)

Aggregations

ModelNode (org.openmuc.openiec61850.ModelNode)25 ServerModel (org.openmuc.openiec61850.ServerModel)11 FcModelNode (org.openmuc.openiec61850.FcModelNode)5 ArrayList (java.util.ArrayList)3 DataSampleDto (org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto)3 NodeReadException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeReadException)1 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)1 Iec61850Connection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850Connection)1 Battery (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Battery)1 Boiler (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Boiler)1 Chp (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Chp)1 Engine (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Engine)1 GasFurnace (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.GasFurnace)1 HeatBuffer (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.HeatBuffer)1 HeatPump (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.HeatPump)1 Load (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Load)1 LogicalDevice (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.LogicalDevice)1 Pv (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Pv)1 Rtu (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Rtu)1 BigDecimal (java.math.BigDecimal)1