use of com.beanit.openiec61850.BdaInt8U in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ClientSSLDEventListener method determineRelayIndex.
private Integer determineRelayIndex(final FcModelNode evnRpn, final String reportDescription) throws ProtocolAdapterException {
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.BdaInt8U in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ClientSSLDEventListener method determineEventType.
private EventTypeDto determineEventType(final FcModelNode evnRpn, final String reportDescription) {
final BdaInt8U evnTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_EVENT_TYPE);
if (evnTypeNode == null) {
throw this.childNodeNotAvailableException(evnRpn, EVENT_NODE_EVENT_TYPE, reportDescription);
}
final short evnTypeCode = evnTypeNode.getValue();
final EventType eventType = EventType.forCode(evnTypeCode);
return eventType.getOsgpEventType();
}
use of com.beanit.openiec61850.BdaInt8U 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.BdaInt8U 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);
}
use of com.beanit.openiec61850.BdaInt8U in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method determineEventType.
private EventTypeDto determineEventType(final FcModelNode evnRpn, final String reportDescription) {
final BdaInt8U evnTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_EVENT_TYPE);
if (evnTypeNode == null) {
throw this.childNodeNotAvailableException(evnRpn, EVENT_NODE_EVENT_TYPE, reportDescription);
}
final short evnTypeCode = evnTypeNode.getValue();
final EventType eventType = EventType.forCode(evnTypeCode);
return eventType.getOsgpEventType();
}
Aggregations