Search in sources :

Example 1 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 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(org.openmuc.openiec61850.ServiceError) ServerModel(org.openmuc.openiec61850.ServerModel) ProtocolAdapterException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) IOException(java.io.IOException)

Example 2 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableChpReportingOnDevice.

private void enableChpReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String chpPrefix = LogicalDevice.CHP.getDescription();
    int i = 1;
    String logicalDeviceName = chpPrefix + i;
    ModelNode chpNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (chpNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.CHP, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.CHP, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = chpPrefix + i;
        chpNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 3 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableRtuReportingOnDevice.

private void enableRtuReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String rtuPrefix = LogicalDevice.RTU.getDescription();
    int i = 1;
    String logicalDeviceName = rtuPrefix + i;
    ModelNode rtuNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (rtuNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.RTU, i, DataAttribute.REPORT_STATUS_ONE);
        i += 1;
        logicalDeviceName = rtuPrefix + i;
        rtuNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 4 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enablePvReportingOnDevice.

private void enablePvReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String pvPrefix = LogicalDevice.PV.getDescription();
    int i = 1;
    String logicalDeviceName = pvPrefix + i;
    ModelNode pvNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (pvNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.PV, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.PV, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = pvPrefix + i;
        pvNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 5 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850DaRtuDeviceService method getData.

@Override
public void getData(final DaDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler, final DaRtuDeviceRequestMessageProcessor messageProcessor) throws JMSException {
    try {
        final String serverName = this.getServerName(deviceRequest);
        final ServerModel serverModel = this.connectAndRetrieveServerModel(deviceRequest, serverName);
        final ClientAssociation clientAssociation = this.iec61850DeviceConnectionService.getClientAssociation(deviceRequest.getDeviceIdentification());
        final Serializable dataResponse = this.handleGetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest, messageProcessor);
        final DaDeviceResponse deviceResponse = new DaDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.OK, dataResponse);
        deviceResponseHandler.handleResponse(deviceResponse);
    } catch (final ConnectionFailureException se) {
        LOGGER.error("Could not connect to device after all retries", se);
        final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
        deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
    } catch (final Exception e) {
        LOGGER.error("Unexpected exception during Get Data", e);
        final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
        deviceResponseHandler.handleException(e, deviceResponse);
    }
}
Also used : DaDeviceResponse(com.alliander.osgp.adapter.protocol.iec61850.device.da.rtu.DaDeviceResponse) Serializable(java.io.Serializable) ServerModel(org.openmuc.openiec61850.ServerModel) Iec61850Connection(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850Connection) Iec61850ClientAssociation(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation) ConnectionFailureException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException) DeviceConnection(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection) Iec61850ClientAssociation(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation) ClientAssociation(org.openmuc.openiec61850.ClientAssociation) ConnectionFailureException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException) JMSException(javax.jms.JMSException) ProtocolAdapterException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse)

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