use of org.openmuc.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850DeviceConnectionService method testIfConnectionIsCachedAndAlive.
private boolean testIfConnectionIsCachedAndAlive(final String deviceIdentification, final IED ied, final String serverName, final String logicalDevice) throws ProtocolAdapterException {
try {
LOGGER.info("Trying to find connection in cache for deviceIdentification: {}", deviceIdentification);
final Iec61850Connection iec61850Connection = this.fetchIec61850Connection(deviceIdentification);
if (iec61850Connection != null) {
// Already connected, check if connection is still usable.
LOGGER.info("Connection found for deviceIdentification: {}", deviceIdentification);
// requires manual reads of remote data.
if (ied != null && logicalDevice != null) {
final String description = this.getActualServerName(ied, serverName);
LOGGER.info("Testing if connection is alive using {}{}/{}.{} for deviceIdentification: {}", description, logicalDevice, LogicalNode.LOGICAL_NODE_ZERO.getDescription(), DataAttribute.NAME_PLATE.getDescription(), deviceIdentification);
final FcModelNode modelNode = this.getModelNode(logicalDevice, iec61850Connection, description);
this.iec61850Client.readNodeDataValues(iec61850Connection.getClientAssociation(), modelNode);
} else {
// Read all data values, which is much slower, but requires
// no manual reads of remote data.
LOGGER.info("Testing if connection is alive using readAllDataValues() for deviceIdentification: {}", deviceIdentification);
this.iec61850Client.readAllDataValues(iec61850Connection.getClientAssociation());
}
LOGGER.info("Connection is still active for deviceIdentification: {}", deviceIdentification);
return true;
}
} catch (final NodeReadException e) {
LOGGER.error("Connection is no longer active, removing connection from cache for deviceIdentification: " + deviceIdentification, e);
this.removeIec61850Connection(deviceIdentification);
}
return false;
}
use of org.openmuc.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850RtuDeviceReportingService method enableGasFurnaceReportingOnDevice.
private void enableGasFurnaceReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
final ServerModel serverModel = connection.getConnection().getServerModel();
final String gasFurnacePrefix = LogicalDevice.GAS_FURNACE.getDescription();
int i = 1;
String logicalDeviceName = gasFurnacePrefix + i;
ModelNode gasFurnaceNode = serverModel.getChild(this.serverName + logicalDeviceName);
while (gasFurnaceNode != null) {
this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.GAS_FURNACE, i, DataAttribute.REPORT_STATUS_ONE);
this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.GAS_FURNACE, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
i += 1;
logicalDeviceName = gasFurnacePrefix + i;
gasFurnaceNode = serverModel.getChild(this.serverName + logicalDeviceName);
}
}
use of org.openmuc.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addHeatPumpDevices.
private void addHeatPumpDevices(final ServerModel serverModel) {
final String heatPumpPrefix = "HEAT_PUMP";
int i = 1;
String logicalDeviceName = heatPumpPrefix + i;
ModelNode heatPumpNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (heatPumpNode != null) {
this.logicalDevices.add(new HeatPump(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = heatPumpPrefix + i;
heatPumpNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of org.openmuc.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addChpDevices.
private void addChpDevices(final ServerModel serverModel) {
final String chpPrefix = "CHP";
int i = 1;
String logicalDeviceName = chpPrefix + i;
ModelNode chpNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (chpNode != null) {
this.logicalDevices.add(new Chp(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = chpPrefix + i;
chpNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of org.openmuc.openiec61850.ModelNode in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addLoadDevices.
private void addLoadDevices(final ServerModel serverModel) {
final String loadPrefix = "LOAD";
int i = 1;
String logicalDeviceName = loadPrefix + i;
ModelNode loadNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (loadNode != null) {
this.logicalDevices.add(new Load(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = loadPrefix + i;
loadNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
Aggregations