use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject in project open-smart-grid-platform by OSGP.
the class DlmsObjectConfigService method getAccessDescription.
private SelectiveAccessDescription getAccessDescription(final AddressRequest addressRequest, final List<DlmsCaptureObject> selectedObjects) {
final DlmsObject object = addressRequest.getDlmsObject();
final DateTime from = addressRequest.getFrom();
final DateTime to = addressRequest.getTo();
if (!(object instanceof DlmsProfile) || from == null || to == null) {
return null;
} else {
final int accessSelector = 1;
final DataObject selectedValues = this.getSelectedValues(addressRequest, selectedObjects);
final DataObject accessParameter = this.dlmsHelper.getAccessSelectionTimeRangeParameter(from, to, selectedValues);
return new SelectiveAccessDescription(accessSelector, accessParameter);
}
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject in project open-smart-grid-platform by OSGP.
the class DlmsObjectConfigService method getDlmsObjectForCommunicationMethod.
public DlmsObject getDlmsObjectForCommunicationMethod(final DlmsDevice device, final DlmsObjectType type) throws ProtocolAdapterException {
final Protocol protocol = Protocol.forDevice(device);
final CommunicationMethod method = CommunicationMethod.getCommunicationMethod(device.getCommunicationMethod());
return this.dlmsObjectConfigs.stream().filter(config -> config.contains(protocol)).findAny().flatMap(dlmsObjectConfig -> dlmsObjectConfig.findObjectForCommunicationMethod(type, method)).orElseThrow(() -> new ProtocolAdapterException("Did not find " + type.name() + " object with communication method " + method.getMethodName() + " for device " + device.getDeviceId()));
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject in project open-smart-grid-platform by OSGP.
the class DlmsObjectConfigService method getSelectedValues.
private DataObject getSelectedValues(final AddressRequest addressRequest, final List<DlmsCaptureObject> selectedObjects) {
List<DataObject> objectDefinitions = new ArrayList<>();
final DlmsObject object = addressRequest.getDlmsObject();
final Protocol protocol = Protocol.forDevice(addressRequest.getDevice());
if (object instanceof DlmsProfile && ((DlmsProfile) object).getCaptureObjects() != null) {
final DlmsProfile profile = (DlmsProfile) object;
objectDefinitions = this.getObjectDefinitions(addressRequest.getChannel(), addressRequest.getFilterMedium(), protocol, profile, selectedObjects);
}
return DataObject.newArrayData(objectDefinitions);
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject in project open-smart-grid-platform by OSGP.
the class DlmsObjectConfigService method getAttributeAddressForProfile.
private AttributeAddressForProfile getAttributeAddressForProfile(final AddressRequest addressRequest) {
final List<DlmsCaptureObject> selectedObjects = new ArrayList<>();
final SelectiveAccessDescription access = this.getAccessDescription(addressRequest, selectedObjects);
final DlmsObject dlmsObject = addressRequest.getDlmsObject();
final ObisCode obisCode = this.replaceChannel(dlmsObject.getObisCodeAsString(), addressRequest.getChannel());
return new AttributeAddressForProfile(new AttributeAddress(dlmsObject.getClassId(), obisCode, dlmsObject.getDefaultAttributeId(), access), selectedObjects);
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.model.DlmsObject in project open-smart-grid-platform by OSGP.
the class DlmsObjectConfigSmr50 method initObjects.
@Override
List<DlmsObject> initObjects() {
final List<DlmsObject> objectList = new ArrayList<>();
// Abstract objects
final DlmsObject clock = new DlmsClock("0.0.1.0.0.255");
final DlmsObject amrStatusIntervalE = new DlmsData(AMR_STATUS, "0.0.96.10.2.255");
final DlmsObject amrStatusIntervalG = new DlmsData(AMR_STATUS, "0.<c>.96.10.3.255");
final DlmsObject amrStatusDailyE = new DlmsData(AMR_STATUS, "0.0.96.10.4.255");
final DlmsObject amrStatusDailyG = new DlmsData(AMR_STATUS, "0.<c>.96.10.5.255");
final DlmsObject amrStatusMonthlyE = new DlmsData(AMR_STATUS, "0.0.96.10.6.255");
final DlmsObject amrStatusMonthlyG = new DlmsData(AMR_STATUS, "0.<c>.96.10.7.255");
final DlmsObject alarmFilter1 = new DlmsData(ALARM_FILTER_1, "0.0.97.98.10.255");
final DlmsObject alarmRegister1 = new DlmsData(ALARM_REGISTER_1, "0.0.97.98.0.255");
final DlmsObject randomisationSettings = new DlmsData(RANDOMISATION_SETTINGS, "0.1.94.31.12.255");
objectList.addAll(Arrays.asList(clock, amrStatusIntervalE, amrStatusIntervalG, amrStatusDailyE, amrStatusDailyG, amrStatusMonthlyE, amrStatusMonthlyG, alarmFilter1, alarmRegister1, randomisationSettings));
final DlmsObject pushScheduler = new DlmsSingleActionSchedule(PUSH_SCHEDULER, "0.0.15.0.4.255");
final DlmsObject pushSetupScheduler = new DlmsPushSetup(PUSH_SETUP_SCHEDULER, "0.0.25.9.0.255");
final DlmsObject externalTriggerSmsOrCsd = new DlmsAutoAnswer(EXTERNAL_TRIGGER, "0.0.2.2.0.255");
final DlmsObject internalTriggerAlarm = new DlmsRegisterMonitor(INTERNAL_TRIGGER_ALARM, "0.0.16.1.0.255");
final DlmsObject pushSetupAlarm = new DlmsPushSetup(PUSH_SETUP_ALARM, "0.1.25.9.0.255");
objectList.addAll(Arrays.asList(pushScheduler, pushSetupScheduler, externalTriggerSmsOrCsd, internalTriggerAlarm, pushSetupAlarm));
final DlmsObject standardEventLogCode = new DlmsData(STANDARD_EVENT_CODE, "0.0.96.11.0.255");
final DlmsObject fraudDetectionEventLogCode = new DlmsData(FRAUD_DETECTION_EVENT_CODE, "0.0.96.11.1.255");
final DlmsObject mbusEventLogCode = new DlmsData(MBUS_EVENT_CODE, "0.0.96.11.3.255");
final DlmsObject communicationSessionsEventLogCode = new DlmsData(COMMUNICATION_SESSIONS_EVENT_CODE, "0.0.96.11.4.255");
final DlmsObject powerQualityEventLogCode = new DlmsData(POWER_QUALITY_EVENT_CODE, "0.0.96.11.5.255");
objectList.addAll(Arrays.asList(standardEventLogCode, fraudDetectionEventLogCode, mbusEventLogCode, communicationSessionsEventLogCode, powerQualityEventLogCode));
// Electricity objects
final DlmsObject activeEnergyImport = new DlmsRegister(ACTIVE_ENERGY_IMPORT, "1.0.1.8.0.255", 0, WH, ELECTRICITY);
final DlmsObject activeEnergyExport = new DlmsRegister(ACTIVE_ENERGY_EXPORT, "1.0.2.8.0.255", 0, WH, ELECTRICITY);
final DlmsObject activeEnergyImportRate1 = new DlmsRegister(ACTIVE_ENERGY_IMPORT_RATE_1, "1.0.1.8.1.255", 0, WH, ELECTRICITY);
final DlmsObject activeEnergyImportRate2 = new DlmsRegister(ACTIVE_ENERGY_IMPORT_RATE_2, "1.0.1.8.2.255", 0, WH, ELECTRICITY);
final DlmsObject activeEnergyExportRate1 = new DlmsRegister(ACTIVE_ENERGY_EXPORT_RATE_1, "1.0.2.8.1.255", 0, WH, ELECTRICITY);
final DlmsObject activeEnergyExportRate2 = new DlmsRegister(ACTIVE_ENERGY_EXPORT_RATE_2, "1.0.2.8.2.255", 0, WH, ELECTRICITY);
objectList.addAll(Arrays.asList(activeEnergyImport, activeEnergyExport, activeEnergyImportRate1, activeEnergyImportRate2, activeEnergyExportRate1, activeEnergyExportRate2));
// Gas objects
final DlmsObject mbusMasterValue = new DlmsExtendedRegister(MBUS_MASTER_VALUE, "0.<c>.24.2.2.255", 0, M3, GAS);
final DlmsObject mbusClientSetup = new DlmsMbusClientSetup(MBUS_CLIENT_SETUP, "0.<c>.24.1.0.255", VERSION_1);
objectList.addAll(Arrays.asList(mbusMasterValue, mbusClientSetup));
final List<DlmsCaptureObject> captureObjectsIntervalE = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(amrStatusIntervalE), DlmsCaptureObject.create(activeEnergyImport), DlmsCaptureObject.create(activeEnergyExport));
objectList.add(new DlmsProfile(INTERVAL_VALUES, "1.0.99.1.0.255", captureObjectsIntervalE, QUARTER_HOUR, ELECTRICITY));
final List<DlmsCaptureObject> captureObjectsIntervalG = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(amrStatusIntervalG), DlmsCaptureObject.create(mbusMasterValue), DlmsCaptureObject.create(mbusMasterValue, 5));
objectList.add(new DlmsProfile(INTERVAL_VALUES, "0.<c>.24.3.0.255", captureObjectsIntervalG, HOUR, GAS));
final List<DlmsCaptureObject> captureObjectsDailyE = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(amrStatusDailyE), DlmsCaptureObject.create(activeEnergyImportRate1), DlmsCaptureObject.create(activeEnergyImportRate2), DlmsCaptureObject.create(activeEnergyExportRate1), DlmsCaptureObject.create(activeEnergyExportRate2));
objectList.add(new DlmsProfile(DAILY_LOAD_PROFILE, "1.0.99.2.0.255", captureObjectsDailyE, DAY, ELECTRICITY));
final List<DlmsCaptureObject> captureObjectsDailyG = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(amrStatusDailyG), DlmsCaptureObject.create(mbusMasterValue), DlmsCaptureObject.create(mbusMasterValue, 5));
objectList.add(new DlmsProfile(DAILY_LOAD_PROFILE, "0.<c>.24.3.1.255", captureObjectsDailyG, DAY, GAS));
final List<DlmsCaptureObject> captureObjectsMonthly = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(amrStatusMonthlyE), DlmsCaptureObject.create(activeEnergyImportRate1), DlmsCaptureObject.create(activeEnergyImportRate2), DlmsCaptureObject.create(activeEnergyExportRate1), DlmsCaptureObject.create(activeEnergyExportRate2));
objectList.add(new DlmsProfile(MONTHLY_BILLING_VALUES, "1.0.98.1.0.255", captureObjectsMonthly, MONTH, ELECTRICITY));
final List<DlmsCaptureObject> captureObjectsMonthlyG = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(amrStatusMonthlyG), DlmsCaptureObject.create(mbusMasterValue), DlmsCaptureObject.create(mbusMasterValue, 5));
objectList.add(new DlmsProfile(MONTHLY_BILLING_VALUES, "0.<c>.24.3.2.255", captureObjectsMonthlyG, MONTH, GAS));
// Event logs
final List<DlmsCaptureObject> captureObjectsStandardEvents = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(standardEventLogCode));
objectList.add(new DlmsProfile(STANDARD_EVENT_LOG, "0.0.99.98.0.255", captureObjectsStandardEvents, ASYNCHRONOUSLY, ABSTRACT));
final List<DlmsCaptureObject> captureObjectsFraudDetectionEvents = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(fraudDetectionEventLogCode));
objectList.add(new DlmsProfile(FRAUD_DETECTION_EVENT_LOG, "0.0.99.98.1.255", captureObjectsFraudDetectionEvents, ASYNCHRONOUSLY, ABSTRACT));
final List<DlmsCaptureObject> captureObjectsMBusEvents = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(mbusEventLogCode));
objectList.add(new DlmsProfile(MBUS_EVENT_LOG, "0.0.99.98.3.255", captureObjectsMBusEvents, ASYNCHRONOUSLY, ABSTRACT));
final List<DlmsCaptureObject> captureObjectsCommunicationSessionsEvents = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(communicationSessionsEventLogCode));
objectList.add(new DlmsProfile(COMMUNICATION_SESSIONS_EVENT_LOG, "0.0.99.98.4.255", captureObjectsCommunicationSessionsEvents, ASYNCHRONOUSLY, ABSTRACT));
final List<DlmsCaptureObject> captureObjectsPowerQualityEvents = Arrays.asList(DlmsCaptureObject.create(clock), DlmsCaptureObject.create(powerQualityEventLogCode));
objectList.add(new DlmsProfile(POWER_QUALITY_EVENT_LOG, "0.0.99.98.5.255", captureObjectsPowerQualityEvents, ASYNCHRONOUSLY, ABSTRACT));
// Additional read mbus status for SMR5.0
final DlmsObject readMBusStatus = new DlmsObject(READ_MBUS_STATUS, InterfaceClass.EXTENDED_REGISTER.id(), "0.<c>.24.2.6.255");
final DlmsObject clientSetupMBus = new DlmsObject(CLIENT_SETUP_MBUS, InterfaceClass.MBUS_CLIENT.id(), "0.<c>.24.1.0.255");
objectList.addAll(Arrays.asList(readMBusStatus, clientSetupMBus));
return objectList;
}
Aggregations