use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addLightMeasurementDevice.
private void addLightMeasurementDevice(final ServerModel serverModel) {
final String logicalDeviceName = "LD0";
final ModelNode lightMeasurementRtuNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
if (lightMeasurementRtuNode != null) {
// Light Measurement RTU found in the server model.
LOGGER.info("Adding lmRtu {}", logicalDeviceName);
this.logicalDevices.add(new LightMeasurementRtu(this.getDeviceName(), logicalDeviceName, serverModel));
}
}
use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addWindDevices.
private void addWindDevices(final ServerModel serverModel) {
final String windPrefix = "WIND";
int i = 1;
String logicalDeviceName = windPrefix + i;
ModelNode windNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (windNode != null) {
this.logicalDevices.add(new Wind(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = windPrefix + i;
windNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform by OSGP.
the class UpdateHealthStatusEventListener method updateServerValue.
private void updateServerValue(final ServerSap serverSap) {
LOGGER.debug("updateServerValue");
final ServerModel serverModel = serverSap.getModelCopy();
final ModelNode modelNode = serverModel.findModelNode(HEALTH_NODE, Fc.ST);
if (modelNode != null) {
final ModelNode dataNode = modelNode.getChild(STATUS_VALUE);
if (dataNode != null && dataNode instanceof BdaInt8) {
final List<BasicDataAttribute> changedAttributes = new ArrayList<>();
final BdaInt8 bda = (BdaInt8) dataNode;
bda.setValue(bda.getValue() == OK ? WARNING : (bda.getValue() == WARNING ? ALARM : OK));
changedAttributes.add(bda);
serverSap.setValues(changedAttributes);
}
}
}
use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform by OSGP.
the class Iec61850RtuDeviceService method setData.
@Override
public void setData(final SetDataDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
try {
final String serverName = this.getServerName(deviceRequest);
final ServerModel serverModel = this.connectAndRetrieveServerModel(deviceRequest, serverName);
final ClientAssociation clientAssociation = this.iec61850DeviceConnectionService.getClientAssociation(deviceRequest.getDeviceIdentification());
this.handleSetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest, DeviceMessageStatus.OK);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
LOGGER.error("Could not connect to device after all retries", se);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest, DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
} catch (final Exception e) {
LOGGER.error("Unexpected exception during Set Data", e);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest, DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleException(e, deviceResponse);
}
}
use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform by OSGP.
the class Iec61850DeviceConnectionService method readServerModel.
private ServerModel readServerModel(final ClientAssociation clientAssociation, final String deviceIdentification, final Iec61850Device iec61850Device) throws ProtocolAdapterException {
ServerModel serverModel;
try {
serverModel = this.readServerModelConfiguredForDevice(clientAssociation, deviceIdentification, iec61850Device);
if (serverModel != null) {
return serverModel;
}
} catch (final ProtocolAdapterException e) {
LOGGER.warn("Ignore exception reading server model based on per device configuration for device: {}.", deviceIdentification, e);
}
try {
serverModel = this.readServerModelFromConfiguredIcdFile(clientAssociation);
if (serverModel != null) {
return serverModel;
}
} catch (final ProtocolAdapterException e) {
LOGGER.warn("Ignore exception reading server model based on configured ICD file.", e);
}
LOGGER.info("Reading ServerModel from device: {} using readServerModelFromDevice()", deviceIdentification);
return this.iec61850Client.readServerModelFromDevice(clientAssociation);
}
Aggregations