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 LogicalNode logicalNode, final DataAttribute dataAttribute, final Fc fc) throws NodeNotFoundException {
final ObjectReference objectReference = this.createObjectReference(logicalDevice, 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);
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientLMDEventListener method determineLightSensorValue.
private boolean determineLightSensorValue(final FcModelNode evnRpn, final String reportDescription) {
final String dataObjectName = SubDataAttribute.STATE.getDescription();
final BdaBoolean stVal = (BdaBoolean) evnRpn.getChild(dataObjectName);
if (stVal == null) {
throw this.childNodeNotAvailableException(evnRpn, dataObjectName, reportDescription);
}
return stVal.getValue();
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientLMDEventListener 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);
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) {
this.logger.warn("report.getSqNum() < this.firstNewSqNum, report.getSqNum() = {}, this.firstNewSqNum = {}", report.getSqNum(), this.firstNewSqNum);
}
this.logReportDetails(report);
if (CollectionUtils.isEmpty(report.getValues())) {
this.logger.warn("No dataSet members available for {}", reportDescription);
return;
}
final Map<LightMeasurementDevice, FcModelNode> reportMemberPerDevice = this.processReportedDataForLightMeasurementDevices(report.getValues());
for (final LightMeasurementDevice lmd : reportMemberPerDevice.keySet()) {
final String deviceIdentification = lmd.getDeviceIdentification();
final Short index = lmd.getDigitalInput();
final FcModelNode member = reportMemberPerDevice.get(lmd);
final EventNotificationDto eventNotification = this.getEventNotificationForReportedData(member, timeOfEntry, reportDescription, deviceIdentification, index.intValue());
try {
this.deviceManagementService.addEventNotifications(deviceIdentification, Arrays.asList(eventNotification));
} catch (final ProtocolAdapterException pae) {
this.logger.error("Error adding device notifications for device: " + deviceIdentification, pae);
}
}
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientLMDEventListener method evnRpnInfo.
private String evnRpnInfo(final String linePrefix, final FcModelNode evnRpn) {
final String dataObjectName = SubDataAttribute.STATE.getDescription();
final StringBuilder sb = new StringBuilder();
final BdaBoolean stValNode = (BdaBoolean) evnRpn.getChild(dataObjectName);
sb.append(linePrefix).append(dataObjectName).append(": ");
if (stValNode == null) {
sb.append("null");
} else {
final boolean stVal = stValNode.getValue();
sb.append(stVal).append(" = ").append(stVal ? "true" : "false");
}
sb.append(System.lineSeparator());
return sb.toString();
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientLMDEventListener method logDataSetMembersDetails.
private void logDataSetMembersDetails(final Report report, final List<FcModelNode> dataSetMembers, final StringBuilder sb) {
if (dataSetMembers == null) {
sb.append("\t DataSet members:\tnull").append(System.lineSeparator());
} else {
sb.append("\t DataSet:\t").append(report.getDataSetRef()).append(System.lineSeparator());
if (!dataSetMembers.isEmpty()) {
sb.append("\t DataSet members:\t").append(dataSetMembers.size()).append(System.lineSeparator());
for (final FcModelNode member : dataSetMembers) {
sb.append("\t member:\t").append(member).append(System.lineSeparator());
this.checkNodeType(member, sb, "CSLC.EvnRpn");
}
}
}
}
Aggregations