use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addPvDevices.
private void addPvDevices(final ServerModel serverModel) {
final String pvPrefix = "PV";
int i = 1;
String logicalDeviceName = pvPrefix + i;
ModelNode pvNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (pvNode != null) {
this.logicalDevices.add(new Pv(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = pvPrefix + i;
pvNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform 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 com.beanit.openiec61850.ServerModel 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.ServerModel in project open-smart-grid-platform 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, 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, DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
} catch (final Exception e) {
LOGGER.error("Unexpected exception during Get 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 getModelNode.
private FcModelNode getModelNode(final String logicalDevice, final Iec61850Connection iec61850Connection, final String description) throws ProtocolAdapterException {
final ServerModel serverModel = iec61850Connection.getServerModel();
if (serverModel == null) {
final String msg = String.format("ServerModel is null for logicalDevice {%s}", logicalDevice);
throw new ProtocolAdapterException(msg);
}
final String objRef = description + logicalDevice + "/" + LogicalNode.LOGICAL_NODE_ZERO.getDescription() + "." + DataAttribute.NAME_PLATE.getDescription();
final FcModelNode modelNode = (FcModelNode) serverModel.findModelNode(objRef, Fc.DC);
if (modelNode == null) {
final String msg = String.format("ModelNode is null for {%s}", objRef);
throw new ProtocolAdapterException(msg);
}
return modelNode;
}
Aggregations