Search in sources :

Example 16 with ClientAssociation

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

the class Iec61850DeviceConnectionService method readNodeDataValues.

public void readNodeDataValues(final String deviceIdentification, final FcModelNode fcModelNode) throws NodeReadException {
    final Iec61850Connection iec61850Connection = this.fetchIec61850Connection(deviceIdentification);
    if (iec61850Connection == null) {
        return;
    }
    final ClientAssociation clientAssociation = iec61850Connection.getClientAssociation();
    this.iec61850Client.readNodeDataValues(clientAssociation, fcModelNode);
}
Also used : Iec61850Connection(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection) Iec61850ClientAssociation(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation) ClientAssociation(com.beanit.openiec61850.ClientAssociation)

Example 17 with ClientAssociation

use of com.beanit.openiec61850.ClientAssociation 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 18 with ClientAssociation

use of com.beanit.openiec61850.ClientAssociation 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 19 with ClientAssociation

use of com.beanit.openiec61850.ClientAssociation 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 20 with ClientAssociation

use of com.beanit.openiec61850.ClientAssociation 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

ClientAssociation (com.beanit.openiec61850.ClientAssociation)8 ServerModel (com.beanit.openiec61850.ServerModel)8 ClientAssociation (org.openmuc.openiec61850.ClientAssociation)7 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)7 Iec61850ClientAssociation (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)6 Iec61850Connection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850Connection)6 JMSException (javax.jms.JMSException)6 Iec61850ClientAssociation (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)6 Iec61850Connection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection)6 ConnectionFailureException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException)5 ConnectionFailureException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException)5 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)4 DeviceConnection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)4 IOException (java.io.IOException)4 ServerModel (org.openmuc.openiec61850.ServerModel)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 ServiceError (com.beanit.openiec61850.ServiceError)2 Serializable (java.io.Serializable)2