Search in sources :

Example 96 with DeviceConnection

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

the class Iec61850AlarmCommand method execute.

@Override
public MeasurementDto execute(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex) throws NodeException {
    final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, LogicalNode.GENERIC_PROCESS_I_O, map.get(this.alarmIndex), Fc.ST);
    client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
    return this.translate(containingNode);
}
Also used : NodeContainer(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 97 with DeviceConnection

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

the class Iec61850ClearReportCommand method clearBufferedReportOnDevice.

public void clearBufferedReportOnDevice(final DeviceConnection deviceConnection) throws NodeException {
    final NodeContainer reporting = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.LOGICAL_NODE_ZERO, DataAttribute.REPORTING, Fc.BR);
    reporting.writeBoolean(SubDataAttribute.ENABLE_REPORTING, false);
    reporting.writeBoolean(SubDataAttribute.PURGE_BUF, true);
    LOGGER.info("Cleared (buffered reporting) event buffer for device: {}", deviceConnection.getDeviceIdentification());
}
Also used : NodeContainer(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 98 with DeviceConnection

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

the class Iec61850DisableRegistrationCommand method disableRegistration.

public void disableRegistration(final DeviceConnection deviceConnection) throws NodeException {
    final NodeContainer deviceRegistration = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.REGISTRATION, Fc.CF);
    deviceRegistration.writeBoolean(SubDataAttribute.DEVICE_REGISTRATION_ENABLED, false);
    LOGGER.info("Registration disabled for device: {}", deviceConnection.getDeviceIdentification());
}
Also used : NodeContainer(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 99 with DeviceConnection

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

the class Iec61850EnableReportingCommand method enableUnbufferedReportingOnLightMeasurementDevice.

public void enableUnbufferedReportingOnLightMeasurementDevice(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection) throws NodeException {
    final NodeContainer reporting = deviceConnection.getFcModelNode(LogicalDevice.LD0, LogicalNode.LOGICAL_NODE_ZERO, DataAttribute.RCB_A, Fc.RP);
    // Read the reporting enabled boolean.
    iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), (FcModelNode) reporting.getFcmodelNode().getChild(SubDataAttribute.ENABLE_REPORTING.getDescription()));
    final boolean reportingEnabled = reporting.getBoolean(SubDataAttribute.ENABLE_REPORTING).getValue();
    LOGGER.info("reportingEnabled for unbuffered reports: {}", reportingEnabled);
    if (reportingEnabled) {
        LOGGER.info("Unbuffered reporting is already enabled for device: {}", deviceConnection.getDeviceIdentification());
        return;
    }
    // Only reading the sequence number for the report node, as the report
    // node is not fully described by the ServerModel when using an ICD
    // file. Since the report node differs from the ServerModel, a full read
    // of the node and all data-attributes will fail. Therefore, only the
    // needed data-attributes are read.
    iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), (FcModelNode) reporting.getFcmodelNode().getChild(SubDataAttribute.SEQUENCE_NUMBER.getDescription()));
    final Iec61850ClientBaseEventListener reportListener = deviceConnection.getConnection().getIec61850ClientAssociation().getReportListener();
    final short sqNum = reporting.getUnsignedByte(SubDataAttribute.SEQUENCE_NUMBER).getValue();
    reportListener.setSqNum(sqNum);
    final String dataSetReference = reporting.getString(SubDataAttribute.DATA_SET);
    LOGGER.info("dataSetReference for unbuffered reporting: {}", dataSetReference);
    if (StringUtils.isEmpty(dataSetReference)) {
        // Set data set reference.
        reporting.writeString(SubDataAttribute.DATA_SET, this.getDataSetReferenceForLightMeasurementDevice());
        reporting.writeString(SubDataAttribute.REPORT_ID, "A");
    }
    // Enable reporting.
    reporting.writeBoolean(SubDataAttribute.ENABLE_REPORTING, true);
    LOGGER.info("Allowing light measurement device {} to send unbuffered reports containing events", deviceConnection.getDeviceIdentification());
}
Also used : NodeContainer(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer) Iec61850ClientBaseEventListener(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.reporting.Iec61850ClientBaseEventListener)

Example 100 with DeviceConnection

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

the class Iec61850EnableReportingCommand method enableUnbufferedReportingOnDeviceWithoutUsingSequenceNumber.

public void enableUnbufferedReportingOnDeviceWithoutUsingSequenceNumber(final DeviceConnection deviceConnection) throws NodeException {
    final NodeContainer reporting = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.LOGICAL_NODE_ZERO, DataAttribute.REPORTING, Fc.RP);
    final Iec61850ClientBaseEventListener reportListener = deviceConnection.getConnection().getIec61850ClientAssociation().getReportListener();
    reportListener.setSqNum(0);
    reporting.writeBoolean(SubDataAttribute.ENABLE_REPORTING, true);
    LOGGER.info("Allowing device {} to send unbuffered reports containing events", deviceConnection.getDeviceIdentification());
}
Also used : NodeContainer(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer) Iec61850ClientBaseEventListener(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.reporting.Iec61850ClientBaseEventListener)

Aggregations

NodeContainer (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)63 JMSException (javax.jms.JMSException)32 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)20 DeviceConnection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)18 DeviceConnection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)18 ConnectionFailureException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException)17 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)17 ConnectionFailureException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException)17 NodeException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.NodeException)14 NodeWriteException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException)13 FunctionalException (com.alliander.osgp.shared.exceptionhandling.FunctionalException)13 TechnicalException (com.alliander.osgp.shared.exceptionhandling.TechnicalException)13 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)13 DeviceMessageLog (org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)12 Function (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.Function)12 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)12 Ssld (com.alliander.osgp.core.db.api.iec61850.entities.Ssld)6 ArrayList (java.util.ArrayList)6 DateTime (org.joda.time.DateTime)6 Iec61850ClientBaseEventListener (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.reporting.Iec61850ClientBaseEventListener)6