Search in sources :

Example 1 with ModelNode

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

the class DistributionAutomationGetPQValuesRequestMessageProcessor method processPQValue.

private DataSampleDto processPQValue(final ModelNode node) {
    Date ts = null;
    String type = null;
    BigDecimal value = null;
    if (node.getChildren() != null) {
        ts = this.findBdaTimestampNodeValue(node);
        final ModelNode floatNode = this.findBdaFloat32NodeInConstructedDataAttribute(node);
        if (floatNode != null) {
            type = node.getName() + "." + floatNode.getParent().getName() + "." + floatNode.getName();
            value = new BigDecimal(((BdaFloat32) floatNode).getFloat(), new MathContext(3, RoundingMode.HALF_EVEN));
        }
    }
    return new DataSampleDto(type, ts, value);
}
Also used : DataSampleDto(org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto) BdaFloat32(org.openmuc.openiec61850.BdaFloat32) FcModelNode(org.openmuc.openiec61850.FcModelNode) ModelNode(org.openmuc.openiec61850.ModelNode) Date(java.util.Date) BigDecimal(java.math.BigDecimal) MathContext(java.math.MathContext)

Example 2 with ModelNode

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

the class Iec61850RtuDeviceReportingService method enableChpReportingOnDevice.

private void enableChpReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String chpPrefix = LogicalDevice.CHP.getDescription();
    int i = 1;
    String logicalDeviceName = chpPrefix + i;
    ModelNode chpNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (chpNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.CHP, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.CHP, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = chpPrefix + i;
        chpNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 3 with ModelNode

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

the class Iec61850RtuDeviceReportingService method enableRtuReportingOnDevice.

private void enableRtuReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String rtuPrefix = LogicalDevice.RTU.getDescription();
    int i = 1;
    String logicalDeviceName = rtuPrefix + i;
    ModelNode rtuNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (rtuNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.RTU, i, DataAttribute.REPORT_STATUS_ONE);
        i += 1;
        logicalDeviceName = rtuPrefix + i;
        rtuNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 4 with ModelNode

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

the class Iec61850RtuDeviceReportingService method enablePvReportingOnDevice.

private void enablePvReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String pvPrefix = LogicalDevice.PV.getDescription();
    int i = 1;
    String logicalDeviceName = pvPrefix + i;
    ModelNode pvNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (pvNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.PV, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.PV, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = pvPrefix + i;
        pvNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 5 with ModelNode

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

the class RtuSimulator method addPvDevices.

private void addPvDevices(final ServerModel serverModel) {
    final String pvPrefix = "PV";
    int i = 1;
    String logicalDeviceName = pvPrefix + i;
    ModelNode pvNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    while (pvNode != null) {
        this.logicalDevices.add(new Pv(this.getDeviceName(), logicalDeviceName, serverModel));
        i += 1;
        logicalDeviceName = pvPrefix + i;
        pvNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
    }
}
Also used : Pv(com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.Pv) ModelNode(org.openmuc.openiec61850.ModelNode)

Aggregations

ModelNode (org.openmuc.openiec61850.ModelNode)25 ModelNode (com.beanit.openiec61850.ModelNode)20 ServerModel (org.openmuc.openiec61850.ServerModel)10 ArrayList (java.util.ArrayList)7 FcModelNode (com.beanit.openiec61850.FcModelNode)5 DataSampleDto (org.opensmartgridplatform.dto.da.iec61850.DataSampleDto)4 BdaFloat32 (com.beanit.openiec61850.BdaFloat32)3 BigDecimal (java.math.BigDecimal)3 MathContext (java.math.MathContext)3 FcModelNode (org.openmuc.openiec61850.FcModelNode)3 DataSampleDto (org.osgpfoundation.osgp.dto.da.iec61850.DataSampleDto)3 BasicDataAttribute (com.beanit.openiec61850.BasicDataAttribute)2 BdaTimestamp (com.beanit.openiec61850.BdaTimestamp)2 ServerModel (com.beanit.openiec61850.ServerModel)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 LightMeasurementRtu (org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.LightMeasurementRtu)2