use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850GetFirmwareVersionCommand method getFirmwareVersionFromDevice.
public List<FirmwareVersionDto> getFirmwareVersionFromDevice(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection) throws ProtocolAdapterException {
final Function<List<FirmwareVersionDto>> function = new Function<List<FirmwareVersionDto>>() {
@Override
public List<FirmwareVersionDto> apply(final DeviceMessageLog deviceMessageLog) throws Exception {
final List<FirmwareVersionDto> output = new ArrayList<>();
// Getting the functional firmware version
LOGGER.info("Reading the functional firmware version");
final NodeContainer functionalFirmwareNode = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.FUNCTIONAL_FIRMWARE, Fc.ST);
iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), functionalFirmwareNode.getFcmodelNode());
final String functionalFirmwareVersion = functionalFirmwareNode.getString(SubDataAttribute.CURRENT_VERSION);
// Adding it to the list
output.add(new FirmwareVersionDto(FirmwareModuleType.FUNCTIONAL, functionalFirmwareVersion));
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.FUNCTIONAL_FIRMWARE, Fc.ST, SubDataAttribute.CURRENT_VERSION, functionalFirmwareVersion);
// Getting the security firmware version
LOGGER.info("Reading the security firmware version");
final NodeContainer securityFirmwareNode = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SECURITY_FIRMWARE, Fc.ST);
iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), securityFirmwareNode.getFcmodelNode());
final String securityFirmwareVersion = securityFirmwareNode.getString(SubDataAttribute.CURRENT_VERSION);
// Adding it to the list
output.add(new FirmwareVersionDto(FirmwareModuleType.SECURITY, securityFirmwareVersion));
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SECURITY_FIRMWARE, Fc.ST, SubDataAttribute.CURRENT_VERSION, securityFirmwareVersion);
DeviceMessageLoggingService.logMessage(deviceMessageLog, deviceConnection.getDeviceIdentification(), deviceConnection.getOrganisationIdentification(), false);
return output;
}
};
return iec61850Client.sendCommandWithRetry(function, "GetFirmwareVersion", deviceConnection.getDeviceIdentification());
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850HealthCommand 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.HEALTH, Fc.ST);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850LoadActualPowerCommand 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.ACTUAL_POWER, Fc.MX);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850AlarmOtherCommand 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.GENERIC_PROCESS_I_O, DataAttribute.ALARM_OTHER, Fc.ST);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ClearReportCommand method clearReportOnDevice.
public void clearReportOnDevice(final DeviceConnection deviceConnection) throws NodeWriteException {
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 event buffer for device: {}", deviceConnection.getDeviceIdentification());
}
Aggregations