Search in sources :

Example 1 with BdaInt8U

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;
}
Also used : BdaInt8U(org.openmuc.openiec61850.BdaInt8U)

Example 2 with BdaInt8U

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();
}
Also used : EventType(com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.EventType) BdaInt8U(org.openmuc.openiec61850.BdaInt8U)

Example 3 with BdaInt8U

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;
}
Also used : BdaInt8U(com.beanit.openiec61850.BdaInt8U)

Example 4 with BdaInt8U

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);
}
Also used : DeviceMessageLog(org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog) BdaVisibleString(com.beanit.openiec61850.BdaVisibleString) BdaInt8U(com.beanit.openiec61850.BdaInt8U) BdaTimestamp(com.beanit.openiec61850.BdaTimestamp) BdaBoolean(com.beanit.openiec61850.BdaBoolean)

Example 5 with BdaInt8U

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();
}
Also used : EventType(org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.EventType) BdaInt8U(com.beanit.openiec61850.BdaInt8U)

Aggregations

BdaInt8U (com.beanit.openiec61850.BdaInt8U)6 BdaVisibleString (com.beanit.openiec61850.BdaVisibleString)4 BdaInt8U (org.openmuc.openiec61850.BdaInt8U)4 BdaBoolean (com.beanit.openiec61850.BdaBoolean)2 BdaTimestamp (com.beanit.openiec61850.BdaTimestamp)2 DateTime (org.joda.time.DateTime)2 BdaVisibleString (org.openmuc.openiec61850.BdaVisibleString)2 EventType (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.EventType)1 BdaBoolean (org.openmuc.openiec61850.BdaBoolean)1 BdaTimestamp (org.openmuc.openiec61850.BdaTimestamp)1 DeviceMessageLog (org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)1 EventType (org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.EventType)1