Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Electrical power measurement to energy management app #31616

Merged
Show file tree
Hide file tree
Changes from 162 commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
42378df
Hoist shared enums and bitmaps into detail namespace
hasty Dec 14, 2023
5ee8f28
Regenerate
hasty Dec 14, 2023
849cad0
Add electrical measurement clusters
hasty Nov 21, 2023
d0428be
Add NumberOfMeasurements attribute
hasty Nov 22, 2023
9e1584a
Bump to latest spec
hasty Jan 17, 2024
c575ae6
Bump ZAP version
hasty Jan 17, 2024
05fecc3
Remove Electrical Measurement cluster
hasty Jan 18, 2024
76d8ddd
Add initial Electrical Power Measurement cluster implementation
hasty Jan 18, 2024
b69252b
Revert "Remove Electrical Measurement cluster"
hasty Jan 18, 2024
cd6f0d6
Fix incorrect min/max values on energy attributes
hasty Jan 19, 2024
4dd9b67
Formatting electrical-power-measurement-server
hasty Jan 19, 2024
21d08bf
Regen after restoring deprecated electrical measurement cluster
hasty Jan 19, 2024
565b64c
Re-add inexplicably important blank line to zap_execution.py
hasty Jan 19, 2024
1ffda41
De-alphabetize list of files to avoid breaking GH action
hasty Jan 19, 2024
8ebcd8d
Semi-realphabetize?
hasty Jan 19, 2024
c2bf953
Added EPM cluster to Energy Management App
jamesharrow Jan 22, 2024
76574fa
Restore strangely dropped events
hasty Jan 19, 2024
6768141
Better BitMask handling
hasty Jan 19, 2024
d223821
Change min/max on electrical measurements to be decimal instead of hex
hasty Jan 22, 2024
cbd200c
Rename meas-and-sense to measurement-and-sensing.xml
hasty Jan 22, 2024
f3fdd5b
Remove seemingly superfluous attribute requirements on Descriptor clu…
hasty Jan 22, 2024
6728e90
Updates to electrical-power-measurement-server based on comments
hasty Jan 22, 2024
8322207
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Jan 22, 2024
d9ba277
Take all-clusters-zap from upstream-master.
jamesharrow Jan 22, 2024
9a51fc1
Added side=server into electrical-power and electrical-energy cluster…
jamesharrow Jan 22, 2024
7b937ac
Updated all-clusters.zap and reran autogen. Added EPM cluster to ener…
jamesharrow Jan 22, 2024
383deef
Added initial version of EPM delegate and instance to energy-manageme…
jamesharrow Jan 22, 2024
4e2109e
Enabled Electrical Energy Measurement in example-energy-management-ap…
jamesharrow Jan 23, 2024
2657e28
Added ElectricalEnergyMeasurement to chip-repl __init__.py
jamesharrow Jan 23, 2024
5104e2d
Restyled by isort
restyled-commits Jan 23, 2024
1174c33
Changed feature map to indicate CUME and IMP support only
jamesharrow Jan 23, 2024
341cd20
Merge branch 'master' into 31258-13-the-implementation-of-the-electri…
jamesharrow Jan 23, 2024
664e12c
Adding into __all__ some missing clusters which are causing flake8 is…
jamesharrow Jan 23, 2024
9da8f32
Removed out of date comment
jamesharrow Jan 23, 2024
c6971eb
Added a test event trigger to fake energy reporting readings into the…
jamesharrow Jan 23, 2024
5f0c4af
Added new Energy Reporting TE Trigger delegate
jamesharrow Jan 23, 2024
f975000
Updated random calculation and scaled into mWh (divide by 3600)
jamesharrow Jan 23, 2024
36e928a
Restyled by whitespace
restyled-commits Jan 23, 2024
5192257
Restyled by gn
restyled-commits Jan 23, 2024
e4715d7
Removed accidental launch.json inclusion
jamesharrow Jan 23, 2024
16fb7d9
Fix for ARM linux etc builds due to gn dependency check error
jamesharrow Jan 24, 2024
014fa25
Merge branch 'upstream-master' into 31258-13-the-implementation-of-th…
jamesharrow Jan 24, 2024
0b7e6f5
Added code review suggestions.
jamesharrow Jan 24, 2024
88abbdb
More code review suggestions fixed.
jamesharrow Jan 24, 2024
6b02d7b
Hoist shared enums and bitmaps into detail namespace
hasty Dec 14, 2023
f6e2e30
Regenerate
hasty Dec 14, 2023
82716f2
Add electrical measurement clusters
hasty Nov 21, 2023
b4164bd
Add NumberOfMeasurements attribute
hasty Nov 22, 2023
9c2842c
Bump to latest spec
hasty Jan 17, 2024
18b453b
Bump ZAP version
hasty Jan 17, 2024
f9123c4
Remove Electrical Measurement cluster
hasty Jan 18, 2024
80960e1
Add initial Electrical Power Measurement cluster implementation
hasty Jan 18, 2024
e8a1f9c
Revert "Remove Electrical Measurement cluster"
hasty Jan 18, 2024
76a7465
Fix incorrect min/max values on energy attributes
hasty Jan 19, 2024
58d6cf2
Formatting electrical-power-measurement-server
hasty Jan 19, 2024
f755203
Regen after restoring deprecated electrical measurement cluster
hasty Jan 19, 2024
d55d637
Re-add inexplicably important blank line to zap_execution.py
hasty Jan 19, 2024
3aead8a
De-alphabetize list of files to avoid breaking GH action
hasty Jan 19, 2024
dbea267
Semi-realphabetize?
hasty Jan 19, 2024
1335b8a
Restore strangely dropped events
hasty Jan 19, 2024
58bfa09
Better BitMask handling
hasty Jan 19, 2024
519b0ac
Change min/max on electrical measurements to be decimal instead of hex
hasty Jan 22, 2024
9d79bba
Rename meas-and-sense to measurement-and-sensing.xml
hasty Jan 22, 2024
792b0e5
Remove seemingly superfluous attribute requirements on Descriptor clu…
hasty Jan 22, 2024
c7161de
Updates to electrical-power-measurement-server based on comments
hasty Jan 22, 2024
1ff7640
Remove defaults from MeasurementAccuracyRangeStruct to match spec update
hasty Jan 24, 2024
ab2ba44
Restore side="server" to events
hasty Jan 25, 2024
9117f30
Move common enums and bitmaps to detail:: instead of detail::Enums an…
hasty Jan 25, 2024
6b0b45c
Assign ID to Electrical Sensor device type
hasty Jan 25, 2024
adf13f6
Merge branch 'master' into granbery/electrical_measurement
hasty Jan 25, 2024
2064e85
Merge branch 'master' into 31258-13-the-implementation-of-the-electri…
jamesharrow Jan 25, 2024
6dcf82c
Removed EPM and EEM from Root Node Device
hasty Jan 25, 2024
d788995
Restyled formatting is different than clang-format
hasty Jan 25, 2024
a9f0afd
Re-add FeatureMap to attributeAccessInterfaceAttributes for EEM and EPM
hasty Jan 25, 2024
ab17650
Regen after merge
hasty Jan 25, 2024
e496350
Added electrical-energy-measurement-server to CMakelist to fix linker…
jamesharrow Jan 26, 2024
f854e11
Lock client on Electrical Sensor device type
hasty Jan 26, 2024
2d8fa4b
Remove unneeded using statement now that Enums are in detail::
hasty Jan 26, 2024
54b126f
Check for null iterators and error
hasty Jan 26, 2024
0fd361e
Switch to ResourceExhausted from CHIP_ERROR_INTERNAL
hasty Jan 26, 2024
27aaa23
Merge branch 'granbery/electrical_measurement' into granbery/electric…
jamesharrow Jan 26, 2024
bbc0533
Merge branch '31258-13-the-implementation-of-the-electrical-energy-me…
jamesharrow Jan 26, 2024
68084c1
Re-enabled EEM in energy management app and regen all after previous …
jamesharrow Jan 26, 2024
d392bd9
Some refactoring to add EPM Instance into the EVSEManufacturer class …
jamesharrow Jan 26, 2024
8782d9f
Missed one file.
jamesharrow Jan 26, 2024
0cd0549
Fixed crash due to unassigned dg pointer. Power/Voltage/Current fakin…
jamesharrow Jan 26, 2024
5636975
Touch file since restyled crashed
jamesharrow Jan 26, 2024
eeb4e71
Restyled by gn
restyled-commits Jan 26, 2024
013ae77
Restyled by isort
restyled-commits Jan 26, 2024
29d6f41
Add stub for EPM cluster
hasty Jan 26, 2024
4e401d2
Reverted whitespace change
jamesharrow Jan 26, 2024
cc4c144
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Jan 26, 2024
9978a08
Did regen_all after merge from master to resolve conflicts.
jamesharrow Jan 27, 2024
2d6e59a
Put back line of clusters which somehow got deleted accidentally.
jamesharrow Jan 27, 2024
f89a9a9
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Jan 27, 2024
fa610ef
Remerged ZAP file and regen all after resolving conflicts.
jamesharrow Jan 27, 2024
78c7658
Fixes for Python tests
hasty Jan 27, 2024
5677719
Merge branch 'master' into granbery/electrical_measurement
hasty Jan 27, 2024
887253a
Correct name for Ember init callback
hasty Jan 27, 2024
2e1d2c9
Formatting
hasty Jan 27, 2024
febcb9c
Merge branch 'master' into granbery/electrical_measurement
hasty Jan 27, 2024
8f1edea
Sync optional attributes list with .zap file for EPM
hasty Jan 27, 2024
3b4ad35
Add missing features to EPM stub
hasty Jan 27, 2024
1203545
Revert FeatureMap in attributeAccessInterfaceAttributes
hasty Jan 27, 2024
37e8fed
Allow FeatureMap in EEM constructor; add all-clusters-app EEM stub
hasty Jan 27, 2024
272ca37
Forgot zcl-with-test-extensions
hasty Jan 27, 2024
3fae3b4
Unregister EEM attribute access in destructor
hasty Jan 27, 2024
a951bf1
Remove redundant returns to keep clang-tidy happy
hasty Jan 28, 2024
39a3c04
Fix for issue mentioned in code review on EEM cluster limiting the nu…
jamesharrow Jan 28, 2024
72600fd
Refactoring to have a common EvseMain across all platforms to avoid m…
jamesharrow Jan 28, 2024
3276299
Merge remote-tracking branch 'hasty_epm/granbery/electrical_measureme…
jamesharrow Jan 28, 2024
ae00d9f
Added electrical-power-measurement-server to ESP32 CMakeLists.txt
jamesharrow Jan 28, 2024
9a9db14
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Jan 29, 2024
60e60c4
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Jan 30, 2024
82bbadf
Updated Matter device types to add EVSE
jamesharrow Jan 30, 2024
ae73d8d
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Feb 4, 2024
38732a8
Open and saved energy-management-app.zap and regen_all
jamesharrow Feb 4, 2024
62fd3fa
Removed duplicate ElectricalEnergyMeasurment class which was accident…
jamesharrow Feb 4, 2024
626f976
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Feb 4, 2024
821c07f
Added support for test event triggers and handling of reading events …
jamesharrow Feb 4, 2024
98cf8ae
Made TC_EEVSE_Utils.py use the matter_testing_support instead of its …
jamesharrow Feb 4, 2024
bfa7f0e
Restyled by isort
restyled-commits Feb 4, 2024
71b8c66
Cherry pick from Tweaks to EVSE Test plans (Issue #31460)
jamesharrow Feb 4, 2024
3775ade
Changed the random value generation to make the values +/- and handle…
jamesharrow Feb 5, 2024
bf7972b
Enabled cumulativeEnergyExported in Energy-management-app.
jamesharrow Feb 5, 2024
68af0a0
Added initial electrical power measurement 2.2 test case
jamesharrow Feb 5, 2024
f37e745
Changed copyright date
jamesharrow Feb 6, 2024
d35c70c
Code review comment fixes.
jamesharrow Feb 6, 2024
bb748c6
Changed to c++ style cast
jamesharrow Feb 6, 2024
90e01a7
Fixed trailing whitepace
jamesharrow Feb 6, 2024
00fb2d9
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Feb 6, 2024
db9bb17
Added support for testing read of EEM attributes and change of values
jamesharrow Feb 6, 2024
227516c
Corrected EPM references in TC_EEM_2_2. Added TC_EEM_2_3
jamesharrow Feb 6, 2024
1fc8759
Added periodic energy reporting, and new cumulativeEnergyReset attrib…
jamesharrow Feb 6, 2024
69d000e
Added periodic energy reading support and TC_EEM_2_3 to 2_5.
jamesharrow Feb 6, 2024
f40837d
Python removed unused logging and EventChangeCallback
jamesharrow Feb 6, 2024
35b446b
Updates to align to test plan PR #3949
jamesharrow Feb 7, 2024
ab55452
Added initial EEM_2_1 test script.
jamesharrow Feb 7, 2024
babf463
Added example of setting EEM Accuracy and EEM CumulativeEnergyReset s…
jamesharrow Feb 7, 2024
f536ffb
Restyled by whitespace
restyled-commits Feb 7, 2024
1757efa
Restyled
jamesharrow Feb 8, 2024
078af94
Removed extra spaces in TC_EEM_2_1.py
jamesharrow Feb 8, 2024
e85b3f0
Removed unused EnergyManagementManager.cpp/.h
jamesharrow Feb 8, 2024
d72ab68
Fixed PowerMode = kAc
jamesharrow Feb 8, 2024
ae08b31
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Feb 8, 2024
ad6505b
Initial TC_EPM_2_1.py script
jamesharrow Feb 8, 2024
689884f
Restyled by isort
restyled-commits Feb 8, 2024
c95b1ea
Merge branch 'upstream-master' into granbery/electrical_measurement-A…
jamesharrow Feb 8, 2024
b1f497d
Merged TC_EEVSE tests back in
jamesharrow Feb 8, 2024
9b3b7eb
Initialized NumberOfMeasurementTypes
jamesharrow Feb 8, 2024
ce708f8
Added EEM 2.1,2.2,2.3,2.4,2.5 and EPM 2.1,2.2 into CI workflow tests.…
jamesharrow Feb 8, 2024
d04127e
Interim state - partially refactored how Measurement Structs are enco…
jamesharrow Feb 9, 2024
f3d0efd
Merge remote-tracking branch 'upstream/master' into granbery/electric…
jamesharrow Feb 9, 2024
e6fab15
Removed SetNumberOfMeasurementTypes since this can be derived from th…
jamesharrow Feb 9, 2024
80bc590
Completed TC_EPM_2_1.py script
jamesharrow Feb 9, 2024
d19b1b9
Corrected test plan spec reference.
jamesharrow Feb 9, 2024
68a1890
Test EPM_2_1 now runs and passes. Allows checking that attributes are…
jamesharrow Feb 9, 2024
c068b61
Revert unintended change to tests.yaml
jamesharrow Feb 9, 2024
4efe496
Python test case code-review updates
jamesharrow Feb 9, 2024
2a16811
Removed old range iterator.
jamesharrow Feb 9, 2024
34e52cd
Fixed lint issues and adjusted timings to match the test plan pr.
jamesharrow Feb 9, 2024
88fa403
Fixed all-clusters electrical-power-measurement cluster by using the …
jamesharrow Feb 9, 2024
9ba5390
Implemented HarmonicCurrents and HarmonicStructs (to return empty lis…
jamesharrow Feb 9, 2024
ebc6243
Changed the API to ensure that a delegate doesn't change the data mid…
jamesharrow Feb 11, 2024
fa7cb67
Applying suggested changes
jamesharrow Feb 11, 2024
db4f09e
Incorporated feedback from review to simplify the code
jamesharrow Feb 12, 2024
9d6ad9f
Removed comment per code review
jamesharrow Feb 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,16 @@ jobs:
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceBasicComposition.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceConformance.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --bool-arg ignore_in_progress:True allow_provisional:True --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --tests test_TC_IDM_10_2"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,239 +16,25 @@
* limitations under the License.
*/

#include <app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h>
#include <ElectricalPowerMeasurementDelegate.h>

using namespace chip;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::ElectricalPowerMeasurement;
using namespace chip::app::Clusters::ElectricalPowerMeasurement::Structs;

namespace chip {
namespace app {
namespace Clusters {
namespace ElectricalPowerMeasurement {

static MeasurementAccuracyRangeStruct::Type activeCurrentAccuracyRanges[] = { { .rangeMin = 500, .rangeMax = 1000 } };

class StubAccuracyIterator : public Delegate::AccuracyIterator
{
public:
size_t Count() override;
bool Next(MeasurementAccuracyStruct::Type & output) override;
void Release() override;

private:
uint8_t mIndex;
};

size_t StubAccuracyIterator::Count()
{
return 1;
}

bool StubAccuracyIterator::Next(MeasurementAccuracyStruct::Type & output)
{
if (mIndex >= 1)
{
return false;
}
output.measurementType = MeasurementTypeEnum::kActiveCurrent;
output.measured = true;
output.minMeasuredValue = -10000000;
output.maxMeasuredValue = 10000000;
output.accuracyRanges = DataModel::List<const MeasurementAccuracyRangeStruct::Type>(activeCurrentAccuracyRanges);
mIndex++;
return true;
}

void StubAccuracyIterator::Release()
{
mIndex = 0;
}

class StubRangeIterator : public Delegate::RangeIterator
{
public:
size_t Count() override;
bool Next(MeasurementRangeStruct::Type & output) override;
void Release() override;
};

size_t StubRangeIterator::Count()
{
return 0;
}

bool StubRangeIterator::Next(MeasurementRangeStruct::Type & output)
{
return false;
}

void StubRangeIterator::Release() {}

class StubHarmonicMeasurementIterator : public Delegate::HarmonicMeasurementIterator
{
public:
size_t Count() override;
bool Next(HarmonicMeasurementStruct::Type & output) override;
void Release() override;
};

size_t StubHarmonicMeasurementIterator::Count()
{
return 0;
}

bool StubHarmonicMeasurementIterator::Next(HarmonicMeasurementStruct::Type & output)
{
return false;
}

void StubHarmonicMeasurementIterator::Release() {}

static StubAccuracyIterator accuracyIterator;
static StubRangeIterator rangeIterator;
static StubHarmonicMeasurementIterator harmonicMeasurementIterator;

class ElectricalPowerMeasurementDelegate : public Delegate
{
public:
PowerModeEnum GetPowerMode() override;
uint8_t GetNumberOfMeasurementTypes() override;
AccuracyIterator * IterateAccuracy() override;
RangeIterator * IterateRanges() override;
DataModel::Nullable<int64_t> GetVoltage() override;
DataModel::Nullable<int64_t> GetActiveCurrent() override;
DataModel::Nullable<int64_t> GetReactiveCurrent() override;
DataModel::Nullable<int64_t> GetApparentCurrent() override;
DataModel::Nullable<int64_t> GetActivePower() override;
DataModel::Nullable<int64_t> GetReactivePower() override;
DataModel::Nullable<int64_t> GetApparentPower() override;
DataModel::Nullable<int64_t> GetRMSVoltage() override;
DataModel::Nullable<int64_t> GetRMSCurrent() override;
DataModel::Nullable<int64_t> GetRMSPower() override;
DataModel::Nullable<int64_t> GetFrequency() override;
HarmonicMeasurementIterator * IterateHarmonicCurrents() override;
HarmonicMeasurementIterator * IterateHarmonicPhases() override;
DataModel::Nullable<int64_t> GetPowerFactor() override;
DataModel::Nullable<int64_t> GetNeutralCurrent() override;

~ElectricalPowerMeasurementDelegate() = default;
};

PowerModeEnum ElectricalPowerMeasurementDelegate::GetPowerMode()
{
return PowerModeEnum::kAc;
}

uint8_t ElectricalPowerMeasurementDelegate::GetNumberOfMeasurementTypes()
{
return 1;
}

Delegate::AccuracyIterator * ElectricalPowerMeasurementDelegate::IterateAccuracy()
{
return &accuracyIterator;
}

Delegate::RangeIterator * ElectricalPowerMeasurementDelegate::IterateRanges()
{
return &rangeIterator;
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetVoltage()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetActiveCurrent()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetReactiveCurrent()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetApparentCurrent()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetActivePower()
{
return DataModel::Nullable<int64_t>(10000);
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetReactivePower()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetApparentPower()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetRMSVoltage()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetRMSCurrent()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetRMSPower()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetFrequency()
{
return {};
}

Delegate::HarmonicMeasurementIterator * ElectricalPowerMeasurementDelegate::IterateHarmonicCurrents()
{
return &harmonicMeasurementIterator;
}

Delegate::HarmonicMeasurementIterator * ElectricalPowerMeasurementDelegate::IterateHarmonicPhases()
{
return &harmonicMeasurementIterator;
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetPowerFactor()
{
return {};
}

DataModel::Nullable<int64_t> ElectricalPowerMeasurementDelegate::GetNeutralCurrent()
{
return {};
}

} // namespace ElectricalPowerMeasurement
} // namespace Clusters
} // namespace app
} // namespace chip

static std::unique_ptr<ElectricalPowerMeasurement::Delegate> gDelegate;
static std::unique_ptr<ElectricalPowerMeasurement::Instance> gInstance;
static std::unique_ptr<ElectricalPowerMeasurementDelegate> gEPMDelegate;
static std::unique_ptr<ElectricalPowerMeasurementInstance> gEPMInstance;

void emberAfElectricalPowerMeasurementClusterInitCallback(chip::EndpointId endpointId)
{
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(!gInstance);
VerifyOrDie(!gEPMInstance);

gDelegate = std::make_unique<ElectricalPowerMeasurementDelegate>();
if (gDelegate)
gEPMDelegate = std::make_unique<ElectricalPowerMeasurementDelegate>();
if (gEPMDelegate)
{
gInstance = std::make_unique<Instance>(
endpointId, *gDelegate,
gEPMInstance = std::make_unique<ElectricalPowerMeasurementInstance>(
endpointId, *gEPMDelegate,
BitMask<Feature, uint32_t>(Feature::kDirectCurrent, Feature::kAlternatingCurrent, Feature::kPolyphasePower,
Feature::kHarmonics, Feature::kPowerQuality),
BitMask<OptionalAttributes, uint32_t>(
Expand All @@ -260,6 +46,6 @@ void emberAfElectricalPowerMeasurementClusterInitCallback(chip::EndpointId endpo
OptionalAttributes::kOptionalAttributeFrequency, OptionalAttributes::kOptionalAttributePowerFactor,
OptionalAttributes::kOptionalAttributeNeutralCurrent));

gInstance->Init();
gEPMInstance->Init();
}
}
1 change: 1 addition & 0 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ list(

${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp
${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp
${chip_dir}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ asr_executable("clusters_app") {
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${examples_plat_dir}/ButtonHandler.cpp",
Expand Down
Loading
Loading