|
| 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 | +} |
| 93 | + |
| 94 | +// Metrics depicted as a collection of statistical summaries. |
| 95 | +// |
| 96 | +// Useful when a component has to report multiple values for the same metric. |
| 97 | +// E.g., a battery is a collection of several blocks, and each block has a |
| 98 | +// temperature sensor. The battery can report a summary of the values provided |
| 99 | +// by all these sensors, like, min, max, avg, etc., and if possible, the entire |
| 100 | +// array of temperature values. |
| 101 | +message MetricAggregation { |
| 102 | + // The average value of the metric. |
| 103 | + float avg = 1; |
| 104 | + |
| 105 | + // The minimum value of the metric. |
| 106 | + optional float min = 2; |
| 107 | + |
| 108 | + // The maximum value of the metric. |
| 109 | + optional float max = 3; |
| 110 | + |
| 111 | + // The array of all the metric values. |
| 112 | + repeated float raw_values = 12; |
| 113 | + |
| 114 | + // The manufacturer's rated bounds of the metric. This may differ from |
| 115 | + // `system_bounds` as it does not take into account the current state of the |
| 116 | + // overall system. |
| 117 | + frequenz.api.common.metrics.Bounds rated_bounds = 13; |
| 118 | + |
| 119 | + // The current bounds of the metric, as imposed by the component this metric |
| 120 | + // originates from. |
| 121 | + frequenz.api.common.metrics.Bounds component_bounds = 14; |
| 122 | + |
| 123 | + // These bounds indicate the range of values that are disallowed for the |
| 124 | + // metric. |
| 125 | + // If these bounds for a metric are [`lower`, `upper`], then this metric's |
| 126 | + // `value` needs to comply with the constraints |
| 127 | + // `value <= lower` OR `upper <= value`. |
| 128 | + // |
| 129 | + // It is important to note that these bounds work together with |
| 130 | + // `system_inclusion_bounds`. |
| 131 | + // |
| 132 | + // E.g., for the system to accept a charge command, |
| 133 | + // clients need to request power values within the bounds |
| 134 | + // `[system_inclusion_bounds.lower, system_exclusion_bounds.lower]`. |
| 135 | + // This means that clients can only request charge commands with power values |
| 136 | + // that are within the `system_inclusion_bounds`, but not within |
| 137 | + // `system_exclusion_bounds`. |
| 138 | + // Similarly, for the system to accept a discharge command, |
| 139 | + // clients need to request power values within the bounds |
| 140 | + // `[system_exclusion_bounds.upper, system_inclusion_bounds.upper]`. |
| 141 | + // |
| 142 | + // The following diagram illustrates the relationship between the bounds. |
| 143 | + // ``` |
| 144 | + // inclusion.lower inclusion.upper |
| 145 | + // <-------|============|------------------|============|---------> |
| 146 | + // exclusion.lower exclusion.upper |
| 147 | + // ``` |
| 148 | + // ---- values here are disallowed and wil be rejected |
| 149 | + // ==== vales here are allowed and will be accepted |
| 150 | + frequenz.api.common.metrics.Bounds system_exclusion_bounds = 4; |
| 151 | + |
| 152 | + // These bounds indicate the range of values that are allowed for the metric. |
| 153 | + // If these bounds for a metric are [`lower`, `upper`], then this metric's |
| 154 | + // `value` needs to comply with the constraint `lower <= value <= upper` |
| 155 | + // |
| 156 | + // It is important to note that these bounds work together with |
| 157 | + // `system_exclusion_bounds`. |
| 158 | + // |
| 159 | + // E.g., for the system to accept a charge command, |
| 160 | + // clients need to request power values within the bounds |
| 161 | + // `[system_inclusion_bounds.lower, system_exclusion_bounds.lower]`. |
| 162 | + // This means that clients can only request charge commands with power values |
| 163 | + // that are within the `system_inclusion_bounds`, but not within |
| 164 | + // `system_exclusion_bounds`. |
| 165 | + // Similarly, for the system to accept a discharge command, |
| 166 | + // clients need to request power values within the bounds |
| 167 | + // `[system_exclusion_bounds.upper, system_inclusion_bounds.upper]`. |
| 168 | + // |
| 169 | + // The following diagram illustrates the relationship between the bounds. |
| 170 | + // ``` |
| 171 | + // inclusion.lower inclusion.upper |
| 172 | + // <-------|============|------------------|============|---------> |
| 173 | + // exclusion.lower exclusion.upper |
| 174 | + // ``` |
| 175 | + // ---- values here are disallowed and wil be rejected |
| 176 | + // ==== vales here are allowed and will be accepted |
| 177 | + frequenz.api.common.metrics.Bounds system_inclusion_bounds = 5; |
| 178 | +} |
0 commit comments