use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method determineRelayIndex.
private Integer determineRelayIndex(final FcModelNode evnRpn, final String reportDescription) {
final BdaInt8U swNumNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_SWITCH_NUMBER);
if (swNumNode == null) {
throw this.childNodeNotAvailableException(evnRpn, EVENT_NODE_SWITCH_NUMBER, reportDescription);
}
final Short swNum = swNumNode.getValue();
final Integer externalIndex = this.externalIndexByInternalIndex.get(swNum.intValue());
if (externalIndex == null) {
this.logger.error("No external index configured for internal index: {} for device: {}, using '0' for event", swNum, this.deviceIdentification);
return 0;
}
return externalIndex;
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method determineDescription.
private String determineDescription(final FcModelNode evnRpn) {
final StringBuilder sb = new StringBuilder();
final String triggerTypeNode = this.determineTriggerTypeNode(evnRpn);
if (isNotEmpty(triggerTypeNode)) {
sb.append(triggerTypeNode);
}
final String eventTypeNode = this.determineEventTypeNode(evnRpn);
if (isNotEmpty(eventTypeNode)) {
if (sb.length() > 0) {
sb.append("; ");
}
sb.append(eventTypeNode);
}
final String remarkNode = this.determineRemarkNode(evnRpn);
if (isNotEmpty(remarkNode)) {
if (sb.length() > 0) {
sb.append(' ');
}
sb.append(remarkNode);
}
return sb.toString();
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method addEventNotificationForReportedData.
private void addEventNotificationForReportedData(final FcModelNode evnRpn, final DateTime timeOfEntry, final String reportDescription) {
final EventTypeDto eventType = this.determineEventType(evnRpn, reportDescription);
final Integer index = this.determineRelayIndex(evnRpn, reportDescription);
final String description = this.determineDescription(evnRpn);
final DateTime dateTime = this.determineDateTime(evnRpn, timeOfEntry);
final EventNotificationDto eventNotification = new EventNotificationDto(this.deviceIdentification, dateTime, eventType, description, index);
synchronized (this.eventNotifications) {
this.eventNotifications.add(eventNotification);
}
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method logReportDetails.
private void logReportDetails(final Report report) {
final StringBuilder sb = new StringBuilder("Report details for device ").append(this.deviceIdentification).append(System.lineSeparator());
this.logDefaultReportDetails(sb, report);
final List<FcModelNode> dataSetMembers = report.getValues();
this.logDataSetMembersDetails(report, dataSetMembers, sb);
final String logmessage = sb.append(System.lineSeparator()).toString();
this.logger.info(logmessage);
}
use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method logEventNotificationDeviceMessage.
private void logEventNotificationDeviceMessage(final FcModelNode evnRpn) {
final DeviceMessageLog deviceMessageLog = new DeviceMessageLog(IED.FLEX_OVL, LogicalDevice.LIGHTING, "EventNotification");
final BdaInt8U evnTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_EVENT_TYPE);
if (evnTypeNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.EVENT_TYPE, Short.toString(evnTypeNode.getValue()));
}
final BdaInt8U swNumNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_SWITCH_NUMBER);
if (swNumNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.SWITCH_NUMBER, Short.toString(swNumNode.getValue()));
}
final BdaInt8U trgTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_TRIGGER_TYPE);
if (trgTypeNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.TRIGGER_TYPE, Short.toString(trgTypeNode.getValue()));
}
final BdaBoolean swValNode = (BdaBoolean) evnRpn.getChild(EVENT_NODE_SWITCH_VALUE);
if (swValNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.SWITCH_VALUE, swValNode.getValueString());
}
final BdaTimestamp trgTimeNode = (BdaTimestamp) evnRpn.getChild(EVENT_NODE_TRIGGER_TIME);
if (trgTimeNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.TRIGGER_TIME, trgTimeNode.getDate().toString());
}
final BdaVisibleString remarkNode = (BdaVisibleString) evnRpn.getChild(EVENT_NODE_REMARK);
if (remarkNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.REMARK, remarkNode.getStringValue());
}
this.loggingService.logMessage(deviceMessageLog, this.deviceIdentification, this.organizationIdentification, true);
}
Aggregations