Search in sources :

Example 11 with LogicalNode

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));
    }
}
Also used : BdaBoolean(com.beanit.openiec61850.BdaBoolean) NodeContainer(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 12 with LogicalNode

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);
}
Also used : NodeNotFoundException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.NodeNotFoundException) ObjectReference(com.beanit.openiec61850.ObjectReference) FcModelNode(com.beanit.openiec61850.FcModelNode)

Example 13 with LogicalNode

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);
}
Also used : ScheduleEntry(org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.ScheduleEntry)

Aggregations

LogicalNode (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.LogicalNode)6 NodeContainer (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)6 DeviceMessageLog (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)4 Function (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function)4 ArrayList (java.util.ArrayList)4 NodeContainer (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)4 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)3 BdaBoolean (com.beanit.openiec61850.BdaBoolean)3 BdaBoolean (org.openmuc.openiec61850.BdaBoolean)3 LogicalNode (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.LogicalNode)3 FcModelNode (com.beanit.openiec61850.FcModelNode)2 ObjectReference (com.beanit.openiec61850.ObjectReference)2 DateTime (org.joda.time.DateTime)2 NodeNotFoundException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.NodeNotFoundException)2 DaylightSavingTimeTransition (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DaylightSavingTimeTransition)1 ScheduleEntry (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.ScheduleEntry)1 DeviceOutputSetting (com.alliander.osgp.core.db.api.iec61850.entities.DeviceOutputSetting)1 RelayType (com.alliander.osgp.core.db.api.iec61850valueobjects.RelayType)1 DeviceFixedIpDto (com.alliander.osgp.dto.valueobjects.DeviceFixedIpDto)1 DeviceStatusDto (com.alliander.osgp.dto.valueobjects.DeviceStatusDto)1