Search in sources :

Example 41 with ServerModel

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

the class Iec61850RtuDeviceReportingService method enableReport.

private void enableReport(final String serverName, final String deviceIdentification, final Iec61850Report iec61850Report, final ServerModel serverModel, final ClientAssociation clientAssociation) {
    int i = 1;
    Rcb rcb = this.getRcb(serverModel, this.getReportNode(serverName, iec61850Report.getLogicalDevice(), i, iec61850Report.getLogicalNode()));
    while (rcb != null) {
        this.enableRcb(deviceIdentification, clientAssociation, rcb);
        i += 1;
        rcb = this.getRcb(serverModel, this.getReportNode(serverName, iec61850Report.getLogicalDevice(), i, iec61850Report.getLogicalNode()));
    }
}
Also used : Rcb(com.beanit.openiec61850.Rcb)

Example 42 with ServerModel

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

the class Iec61850RtuDeviceReportingService method enableAllReports.

private void enableAllReports(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    this.enableReports(connection, deviceIdentification, serverModel.getBrcbs());
    this.enableReports(connection, deviceIdentification, serverModel.getUrcbs());
}
Also used : ServerModel(com.beanit.openiec61850.ServerModel)

Example 43 with ServerModel

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

the class Iec61850RtuDeviceReportingService method enableSpecificReports.

private void enableSpecificReports(final DeviceConnection connection, final String deviceIdentification, final String serverName) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final ClientAssociation clientAssociation = connection.getConnection().getClientAssociation();
    final List<Iec61850DeviceReportGroup> deviceReportGroups = this.iec61850DeviceReportRepository.findByDeviceIdentificationAndEnabled(deviceIdentification, true);
    for (final Iec61850DeviceReportGroup deviceReportGroup : deviceReportGroups) {
        this.enableReportGroup(serverName, deviceIdentification, deviceReportGroup.getIec61850ReportGroup(), serverModel, clientAssociation);
    }
}
Also used : ServerModel(com.beanit.openiec61850.ServerModel) Iec61850DeviceReportGroup(org.opensmartgridplatform.adapter.protocol.iec61850.domain.entities.Iec61850DeviceReportGroup) ClientAssociation(com.beanit.openiec61850.ClientAssociation)

Example 44 with ServerModel

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

the class Iec61850Client method readServerModelFromDevice.

/**
 * Read the device model from the device.
 *
 * @param clientAssociation The {@link ClientAssociation} instance.
 * @return A {@link ServerModel} instance.
 * @throws ProtocolAdapterException
 */
public ServerModel readServerModelFromDevice(final ClientAssociation clientAssociation) throws ProtocolAdapterException {
    try {
        LOGGER.debug("Start reading server model from device");
        // RetrieveModel() will call all GetDirectory and GetDefinition ACSI
        // services needed to get the complete server model.
        final ServerModel serverModel = clientAssociation.retrieveModel();
        LOGGER.debug("Completed reading server model from device");
        return serverModel;
    } catch (final ServiceError e) {
        clientAssociation.close();
        throw new ProtocolAdapterException("Service Error requesting model.", e);
    } catch (final IOException e) {
        throw new ProtocolAdapterException("Fatal IOException requesting model.", e);
    }
}
Also used : ServiceError(com.beanit.openiec61850.ServiceError) ServerModel(com.beanit.openiec61850.ServerModel) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) IOException(java.io.IOException)

Example 45 with ServerModel

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

the class Iec61850Client method readServerModelFromSclFile.

/**
 * Use an ICD file (model file) to read the device model.
 *
 * @param clientAssociation Instance of {@link ClientAssociation}
 * @param filePath "../sampleServer/sampleModel.icd"
 * @return Instance of {@link ServerModel}
 * @throws ProtocolAdapterException In case the file path is empty.
 */
public ServerModel readServerModelFromSclFile(final ClientAssociation clientAssociation, final String filePath) throws ProtocolAdapterException {
    if (StringUtils.isEmpty(filePath)) {
        throw new ProtocolAdapterException("File path is empty");
    }
    try {
        final ServerModel serverModel = SclParser.parse(filePath).get(0);
        clientAssociation.setServerModel(serverModel);
        return serverModel;
    } catch (final SclParseException e) {
        throw new ProtocolAdapterException("Error parsing SCL file: " + filePath, e);
    }
}
Also used : ServerModel(com.beanit.openiec61850.ServerModel) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) SclParseException(com.beanit.openiec61850.SclParseException)

Aggregations

ServerModel (org.openmuc.openiec61850.ServerModel)17 ModelNode (com.beanit.openiec61850.ModelNode)16 ServerModel (com.beanit.openiec61850.ServerModel)12 ModelNode (org.openmuc.openiec61850.ModelNode)10 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)8 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)7 JMSException (javax.jms.JMSException)6 ClientAssociation (com.beanit.openiec61850.ClientAssociation)5 ConnectionFailureException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException)4 Iec61850ClientAssociation (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)4 Iec61850Connection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850Connection)4 DeviceConnection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)4 ClientAssociation (org.openmuc.openiec61850.ClientAssociation)4 ConnectionFailureException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException)4 Iec61850ClientAssociation (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)4 Iec61850Connection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection)4 DeviceConnection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)4 EmptyDeviceResponse (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse)3 EmptyDeviceResponse (org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse)3 BasicDataAttribute (com.beanit.openiec61850.BasicDataAttribute)2