use of org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileDto in project open-smart-grid-platform by OSGP.
the class Iec61850EngineSystemService method getData.
@Override
public GetDataSystemIdentifierDto getData(final SystemFilterDto systemFilter, final Iec61850Client client, final DeviceConnection connection) throws NodeException {
final int logicalDeviceIndex = systemFilter.getId();
LOGGER.info("Get data called for logical device {}{}", DEVICE.getDescription(), logicalDeviceIndex);
final List<MeasurementDto> measurements = new ArrayList<>();
for (final MeasurementFilterDto filter : systemFilter.getMeasurementFilters()) {
final RtuReadCommand<MeasurementDto> command = this.iec61850EngineCommandFactory.getCommand(filter);
if (command == null) {
LOGGER.warn("Unsupported data attribute [{}], skip get data for it", filter.getNode());
} else {
measurements.add(command.execute(client, connection, DEVICE, logicalDeviceIndex));
}
}
final List<ProfileDto> profiles = new ArrayList<>();
for (final ProfileFilterDto filter : systemFilter.getProfileFilters()) {
final RtuReadCommand<ProfileDto> command = Iec61850RtuReadProfileCommandFactory.getInstance().getCommand(filter);
if (command == null) {
LOGGER.warn("Unsupported data attribute [{}], skip get data for it", filter.getNode());
} else {
profiles.add(command.execute(client, connection, DEVICE, logicalDeviceIndex));
}
}
return new GetDataSystemIdentifierDto(systemFilter.getId(), systemFilter.getSystemType(), measurements, profiles);
}
use of org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileDto in project open-smart-grid-platform by OSGP.
the class Iec61850HeatPumpSystemService method setData.
@Override
public void setData(final SetDataSystemIdentifierDto systemIdentifier, final Iec61850Client client, final DeviceConnection connection) throws NodeException {
final int logicalDeviceIndex = systemIdentifier.getId();
LOGGER.info("Set data called for logical device {}{}", DEVICE.getDescription(), logicalDeviceIndex);
/*
* Set profiles before setpoints, so that profile updates can be
* detected by an increment of the SchdId after the profiles are already
* set to the RTU
*/
for (final ProfileDto p : systemIdentifier.getProfiles()) {
final RtuWriteCommand<ProfileDto> command = Iec61850WriteProfileCommandFactory.getInstance().getCommand(p.getNode() + p.getId());
if (command == null) {
LOGGER.warn("Unsupported profile [{}], skip set data for it.", p.getNode() + p.getId());
} else {
command.executeWrite(client, connection, DEVICE, logicalDeviceIndex, p);
}
}
for (final SetPointDto sp : systemIdentifier.getSetPoints()) {
final RtuWriteCommand<SetPointDto> command = Iec61850SetPointCommandFactory.getInstance().getCommand(sp.getNode() + sp.getId());
if (command == null) {
LOGGER.warn("Unsupported set point [{}], skip set data for it.", sp.getNode() + sp.getId());
} else {
command.executeWrite(client, connection, DEVICE, logicalDeviceIndex, sp);
}
}
}
Aggregations