Search in sources :

Example 41 with ModelNode

use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.

the class RtuSimulator method addBoilerDevices.

private void addBoilerDevices(final ServerModel serverModel) {
    final String boilerPrefix = "BOILER";
    int i = 1;
    String logicalDeviceName = boilerPrefix + i;
    ModelNode boilerNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    while (boilerNode != null) {
        this.logicalDevices.add(new Boiler(this.getDeviceName(), logicalDeviceName, serverModel));
        i += 1;
        logicalDeviceName = boilerPrefix + i;
        boilerNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    }
}
Also used : Boiler(org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.Boiler) ModelNode(com.beanit.openiec61850.ModelNode)

Example 42 with ModelNode

use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.

the class RtuSimulator method addPqDevices.

private void addPqDevices(final ServerModel serverModel) {
    final String pqPrefix = "PQ";
    int i = 1;
    String logicalDeviceName = pqPrefix + i;
    ModelNode pqNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    while (pqNode != null) {
        this.logicalDevices.add(new Pq(this.getDeviceName(), logicalDeviceName, serverModel));
        i += 1;
        logicalDeviceName = pqPrefix + i;
        pqNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    }
}
Also used : Pq(org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.Pq) ModelNode(com.beanit.openiec61850.ModelNode)

Example 43 with ModelNode

use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform 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(org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.GasFurnace) ModelNode(com.beanit.openiec61850.ModelNode)

Example 44 with ModelNode

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

Example 45 with ModelNode

use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.

the class RtuSimulator method addSwitchDevices.

private void addSwitchDevices(final ServerModel serverModel) {
    final String logicalDeviceName = "IO";
    final ModelNode switchDevice = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    if (switchDevice != null) {
        LOGGER.info("Adding switchDevice {}", this.getDeviceName());
        this.logicalDevices.add(new SwitchDevice(this.getDeviceName(), logicalDeviceName, serverModel));
    }
}
Also used : ModelNode(com.beanit.openiec61850.ModelNode) SwitchDevice(org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.SwitchDevice)

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 BigDecimal (java.math.BigDecimal)3 FcModelNode (org.openmuc.openiec61850.FcModelNode)3 DataSampleDto (org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto)3 BasicDataAttribute (com.beanit.openiec61850.BasicDataAttribute)2 BdaFloat32 (com.beanit.openiec61850.BdaFloat32)2 BdaTimestamp (com.beanit.openiec61850.BdaTimestamp)2 ServerModel (com.beanit.openiec61850.ServerModel)2 MathContext (java.math.MathContext)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