use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method newReport.
@Override
public void newReport(final Report report) {
final DateTime timeOfEntry = this.getTimeOfEntry(report);
final String reportDescription = this.getReportDescription(report, timeOfEntry);
this.logger.info("newReport for {}", reportDescription);
boolean skipRecordBecauseOfOldSqNum = false;
if (Boolean.TRUE.equals(report.getBufOvfl())) {
this.logger.warn("Buffer Overflow reported for {} - entries within the buffer may have been lost.", reportDescription);
}
if (this.firstNewSqNum != null && report.getSqNum() != null && report.getSqNum() < this.firstNewSqNum) {
skipRecordBecauseOfOldSqNum = true;
}
this.logReportDetails(report);
final List<FcModelNode> dataSetMembers = report.getValues();
if (CollectionUtils.isEmpty(dataSetMembers)) {
this.logger.warn("No dataSet members available for {}", reportDescription);
return;
} else {
this.logger.debug("Handling {} DataSet members for {}", dataSetMembers.size(), reportDescription);
}
for (final FcModelNode member : dataSetMembers) {
if (member == null) {
this.logger.warn("Member == null in DataSet for {}", reportDescription);
continue;
}
this.logger.info("Handle member {} for {}", member.getReference(), reportDescription);
try {
if (skipRecordBecauseOfOldSqNum) {
this.logger.warn("Skipping report because SqNum: {} is less than what should be the first new value: {}", report.getSqNum(), this.firstNewSqNum);
} else {
this.addEventNotificationForReportedData(member, timeOfEntry, reportDescription);
this.logEventNotificationDeviceMessage(member);
}
} catch (final Exception e) {
this.logger.error("Error adding event notification for member {} from {}", member.getReference(), reportDescription, e);
}
}
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class DistributionAutomationGetPQValuesRequestMessageProcessor method processPQValueNodeChildren.
private List<DataSampleDto> processPQValueNodeChildren(final LogicalNode node) {
final List<DataSampleDto> data = new ArrayList<>();
final Collection<ModelNode> children = node.getChildren();
final Map<String, Set<Fc>> childMap = new HashMap<>();
for (final ModelNode child : children) {
if (!childMap.containsKey(child.getName())) {
childMap.put(child.getName(), new HashSet<>());
}
childMap.get(child.getName()).add(((FcModelNode) child).getFc());
}
for (final Map.Entry<String, Set<Fc>> childEntry : childMap.entrySet()) {
final List<DataSampleDto> childData = this.processPQValuesFunctionalConstraintObject(node, childEntry.getKey(), childEntry.getValue());
if (!childData.isEmpty()) {
data.addAll(childData);
}
}
return data;
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class DeviceConnection method getFcModelNode.
/**
* Returns a {@link NodeContainer} for the given {@link ObjectReference} data and the Functional
* constraint.
*
* @throws NodeNotFoundException
*/
public NodeContainer getFcModelNode(final LogicalDevice logicalDevice, final int logicalDeviceIndex, final LogicalNode logicalNode, final DataAttribute dataAttribute, final Fc fc) throws NodeNotFoundException {
final ObjectReference objectReference = this.createObjectReference(logicalDevice, logicalDeviceIndex, logicalNode, dataAttribute);
final FcModelNode fcModelNode = (FcModelNode) this.connection.getServerModel().findModelNode(objectReference, fc);
if (fcModelNode == null) {
LOGGER.error("FcModelNode is null, most likely the data attribute: {} does not exist", dataAttribute.getDescription());
throw new NodeNotFoundException(String.format("FcModelNode with objectReference %s does not exist", objectReference));
}
return new NodeContainer(this, fcModelNode);
}
Aggregations