Search in sources :

Example 21 with BasicDataAttribute

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

the class UpdatePqValuesEventListener method updateServerValue.

private void updateServerValue(final ServerSap serverSap) {
    LOGGER.debug("updateServerValue");
    final ServerModel serverModel = serverSap.getModelCopy();
    final List<Node> nodes = Iec61850ServerHelper.initializeServerNodes(serverModel);
    final List<BasicDataAttribute> changedAttributes = Iec61850ServerHelper.getAllChangedAttributes(nodes);
    serverSap.setValues(changedAttributes);
}
Also used : ServerModel(com.beanit.openiec61850.ServerModel) Node(org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.substation.Node) BasicDataAttribute(com.beanit.openiec61850.BasicDataAttribute)

Example 22 with BasicDataAttribute

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

the class LightMeasurementRtu method setGeneralIO.

/**
 * Updates the value for the status of the 4 light sensors.
 *
 * @param bdaValue Array indicating which the status per light sensor. Each element in the array
 *     represents the status for one light sensor. Meaning of an element: 0 = OFF, greater than 0
 *     = ON. When there are less than 4 elements, the remaining light sensors will be set to OFF.
 * @return The updated values.
 */
private List<BasicDataAttribute> setGeneralIO(final byte[] bdaValue) {
    final List<BasicDataAttribute> values = new ArrayList<>();
    for (short lmIndex = 1; lmIndex <= 4; lmIndex++) {
        boolean stVal = false;
        if (bdaValue != null && bdaValue.length >= lmIndex) {
            stVal = bdaValue[lmIndex - 1] - 48 > 0;
        }
        final BasicDataAttribute bda = this.setBoolean(LogicalDeviceNode.fromDescription("SPGGIO" + lmIndex + ".Ind.stVal"), stVal);
        values.add(bda);
    }
    return values;
}
Also used : ArrayList(java.util.ArrayList) BasicDataAttribute(com.beanit.openiec61850.BasicDataAttribute)

Example 23 with BasicDataAttribute

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

the class LightMeasurementRtu method writeValueAndUpdateRelatedAttributes.

@Override
public List<BasicDataAttribute> writeValueAndUpdateRelatedAttributes(final String node, final BasicDataAttribute value) {
    final List<BasicDataAttribute> values = new ArrayList<>();
    if (LogicalDeviceNode.SPGGIO1_IND_D.getDescription().equals(node)) {
        LOGGER.info("Update the values for the light sensors");
        final byte[] newValue = ((BdaVisibleString) value).getValue();
        LOGGER.info("New value for {}: {}", node, new String(newValue));
        // Update the status of the 4 SPGGIO nodes, which represent the
        // light sensors, because we use changes in SPGGIO.Ind.d to trigger
        // their update.
        values.addAll(this.setGeneralIO(newValue));
    } else if (LogicalDeviceNode.SPGGIO2_IND_D.getDescription().equals(node)) {
        LOGGER.info("Update reporting control block enabled value");
        final byte[] bool = ((BdaVisibleString) value).getValue();
        final BasicDataAttribute bda = this.setReportingControlBlock(bool);
        if (bda != null) {
            values.add(bda);
        }
    } else {
        LOGGER.info("No special update action needed for setting node {}", value);
    }
    return values;
}
Also used : BdaVisibleString(com.beanit.openiec61850.BdaVisibleString) ArrayList(java.util.ArrayList) BasicDataAttribute(com.beanit.openiec61850.BasicDataAttribute) BdaVisibleString(com.beanit.openiec61850.BdaVisibleString)

Example 24 with BasicDataAttribute

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

the class LogicalDevice method setTime.

protected BasicDataAttribute setTime(final LogicalDeviceNode node, final Date date) {
    final BdaTimestamp value = (BdaTimestamp) this.serverModel.findModelNode(this.createNodeName(node), node.getFc());
    value.setDate(date);
    return value;
}
Also used : BdaTimestamp(com.beanit.openiec61850.BdaTimestamp)

Example 25 with BasicDataAttribute

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

the class LogicalDevice method setFixedFloat.

protected BasicDataAttribute setFixedFloat(final LogicalDeviceNode node, final float val) {
    final BdaFloat32 value = (BdaFloat32) this.serverModel.findModelNode(this.createNodeName(node), node.getFc());
    value.setFloat(val);
    return value;
}
Also used : BdaFloat32(com.beanit.openiec61850.BdaFloat32)

Aggregations

BasicDataAttribute (com.beanit.openiec61850.BasicDataAttribute)11 ArrayList (java.util.ArrayList)7 BasicDataAttribute (org.openmuc.openiec61850.BasicDataAttribute)4 LogicalDevice (org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.LogicalDevice)4 LogicalDevice (com.alliander.osgp.simulator.protocol.iec61850.server.logicaldevices.LogicalDevice)3 BdaFloat32 (com.beanit.openiec61850.BdaFloat32)3 BdaInt32 (com.beanit.openiec61850.BdaInt32)3 BdaInt8 (com.beanit.openiec61850.BdaInt8)3 BdaTimestamp (com.beanit.openiec61850.BdaTimestamp)2 BdaVisibleString (com.beanit.openiec61850.BdaVisibleString)2 ModelNode (com.beanit.openiec61850.ModelNode)2 ServerModel (com.beanit.openiec61850.ServerModel)2 Date (java.util.Date)2 Scheduled (org.springframework.scheduling.annotation.Scheduled)2 BdaBoolean (com.beanit.openiec61850.BdaBoolean)1 BdaInt64 (com.beanit.openiec61850.BdaInt64)1 BdaQuality (com.beanit.openiec61850.BdaQuality)1 SclParseException (com.beanit.openiec61850.SclParseException)1 IOException (java.io.IOException)1 Matcher (java.util.regex.Matcher)1