Search in sources :

Example 26 with NodeContainer

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850ScheduleCatCommand method executeWrite.

@Override
public void executeWrite(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex, final SetPointDto setPoint) throws NodeWriteException {
    final int value = this.checkValue(setPoint.getValue());
    final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, this.logicalNode, DATA_ATTRIBUTE_RTU, FC);
    containingNode.writeInteger(SUB_DATA_ATTRIBUTE, value);
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 27 with NodeContainer

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850ScheduleIdCommand method executeWrite.

@Override
public void executeWrite(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex, final SetPointDto setPoint) throws NodeWriteException {
    final int value = this.checkValue(setPoint.getValue());
    final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, this.logicalNode, DATA_ATTRIBUTE, FC);
    containingNode.writeInteger(SUB_DATA_ATTRIBUTE, value);
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Example 28 with NodeContainer

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850UpdateFirmwareCommand method updateSecurityFirmware.

private void updateSecurityFirmware(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection, final String fullUrl, final DeviceMessageLog deviceMessageLog) throws NodeException {
    LOGGER.info("Reading the security firmware node for device: {}", deviceConnection.getDeviceIdentification());
    final NodeContainer securityFirmwareNode = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SECURITY_FIRMWARE, Fc.CF);
    iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), securityFirmwareNode.getFcmodelNode());
    final String currentSecurityFirmwareDownloadUrl = securityFirmwareNode.getString(SubDataAttribute.URL);
    final Date currentSecurityFirmwareUpdateDateTime = securityFirmwareNode.getDate(SubDataAttribute.START_TIME);
    LOGGER.info("Current security firmware download url: {}, start time: {} for device: {}", currentSecurityFirmwareDownloadUrl, currentSecurityFirmwareUpdateDateTime, deviceConnection.getDeviceIdentification());
    LOGGER.info("Updating the security firmware download url to : {} for device: {}", fullUrl, deviceConnection.getDeviceIdentification());
    securityFirmwareNode.writeString(SubDataAttribute.URL, fullUrl);
    deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SECURITY_FIRMWARE, Fc.CF, SubDataAttribute.URL, fullUrl);
    final Date oneMinuteFromNow = this.determineFirmwareUpdateDateTime(iec61850Client, deviceConnection);
    LOGGER.info("Updating the security firmware download start time to: {} for device: {}", oneMinuteFromNow, deviceConnection.getDeviceIdentification());
    securityFirmwareNode.writeDate(SubDataAttribute.START_TIME, oneMinuteFromNow);
    deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SECURITY_FIRMWARE, Fc.CF, SubDataAttribute.START_TIME, simpleDateFormat.format(oneMinuteFromNow));
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer) Date(java.util.Date)

Example 29 with NodeContainer

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850UpdateFirmwareCommand method determineFirmwareUpdateDateTime.

private Date determineFirmwareUpdateDateTime(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection) throws NodeReadException {
    final NodeContainer clock = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.CLOCK, Fc.CF);
    iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), clock.getFcmodelNode());
    final DateTime deviceTime = new DateTime(clock.getDate(SubDataAttribute.CURRENT_TIME));
    // Creating a DateTime one minute from now.
    return deviceTime.plusMinutes(1).toDate();
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer) DateTime(org.joda.time.DateTime)

Example 30 with NodeContainer

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850VlmCapCommand 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.TANK_CHARACTERISTICS_ONE, DataAttribute.VLMCAP, Fc.SP);
    client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
    return this.translate(containingNode);
}
Also used : NodeContainer(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)

Aggregations

NodeContainer (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)55 DeviceMessageLog (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)10 Function (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function)10 LogicalNode (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.LogicalNode)6 ArrayList (java.util.ArrayList)5 DateTime (org.joda.time.DateTime)5 BdaBoolean (org.openmuc.openiec61850.BdaBoolean)5 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)3 Date (java.util.Date)3 DaylightSavingTimeTransition (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DaylightSavingTimeTransition)2 NodeWriteException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException)2 Iec61850ClientBaseEventListener (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.reporting.Iec61850ClientBaseEventListener)2 DeviceOutputSetting (com.alliander.osgp.core.db.api.iec61850.entities.DeviceOutputSetting)2 DeviceFixedIpDto (com.alliander.osgp.dto.valueobjects.DeviceFixedIpDto)2 LightTypeDto (com.alliander.osgp.dto.valueobjects.LightTypeDto)2 RelayMapDto (com.alliander.osgp.dto.valueobjects.RelayMapDto)2 List (java.util.List)2 ProfilePair (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.ProfilePair)1 ScheduleEntry (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.ScheduleEntry)1 RelayType (com.alliander.osgp.core.db.api.iec61850valueobjects.RelayType)1