Search in sources :

Example 6 with BdaInt8

use of com.beanit.openiec61850.BdaInt8 in project Protocol-Adapter-IEC61850 by OSGP.

the class LogicalDevice method setRandomByte.

protected BasicDataAttribute setRandomByte(final String node, final Fc fc, final int min, final int max) {
    final BdaInt8 value = (BdaInt8) this.serverModel.findModelNode(this.createNodeName(node), fc);
    value.setValue((byte) ThreadLocalRandom.current().nextInt(min, max));
    return value;
}
Also used : BdaInt8(org.openmuc.openiec61850.BdaInt8)

Example 7 with BdaInt8

use of com.beanit.openiec61850.BdaInt8 in project open-smart-grid-platform by OSGP.

the class Iec61850SetConfigurationFunction method setRelayConfiguration.

private void setRelayConfiguration(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection, final ConfigurationDto configuration, final DeviceMessageLog deviceMessageLog) throws NodeException {
    if (configuration.getRelayConfiguration() != null && configuration.getRelayConfiguration().getRelayMap() != null) {
        final List<RelayMapDto> relayMaps = configuration.getRelayConfiguration().getRelayMap();
        for (final RelayMapDto relayMap : relayMaps) {
            final Integer internalIndex = relayMap.getAddress();
            final RelayTypeDto relayType = relayMap.getRelayType();
            final LogicalNode logicalNode = LogicalNode.getSwitchComponentByIndex(internalIndex);
            final NodeContainer switchType = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, logicalNode, DataAttribute.SWITCH_TYPE, Fc.CO);
            iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), switchType.getFcmodelNode());
            final NodeContainer operation = switchType.getChild(SubDataAttribute.OPERATION);
            iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), operation.getFcmodelNode());
            final BdaInt8 ctlVal = operation.getByte(SubDataAttribute.CONTROL_VALUE);
            final byte switchTypeValue = (byte) (RelayTypeDto.LIGHT.equals(relayType) ? SWITCH_TYPE_LIGHT : SWITCH_TYPE_TARIFF);
            LOGGER.info("Updating Switch for internal index {} to {} ({})", internalIndex, switchTypeValue, relayType);
            ctlVal.setValue(switchTypeValue);
            operation.write();
            deviceMessageLog.addVariable(logicalNode, DataAttribute.SWITCH_TYPE, Fc.CO, SubDataAttribute.OPERATION, SubDataAttribute.CONTROL_VALUE, Byte.toString(switchTypeValue));
        }
    }
}
Also used : BdaInt8(com.beanit.openiec61850.BdaInt8) RelayMapDto(org.opensmartgridplatform.dto.valueobjects.RelayMapDto) RelayTypeDto(org.opensmartgridplatform.dto.valueobjects.RelayTypeDto)

Example 8 with BdaInt8

use of com.beanit.openiec61850.BdaInt8 in project open-smart-grid-platform by OSGP.

the class NodeContainer method writeByte.

public void writeByte(final SubDataAttribute child, final byte value) throws NodeWriteException {
    final BdaInt8 bdaByte = (BdaInt8) this.parent.getChild(child.getDescription());
    bdaByte.setValue(value);
    this.writeNode(bdaByte);
}
Also used : BdaInt8(com.beanit.openiec61850.BdaInt8)

Example 9 with BdaInt8

use of com.beanit.openiec61850.BdaInt8 in project open-smart-grid-platform by OSGP.

the class LogicalDevice method setByte.

protected BasicDataAttribute setByte(final LogicalDeviceNode node, final byte val) {
    final BdaInt8 value = (BdaInt8) this.serverModel.findModelNode(this.createNodeName(node), node.getFc());
    value.setValue(val);
    return value;
}
Also used : BdaInt8(com.beanit.openiec61850.BdaInt8)

Aggregations

BdaInt8 (com.beanit.openiec61850.BdaInt8)5 BdaInt8 (org.openmuc.openiec61850.BdaInt8)4 DaylightSavingTimeTransition (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DaylightSavingTimeTransition)1 DeviceMessageLog (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)1 Function (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function)1 LogicalNode (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.LogicalNode)1 NodeContainer (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.NodeContainer)1 DeviceFixedIpDto (com.alliander.osgp.dto.valueobjects.DeviceFixedIpDto)1 RelayMapDto (com.alliander.osgp.dto.valueobjects.RelayMapDto)1 RelayTypeDto (com.alliander.osgp.dto.valueobjects.RelayTypeDto)1 BasicDataAttribute (com.beanit.openiec61850.BasicDataAttribute)1 ModelNode (com.beanit.openiec61850.ModelNode)1 ServerModel (com.beanit.openiec61850.ServerModel)1 ArrayList (java.util.ArrayList)1 DateTime (org.joda.time.DateTime)1 RelayMapDto (org.opensmartgridplatform.dto.valueobjects.RelayMapDto)1 RelayTypeDto (org.opensmartgridplatform.dto.valueobjects.RelayTypeDto)1