use of com.alliander.osgp.dto.valueobjects.microgrids.ReportDto 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));
}
Aggregations