|
1 | 1 | # Components::PowerMonitor |
2 | 2 |
|
3 | | -Manager for ina219 device for power monitoring |
| 3 | +The Power Monitor component is a manager that coordinates power monitoring across multiple power sources. It periodically polls voltage, current, and power measurements from both system power and solar panel power sources. |
4 | 4 |
|
5 | 5 | ## Usage Examples |
6 | | -Add usage examples here |
7 | 6 |
|
8 | | -### Diagrams |
9 | | -Add diagrams here |
| 7 | +The Power Monitor component is designed to run periodically via a rate group scheduler. It operates as a passive component that coordinates data collection from multiple power monitoring drivers. |
10 | 8 |
|
11 | 9 | ### Typical Usage |
12 | | -And the typical usage of the component here |
| 10 | + |
| 11 | +1. The component is instantiated and initialized during system startup |
| 12 | +2. The component is connected to: |
| 13 | + - A rate group scheduler (via the `run` input port) |
| 14 | + - System power monitoring driver (via `sys*` output ports) |
| 15 | + - Solar panel power monitoring driver (via `sol*` output ports) |
| 16 | +3. On each scheduler cycle: |
| 17 | + - The component calls all six output ports to trigger measurements |
| 18 | + - Each connected driver fetches sensor data and writes telemetry |
| 19 | + - Power monitoring data becomes available system-wide |
13 | 20 |
|
14 | 21 | ## Class Diagram |
15 | | -Add a class diagram here |
16 | 22 |
|
17 | | -## Port Descriptions |
18 | | -| Name | Description | |
19 | | -|---|---| |
20 | | -|---|---| |
| 23 | +```mermaid |
| 24 | +classDiagram |
| 25 | + namespace Components { |
| 26 | + class PowerMonitorComponentBase { |
| 27 | + <<Auto-generated>> |
| 28 | + } |
| 29 | + class PowerMonitor { |
| 30 | + + PowerMonitor(const char* compName) |
| 31 | + + ~PowerMonitor() |
| 32 | + - run_handler(FwIndexType portNum, U32 context) |
| 33 | + } |
| 34 | + } |
| 35 | + PowerMonitorComponentBase <|-- PowerMonitor : inherits |
| 36 | +``` |
21 | 37 |
|
22 | | -## Component States |
23 | | -Add component states in the chart below |
24 | | -| Name | Description | |
25 | | -|---|---| |
26 | | -|---|---| |
| 38 | +## Port Descriptions |
| 39 | +| Name | Type | Description | |
| 40 | +|---|---|---| |
| 41 | +| run | sync input | Scheduler port that triggers periodic power monitoring cycle | |
| 42 | +| sysVoltageGet | output | Requests voltage measurement from system power driver | |
| 43 | +| sysCurrentGet | output | Requests current measurement from system power driver | |
| 44 | +| sysPowerGet | output | Requests power measurement from system power driver | |
| 45 | +| solVoltageGet | output | Requests voltage measurement from solar panel power driver | |
| 46 | +| solCurrentGet | output | Requests current measurement from solar panel power driver | |
| 47 | +| solPowerGet | output | Requests power measurement from solar panel power driver | |
27 | 48 |
|
28 | 49 | ## Sequence Diagrams |
29 | | -Add sequence diagrams here |
30 | 50 |
|
31 | | -## Parameters |
32 | | -| Name | Description | |
33 | | -|---|---| |
34 | | -|---|---| |
| 51 | +### Run Cycle |
| 52 | +```mermaid |
| 53 | +sequenceDiagram |
| 54 | + participant Rate Group |
| 55 | + participant Power Monitor |
| 56 | + participant System Power Driver |
| 57 | + participant Solar Power Driver |
35 | 58 |
|
36 | | -## Commands |
37 | | -| Name | Description | |
38 | | -|---|---| |
39 | | -|---|---| |
| 59 | + Rate Group->>Power Monitor: run(portNum, context) |
40 | 60 |
|
41 | | -## Events |
42 | | -| Name | Description | |
43 | | -|---|---| |
44 | | -|---|---| |
| 61 | + Power Monitor->>System Power Driver: sysVoltageGet() |
| 62 | + System Power Driver-->>Power Monitor: voltage |
45 | 63 |
|
46 | | -## Telemetry |
47 | | -| Name | Description | |
48 | | -|---|---| |
49 | | -|---|---| |
| 64 | + Power Monitor->>System Power Driver: sysCurrentGet() |
| 65 | + System Power Driver-->>Power Monitor: current |
| 66 | +
|
| 67 | + Power Monitor->>System Power Driver: sysPowerGet() |
| 68 | + System Power Driver-->>Power Monitor: power |
| 69 | +
|
| 70 | + Power Monitor->>Solar Power Driver: solVoltageGet() |
| 71 | + Solar Power Driver-->>Power Monitor: voltage |
50 | 72 |
|
51 | | -## Unit Tests |
52 | | -Add unit test descriptions in the chart below |
53 | | -| Name | Description | Output | Coverage | |
54 | | -|---|---|---|---| |
55 | | -|---|---|---|---| |
| 73 | + Power Monitor->>Solar Power Driver: solCurrentGet() |
| 74 | + Solar Power Driver-->>Power Monitor: current |
| 75 | +
|
| 76 | + Power Monitor->>Solar Power Driver: solPowerGet() |
| 77 | + Solar Power Driver-->>Power Monitor: power |
| 78 | +``` |
56 | 79 |
|
57 | 80 | ## Requirements |
58 | | -Add requirements in the chart below |
59 | 81 | | Name | Description | Validation | |
60 | 82 | |---|---|---| |
61 | | -|---|---|---| |
| 83 | +| PWR-MON-REQ-001 | The component shall respond to scheduler calls via the run port | Integration test | |
| 84 | +| PWR-MON-REQ-002 | The component shall request voltage measurements from the system power driver on each run cycle | Integration test | |
| 85 | +| PWR-MON-REQ-003 | The component shall request current measurements from the system power driver on each run cycle | Integration test | |
| 86 | +| PWR-MON-REQ-004 | The component shall request power measurements from the system power driver on each run cycle | Integration test | |
| 87 | +| PWR-MON-REQ-005 | The component shall request voltage measurements from the solar panel power driver on each run cycle | Integration test | |
| 88 | +| PWR-MON-REQ-006 | The component shall request current measurements from the solar panel power driver on each run cycle | Integration test | |
| 89 | +| PWR-MON-REQ-007 | The component shall request power measurements from the solar panel power driver on each run cycle | Integration test | |
62 | 90 |
|
63 | 91 | ## Change Log |
64 | 92 | | Date | Description | |
65 | 93 | |---|---| |
66 | | -|---| Initial Draft | |
| 94 | +| 2025-11-03 | Initial Power Monitor component | |
0 commit comments