Search in sources :

Example 11 with GetDataSystemIdentifierDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project open-smart-grid-platform by OSGP.

the class Iec61850PqSystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeException {
    final int logicalDeviceIndex = systemFilter.getId();
    LOGGER.info("Get data called for logical device {}{}", DEVICE.getDescription(), logicalDeviceIndex);
    final List<MeasurementDto> measurements = new ArrayList<>();
    for (final MeasurementFilterDto filter : systemFilter.getMeasurementFilters()) {
        final RtuReadCommand<MeasurementDto> command = this.iec61850PqCommandFactory.getCommand(filter);
        if (command == null) {
            LOGGER.warn("Unsupported data attribute [{}], skip get data for it", filter.getNode());
        } else {
            measurements.add(command.execute(client, connection, DEVICE, logicalDeviceIndex));
        }
    }
    return new GetDataSystemIdentifierDto(systemFilter.getId(), systemFilter.getSystemType(), measurements);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)

Example 12 with GetDataSystemIdentifierDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project open-smart-grid-platform by OSGP.

the class Iec61850PvSystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeException {
    final int logicalDeviceIndex = systemFilter.getId();
    LOGGER.info("Get data called for logical device {}{}", DEVICE.getDescription(), logicalDeviceIndex);
    final List<MeasurementDto> measurements = new ArrayList<>();
    for (final MeasurementFilterDto filter : systemFilter.getMeasurementFilters()) {
        final RtuReadCommand<MeasurementDto> command = this.iec61850PvCommandFactory.getCommand(filter);
        if (command == null) {
            LOGGER.warn("Unsupported data attribute [{}], skip get data for it", filter.getNode());
        } else {
            measurements.add(command.execute(client, connection, DEVICE, logicalDeviceIndex));
        }
    }
    return new GetDataSystemIdentifierDto(systemFilter.getId(), systemFilter.getSystemType(), measurements);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)

Example 13 with GetDataSystemIdentifierDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project open-smart-grid-platform by OSGP.

the class Iec61850ChpSystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeException {
    final int logicalDeviceIndex = systemFilter.getId();
    LOGGER.info("Get data called for logical device {}{}", DEVICE.getDescription(), logicalDeviceIndex);
    final List<MeasurementDto> measurements = new ArrayList<>();
    for (final MeasurementFilterDto filter : systemFilter.getMeasurementFilters()) {
        final RtuReadCommand<MeasurementDto> command = this.iec61850ChpCommandFactory.getCommand(filter);
        if (command == null) {
            LOGGER.warn("Unsupported data attribute [{}], skip get data for it", filter.getNode());
        } else {
            measurements.add(command.execute(client, connection, DEVICE, logicalDeviceIndex));
        }
    }
    return new GetDataSystemIdentifierDto(systemFilter.getId(), systemFilter.getSystemType(), measurements);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)

Example 14 with GetDataSystemIdentifierDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project open-smart-grid-platform by OSGP.

the class Iec61850EngineSystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeException {
    final int logicalDeviceIndex = systemFilter.getId();
    LOGGER.info("Get data called for logical device {}{}", DEVICE.getDescription(), logicalDeviceIndex);
    final List<MeasurementDto> measurements = new ArrayList<>();
    for (final MeasurementFilterDto filter : systemFilter.getMeasurementFilters()) {
        final RtuReadCommand<MeasurementDto> command = this.iec61850EngineCommandFactory.getCommand(filter);
        if (command == null) {
            LOGGER.warn("Unsupported data attribute [{}], skip get data for it", filter.getNode());
        } else {
            measurements.add(command.execute(client, connection, DEVICE, logicalDeviceIndex));
        }
    }
    final List<ProfileDto> profiles = new ArrayList<>();
    for (final ProfileFilterDto filter : systemFilter.getProfileFilters()) {
        final RtuReadCommand<ProfileDto> command = Iec61850RtuReadProfileCommandFactory.getInstance().getCommand(filter);
        if (command == null) {
            LOGGER.warn("Unsupported data attribute [{}], skip get data for it", filter.getNode());
        } else {
            profiles.add(command.execute(client, connection, DEVICE, logicalDeviceIndex));
        }
    }
    return new GetDataSystemIdentifierDto(systemFilter.getId(), systemFilter.getSystemType(), measurements, profiles);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) ProfileFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileFilterDto) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto) ProfileDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileDto)

Example 15 with GetDataSystemIdentifierDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project open-smart-grid-platform by OSGP.

the class Iec61850ClientRTUEventListener method processReport.

private void processReport(final Report report, final String reportDescription, final Iec61850ReportHandler reportHandler) throws ProtocolAdapterException {
    final List<FcModelNode> dataSetMembers = report.getValues();
    if (CollectionUtils.isEmpty(dataSetMembers)) {
        this.logger.warn("No dataSet members available for {}", reportDescription);
        return;
    }
    final List<MeasurementDto> measurements = this.processMeasurements(reportHandler, reportDescription, dataSetMembers);
    final GetDataSystemIdentifierDto systemResult = reportHandler.createResult(measurements);
    final List<GetDataSystemIdentifierDto> systems = new ArrayList<>();
    systems.add(systemResult);
    final ReportDto reportDto = new ReportDto(report.getSqNum(), new DateTime(report.getTimeOfEntry().getTimestampValue()), report.getRptId());
    this.deviceManagementService.sendMeasurements(this.deviceIdentification, new GetDataResponseDto(systems, reportDto));
    this.reportingService.storeLastReportEntry(report, this.deviceIdentification);
}
Also used : GetDataResponseDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto) GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) FcModelNode(com.beanit.openiec61850.FcModelNode) ReportDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ReportDto) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) DateTime(org.joda.time.DateTime)

Aggregations

GetDataSystemIdentifierDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto)15 ArrayList (java.util.ArrayList)14 MeasurementDto (org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto)14 MeasurementFilterDto (org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)12 ProfileDto (org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileDto)5 ProfileFilterDto (org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileFilterDto)5 GetDataResponseDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto)3 DateTime (org.joda.time.DateTime)2 FcModelNode (com.beanit.openiec61850.FcModelNode)1 DeviceMessageLog (org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)1 SystemService (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.SystemService)1 Function (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.Function)1 GetDataRequestDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataRequestDto)1 ReportDto (org.opensmartgridplatform.dto.valueobjects.microgrids.ReportDto)1 SystemFilterDto (org.opensmartgridplatform.dto.valueobjects.microgrids.SystemFilterDto)1 CorrelationIds (org.opensmartgridplatform.shared.infra.jms.CorrelationIds)1