use of com.beanit.openiec61850.ServerModel 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.ServerModel in project open-smart-grid-platform by OSGP.
the class Iec61850RtuDeviceReportingService method enableAllReports.
private void enableAllReports(final DeviceConnection connection, final String deviceIdentification) {
final ServerModel serverModel = connection.getConnection().getServerModel();
this.enableReports(connection, deviceIdentification, serverModel.getBrcbs());
this.enableReports(connection, deviceIdentification, serverModel.getUrcbs());
}
use of com.beanit.openiec61850.ServerModel 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.ServerModel 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.ServerModel 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