frequenz-api-common 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- frequenz-api-common-0.0.1/CODEOWNERS +7 -0
- frequenz-api-common-0.0.1/CONTRIBUTING.md +82 -0
- frequenz-api-common-0.0.1/LICENSE +21 -0
- frequenz-api-common-0.0.1/MANIFEST.in +7 -0
- frequenz-api-common-0.0.1/PKG-INFO +30 -0
- frequenz-api-common-0.0.1/README.md +2 -0
- frequenz-api-common-0.0.1/RELEASE_NOTES.md +5 -0
- frequenz-api-common-0.0.1/proto/frequenz/api/common/components.proto +117 -0
- frequenz-api-common-0.0.1/proto/frequenz/api/common/metrics/electrical.proto +199 -0
- frequenz-api-common-0.0.1/proto/frequenz/api/common/metrics.proto +92 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/__init__.py +4 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/components_pb2.py +33 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/components_pb2.pyi +207 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/components_pb2_grpc.py +4 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/components_pb2_grpc.pyi +11 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics/__init__.py +4 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics/electrical_pb2.py +36 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics/electrical_pb2.pyi +383 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics/electrical_pb2_grpc.py +4 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics/electrical_pb2_grpc.pyi +11 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics_pb2.py +27 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics_pb2.pyi +142 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics_pb2_grpc.py +4 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/metrics_pb2_grpc.pyi +11 -0
- frequenz-api-common-0.0.1/py/frequenz/api/common/py.typed +0 -0
- frequenz-api-common-0.0.1/py/frequenz_api_common.egg-info/PKG-INFO +30 -0
- frequenz-api-common-0.0.1/py/frequenz_api_common.egg-info/SOURCES.txt +30 -0
- frequenz-api-common-0.0.1/py/frequenz_api_common.egg-info/dependency_links.txt +1 -0
- frequenz-api-common-0.0.1/py/frequenz_api_common.egg-info/requires.txt +28 -0
- frequenz-api-common-0.0.1/py/frequenz_api_common.egg-info/top_level.txt +1 -0
- frequenz-api-common-0.0.1/pyproject.toml +69 -0
- frequenz-api-common-0.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Each line is a file pattern followed by one or more owners.
|
|
2
|
+
# Owners will be requested for review when someone opens a pull request.
|
|
3
|
+
|
|
4
|
+
# Fallback owner.
|
|
5
|
+
# These are the default owners for everything in the repo, unless a later match
|
|
6
|
+
# takes precedence.
|
|
7
|
+
* @frequenz-floss/api-team
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Contributing to Frequenz Microgrid API
|
|
2
|
+
======================================
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Build
|
|
6
|
+
=====
|
|
7
|
+
|
|
8
|
+
You can use `build` to simply build the source and binary distribution:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
python -m pip install build
|
|
12
|
+
python -m build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Local development
|
|
16
|
+
=================
|
|
17
|
+
|
|
18
|
+
You need to make sure you have the `git submodules` updated:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
git submodule update --init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If you want to manually compile the proto files you need to install the build
|
|
25
|
+
dependencies manually (sadly it seems like there is no way to install build
|
|
26
|
+
dependencies from the `pyproject.toml` file with a simple command):
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
python -m pip install grpcio-tools mypy-protobuf setuptools setuptools_scm[toml] wheel
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then you can compile the proto files by running:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
python setup.py compile_proto
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If you have any issues with these dependencies, please check the
|
|
39
|
+
`pyproject.toml` file and try installing the exact supported versions instead.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Releasing
|
|
43
|
+
=========
|
|
44
|
+
|
|
45
|
+
These are the steps to create a new release:
|
|
46
|
+
|
|
47
|
+
1. Get the latest head you want to create a release from.
|
|
48
|
+
|
|
49
|
+
1. Update the `RELEASE_NOTES.md` file if it is not complete, up to date, and
|
|
50
|
+
clean from template comments (`<!-- ... ->`) and empty sections. Submit
|
|
51
|
+
a pull request if an update is needed, wait until it is merged, and update
|
|
52
|
+
the latest head you want to create a release from to get the new merged pull
|
|
53
|
+
request.
|
|
54
|
+
|
|
55
|
+
3. Create a new signed tag using the release notes and
|
|
56
|
+
a [semver](https://semver.org/) compatible version number with a `v` prefix,
|
|
57
|
+
for example:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
git tag -s -F RELEASE_NOTES.md v0.0.1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
4. Push the new tag.
|
|
64
|
+
|
|
65
|
+
5. A GitHub action will test the tag and if all goes well it will create
|
|
66
|
+
a [GitHub
|
|
67
|
+
Release](https://github.com/frequenz-floss/frequenz-api-microgrid/releases),
|
|
68
|
+
create a new
|
|
69
|
+
[announcement](https://github.com/frequenz-floss/frequenz-api-microgrid/discussions/categories/announcements)
|
|
70
|
+
about the release, and upload a new package to
|
|
71
|
+
[PyPI](https://pypi.org/project/frequenz-api-microgrid/) automatically.
|
|
72
|
+
|
|
73
|
+
6. Once this is done, reset the `RELEASE_NOTES.md` with the template:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
cp .github/RELEASE_NOTES.template.md RELEASE_NOTES.md
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Commit the new release notes and create a PR (this step should be automated
|
|
80
|
+
eventually too).
|
|
81
|
+
|
|
82
|
+
7. Celebrate!
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Frequenz Energy-as-a-Service GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: frequenz-api-common
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Frequenz common gRPC API and bindings
|
|
5
|
+
Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Changelog, https://github.com/frequenz-floss/frequenz-api-common/releases
|
|
8
|
+
Project-URL: Repository, https://github.com/frequenz-floss/frequenz-api-common
|
|
9
|
+
Project-URL: Issues, https://github.com/frequenz-floss/frequenz-api-common/issues
|
|
10
|
+
Project-URL: Support, https://github.com/frequenz-floss/frequenz-api-common/discussions/categories/support
|
|
11
|
+
Keywords: frequenz,api,microgrid,grpc,common
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Requires-Python: <4,>=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Provides-Extra: dev-docstrings
|
|
21
|
+
Provides-Extra: dev-formatting
|
|
22
|
+
Provides-Extra: dev-mypy
|
|
23
|
+
Provides-Extra: dev-noxfile
|
|
24
|
+
Provides-Extra: dev-pylint
|
|
25
|
+
Provides-Extra: dev-pytest
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
|
|
29
|
+
# frequenz-api-common
|
|
30
|
+
Common definitions for frequenz GRPC APIs
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Frequenz microgrid components definitions.
|
|
2
|
+
//
|
|
3
|
+
// Copyright:
|
|
4
|
+
// Copyright 2023 Frequenz Energy-as-a-Service GmbH
|
|
5
|
+
//
|
|
6
|
+
// License:
|
|
7
|
+
// MIT
|
|
8
|
+
|
|
9
|
+
syntax = "proto3";
|
|
10
|
+
|
|
11
|
+
package frequenz.api.common.components;
|
|
12
|
+
|
|
13
|
+
// Enumrated component categories.
|
|
14
|
+
enum ComponentCategory {
|
|
15
|
+
// An unknown component categories, useful for error handling, and marking
|
|
16
|
+
// unknown components in a list of components with otherwise known categories.
|
|
17
|
+
COMPONENT_CATEGORY_UNSPECIFIED = 0;
|
|
18
|
+
|
|
19
|
+
// The point where the local microgrid is connected to the grid.
|
|
20
|
+
COMPONENT_CATEGORY_GRID = 1;
|
|
21
|
+
|
|
22
|
+
// A meter, for measuring electrical metrics, e.g., current, voltage, etc.
|
|
23
|
+
COMPONENT_CATEGORY_METER = 2;
|
|
24
|
+
|
|
25
|
+
// An electricity generator, with batteries or solar energy.
|
|
26
|
+
COMPONENT_CATEGORY_INVERTER = 3;
|
|
27
|
+
|
|
28
|
+
// A DC-DC converter.
|
|
29
|
+
COMPONENT_CATEGORY_CONVERTER = 4;
|
|
30
|
+
|
|
31
|
+
// A storage system for electrical energy, used by inverters.
|
|
32
|
+
COMPONENT_CATEGORY_BATTERY = 5;
|
|
33
|
+
|
|
34
|
+
// A station for charging electrical vehicles.
|
|
35
|
+
COMPONENT_CATEGORY_EV_CHARGER = 6;
|
|
36
|
+
|
|
37
|
+
// A sensor for measuring ambient metrics, e.g., temperature, humidity, etc.
|
|
38
|
+
COMPONENT_CATEGORY_SENSOR = 7;
|
|
39
|
+
|
|
40
|
+
// A crypto miner.
|
|
41
|
+
COMPONENT_CATEGORY_CRYPTO_MINER = 8;
|
|
42
|
+
|
|
43
|
+
// An electrolyzer for converting water into hydrogen and oxygen.
|
|
44
|
+
COMPONENT_CATEGORY_ELECTROLYZER = 9;
|
|
45
|
+
|
|
46
|
+
// A heat and power combustion plant (CHP stands for combined heat and power).
|
|
47
|
+
COMPONENT_CATEGORY_CHP = 10;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Enumerated battery types.
|
|
51
|
+
enum BatteryType {
|
|
52
|
+
// Unspecified.
|
|
53
|
+
BATTERY_TYPE_UNSPECIFIED = 0;
|
|
54
|
+
|
|
55
|
+
// Li-ion batteries.
|
|
56
|
+
BATTERY_TYPE_LI_ION = 1;
|
|
57
|
+
|
|
58
|
+
// Sodium-ion batteries
|
|
59
|
+
BATTERY_TYPE_NA_ION = 2;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Enumerated inverter types.
|
|
63
|
+
enum InverterType {
|
|
64
|
+
// Unspecified.
|
|
65
|
+
INVERTER_TYPE_UNSPECIFIED = 0;
|
|
66
|
+
|
|
67
|
+
// Battery inverter.
|
|
68
|
+
INVERTER_TYPE_BATTERY = 1;
|
|
69
|
+
|
|
70
|
+
// Solar inverter.
|
|
71
|
+
INVERTER_TYPE_SOLAR = 2;
|
|
72
|
+
|
|
73
|
+
// Hybrid inverter.
|
|
74
|
+
INVERTER_TYPE_HYBRID = 3;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Enumerated EV charger types.
|
|
78
|
+
enum EVChargerType {
|
|
79
|
+
// Default type.
|
|
80
|
+
EVCHARGER_TYPE_UNSPECIFIED = 0;
|
|
81
|
+
|
|
82
|
+
// The EV charging station supports AC charging only.
|
|
83
|
+
EVCHARGER_TYPE_AC = 1;
|
|
84
|
+
|
|
85
|
+
// The EV charging station supports DC charging only.
|
|
86
|
+
EVCHARGER_TYPE_DC = 2;
|
|
87
|
+
|
|
88
|
+
// The EV charging station supports both AC and DC.
|
|
89
|
+
EVCHARGER_TYPE_HYBRID = 3;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Enumerated sensor types.
|
|
93
|
+
enum SensorType {
|
|
94
|
+
// Unspecified
|
|
95
|
+
SENSOR_TYPE_UNSPECIFIED = 0;
|
|
96
|
+
|
|
97
|
+
// Thermometer (temperature sensor)
|
|
98
|
+
SENSOR_TYPE_THERMOMETER = 1;
|
|
99
|
+
|
|
100
|
+
// Hygrometer (humidity sensor)
|
|
101
|
+
SENSOR_TYPE_HYGROMETER = 2;
|
|
102
|
+
|
|
103
|
+
// Barometer (pressure sensor).
|
|
104
|
+
SENSOR_TYPE_BAROMETER = 3;
|
|
105
|
+
|
|
106
|
+
// Pyranometer (solar irradiance sensor).
|
|
107
|
+
SENSOR_TYPE_PYRANOMETER = 4;
|
|
108
|
+
|
|
109
|
+
// Anemometer (wind velocity and direction sensor).
|
|
110
|
+
SENSOR_TYPE_ANEMOMETER = 5;
|
|
111
|
+
|
|
112
|
+
// Accelerometers (acceleration sensor).
|
|
113
|
+
SENSOR_TYPE_ACCELEROMETER = 6;
|
|
114
|
+
|
|
115
|
+
// General sensors, which do not fall in any of the above categories
|
|
116
|
+
SENSOR_TYPE_GENERAL = 7;
|
|
117
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// Contains definitions for electrical metrics (AC and DC).
|
|
2
|
+
//
|
|
3
|
+
// Copyright:
|
|
4
|
+
// Copyright 2023 Frequenz Energy-as-a-Service GmbH
|
|
5
|
+
//
|
|
6
|
+
// License:
|
|
7
|
+
// MIT
|
|
8
|
+
|
|
9
|
+
syntax = "proto3";
|
|
10
|
+
|
|
11
|
+
package frequenz.api.common.metrics.electrical;
|
|
12
|
+
|
|
13
|
+
import "frequenz/api/common/metrics.proto";
|
|
14
|
+
|
|
15
|
+
// Metrics of a DC electrical connection.
|
|
16
|
+
message DC {
|
|
17
|
+
// The DC voltage across the component.
|
|
18
|
+
// In Volt (V).
|
|
19
|
+
metrics.Metric voltage = 1;
|
|
20
|
+
|
|
21
|
+
// The DC current flowing away from the grid connection.
|
|
22
|
+
// In passive sign convention:
|
|
23
|
+
// +ve current means consumption, away from the grid.
|
|
24
|
+
// -ve current means supply into the grid.
|
|
25
|
+
// In Ampere (A).
|
|
26
|
+
metrics.Metric current = 2;
|
|
27
|
+
|
|
28
|
+
// The DC power flowing away from the grid connection.
|
|
29
|
+
// In passive sign convention:
|
|
30
|
+
// +ve power means consumption, away from the grid.
|
|
31
|
+
// -ve power means supply into the grid.
|
|
32
|
+
// In Watt (W).
|
|
33
|
+
metrics.Metric power = 3;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// The current state and metrics of the electrical connections to the
|
|
37
|
+
// inverter.
|
|
38
|
+
message AC {
|
|
39
|
+
// The active energy the inverter is consuming or generating.
|
|
40
|
+
message ActiveEnergy {
|
|
41
|
+
// The sum of the consumed and delivered energy.
|
|
42
|
+
// This is a signed value in passive sign convention: if more energy is
|
|
43
|
+
// consumed than delivered, this is a -ve number, otherwise +ve.
|
|
44
|
+
// In Watt-hour (Wh).
|
|
45
|
+
metrics.Metric energy = 1;
|
|
46
|
+
|
|
47
|
+
// The consumed energy.
|
|
48
|
+
// In Watt-hour (Wh).
|
|
49
|
+
metrics.Metric energy_consumed = 2;
|
|
50
|
+
|
|
51
|
+
// The delivered energy.
|
|
52
|
+
// In Watt-hour (Wh).
|
|
53
|
+
metrics.Metric energy_delivered = 3;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// The reactive energy the inverter is consuming or generating.
|
|
57
|
+
message ReactiveEnergy {
|
|
58
|
+
// The sum of the capacitive and inductive energy.
|
|
59
|
+
// This is a signed value. If more energy is capacitive than inductive,
|
|
60
|
+
// this is a -ve number, otherwise +ve.
|
|
61
|
+
// In Volt-Ampere-hour (VArh).
|
|
62
|
+
metrics.Metric energy = 1;
|
|
63
|
+
|
|
64
|
+
// The capacitive energy.
|
|
65
|
+
// In Volt-Ampere-hour (VArh).
|
|
66
|
+
metrics.Metric energy_capacitive = 2;
|
|
67
|
+
|
|
68
|
+
// The inductive energy.
|
|
69
|
+
// In Volt-Ampere-hour (VArh).
|
|
70
|
+
metrics.Metric energy_inductive = 3;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The harmonics of the fast Fourier transform of the instantaneous values
|
|
74
|
+
// and its total harmonic distortion.
|
|
75
|
+
// In percent (%).
|
|
76
|
+
message Harmonics {
|
|
77
|
+
float harmonic_1 = 1;
|
|
78
|
+
float harmonic_2 = 2;
|
|
79
|
+
float harmonic_3 = 3;
|
|
80
|
+
float harmonic_4 = 4;
|
|
81
|
+
float harmonic_5 = 5;
|
|
82
|
+
float harmonic_6 = 6;
|
|
83
|
+
float harmonic_7 = 7;
|
|
84
|
+
float harmonic_8 = 8;
|
|
85
|
+
float harmonic_9 = 9;
|
|
86
|
+
float harmonic_10 = 10;
|
|
87
|
+
float harmonic_11 = 11;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// AC metrics of a single phase.
|
|
91
|
+
message ACPhase {
|
|
92
|
+
// The AC voltage between the line and the neutral wire.
|
|
93
|
+
// In Volt (V).
|
|
94
|
+
metrics.Metric voltage = 1;
|
|
95
|
+
|
|
96
|
+
// AC current.
|
|
97
|
+
// +ve current means consumption, away from the grid.
|
|
98
|
+
// -ve current means supply into the grid.
|
|
99
|
+
// In Ampere (A).
|
|
100
|
+
metrics.Metric current = 2;
|
|
101
|
+
|
|
102
|
+
// AC active power.
|
|
103
|
+
// +ve power means consumption, away from the grid.
|
|
104
|
+
// -ve power means supply into the grid.
|
|
105
|
+
// In Watt (W).
|
|
106
|
+
metrics.Metric power_active = 3;
|
|
107
|
+
|
|
108
|
+
// AC reactive power.
|
|
109
|
+
// +ve power means inductive (leading).
|
|
110
|
+
// -ve power means capacitive (lagging).
|
|
111
|
+
// In Volt-Ampere reactive (VAr).
|
|
112
|
+
metrics.Metric power_reactive = 4;
|
|
113
|
+
|
|
114
|
+
// The total apparent energy. A Positive value represents the net apparent
|
|
115
|
+
// energy supplied to the grid connection, and vice versa.
|
|
116
|
+
// In Volt-Ampere-hour (VAh).
|
|
117
|
+
metrics.Metric energy_apparent = 5;
|
|
118
|
+
|
|
119
|
+
// The total active energy counters for the underlying component's
|
|
120
|
+
// consumption and supply.
|
|
121
|
+
// In Watt-hour (Wh).
|
|
122
|
+
ActiveEnergy energy_active = 6;
|
|
123
|
+
|
|
124
|
+
// The total reactive energy counters for the underlying component's
|
|
125
|
+
// capacitive and inductive energy values.
|
|
126
|
+
// In Volt-Ampere reactive hour (VArh).
|
|
127
|
+
ReactiveEnergy energy_reactive = 7;
|
|
128
|
+
|
|
129
|
+
// Harmonics of the instantaneous active power at the component.
|
|
130
|
+
// In percent (%).
|
|
131
|
+
Harmonics harmonics_power_active = 8;
|
|
132
|
+
|
|
133
|
+
// Total harmonic distortion
|
|
134
|
+
// of the instantaneous active power at the component.
|
|
135
|
+
// In percent (%).
|
|
136
|
+
float thd_power_active = 9;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Overall AC metrics.
|
|
140
|
+
|
|
141
|
+
// The AC frequency.
|
|
142
|
+
// In Hertz (Hz).
|
|
143
|
+
metrics.Metric frequency = 1;
|
|
144
|
+
|
|
145
|
+
// The apparent 3-phase AC current. Positive values represent apparent energy
|
|
146
|
+
// flowing towards the grid connection, and vice versa.
|
|
147
|
+
// In Ampere (A).
|
|
148
|
+
metrics.Metric current = 2;
|
|
149
|
+
|
|
150
|
+
// The apparent 3-phase AC power. Positive values represent apparent energy
|
|
151
|
+
// flowing towards the grid connection, and vice versa.
|
|
152
|
+
// In Volt-Ampere (VA).
|
|
153
|
+
metrics.Metric power_apparent = 3;
|
|
154
|
+
|
|
155
|
+
// The total active 3-phase AC active power.
|
|
156
|
+
// +ve power means consumption, away from the grid.
|
|
157
|
+
// -ve power means supply into the grid.
|
|
158
|
+
// In Watt (W).
|
|
159
|
+
metrics.Metric power_active = 4;
|
|
160
|
+
|
|
161
|
+
// The reactive 3-phase AC power.
|
|
162
|
+
// +ve power means inductive (leading).
|
|
163
|
+
// -ve power means capacitive (lagging).
|
|
164
|
+
// In Volt-Ampere reactive (VAr).
|
|
165
|
+
metrics.Metric power_reactive = 5;
|
|
166
|
+
|
|
167
|
+
// The total 3-phase apparent energy. A positive value represents the net
|
|
168
|
+
// apparent energy supplied to the grid connection, and vice versa.
|
|
169
|
+
// In Volt-Ampere-hour (VAh).
|
|
170
|
+
metrics.Metric energy_apparent = 6;
|
|
171
|
+
|
|
172
|
+
// The total 3-phase active energy counters for the underlying component's
|
|
173
|
+
// consumption and supply.
|
|
174
|
+
// In Watt-hour (Wh).
|
|
175
|
+
ActiveEnergy energy_active = 7;
|
|
176
|
+
|
|
177
|
+
// The total 3-phase reactive energy counters for the underlying component's
|
|
178
|
+
// capacitive and inductive energy values.
|
|
179
|
+
// In Volt-Ampere reactive hour (VArh).
|
|
180
|
+
// FIXME: ReactiveEnergy says Volt-Ampere-hour (VAh).
|
|
181
|
+
ReactiveEnergy energy_reactive = 8;
|
|
182
|
+
|
|
183
|
+
// The sums of the harmonics
|
|
184
|
+
// of the instantaneous active power at the component across all 3 phases.
|
|
185
|
+
Harmonics harmonics_power_active = 9;
|
|
186
|
+
|
|
187
|
+
// The sums of the total harmonic distortion
|
|
188
|
+
// of the instantaneous active power at the component across all 3 phases.
|
|
189
|
+
float thd_power_active = 10;
|
|
190
|
+
|
|
191
|
+
// AC metrics for phase/line 1.
|
|
192
|
+
ACPhase phase_1 = 11;
|
|
193
|
+
|
|
194
|
+
// AC metrics for phase/line 2.
|
|
195
|
+
ACPhase phase_2 = 12;
|
|
196
|
+
|
|
197
|
+
// AC metrics for phase/line 3.
|
|
198
|
+
ACPhase phase_3 = 13;
|
|
199
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Metrics & bounds definitions.
|
|
2
|
+
//
|
|
3
|
+
// Copyright:
|
|
4
|
+
// Copyright 2023 Frequenz Energy-as-a-Service GmbH
|
|
5
|
+
//
|
|
6
|
+
// License:
|
|
7
|
+
// MIT
|
|
8
|
+
|
|
9
|
+
syntax = "proto3";
|
|
10
|
+
|
|
11
|
+
package frequenz.api.common.metrics;
|
|
12
|
+
|
|
13
|
+
// A set of lower and upper bounds for any metric.
|
|
14
|
+
// The units of the bounds are always the same as the related metric.
|
|
15
|
+
message Bounds {
|
|
16
|
+
// The lower bound.
|
|
17
|
+
float lower = 1;
|
|
18
|
+
|
|
19
|
+
// The upper bound.
|
|
20
|
+
float upper = 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// A metric's value, with optional limits.
|
|
24
|
+
message Metric {
|
|
25
|
+
// The current value of the metric.
|
|
26
|
+
float value = 1;
|
|
27
|
+
|
|
28
|
+
// The manufacturer's rated bounds of the metric. This may differ from
|
|
29
|
+
// `system_bounds` as it does not take into account the current state of the
|
|
30
|
+
// overall system.
|
|
31
|
+
Bounds rated_bounds = 2;
|
|
32
|
+
|
|
33
|
+
// The current bounds of the metric, as imposed by the component this metric
|
|
34
|
+
// originates from.
|
|
35
|
+
Bounds component_bounds = 3;
|
|
36
|
+
|
|
37
|
+
// These bounds indicate the range of values that are disallowed for the
|
|
38
|
+
// metric.
|
|
39
|
+
// If these bounds for a metric are [`lower`, `upper`], then this metric's
|
|
40
|
+
// `value` needs to comply with the constraints
|
|
41
|
+
// `value <= lower` OR `upper <= value`.
|
|
42
|
+
//
|
|
43
|
+
// It is important to note that these bounds work together with
|
|
44
|
+
// `system_inclusion_bounds`.
|
|
45
|
+
//
|
|
46
|
+
// E.g., for the system to accept a charge command,
|
|
47
|
+
// clients need to request power values within the bounds
|
|
48
|
+
// `[system_inclusion_bounds.lower, system_exclusion_bounds.lower]`.
|
|
49
|
+
// This means that clients can only request charge commands with values that
|
|
50
|
+
// are within the `system_inclusion_bounds`, but not within
|
|
51
|
+
// `system_exclusion_bounds`.
|
|
52
|
+
// Similarly, for the system to accept a discharge command,
|
|
53
|
+
// clients need to request power values within the bounds
|
|
54
|
+
// `[system_exclusion_bounds.upper, system_inclusion_bounds.upper]`.
|
|
55
|
+
//
|
|
56
|
+
// The following diagram illustrates the relationship between the bounds.
|
|
57
|
+
// ```
|
|
58
|
+
// inclusion.lower inclusion.upper
|
|
59
|
+
// <-------|============|------------------|============|--------->
|
|
60
|
+
// exclusion.lower exclusion.upper
|
|
61
|
+
// ```
|
|
62
|
+
// ---- values here are disallowed and wil be rejected
|
|
63
|
+
// ==== vales here are allowed and will be accepted
|
|
64
|
+
Bounds system_exclusion_bounds = 4;
|
|
65
|
+
|
|
66
|
+
// These bounds indicate the range of values that are allowed for the metric.
|
|
67
|
+
// If these bounds for a metric are [`lower`, `upper`], then this metric's
|
|
68
|
+
// `value` needs to comply with the constraint `lower <= value <= upper`
|
|
69
|
+
//
|
|
70
|
+
// It is important to note that these bounds work together with
|
|
71
|
+
// `system_exclusion_bounds`.
|
|
72
|
+
//
|
|
73
|
+
// E.g., for the system to accept a charge command,
|
|
74
|
+
// clients need to request power values within the bounds
|
|
75
|
+
// `[system_inclusion_bounds.lower, system_exclusion_bounds.lower]`.
|
|
76
|
+
// This means that clients can only request charge commands with values that
|
|
77
|
+
// are within the `system_inclusion_bounds`, but not within
|
|
78
|
+
// `system_exclusion_bounds`.
|
|
79
|
+
// Similarly, for the system to accept a discharge command,
|
|
80
|
+
// clients need to request power values within the bounds
|
|
81
|
+
// `[system_exclusion_bounds.upper, system_inclusion_bounds.upper]`.
|
|
82
|
+
//
|
|
83
|
+
// The following diagram illustrates the relationship between the bounds.
|
|
84
|
+
// ```
|
|
85
|
+
// inclusion.lower inclusion.upper
|
|
86
|
+
// <-------|============|------------------|============|--------->
|
|
87
|
+
// exclusion.lower exclusion.upper
|
|
88
|
+
// ```
|
|
89
|
+
// ---- values here are disallowed and wil be rejected
|
|
90
|
+
// ==== vales here are allowed and will be accepted
|
|
91
|
+
Bounds system_inclusion_bounds = 5;
|
|
92
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: frequenz/api/common/components.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$frequenz/api/common/components.proto\x12\x1e\x66requenz.api.common.components*\xfd\x02\n\x11\x43omponentCategory\x12\"\n\x1e\x43OMPONENT_CATEGORY_UNSPECIFIED\x10\x00\x12\x1b\n\x17\x43OMPONENT_CATEGORY_GRID\x10\x01\x12\x1c\n\x18\x43OMPONENT_CATEGORY_METER\x10\x02\x12\x1f\n\x1b\x43OMPONENT_CATEGORY_INVERTER\x10\x03\x12 \n\x1c\x43OMPONENT_CATEGORY_CONVERTER\x10\x04\x12\x1e\n\x1a\x43OMPONENT_CATEGORY_BATTERY\x10\x05\x12!\n\x1d\x43OMPONENT_CATEGORY_EV_CHARGER\x10\x06\x12\x1d\n\x19\x43OMPONENT_CATEGORY_SENSOR\x10\x07\x12#\n\x1f\x43OMPONENT_CATEGORY_CRYPTO_MINER\x10\x08\x12#\n\x1f\x43OMPONENT_CATEGORY_ELECTROLYZER\x10\t\x12\x1a\n\x16\x43OMPONENT_CATEGORY_CHP\x10\n*]\n\x0b\x42\x61tteryType\x12\x1c\n\x18\x42\x41TTERY_TYPE_UNSPECIFIED\x10\x00\x12\x17\n\x13\x42\x41TTERY_TYPE_LI_ION\x10\x01\x12\x17\n\x13\x42\x41TTERY_TYPE_NA_ION\x10\x02*{\n\x0cInverterType\x12\x1d\n\x19INVERTER_TYPE_UNSPECIFIED\x10\x00\x12\x19\n\x15INVERTER_TYPE_BATTERY\x10\x01\x12\x17\n\x13INVERTER_TYPE_SOLAR\x10\x02\x12\x18\n\x14INVERTER_TYPE_HYBRID\x10\x03*x\n\rEVChargerType\x12\x1e\n\x1a\x45VCHARGER_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VCHARGER_TYPE_AC\x10\x01\x12\x15\n\x11\x45VCHARGER_TYPE_DC\x10\x02\x12\x19\n\x15\x45VCHARGER_TYPE_HYBRID\x10\x03*\xee\x01\n\nSensorType\x12\x1b\n\x17SENSOR_TYPE_UNSPECIFIED\x10\x00\x12\x1b\n\x17SENSOR_TYPE_THERMOMETER\x10\x01\x12\x1a\n\x16SENSOR_TYPE_HYGROMETER\x10\x02\x12\x19\n\x15SENSOR_TYPE_BAROMETER\x10\x03\x12\x1b\n\x17SENSOR_TYPE_PYRANOMETER\x10\x04\x12\x1a\n\x16SENSOR_TYPE_ANEMOMETER\x10\x05\x12\x1d\n\x19SENSOR_TYPE_ACCELEROMETER\x10\x06\x12\x17\n\x13SENSOR_TYPE_GENERAL\x10\x07\x62\x06proto3')
|
|
17
|
+
|
|
18
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
19
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'frequenz.api.common.components_pb2', globals())
|
|
20
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
21
|
+
|
|
22
|
+
DESCRIPTOR._options = None
|
|
23
|
+
_COMPONENTCATEGORY._serialized_start=73
|
|
24
|
+
_COMPONENTCATEGORY._serialized_end=454
|
|
25
|
+
_BATTERYTYPE._serialized_start=456
|
|
26
|
+
_BATTERYTYPE._serialized_end=549
|
|
27
|
+
_INVERTERTYPE._serialized_start=551
|
|
28
|
+
_INVERTERTYPE._serialized_end=674
|
|
29
|
+
_EVCHARGERTYPE._serialized_start=676
|
|
30
|
+
_EVCHARGERTYPE._serialized_end=796
|
|
31
|
+
_SENSORTYPE._serialized_start=799
|
|
32
|
+
_SENSORTYPE._serialized_end=1037
|
|
33
|
+
# @@protoc_insertion_point(module_scope)
|