Search in sources :

Example 6 with MeasurementDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto in project open-smart-grid-platform by OSGP.

the class Iec61850HeatPumpSystemService 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.iec61850HeatPumpCommandFactory.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);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) ProfileFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileFilterDto) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto) ProfileDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileDto)

Example 7 with MeasurementDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto in project open-smart-grid-platform by OSGP.

the class Iec61850BatterySystemService 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.iec61850BatteryCommandFactory.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);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) ProfileFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileFilterDto) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto) ProfileDto(org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileDto)

Example 8 with MeasurementDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto in project open-smart-grid-platform by OSGP.

the class CommunicationRecoveryService method signalConnectionLost.

/**
 * Send a signal that the connection with the device has been lost. This is done by putting a
 * GetDataResponse on the queue with an alarm value. When this response is received by the
 * webservice adapter, it can send a notification to the client.
 */
public void signalConnectionLost(final RtuDevice rtu) {
    LOGGER.info("Sending connection lost signal for device {}.", rtu.getDeviceIdentification());
    final GetDataResponseDto dataResponse = new GetDataResponseDto(Arrays.asList(new GetDataSystemIdentifierDto(SYSTEM_ID, SYSTEM_TYPE, Arrays.asList(new MeasurementDto(MEASUREMENT_ID, MEASUREMENT_NODE, 0, new DateTime(DateTimeZone.UTC), MEASUREMENT_VALUE_ALARM_ON)))), null);
    final String correlationUid = this.createCorrelationUid(rtu);
    final String organisationIdentification = rtu.getOwner().getOrganisationIdentification();
    final String deviceIdentification = rtu.getDeviceIdentification();
    final CorrelationIds ids = new CorrelationIds(organisationIdentification, deviceIdentification, correlationUid);
    this.adHocManagementService.handleInternalDataResponse(dataResponse, ids, DeviceFunction.GET_DATA.toString());
}
Also used : GetDataResponseDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto) GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) DateTime(org.joda.time.DateTime) CorrelationIds(org.opensmartgridplatform.shared.infra.jms.CorrelationIds)

Example 9 with MeasurementDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto in project open-smart-grid-platform by OSGP.

the class Iec61850LoadSystemService 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.getFactory(connection.getDeviceIdentification()).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));
        }
    }
    return new GetDataSystemIdentifierDto(systemFilter.getId(), systemFilter.getSystemType(), measurements);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)

Example 10 with MeasurementDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto in project open-smart-grid-platform by OSGP.

the class Iec61850PqSystemService 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.iec61850PqCommandFactory.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));
        }
    }
    return new GetDataSystemIdentifierDto(systemFilter.getId(), systemFilter.getSystemType(), measurements);
}
Also used : GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList) MeasurementDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)

Aggregations

GetDataSystemIdentifierDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto)14 MeasurementDto (org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementDto)14 ArrayList (java.util.ArrayList)13 MeasurementFilterDto (org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)12 ProfileDto (org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileDto)5 ProfileFilterDto (org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileFilterDto)5 DateTime (org.joda.time.DateTime)2 GetDataResponseDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto)2 FcModelNode (com.beanit.openiec61850.FcModelNode)1 ReportDto (org.opensmartgridplatform.dto.valueobjects.microgrids.ReportDto)1 CorrelationIds (org.opensmartgridplatform.shared.infra.jms.CorrelationIds)1