Search in sources :

Example 66 with DeviceConnection

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850LoadMinimumActualPowerCommand method execute.

@Override
public MeasurementDto execute(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex) throws NodeReadException {
    final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, this.logicalNode, DataAttribute.MIN_ACTUAL_POWER, Fc.MX);
    client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
    return this.translate(containingNode);
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 67 with DeviceConnection

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850LoadTotalEnergyCommand method execute.

@Override
public MeasurementDto execute(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex) throws NodeReadException {
    final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, this.logicalNode, DataAttribute.TOTAL_ENERGY, Fc.ST);
    client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
    return this.translate(containingNode);
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 68 with DeviceConnection

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850MaterialStatusCommand method execute.

@Override
public MeasurementDto execute(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex) throws NodeReadException {
    final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, this.logicalNode, DataAttribute.MATERIAL_STATUS, Fc.SP);
    client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
    return this.translate(containingNode);
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 69 with DeviceConnection

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.

the class DeviceRegistrationService method setLocationInformation.

/**
     * Set the location information for this device. If the osgp_core database
     * contains longitude and latitude information for the given device, those
     * values must be saved to the corresponding data-attributes.
     */
protected void setLocationInformation(final DeviceConnection deviceConnection) {
    final Ssld ssld = DeviceRegistrationService.this.ssldDataRepository.findByDeviceIdentification(deviceConnection.getDeviceIdentification());
    if (ssld != null) {
        final Float longitude = ssld.getGpsLongitude();
        final Float latitude = ssld.getGpsLatitude();
        LOGGER.info("Ssld found for device: {} longitude: {}, latitude: {}", deviceConnection.getDeviceIdentification(), longitude, latitude);
        if (longitude != null && latitude != null) {
            try {
                new Iec61850SetGpsCoordinatesCommand().setGpsCoordinates(deviceConnection, longitude, latitude);
            } catch (final NodeWriteException e) {
                LOGGER.error("Unable to set location information for device: " + deviceConnection.getDeviceIdentification(), e);
            }
        }
    }
}
Also used : NodeWriteException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException) Iec61850SetGpsCoordinatesCommand(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850SetGpsCoordinatesCommand) Ssld(com.alliander.osgp.core.db.api.iec61850.entities.Ssld)

Example 70 with DeviceConnection

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableStatusReportingOnDevice.

private void enableStatusReportingOnDevice(final DeviceConnection deviceConnection, final String deviceIdentification, final LogicalDevice logicalDevice, final int logicalDeviceIndex, final DataAttribute reportName) {
    LOGGER.info("Allowing device {} to send events", deviceIdentification);
    try {
        final NodeContainer reportingNode = deviceConnection.getFcModelNode(logicalDevice, logicalDeviceIndex, LogicalNode.LOGICAL_NODE_ZERO, reportName, Fc.BR);
        reportingNode.writeBoolean(SubDataAttribute.ENABLE_REPORTING, true);
    } catch (final NullPointerException e) {
        LOGGER.debug("NullPointerException", e);
        LOGGER.warn("Skip enable reporting for device {}{}, report {}.", logicalDevice, logicalDeviceIndex, reportName.getDescription());
    } catch (final NodeWriteException e) {
        LOGGER.debug("NodeWriteException", e);
        LOGGER.error("Enable reporting for device {}{}, report {}, failed with exception: {}", logicalDevice, logicalDeviceIndex, reportName.getDescription(), e.getMessage());
    }
}
Also used : NodeWriteException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException) NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Aggregations

NodeContainer (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)55 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)22 DeviceConnection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)18 ConnectionFailureException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException)17 NodeWriteException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException)17 JMSException (javax.jms.JMSException)16 DeviceMessageLog (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)15 Function (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function)15 FunctionalException (com.alliander.osgp.shared.exceptionhandling.FunctionalException)14 TechnicalException (com.alliander.osgp.shared.exceptionhandling.TechnicalException)13 ArrayList (java.util.ArrayList)8 Ssld (com.alliander.osgp.core.db.api.iec61850.entities.Ssld)7 LogicalNode (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.LogicalNode)6 DeviceOutputSetting (com.alliander.osgp.core.db.api.iec61850.entities.DeviceOutputSetting)6 DateTime (org.joda.time.DateTime)6 BdaBoolean (org.openmuc.openiec61850.BdaBoolean)5 Iec61850ClientAssociation (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)4 Iec61850Connection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850Connection)4 ClientAssociation (org.openmuc.openiec61850.ClientAssociation)4 ServerModel (org.openmuc.openiec61850.ServerModel)4