use of com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeReadException in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ModeCommand 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, LogicalNode.LOGICAL_NODE_ZERO, DataAttribute.MODE, Fc.ST);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
use of com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeReadException in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850Client method readAllDataValues.
/**
* Read the values of all data attributes of all data objects of all Logical
* Nodes.
*
* @param clientAssociation
* An {@link ClientAssociation} instance.
*
* @throws NodeReadException
* In case the read action fails.
*/
public void readAllDataValues(final ClientAssociation clientAssociation) throws NodeReadException {
try {
LOGGER.debug("Start getAllDataValues from device");
clientAssociation.getAllDataValues();
LOGGER.debug("Completed getAllDataValues from device");
} catch (final ServiceError e) {
LOGGER.error("ServiceError during readAllDataValues", e);
throw new NodeReadException(e.getMessage(), e, ConnectionState.OK);
} catch (final IOException e) {
LOGGER.error("IOException during readAllDataValues", e);
throw new NodeReadException(e.getMessage(), e, ConnectionState.BROKEN);
}
}
use of com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeReadException in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850Client method sendCommandWithRetry.
/**
* Executes the apply method of the given {@link Function} with retries and
* message logging.
*
* @return The given T.
*/
public <T> T sendCommandWithRetry(final Function<T> function, final String functionName, final String deviceIdentification) throws ProtocolAdapterException {
T output = null;
final DeviceMessageLog deviceMessageLog = new DeviceMessageLog(IED.FLEX_OVL, LogicalDevice.LIGHTING, functionName);
try {
output = function.apply(deviceMessageLog);
} catch (final NodeWriteException | NodeReadException e) {
if (ConnectionState.OK.equals(e.getConnectionState())) {
// ServiceError means we have to retry.
LOGGER.error("Caught ServiceError, retrying", e);
this.sendCommandWithRetry(function, deviceIdentification, 1, deviceMessageLog);
} else {
LOGGER.error("Caught IOException, connection with device is broken.", e);
}
} catch (final ConnectionFailureException e) {
throw e;
} catch (final Exception e) {
throw new ProtocolAdapterException(e == null ? "Could not execute command" : e.getMessage(), e);
}
return output;
}
use of com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeReadException in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ScheduleAbsTimeCommand method execute.
@Override
public ProfileDto execute(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex) throws NodeReadException {
final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, this.logicalNode, DATA_ATTRIBUTE, FC);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
use of com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeReadException in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ScheduleCatCommand 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, DATA_ATTRIBUTE_RTU, FC);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
Aggregations