Search in sources :

Example 6 with GetDataSystemIdentifierDto

use of com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850PvSystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeReadException {
    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 = Iec61850PvCommandFactory.getInstance().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(com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) MeasurementDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementFilterDto)

Example 7 with GetDataSystemIdentifierDto

use of com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceService method handleGetData.

// ========================
// PRIVATE HELPER METHODS =
// ========================
private GetDataResponseDto handleGetData(final DeviceConnection connection, final GetDataDeviceRequest deviceRequest) throws ProtocolAdapterException {
    final GetDataRequestDto requestedData = deviceRequest.getDataRequest();
    final String serverName = this.getServerName(deviceRequest);
    final Function<GetDataResponseDto> function = new Function<GetDataResponseDto>() {

        @Override
        public GetDataResponseDto apply(final DeviceMessageLog deviceMessageLog) throws Exception {
            final Iec61850RtuDeviceReportingService reportingService = new Iec61850RtuDeviceReportingService(serverName);
            reportingService.enableReportingOnDevice(connection, deviceRequest.getDeviceIdentification());
            final List<GetDataSystemIdentifierDto> identifiers = new ArrayList<>();
            for (final SystemFilterDto systemFilter : requestedData.getSystemFilters()) {
                final SystemService systemService = Iec61850RtuDeviceService.this.systemServiceFactory.getSystemService(systemFilter);
                final GetDataSystemIdentifierDto getDataSystemIdentifier = systemService.getData(systemFilter, Iec61850RtuDeviceService.this.iec61850Client, connection);
                identifiers.add(getDataSystemIdentifier);
            }
            return new GetDataResponseDto(identifiers, null);
        }
    };
    return this.iec61850Client.sendCommandWithRetry(function, deviceRequest.getDeviceIdentification());
}
Also used : Function(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function) GetDataRequestDto(com.alliander.osgp.dto.valueobjects.microgrids.GetDataRequestDto) DeviceMessageLog(com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog) SystemFilterDto(com.alliander.osgp.dto.valueobjects.microgrids.SystemFilterDto) SystemService(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.SystemService) GetDataResponseDto(com.alliander.osgp.dto.valueobjects.microgrids.GetDataResponseDto) GetDataSystemIdentifierDto(com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) Iec61850RtuDeviceReportingService(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.reporting.Iec61850RtuDeviceReportingService) ArrayList(java.util.ArrayList)

Example 8 with GetDataSystemIdentifierDto

use of com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850BatterySystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeReadException {
    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 = Iec61850BatteryCommandFactory.getInstance().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(com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) ProfileFilterDto(com.alliander.osgp.dto.valueobjects.microgrids.ProfileFilterDto) MeasurementDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementFilterDto) ProfileDto(com.alliander.osgp.dto.valueobjects.microgrids.ProfileDto)

Example 9 with GetDataSystemIdentifierDto

use of com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850BoilerSystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeReadException {
    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 = Iec61850BoilerCommandFactory.getInstance().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(com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) ProfileFilterDto(com.alliander.osgp.dto.valueobjects.microgrids.ProfileFilterDto) MeasurementDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementFilterDto) ProfileDto(com.alliander.osgp.dto.valueobjects.microgrids.ProfileDto)

Example 10 with GetDataSystemIdentifierDto

use of com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850ChpSystemService method getData.

@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeReadException {
    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 = Iec61850ChpCommandFactory.getInstance().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(com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) MeasurementDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementFilterDto)

Aggregations

GetDataSystemIdentifierDto (com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto)22 ArrayList (java.util.ArrayList)22 MeasurementDto (com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto)11 MeasurementFilterDto (com.alliander.osgp.dto.valueobjects.microgrids.MeasurementFilterDto)10 ProfileDto (com.alliander.osgp.dto.valueobjects.microgrids.ProfileDto)4 ProfileFilterDto (com.alliander.osgp.dto.valueobjects.microgrids.ProfileFilterDto)4 GetDataResponseDto (com.alliander.osgp.dto.valueobjects.microgrids.GetDataResponseDto)2 DeviceMessageLog (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)1 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)1 SystemService (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.SystemService)1 Function (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function)1 ReadOnlyNodeContainer (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.ReadOnlyNodeContainer)1 Iec61850RtuDeviceReportingService (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.reporting.Iec61850RtuDeviceReportingService)1 GetDataRequestDto (com.alliander.osgp.dto.valueobjects.microgrids.GetDataRequestDto)1 ReportDto (com.alliander.osgp.dto.valueobjects.microgrids.ReportDto)1 SystemFilterDto (com.alliander.osgp.dto.valueobjects.microgrids.SystemFilterDto)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 DateTime (org.joda.time.DateTime)1 FcModelNode (org.openmuc.openiec61850.FcModelNode)1