use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.LogicalNode in project open-smart-grid-platform by OSGP.
the class Iec61850Commands method enableOperationOfRelay.
/**
* Checks if {@code CfSt.enbOper [CF]} for the given {@code logicalNode} is set to {@code true} on
* the Lighting device, because this is necessary to be able to operate the relay.
*
* <p>If it is {@code false}, switching of the relay is enabled by writing boolean {@code true} to
* {@code CfSt.enbOper [CF]}.
*/
public static void enableOperationOfRelay(final DeviceConnection deviceConnection, final Iec61850Client iec61850Client, final DeviceMessageLog deviceMessageLog, final LogicalNode logicalNode, final Integer index) throws NodeException {
final NodeContainer masterControl = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, logicalNode, DataAttribute.MASTER_CONTROL, Fc.CF);
iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), masterControl.getFcmodelNode());
final BdaBoolean enbOper = masterControl.getBoolean(SubDataAttribute.ENABLE_OPERATION);
if (enbOper.getValue()) {
LOGGER.info("masterControl.enbOper is true, switching of relay {} is enabled", index);
} else {
LOGGER.info("masterControl.enbOper is false, switching of relay {} is disabled", index);
masterControl.writeBoolean(SubDataAttribute.ENABLE_OPERATION, true);
LOGGER.info("set masterControl.enbOper to true to enable switching of relay {}", index);
deviceMessageLog.addVariable(logicalNode, DataAttribute.MASTER_CONTROL, Fc.CF, SubDataAttribute.ENABLE_OPERATION, Boolean.toString(true));
}
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.LogicalNode in project open-smart-grid-platform by OSGP.
the class DeviceConnection method getFcModelNode.
/**
* Returns a {@link NodeContainer} for the given {@link ObjectReference} data and the Functional
* constraint.
*
* @throws NodeNotFoundException
*/
public NodeContainer getFcModelNode(final LogicalDevice logicalDevice, final int logicalDeviceIndex, final LogicalNode logicalNode, final DataAttribute dataAttribute, final Fc fc) throws NodeNotFoundException {
final ObjectReference objectReference = this.createObjectReference(logicalDevice, logicalDeviceIndex, logicalNode, dataAttribute);
final FcModelNode fcModelNode = (FcModelNode) this.connection.getServerModel().findModelNode(objectReference, fc);
if (fcModelNode == null) {
LOGGER.error("FcModelNode is null, most likely the data attribute: {} does not exist", dataAttribute.getDescription());
throw new NodeNotFoundException(String.format("FcModelNode with objectReference %s does not exist", objectReference));
}
return new NodeContainer(this, fcModelNode);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.LogicalNode in project open-smart-grid-platform by OSGP.
the class Iec61850SetScheduleFunction method writeScheduleEntryForRelay.
private void writeScheduleEntryForRelay(final DeviceMessageLog deviceMessageLog, final List<ScheduleEntry> scheduleEntries, final LogicalNode logicalNode, final NodeContainer schedule, final int i) throws NodeWriteException {
final ScheduleEntry scheduleEntry = scheduleEntries.get(i);
final String scheduleEntryName = SubDataAttribute.SCHEDULE_ENTRY.getDescription() + (i + 1);
final NodeContainer scheduleNode = schedule.getChild(scheduleEntryName);
this.setEnabled(deviceMessageLog, logicalNode, scheduleEntry, scheduleEntryName, scheduleNode);
this.setDay(deviceMessageLog, logicalNode, scheduleEntry, scheduleEntryName, scheduleNode);
this.setSwitchTimes(deviceMessageLog, logicalNode, scheduleEntry, scheduleEntryName, scheduleNode);
this.setMinimumTimeOn(deviceMessageLog, logicalNode, scheduleEntry, scheduleEntryName, scheduleNode);
this.setTriggerWindow(deviceMessageLog, logicalNode, scheduleEntry, scheduleEntryName, scheduleNode);
}
Aggregations