Search in sources :

Example 11 with FcModelNode

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

Example 12 with FcModelNode

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

Example 13 with FcModelNode

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);
    }
}
Also used : EventNotificationDto(org.opensmartgridplatform.dto.valueobjects.EventNotificationDto) BdaVisibleString(com.beanit.openiec61850.BdaVisibleString) DateTime(org.joda.time.DateTime) EventTypeDto(org.opensmartgridplatform.dto.valueobjects.EventTypeDto)

Example 14 with FcModelNode

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

Example 15 with FcModelNode

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);
}
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)

Aggregations

FcModelNode (com.beanit.openiec61850.FcModelNode)13 DateTime (org.joda.time.DateTime)9 BdaVisibleString (com.beanit.openiec61850.BdaVisibleString)8 FcModelNode (org.openmuc.openiec61850.FcModelNode)7 BdaInt8U (com.beanit.openiec61850.BdaInt8U)6 ArrayList (java.util.ArrayList)5 BdaBoolean (com.beanit.openiec61850.BdaBoolean)4 BdaTimestamp (com.beanit.openiec61850.BdaTimestamp)4 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)3 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 DataSet (org.openmuc.openiec61850.DataSet)3 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)3 DataSampleDto (org.opensmartgridplatform.dto.da.iec61850.DataSampleDto)3 Iec61850BdaOptFldsHelper (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850BdaOptFldsHelper)2 BdaFloat32 (com.beanit.openiec61850.BdaFloat32)2 ObjectReference (com.beanit.openiec61850.ObjectReference)2 BigDecimal (java.math.BigDecimal)2 MathContext (java.math.MathContext)2 HashSet (java.util.HashSet)2