Search in sources :

Example 6 with ModelNode

use of com.beanit.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 com.beanit.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 com.beanit.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 com.beanit.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 com.beanit.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 ModelNode (com.beanit.openiec61850.ModelNode)20 ServerModel (org.openmuc.openiec61850.ServerModel)10 ArrayList (java.util.ArrayList)7 FcModelNode (com.beanit.openiec61850.FcModelNode)5 DataSampleDto (org.opensmartgridplatform.dto.da.iec61850.DataSampleDto)4 BdaFloat32 (com.beanit.openiec61850.BdaFloat32)3 BigDecimal (java.math.BigDecimal)3 MathContext (java.math.MathContext)3 FcModelNode (org.openmuc.openiec61850.FcModelNode)3 DataSampleDto (org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto)3 BasicDataAttribute (com.beanit.openiec61850.BasicDataAttribute)2 BdaTimestamp (com.beanit.openiec61850.BdaTimestamp)2 ServerModel (com.beanit.openiec61850.ServerModel)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 LightMeasurementRtu (org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.LightMeasurementRtu)2