forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[modbus][sunspec] Support for SunSpec meters (openhab#7441)
* [sunspec] Support for SunSpec meters This commit adds support for SunSpec compatible meters. They are auto discovered and handled as separate things even if they are part of another device. This is due to the nature of the SunSpec format wich also handles the different report types as different blocks. * [sunspec] fixed file endings and missing unit declaration * [sunspec] meter block dto refactored This way we could get rid of ~250 loc. * [sunspec] make sure we don't fail if the address/block size contains decimal dots Some older installations of OpenHAB returned this values incorrectly Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
- Loading branch information
Showing
9 changed files
with
955 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
262 changes: 262 additions & 0 deletions
262
...unspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/dto/MeterModelBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,262 @@ | ||
/** | ||
* Copyright (c) 2010-2020 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.modbus.sunspec.internal.dto; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* | ||
* Data object for the parsed information from a sunspec meter | ||
* | ||
* @author Nagy Attila Gabor - Initial contribution | ||
* | ||
*/ | ||
public class MeterModelBlock { | ||
|
||
/** | ||
* Sunspec device type id | ||
*/ | ||
public Integer sunspecDID; | ||
|
||
/** | ||
* Block length | ||
*/ | ||
public Integer length; | ||
|
||
/** | ||
* AC Total Current value | ||
*/ | ||
public Short acCurrentTotal; | ||
|
||
/** | ||
* Descriptors for phase A | ||
*/ | ||
public PhaseBlock phaseA = new PhaseBlock(); | ||
|
||
/** | ||
* Descriptors for phase B | ||
*/ | ||
public PhaseBlock phaseB = new PhaseBlock(); | ||
|
||
/** | ||
* Descriptors for phase C | ||
*/ | ||
public PhaseBlock phaseC = new PhaseBlock(); | ||
|
||
/** | ||
* AC Current scale factor | ||
*/ | ||
public Short acCurrentSF; | ||
|
||
/** | ||
* AC Voltage Line to line value | ||
*/ | ||
public Optional<Short> acVoltageLineToNAverage; | ||
|
||
/** | ||
* AC Voltage Line to N value | ||
*/ | ||
public Optional<Short> acVoltageLineToLineAverage; | ||
|
||
/** | ||
* AC Voltage scale factor | ||
*/ | ||
public Short acVoltageSF; | ||
|
||
/** | ||
* AC Frequency value | ||
*/ | ||
public Short acFrequency; | ||
|
||
/** | ||
* AC Frequency scale factor | ||
*/ | ||
public Optional<Short> acFrequencySF; | ||
|
||
/** | ||
* Total real power | ||
*/ | ||
public Short acRealPowerTotal; | ||
|
||
/** | ||
* AC Real Power Scale Factor | ||
*/ | ||
public Short acRealPowerSF; | ||
|
||
/** | ||
* Total apparent power | ||
*/ | ||
public Optional<Short> acApparentPowerTotal; | ||
|
||
/** | ||
* AC Apparent Power Scale Factor | ||
*/ | ||
public Optional<Short> acApparentPowerSF; | ||
|
||
/** | ||
* Total reactive power | ||
*/ | ||
public Optional<Short> acReactivePowerTotal; | ||
|
||
/** | ||
* AC Reactive Power Scale Factor | ||
*/ | ||
public Optional<Short> acReactivePowerSF; | ||
|
||
/** | ||
* Power factor | ||
*/ | ||
public Optional<Short> acPowerFactor; | ||
|
||
/** | ||
* Power factor scale factor | ||
*/ | ||
public Optional<Short> acPowerFactorSF; | ||
|
||
/** | ||
* Total exported real energy | ||
*/ | ||
public Optional<Long> acExportedRealEnergyTotal; | ||
|
||
/** | ||
* Total imported real energy | ||
*/ | ||
public Long acImportedRealEnergyTotal; | ||
|
||
/** | ||
* Real Energy Scale Factor | ||
*/ | ||
public Short acRealEnergySF; | ||
|
||
/** | ||
* Total exported apparent energy | ||
*/ | ||
public Optional<Long> acExportedApparentEnergyTotal; | ||
|
||
/** | ||
* Total imported apparent energy | ||
*/ | ||
public Optional<Long> acImportedApparentEnergyTotal; | ||
|
||
/** | ||
* Apparent Energy Scale Factor | ||
*/ | ||
public Optional<Short> acApparentEnergySF; | ||
|
||
/** | ||
* Quadrant 1: Total imported reactive energy | ||
*/ | ||
public Optional<Long> acImportedReactiveEnergyQ1Total; | ||
|
||
/** | ||
* Quadrant 2: Total imported reactive energy | ||
*/ | ||
public Optional<Long> acImportedReactiveEnergyQ2Total; | ||
|
||
/** | ||
* Quadrant 3: Total exported reactive energy | ||
*/ | ||
public Optional<Long> acExportedReactiveEnergyQ3Total; | ||
|
||
/** | ||
* Quadrant 4: Total exported reactive energy | ||
*/ | ||
public Optional<Long> acExportedReactiveEnergyQ4Total; | ||
|
||
/** | ||
* Reactive Energy Scale Factor | ||
*/ | ||
public Optional<Short> acReactiveEnergySF; | ||
|
||
/** | ||
* This subclass is used to store raw data for a single phase in | ||
* multi phase meters. | ||
*/ | ||
public static class PhaseBlock { | ||
/** | ||
* AC Phase A Current value | ||
*/ | ||
public Optional<Short> acPhaseCurrent; | ||
|
||
/** | ||
* AC Voltage Phase Phase to N value | ||
*/ | ||
public Optional<Short> acVoltageToN; | ||
|
||
/** | ||
* AC Voltage Phase Line to next Line value | ||
*/ | ||
public Optional<Short> acVoltageToNext; | ||
|
||
/** | ||
* Phase A AC real power | ||
*/ | ||
public Optional<Short> acRealPower; | ||
|
||
/** | ||
* Phase A AC apparent power | ||
*/ | ||
public Optional<Short> acApparentPower; | ||
|
||
/** | ||
* Phase A AC reactive power | ||
*/ | ||
public Optional<Short> acReactivePower; | ||
|
||
/** | ||
* Phase A Power factor | ||
*/ | ||
public Optional<Short> acPowerFactor; | ||
|
||
/** | ||
* Phase A exported real energy | ||
*/ | ||
public Optional<Long> acExportedRealEnergy; | ||
|
||
/** | ||
* Phase A imported real energy | ||
*/ | ||
public Optional<Long> acImportedRealEnergy; | ||
|
||
/** | ||
* Phase A exported apparent energy | ||
*/ | ||
public Optional<Long> acExportedApparentEnergy; | ||
|
||
/** | ||
* Phase A imported apparent energy | ||
*/ | ||
public Optional<Long> acImportedApparentEnergy; | ||
|
||
/** | ||
* Quadrant 1: Phase A imported reactive energy | ||
*/ | ||
public Optional<Long> acImportedReactiveEnergyQ1; | ||
|
||
/** | ||
* Quadrant 2: Phase A imported reactive energy | ||
*/ | ||
public Optional<Long> acImportedReactiveEnergyQ2; | ||
|
||
/** | ||
* Quadrant 3: Phase A exported reactive energy | ||
*/ | ||
public Optional<Long> acExportedReactiveEnergyQ3; | ||
|
||
/** | ||
* Quadrant 4: Phase A exported reactive energy | ||
*/ | ||
public Optional<Long> acExportedReactiveEnergyQ4; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.