Search in sources :

Example 16 with Iec61850Connection

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection in project open-smart-grid-platform by OSGP.

the class Iec61850DeviceConnectionService method disconnect.

/**
 * Closes the {@link ClientAssociation}, send a disconnect request and close the socket.
 */
public void disconnect(final String deviceIdentification) {
    LOGGER.info("Trying to disconnect from deviceIdentification: {}", deviceIdentification);
    final Iec61850Connection iec61850Connection = this.fetchIec61850Connection(deviceIdentification);
    if (iec61850Connection != null) {
        iec61850Connection.getClientAssociation().disconnect();
        this.removeIec61850Connection(deviceIdentification);
        LOGGER.info("Disconnected from deviceIdentification: {}", deviceIdentification);
    } else {
        LOGGER.info("Unable to disconnect from deviceIdentification: {}, no cached connection was found", deviceIdentification);
    }
}
Also used : Iec61850Connection(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection)

Example 17 with Iec61850Connection

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection 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)

Aggregations

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