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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations