Search in sources :

Example 1 with MeasurementDto

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

the class Iec61850ClientRTUEventListener method processReport.

private void processReport(final Report report, final String reportDescription, final Iec61850ReportHandler reportHandler) throws ProtocolAdapterException {
    if (report.getDataSet() == null) {
        this.logger.warn("No DataSet available for {}", reportDescription);
        return;
    }
    final List<FcModelNode> members = report.getDataSet().getMembers();
    if ((members == null) || members.isEmpty()) {
        this.logger.warn("No members in DataSet available for {}", reportDescription);
        return;
    }
    final List<MeasurementDto> measurements = new ArrayList<>();
    for (final FcModelNode member : members) {
        if (member == null) {
            this.logger.warn("Member == null in DataSet for {}", reportDescription);
            continue;
        }
        this.logger.info("Handle member {} for {}", member.getReference(), reportDescription);
        try {
            final MeasurementDto dto = reportHandler.handleMember(new ReadOnlyNodeContainer(this.deviceIdentification, member));
            if (dto != null) {
                measurements.add(dto);
            } else {
                this.logger.warn("Unsupprted member {}, skipping", member.getName());
            }
        } catch (final Exception e) {
            this.logger.error("Error adding event notification for member {} from {}", member.getReference(), reportDescription, e);
        }
    }
    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() + IEC61850_ENTRY_TIME_OFFSET), report.getRptId());
    this.deviceManagementService.sendMeasurements(this.deviceIdentification, new GetDataResponseDto(systems, reportDto));
}
Also used : GetDataResponseDto(com.alliander.osgp.dto.valueobjects.microgrids.GetDataResponseDto) GetDataSystemIdentifierDto(com.alliander.osgp.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) FcModelNode(org.openmuc.openiec61850.FcModelNode) ReportDto(com.alliander.osgp.dto.valueobjects.microgrids.ReportDto) ReadOnlyNodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.ReadOnlyNodeContainer) MeasurementDto(com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProtocolAdapterException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) DateTime(org.joda.time.DateTime)

Example 2 with MeasurementDto

use of com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto 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 3 with MeasurementDto

use of com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto 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 4 with MeasurementDto

use of com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto 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 5 with MeasurementDto

use of com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto 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)11 MeasurementDto (com.alliander.osgp.dto.valueobjects.microgrids.MeasurementDto)11 ArrayList (java.util.ArrayList)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 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)1 ReadOnlyNodeContainer (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.ReadOnlyNodeContainer)1 GetDataResponseDto (com.alliander.osgp.dto.valueobjects.microgrids.GetDataResponseDto)1 ReportDto (com.alliander.osgp.dto.valueobjects.microgrids.ReportDto)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 DateTime (org.joda.time.DateTime)1 FcModelNode (org.openmuc.openiec61850.FcModelNode)1