use of com.beanit.openiec61850.BdaTimestamp in project open-smart-grid-platform by OSGP.
the class NodeContainer method writeDate.
/**
* Writes a Date value to the given child on the device
*/
public void writeDate(final SubDataAttribute child, final Date value) throws NodeWriteException {
final BdaTimestamp dBdaTimestamp = (BdaTimestamp) this.parent.getChild(child.getDescription());
LOGGER.info(DEVICE_WRITE_LOG_MESSAGE, this.deviceIdentification, value, child.getDescription());
dBdaTimestamp.setDate(value);
this.writeNode(dBdaTimestamp);
}
use of com.beanit.openiec61850.BdaTimestamp in project open-smart-grid-platform by OSGP.
the class NodeContainer method getDateArray.
public Date[] getDateArray(final SubDataAttribute child) {
final Array array = (Array) this.parent.getChild(child.getDescription());
final int size = array.size();
final Date[] result = new Date[size];
for (int i = 0; i < size; i++) {
result[i] = ((BdaTimestamp) array.getChild(i)).getDate();
}
return result;
}
use of com.beanit.openiec61850.BdaTimestamp in project open-smart-grid-platform by OSGP.
the class NodeContainer method getDate.
/**
* Returns a {@link Date} for {@link BdaTimestamp} values
*/
public Date getDate(final SubDataAttribute child) {
final BdaTimestamp dBdaTimestamp = (BdaTimestamp) this.parent.getChild(child.getDescription());
if (dBdaTimestamp == null) {
LOGGER.error(ATTRIBUTE_NULL_LOG_MESSAGE, "BdaTimeStamp", child);
throw new NullPointerException(String.format(NULL_POINTER_MESSAGE, child, "BdaTimeStamp"));
}
LOGGER.debug(DEVICE_READ_LOG_MESSAGE, this.deviceIdentification, child.getDescription(), dBdaTimestamp.getDate());
return dBdaTimestamp.getDate();
}
use of com.beanit.openiec61850.BdaTimestamp in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method logEventNotificationDeviceMessage.
private void logEventNotificationDeviceMessage(final FcModelNode evnRpn) {
final DeviceMessageLog deviceMessageLog = new DeviceMessageLog(IED.FLEX_OVL, LogicalDevice.LIGHTING, "EventNotification");
final BdaInt8U evnTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_EVENT_TYPE);
if (evnTypeNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.EVENT_TYPE, Short.toString(evnTypeNode.getValue()));
}
final BdaInt8U swNumNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_SWITCH_NUMBER);
if (swNumNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.SWITCH_NUMBER, Short.toString(swNumNode.getValue()));
}
final BdaInt8U trgTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_TRIGGER_TYPE);
if (trgTypeNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.TRIGGER_TYPE, Short.toString(trgTypeNode.getValue()));
}
final BdaBoolean swValNode = (BdaBoolean) evnRpn.getChild(EVENT_NODE_SWITCH_VALUE);
if (swValNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.SWITCH_VALUE, swValNode.getValueString());
}
final BdaTimestamp trgTimeNode = (BdaTimestamp) evnRpn.getChild(EVENT_NODE_TRIGGER_TIME);
if (trgTimeNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.TRIGGER_TIME, trgTimeNode.getDate().toString());
}
final BdaVisibleString remarkNode = (BdaVisibleString) evnRpn.getChild(EVENT_NODE_REMARK);
if (remarkNode != null) {
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.EVENT_RPN, evnRpn.getFc(), SubDataAttribute.REMARK, remarkNode.getStringValue());
}
this.loggingService.logMessage(deviceMessageLog, this.deviceIdentification, this.organizationIdentification, true);
}
use of com.beanit.openiec61850.BdaTimestamp in project open-smart-grid-platform by OSGP.
the class Iec61850ClientSSLDEventListener method evnRpnInfo.
private String evnRpnInfo(final String linePrefix, final FcModelNode evnRpn) {
final StringBuilder sb = new StringBuilder();
final BdaInt8U evnTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_EVENT_TYPE);
sb.append(linePrefix).append(EVENT_NODE_EVENT_TYPE).append(": ");
if (evnTypeNode == null) {
sb.append("null");
} else {
final short evnType = evnTypeNode.getValue();
sb.append(evnType).append(" = ").append(EventType.forCode(evnType).getDescription());
}
sb.append(System.lineSeparator());
final BdaInt8U swNumNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_SWITCH_NUMBER);
sb.append(linePrefix).append(EVENT_NODE_SWITCH_NUMBER).append(": ");
if (swNumNode == null) {
sb.append("null");
} else {
final short swNum = swNumNode.getValue();
sb.append(swNum).append(" = ").append("get external index for switch ").append(swNum);
}
sb.append(System.lineSeparator());
final BdaInt8U trgTypeNode = (BdaInt8U) evnRpn.getChild(EVENT_NODE_TRIGGER_TYPE);
sb.append(linePrefix).append(EVENT_NODE_TRIGGER_TYPE).append(": ");
if (trgTypeNode == null) {
sb.append("null");
} else {
final short trgType = trgTypeNode.getValue();
sb.append(trgType).append(" = ").append(TRG_TYPE_DESCRIPTION_PER_CODE.get(trgType));
}
sb.append(System.lineSeparator());
final BdaBoolean swValNode = (BdaBoolean) evnRpn.getChild(EVENT_NODE_SWITCH_VALUE);
sb.append(linePrefix).append(EVENT_NODE_SWITCH_VALUE).append(": ");
if (swValNode == null) {
sb.append("null");
} else {
final boolean swVal = swValNode.getValue();
sb.append(swVal).append(" = ").append(swVal ? "ON" : "OFF");
}
sb.append(System.lineSeparator());
final BdaTimestamp trgTimeNode = (BdaTimestamp) evnRpn.getChild(EVENT_NODE_TRIGGER_TIME);
sb.append(linePrefix).append(EVENT_NODE_TRIGGER_TIME).append(": ");
if (trgTimeNode == null || trgTimeNode.getDate() == null) {
sb.append("null");
} else {
final DateTime trgTime = new DateTime(trgTimeNode.getDate());
sb.append(trgTime);
}
sb.append(System.lineSeparator());
final BdaVisibleString remarkNode = (BdaVisibleString) evnRpn.getChild(EVENT_NODE_REMARK);
sb.append(linePrefix).append(EVENT_NODE_REMARK).append(": ");
if (remarkNode == null) {
sb.append("null");
} else {
final String remark = remarkNode.getStringValue();
sb.append(remark);
}
sb.append(System.lineSeparator());
return sb.toString();
}
Aggregations