Search in sources :

Example 31 with ModelNode

use of com.beanit.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.

the class DistributionAutomationGetPQValuesRequestMessageProcessor method processPQValueNodeChildren.

private List<DataSampleDto> processPQValueNodeChildren(final LogicalNode node) {
    final List<DataSampleDto> data = new ArrayList<>();
    final Collection<ModelNode> children = node.getChildren();
    final Map<String, Set<Fc>> childMap = new HashMap<>();
    for (final ModelNode child : children) {
        if (!childMap.containsKey(child.getName())) {
            childMap.put(child.getName(), new HashSet<Fc>());
        }
        childMap.get(child.getName()).add(((FcModelNode) child).getFc());
    }
    for (final Map.Entry<String, Set<Fc>> childEntry : childMap.entrySet()) {
        final List<DataSampleDto> childData = this.processPQValuesFunctionalConstraintObject(node, childEntry.getKey(), childEntry.getValue());
        if (!childData.isEmpty()) {
            data.addAll(childData);
        }
    }
    return data;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DataSampleDto(org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto) FcModelNode(org.openmuc.openiec61850.FcModelNode) ModelNode(org.openmuc.openiec61850.ModelNode) Fc(org.openmuc.openiec61850.Fc) HashMap(java.util.HashMap) Map(java.util.Map)

Example 32 with ModelNode

use of com.beanit.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 33 with ModelNode

use of com.beanit.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableHeatPumpReportingOnDevice.

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

Example 34 with ModelNode

use of com.beanit.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableLoadReportingOnDevice.

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

Example 35 with ModelNode

use of com.beanit.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableBoilerReportingOnDevice.

private void enableBoilerReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String boilerPrefix = LogicalDevice.BOILER.getDescription();
    int i = 1;
    String logicalDeviceName = boilerPrefix + i;
    ModelNode boilerNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (boilerNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.BOILER, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.BOILER, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = boilerPrefix + i;
        boilerNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.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