use of com.beanit.openiec61850.ClientAssociation in project open-smart-grid-platform by OSGP.
the class Iec61850DeviceConnectionService method readNodeDataValues.
public void readNodeDataValues(final String deviceIdentification, final FcModelNode fcModelNode) throws NodeReadException {
final Iec61850Connection iec61850Connection = this.fetchIec61850Connection(deviceIdentification);
if (iec61850Connection == null) {
return;
}
final ClientAssociation clientAssociation = iec61850Connection.getClientAssociation();
this.iec61850Client.readNodeDataValues(clientAssociation, fcModelNode);
}
use of com.beanit.openiec61850.ClientAssociation in project open-smart-grid-platform by OSGP.
the class Iec61850RtuDeviceReportingService method enableReport.
private void enableReport(final String serverName, final String deviceIdentification, final Iec61850Report iec61850Report, final ServerModel serverModel, final ClientAssociation clientAssociation) {
int i = 1;
Rcb rcb = this.getRcb(serverModel, this.getReportNode(serverName, iec61850Report.getLogicalDevice(), i, iec61850Report.getLogicalNode()));
while (rcb != null) {
this.enableRcb(deviceIdentification, clientAssociation, rcb);
i += 1;
rcb = this.getRcb(serverModel, this.getReportNode(serverName, iec61850Report.getLogicalDevice(), i, iec61850Report.getLogicalNode()));
}
}
use of com.beanit.openiec61850.ClientAssociation in project open-smart-grid-platform by OSGP.
the class Iec61850RtuDeviceReportingService method enableSpecificReports.
private void enableSpecificReports(final DeviceConnection connection, final String deviceIdentification, final String serverName) {
final ServerModel serverModel = connection.getConnection().getServerModel();
final ClientAssociation clientAssociation = connection.getConnection().getClientAssociation();
final List<Iec61850DeviceReportGroup> deviceReportGroups = this.iec61850DeviceReportRepository.findByDeviceIdentificationAndEnabled(deviceIdentification, true);
for (final Iec61850DeviceReportGroup deviceReportGroup : deviceReportGroups) {
this.enableReportGroup(serverName, deviceIdentification, deviceReportGroup.getIec61850ReportGroup(), serverModel, clientAssociation);
}
}
use of com.beanit.openiec61850.ClientAssociation in project open-smart-grid-platform by OSGP.
the class Iec61850Client method readServerModelFromDevice.
/**
* Read the device model from the device.
*
* @param clientAssociation The {@link ClientAssociation} instance.
* @return A {@link ServerModel} instance.
* @throws ProtocolAdapterException
*/
public ServerModel readServerModelFromDevice(final ClientAssociation clientAssociation) throws ProtocolAdapterException {
try {
LOGGER.debug("Start reading server model from device");
// RetrieveModel() will call all GetDirectory and GetDefinition ACSI
// services needed to get the complete server model.
final ServerModel serverModel = clientAssociation.retrieveModel();
LOGGER.debug("Completed reading server model from device");
return serverModel;
} catch (final ServiceError e) {
clientAssociation.close();
throw new ProtocolAdapterException("Service Error requesting model.", e);
} catch (final IOException e) {
throw new ProtocolAdapterException("Fatal IOException requesting model.", e);
}
}
use of com.beanit.openiec61850.ClientAssociation in project open-smart-grid-platform by OSGP.
the class Iec61850Client method readServerModelFromSclFile.
/**
* Use an ICD file (model file) to read the device model.
*
* @param clientAssociation Instance of {@link ClientAssociation}
* @param filePath "../sampleServer/sampleModel.icd"
* @return Instance of {@link ServerModel}
* @throws ProtocolAdapterException In case the file path is empty.
*/
public ServerModel readServerModelFromSclFile(final ClientAssociation clientAssociation, final String filePath) throws ProtocolAdapterException {
if (StringUtils.isEmpty(filePath)) {
throw new ProtocolAdapterException("File path is empty");
}
try {
final ServerModel serverModel = SclParser.parse(filePath).get(0);
clientAssociation.setServerModel(serverModel);
return serverModel;
} catch (final SclParseException e) {
throw new ProtocolAdapterException("Error parsing SCL file: " + filePath, e);
}
}
Aggregations