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);
}
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());
}
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());
}
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());
}
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());
}
Aggregations