Search in sources :

Example 1 with LogicalDeviceDto

use of org.opensmartgridplatform.dto.da.iec61850.LogicalDeviceDto in project open-smart-grid-platform 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.opensmartgridplatform.dto.da.iec61850.LogicalDeviceDto) LogicalDevice(com.beanit.openiec61850.LogicalDevice) LogicalNodeDto(org.opensmartgridplatform.dto.da.iec61850.LogicalNodeDto) ArrayList(java.util.ArrayList) ModelNode(com.beanit.openiec61850.ModelNode)

Example 2 with LogicalDeviceDto

use of org.opensmartgridplatform.dto.da.iec61850.LogicalDeviceDto in project open-smart-grid-platform by OSGP.

the class Iec61850ClientDaRTUEventListener method processReport.

private void processReport(final Report report, final String reportDescription) throws ProtocolAdapterException {
    final List<FcModelNode> dataSetMembers = report.getValues();
    final List<LogicalDevice> logicalDevices = new ArrayList<>();
    if (CollectionUtils.isEmpty(dataSetMembers)) {
        this.logger.warn("No dataSet members available for {}", reportDescription);
        return;
    }
    for (final FcModelNode member : dataSetMembers) {
        // we are only interested in measurements
        if (member.getFc() == Fc.MX) {
            this.processMeasurementNode(logicalDevices, member);
        }
    }
    final List<LogicalDeviceDto> logicalDevicesDtos = new ArrayList<>();
    for (final LogicalDevice logicalDevice : logicalDevices) {
        final List<LogicalNodeDto> logicalNodeDtos = new ArrayList<>();
        for (final LogicalNode logicalNode : logicalDevice.getLogicalNodes()) {
            final LogicalNodeDto logicalNodeDto = new LogicalNodeDto(logicalNode.getName(), logicalNode.getDataSamples());
            logicalNodeDtos.add(logicalNodeDto);
        }
        final LogicalDeviceDto logicalDeviceDto = new LogicalDeviceDto(logicalDevice.getName(), logicalNodeDtos);
        logicalDevicesDtos.add(logicalDeviceDto);
    }
    final GetPQValuesResponseDto response = new GetPQValuesResponseDto(logicalDevicesDtos);
    this.deviceManagementService.sendPqValues(this.deviceIdentification, report.getRptId(), response);
}
Also used : GetPQValuesResponseDto(org.opensmartgridplatform.dto.da.GetPQValuesResponseDto) LogicalDeviceDto(org.opensmartgridplatform.dto.da.iec61850.LogicalDeviceDto) LogicalNodeDto(org.opensmartgridplatform.dto.da.iec61850.LogicalNodeDto) ArrayList(java.util.ArrayList) FcModelNode(com.beanit.openiec61850.FcModelNode)

Example 3 with LogicalDeviceDto

use of org.opensmartgridplatform.dto.da.iec61850.LogicalDeviceDto 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)

Aggregations

ArrayList (java.util.ArrayList)3 LogicalDeviceDto (org.opensmartgridplatform.dto.da.iec61850.LogicalDeviceDto)2 LogicalNodeDto (org.opensmartgridplatform.dto.da.iec61850.LogicalNodeDto)2 FcModelNode (com.beanit.openiec61850.FcModelNode)1 LogicalDevice (com.beanit.openiec61850.LogicalDevice)1 ModelNode (com.beanit.openiec61850.ModelNode)1 LogicalDevice (org.openmuc.openiec61850.LogicalDevice)1 ModelNode (org.openmuc.openiec61850.ModelNode)1 GetPQValuesResponseDto (org.opensmartgridplatform.dto.da.GetPQValuesResponseDto)1 LogicalDeviceDto (org.osgpfoundation.osgp.dto.da.iec61850.LogicalDeviceDto)1 LogicalNodeDto (org.osgpfoundation.osgp.dto.da.iec61850.LogicalNodeDto)1