Search in sources :

Example 16 with ModelNode

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

the class RtuSimulator method addLoadDevices.

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

Example 17 with ModelNode

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

the class RtuSimulator method addWindDevices.

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

Example 18 with ModelNode

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

the class RtuSimulator method addLightMeasurementDevice.

private void addLightMeasurementDevice(final ServerModel serverModel) {
    final String logicalDeviceName = "LD0";
    final ModelNode lightMeasurementRtuNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    if (lightMeasurementRtuNode != null) {
        // Light Measurement RTU found in the server model.
        LOGGER.info("Adding lmRtu {}", logicalDeviceName);
        this.logicalDevices.add(new LightMeasurementRtu(this.getDeviceName(), logicalDeviceName, serverModel));
    }
}
Also used : LightMeasurementRtu(org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.LightMeasurementRtu) ModelNode(com.beanit.openiec61850.ModelNode)

Example 19 with ModelNode

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

Example 20 with ModelNode

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

the class UpdateHealthStatusEventListener method updateServerValue.

private void updateServerValue(final ServerSap serverSap) {
    LOGGER.debug("updateServerValue");
    final ServerModel serverModel = serverSap.getModelCopy();
    final ModelNode modelNode = serverModel.findModelNode(HEALTH_NODE, Fc.ST);
    if (modelNode != null) {
        final ModelNode dataNode = modelNode.getChild(STATUS_VALUE);
        if (dataNode != null && dataNode instanceof BdaInt8) {
            final List<BasicDataAttribute> changedAttributes = new ArrayList<>();
            final BdaInt8 bda = (BdaInt8) dataNode;
            bda.setValue(bda.getValue() == OK ? WARNING : (bda.getValue() == WARNING ? ALARM : OK));
            changedAttributes.add(bda);
            serverSap.setValues(changedAttributes);
        }
    }
}
Also used : BdaInt8(com.beanit.openiec61850.BdaInt8) ServerModel(com.beanit.openiec61850.ServerModel) ArrayList(java.util.ArrayList) BasicDataAttribute(com.beanit.openiec61850.BasicDataAttribute) ModelNode(com.beanit.openiec61850.ModelNode)

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