Search in sources :

Example 16 with ModelNode

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

the class RtuSimulator method addBatteryDevices.

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

Example 17 with ModelNode

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

Example 18 with ModelNode

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

the class DistributionAutomationGetDeviceModelRequestMessageProcessor method processLogicalDevices.

private synchronized List<LogicalDeviceDto> processLogicalDevices(final ServerModel model) {
    final List<LogicalDeviceDto> logicalDevices = new ArrayList<>();
    for (final ModelNode node : model.getChildren()) {
        if (node instanceof LogicalDevice) {
            final List<LogicalNodeDto> logicalNodes = this.processLogicalNodes((LogicalDevice) node);
            logicalDevices.add(new LogicalDeviceDto(node.getName(), logicalNodes));
        }
    }
    return logicalDevices;
}
Also used : LogicalDeviceDto(org.osgpfoundation.osgp.dto.da.iec61850.LogicalDeviceDto) LogicalDevice(org.openmuc.openiec61850.LogicalDevice) LogicalNodeDto(org.osgpfoundation.osgp.dto.da.iec61850.LogicalNodeDto) ArrayList(java.util.ArrayList) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 19 with ModelNode

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

the class Iec61850RtuDeviceReportingService method enableBatteryReportingOnDevice.

private void enableBatteryReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String batteryPrefix = LogicalDevice.BATTERY.getDescription();
    int i = 1;
    String logicalDeviceName = batteryPrefix + i;
    ModelNode batteryNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (batteryNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.BATTERY, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.BATTERY, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = batteryPrefix + i;
        batteryNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 20 with ModelNode

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

the class Iec61850DeviceConnectionService method getModelNode.

private FcModelNode getModelNode(final String logicalDevice, final Iec61850Connection iec61850Connection, final String description) throws ProtocolAdapterException {
    final ServerModel serverModel = iec61850Connection.getServerModel();
    if (serverModel == null) {
        final String msg = String.format("ServerModel is null for logicalDevice {%s}", logicalDevice);
        throw new ProtocolAdapterException(msg);
    }
    final String objRef = description + logicalDevice + "/" + LogicalNode.LOGICAL_NODE_ZERO.getDescription() + "." + DataAttribute.NAME_PLATE.getDescription();
    final FcModelNode modelNode = (FcModelNode) serverModel.findModelNode(objRef, Fc.DC);
    if (modelNode == null) {
        final String msg = String.format("ModelNode is null for {%s}", objRef);
        throw new ProtocolAdapterException(msg);
    }
    return modelNode;
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) FcModelNode(org.openmuc.openiec61850.FcModelNode) ProtocolAdapterException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)

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