Search in sources :

Example 26 with FcModelNode

use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.

the class Iec61850DeviceConnectionService method getModelNode.

private FcModelNode getModelNode(final String logicalDevice, final Iec61850Connection iec61850Connection, final String description) throws ProtocolAdapterException {
    final ServerModel serverModel = iec61850Connection.getServerModel();
    if (serverModel == null) {
        final String msg = String.format("ServerModel is null for logicalDevice {%s}", logicalDevice);
        throw new ProtocolAdapterException(msg);
    }
    final String objRef = description + logicalDevice + "/" + LogicalNode.LOGICAL_NODE_ZERO.getDescription() + "." + DataAttribute.NAME_PLATE.getDescription();
    final FcModelNode modelNode = (FcModelNode) serverModel.findModelNode(objRef, Fc.DC);
    if (modelNode == null) {
        final String msg = String.format("ModelNode is null for {%s}", objRef);
        throw new ProtocolAdapterException(msg);
    }
    return modelNode;
}
Also used : ServerModel(com.beanit.openiec61850.ServerModel) FcModelNode(com.beanit.openiec61850.FcModelNode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)

Example 27 with FcModelNode

use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.

the class Iec61850ClientRTUEventListener method processReport.

private void processReport(final Report report, final String reportDescription, final Iec61850ReportHandler reportHandler) throws ProtocolAdapterException {
    final List<FcModelNode> dataSetMembers = report.getValues();
    if (CollectionUtils.isEmpty(dataSetMembers)) {
        this.logger.warn("No dataSet members available for {}", reportDescription);
        return;
    }
    final List<MeasurementDto> measurements = this.processMeasurements(reportHandler, reportDescription, dataSetMembers);
    final GetDataSystemIdentifierDto systemResult = reportHandler.createResult(measurements);
    final List<GetDataSystemIdentifierDto> systems = new ArrayList<>();
    systems.add(systemResult);
    final ReportDto reportDto = new ReportDto(report.getSqNum(), new DateTime(report.getTimeOfEntry().getTimestampValue()), report.getRptId());
    this.deviceManagementService.sendMeasurements(this.deviceIdentification, new GetDataResponseDto(systems, reportDto));
    this.reportingService.storeLastReportEntry(report, this.deviceIdentification);
}
Also used : GetDataResponseDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto) GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) FcModelNode(com.beanit.openiec61850.FcModelNode) ReportDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ReportDto) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) DateTime(org.joda.time.DateTime)

Example 28 with FcModelNode

use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.

the class Iec61850ClientSSLDEventListener method determineTriggerTypeNode.

private String determineTriggerTypeNode(final FcModelNode evnRpn) {
    final BdaInt8U trgTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_TRIGGER_TYPE);
    if (trgTypeNode != null && trgTypeNode.getValue() > 0) {
        final short trgType = trgTypeNode.getValue();
        final String trigger = TRG_TYPE_DESCRIPTION_PER_CODE.get(trgType);
        if (trigger == null) {
            return "trgType=" + trgType;
        } else {
            return trigger;
        }
    }
    return EMPTY;
}
Also used : BdaInt8U(com.beanit.openiec61850.BdaInt8U) BdaVisibleString(com.beanit.openiec61850.BdaVisibleString)

Example 29 with FcModelNode

use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.

the class Iec61850ClientSSLDEventListener method determineEventTypeNode.

private String determineEventTypeNode(final FcModelNode evnRpn) {
    final BdaInt8U evnTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_EVENT_TYPE);
    if (evnTypeNode != null && evnTypeNode.getValue() > 0) {
        final short evnType = evnTypeNode.getValue();
        final String event = EventType.forCode(evnType).getDescription();
        if (event.startsWith("FUNCTION_FIRMWARE")) {
            return "functional firmware";
        } else if (event.startsWith("SECURITY_FIRMWARE")) {
            return "security firmware";
        }
    }
    return EMPTY;
}
Also used : BdaInt8U(com.beanit.openiec61850.BdaInt8U) BdaVisibleString(com.beanit.openiec61850.BdaVisibleString)

Example 30 with FcModelNode

use of com.beanit.openiec61850.FcModelNode in project open-smart-grid-platform by OSGP.

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

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