use of org.openmuc.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addRtuDevices.
private void addRtuDevices(final ServerModel serverModel) {
final String rtuPrefix = "RTU";
int i = 1;
String logicalDeviceName = rtuPrefix + i;
ModelNode rtuNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (rtuNode != null) {
this.logicalDevices.add(new Rtu(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = rtuPrefix + i;
rtuNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of org.openmuc.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addEngineDevices.
private void addEngineDevices(final ServerModel serverModel) {
final String enginePrefix = "ENGINE";
int i = 1;
String logicalDeviceName = enginePrefix + i;
ModelNode engineNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (engineNode != null) {
this.logicalDevices.add(new Engine(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = enginePrefix + i;
engineNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of org.openmuc.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addGasFurnaceDevices.
private void addGasFurnaceDevices(final ServerModel serverModel) {
final String gasFurnacePrefix = "GAS_FURNACE";
int i = 1;
String logicalDeviceName = gasFurnacePrefix + i;
ModelNode gasFurnaceNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (gasFurnaceNode != null) {
this.logicalDevices.add(new GasFurnace(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = gasFurnacePrefix + i;
gasFurnaceNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of org.openmuc.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.
the class RtuSimulator method addHeatBufferDevices.
private void addHeatBufferDevices(final ServerModel serverModel) {
final String heatBufferPrefix = "HEAT_BUFFER";
int i = 1;
String logicalDeviceName = heatBufferPrefix + i;
ModelNode heatBufferNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (heatBufferNode != null) {
this.logicalDevices.add(new HeatBuffer(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = heatBufferPrefix + i;
heatBufferNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of org.openmuc.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850DaRtuDeviceService method getData.
@Override
public void getData(final DaDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler, final DaRtuDeviceRequestMessageProcessor messageProcessor) throws JMSException {
try {
final String serverName = this.getServerName(deviceRequest);
final ServerModel serverModel = this.connectAndRetrieveServerModel(deviceRequest, serverName);
final ClientAssociation clientAssociation = this.iec61850DeviceConnectionService.getClientAssociation(deviceRequest.getDeviceIdentification());
final Serializable dataResponse = this.handleGetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest, messageProcessor);
final DaDeviceResponse deviceResponse = new DaDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.OK, dataResponse);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
LOGGER.error("Could not connect to device after all retries", se);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
} catch (final Exception e) {
LOGGER.error("Unexpected exception during Get Data", e);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleException(e, deviceResponse);
}
}
Aggregations