From 87993bcb596d039f2a4ed288095306e39a4cef7f Mon Sep 17 00:00:00 2001 From: "Donald F. Coffin" Date: Wed, 4 Feb 2026 22:31:50 -0500 Subject: [PATCH] feat(phase-0.2): Generate usage domain enums batch 1 Generated 5 core ESPI usage domain enumerations: - AccumulationKind (11 values) - CommodityKind (27 values) - DataQualifierKind (15 values) - FlowDirectionKind (22 values) - MeasurementKind (125 values) All enums include: - Apache License 2.0 (2025) - JAXB annotations for XML marshalling - Comprehensive Javadoc from XSD - getValue() and fromValue() methods Based on ESPI 4.0 espi.xsd schema. Unit tests: 638/638 passed Co-Authored-By: Claude Sonnet 4.5 --- .../domain/usage/enums/AccumulationKind.java | 156 +++ .../domain/usage/enums/CommodityKind.java | 252 +++++ .../domain/usage/enums/DataQualifierKind.java | 160 +++ .../domain/usage/enums/FlowDirectionKind.java | 237 +++++ .../domain/usage/enums/MeasurementKind.java | 932 ++++++++++++++++++ 5 files changed, 1737 insertions(+) create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/AccumulationKind.java create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/CommodityKind.java create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/DataQualifierKind.java create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/FlowDirectionKind.java create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/MeasurementKind.java diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/AccumulationKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/AccumulationKind.java new file mode 100644 index 00000000..b7729e4d --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/AccumulationKind.java @@ -0,0 +1,156 @@ +/* + * + * Copyright (c) 2025 Green Button Alliance, Inc. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.greenbuttonalliance.espi.common.domain.usage.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for AccumulationKind values. + * + * Code indicating how value is accumulated over time for Readings of ReadingType. + * The list of valid values per the standard are defined in AccumulationBehaviorType. + * Per ESPI 4.0 espi.xsd lines 1851-1927. + */ +@XmlType(name = "AccumulationKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum AccumulationKind { + + /** + * Not Applicable or implied by the unit of measure. + * XSD value: 0 (line 1858) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * Bulk Quantity. Accumulation behaviour is not relevant. + * XSD value: 1 (line 1864) + */ + @XmlEnumValue("1") + BULK_QUANTITY(1), + + /** + * The sum of the previous billing period values and the present period value. + * Note: "ContinuousCumulative" is commonly used in conjunction with "demand." + * The "ContinuousCumulative Demand" would be the cumulative sum of the previous + * billing period maximum demand values (as occurring with each demand reset) + * summed with the present period maximum demand value (which has yet to be reset.) + * XSD value: 2 (line 1870) + */ + @XmlEnumValue("2") + CONTINUOUS_CUMULATIVE(2), + + /** + * The sum of the previous billing period values. + * Note: "Cumulative" is commonly used in conjunction with "demand." Each demand + * reset causes the maximum demand value for the present billing period (since the + * last demand reset) to accumulate as an accumulative total of all maximum demands. + * So instead of "zeroing" the demand register, a demand reset has the effect of + * adding the present maximum demand to this accumulating total. + * XSD value: 3 (line 1876) + */ + @XmlEnumValue("3") + CUMULATIVE(3), + + /** + * The difference between the value at the end of the prescribed interval and the + * beginning of the interval. This is used for incremental interval data. + * Note: One common application would be for load profile data, another use might + * be to report the number of events within an interval (such as the number of + * equipment energizations within the specified period of time.) + * XSD value: 4 (line 1882) + */ + @XmlEnumValue("4") + DELTA_DATA(4), + + /** + * As if a needle is swung out on the meter face to a value to indicate the current value. + * Note: An "indicating" value is typically measured over hundreds of milliseconds or + * greater, or may imply a "pusher" mechanism to capture a value. Compare this to + * "instantaneous" which is measured over a shorter period of time. + * XSD value: 6 (line 1888) + */ + @XmlEnumValue("6") + INDICATING(6), + + /** + * A form of accumulation which is selective with respect to time. + * Note: "Summation" could be considered a specialization of "Bulk Quantity" according + * to the rules of inheritance where "Summation" selectively accumulates pulses over a + * timing pattern, and "BulkQuantity" accumulates pulses all of the time. + * XSD value: 9 (line 1894) + */ + @XmlEnumValue("9") + SUMMATION(9), + + /** + * A form of computation which introduces a time delay characteristic to the data value. + * XSD value: 10 (line 1900) + */ + @XmlEnumValue("10") + TIME_DELAY(10), + + /** + * Typically measured over the fastest period of time allowed by the definition of the + * metric (usually milliseconds or tens of milliseconds.) + * Note: "Instantaneous" was moved to attribute #3 in 61968-9Ed2 from attribute #1 + * in 61968-9Ed1. + * XSD value: 12 (line 1906) + */ + @XmlEnumValue("12") + INSTANTANEOUS(12), + + /** + * Latch the smallest value. + * XSD value: 13 (line 1912) + */ + @XmlEnumValue("13") + LATCHING_QUANTITY(13), + + /** + * When this description is applied to a metered value, it implies that the value is + * a form of accumulation which is bounded by reset actions, but the reading value + * itself is not reset to zero. + * XSD value: 14 (line 1918) + */ + @XmlEnumValue("14") + BOUNDED_QUANTITY(14); + + private final int value; + + AccumulationKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static AccumulationKind fromValue(int value) { + for (AccumulationKind kind : AccumulationKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid AccumulationKind value: " + value); + } +} diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/CommodityKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/CommodityKind.java new file mode 100644 index 00000000..2bcda7df --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/CommodityKind.java @@ -0,0 +1,252 @@ +/* + * + * Copyright (c) 2025 Green Button Alliance, Inc. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.greenbuttonalliance.espi.common.domain.usage.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for CommodityKind values. + * + * Code for commodity classification of Readings of ReadingType. + * The valid values per the standard are defined in CommodityType. + * Per ESPI 4.0 espi.xsd lines 1928-2100. + */ +@XmlType(name = "CommodityKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum CommodityKind { + + /** + * Not Applicable. + * XSD value: 0 (line 1935) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * All types of metered quantities. This type of reading comes from the meter + * and represents a "secondary" metered value. + * XSD value: 1 (line 1941) + */ + @XmlEnumValue("1") + ELECTRICITY_SECONDARY_METERED(1), + + /** + * It is possible for a meter to be outfitted with an external VT and/or CT. + * The meter might not be aware of these devices, and the display not compensate + * for their presence. Ultimately, when these scalars are applied, the value that + * represents the service value is called the "primary metered" value. The "index" + * in sub-category 3 mirrors those of sub-category 0. + * XSD value: 2 (line 1947) + */ + @XmlEnumValue("2") + ELECTRICITY_PRIMARY_METERED(2), + + /** + * A measurement of the communication infrastructure itself. + * XSD value: 3 (line 1953) + */ + @XmlEnumValue("3") + COMMUNICATION(3), + + /** + * Air. + * XSD value: 4 (line 1959) + */ + @XmlEnumValue("4") + AIR(4), + + /** + * Insulative Gas (SF6 is found separately below). + * XSD value: 5 (line 1965) + */ + @XmlEnumValue("5") + INSULATIVE_GAS(5), + + /** + * Insulative Oil. + * XSD value: 6 (line 1971) + */ + @XmlEnumValue("6") + INSULATIVE_OIL(6), + + /** + * Natural Gas. + * XSD value: 7 (line 1977) + */ + @XmlEnumValue("7") + NATURAL_GAS(7), + + /** + * Propane C3H8. + * XSD value: 8 (line 1983) + */ + @XmlEnumValue("8") + PROPANE(8), + + /** + * Drinkable water. + * XSD value: 9 (line 1989) + */ + @XmlEnumValue("9") + POTABLE_WATER(9), + + /** + * Water in steam form, usually used for heating. + * XSD value: 10 (line 1995) + */ + @XmlEnumValue("10") + STEAM(10), + + /** + * Waste Water (Sewerage). + * XSD value: 11 (line 2001) + */ + @XmlEnumValue("11") + WASTE_WATER(11), + + /** + * This fluid is likely in liquid form. It is not necessarily water or water based. + * The warm fluid returns cooler than when it was sent. The heat conveyed may be metered. + * XSD value: 12 (line 2007) + */ + @XmlEnumValue("12") + HEATING_FLUID(12), + + /** + * The cool fluid returns warmer than when it was sent. The heat conveyed may be metered. + * XSD value: 13 (line 2013) + */ + @XmlEnumValue("13") + COOLING_FLUID(13), + + /** + * Reclaimed water – possibly used for irrigation but not sufficiently treated to be + * considered safe for drinking. + * XSD value: 14 (line 2019) + */ + @XmlEnumValue("14") + NONPOTABLE_WATER(14), + + /** + * Nitrous Oxides NOX. + * XSD value: 15 (line 2025) + */ + @XmlEnumValue("15") + NOX(15), + + /** + * Sulfur Dioxide SO2. + * XSD value: 16 (line 2031) + */ + @XmlEnumValue("16") + SO2(16), + + /** + * Methane CH4. + * XSD value: 17 (line 2037) + */ + @XmlEnumValue("17") + CH4(17), + + /** + * Carbon Dioxide CO2. + * XSD value: 18 (line 2043) + */ + @XmlEnumValue("18") + CO2(18), + + /** + * Carbon. + * XSD value: 19 (line 2049) + */ + @XmlEnumValue("19") + CARBON(19), + + /** + * Hexachlorocyclohexane HCH. + * XSD value: 20 (line 2055) + */ + @XmlEnumValue("20") + HCH(20), + + /** + * Perfluorocarbons PFC. + * XSD value: 21 (line 2061) + */ + @XmlEnumValue("21") + PFC(21), + + /** + * Sulfurhexafluoride SF6. + * XSD value: 22 (line 2067) + */ + @XmlEnumValue("22") + SF6(22), + + /** + * Television. + * XSD value: 23 (line 2073) + */ + @XmlEnumValue("23") + TV_LICENCE(23), + + /** + * Internet service. + * XSD value: 24 (line 2079) + */ + @XmlEnumValue("24") + INTERNET(24), + + /** + * Trash. + * XSD value: 25 (line 2085) + */ + @XmlEnumValue("25") + REFUSE(25), + + /** + * Electricity Transmission "metered" -- Service taken directly from transmission + * system without transformation from standard transmission voltages. + * XSD value: 26 (line 2091) + */ + @XmlEnumValue("26") + ELECTRICITY_TRANSMISSION_METERED(26); + + private final int value; + + CommodityKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static CommodityKind fromValue(int value) { + for (CommodityKind kind : CommodityKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid CommodityKind value: " + value); + } +} \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/DataQualifierKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/DataQualifierKind.java new file mode 100644 index 00000000..27eba8bd --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/DataQualifierKind.java @@ -0,0 +1,160 @@ +/* + * + * Copyright (c) 2025 Green Button Alliance, Inc. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.greenbuttonalliance.espi.common.domain.usage.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for DataQualifierKind values. + * + * Code describing a salient attribute of Readings of ReadingType. + * Valid values per the standard are defined in DataQualifierType. + * Per ESPI 4.0 espi.xsd lines 2196-2296. + */ +@XmlType(name = "DataQualifierKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum DataQualifierKind { + + /** + * Not Applicable. + * XSD value: 0 (line 2203) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * Average value. + * XSD value: 2 (line 2209) + */ + @XmlEnumValue("2") + AVERAGE(2), + + /** + * The value represents an amount over which a threshold was exceeded. + * XSD value: 4 (line 2215) + */ + @XmlEnumValue("4") + EXCESS(4), + + /** + * The value represents a programmed threshold. + * XSD value: 5 (line 2221) + */ + @XmlEnumValue("5") + HIGH_THRESHOLD(5), + + /** + * The value represents a programmed threshold. + * XSD value: 7 (line 2227) + */ + @XmlEnumValue("7") + LOW_THRESHOLD(7), + + /** + * The highest value observed. + * XSD value: 8 (line 2233) + */ + @XmlEnumValue("8") + MAXIMUM(8), + + /** + * The smallest value observed. + * XSD value: 9 (line 2239) + */ + @XmlEnumValue("9") + MINIMUM(9), + + /** + * Nominal. + * XSD value: 11 (line 2245) + */ + @XmlEnumValue("11") + NOMINAL(11), + + /** + * Normal. + * XSD value: 12 (line 2251) + */ + @XmlEnumValue("12") + NORMAL(12), + + /** + * The second highest value observed. + * XSD value: 16 (line 2257) + */ + @XmlEnumValue("16") + SECOND_MAXIMUM(16), + + /** + * The second smallest value observed. + * XSD value: 17 (line 2263) + */ + @XmlEnumValue("17") + SECOND_MINIMUM(17), + + /** + * The third highest value observed. + * XSD value: 23 (line 2269) + */ + @XmlEnumValue("23") + THIRD_MAXIMUM(23), + + /** + * The fourth highest value observed. + * XSD value: 24 (line 2275) + */ + @XmlEnumValue("24") + FOURTH_MAXIMUM(24), + + /** + * The fifth highest value observed. + * XSD value: 25 (line 2281) + */ + @XmlEnumValue("25") + FIFTH_MAXIMUM(25), + + /** + * The accumulated sum. + * XSD value: 26 (line 2287) + */ + @XmlEnumValue("26") + SUM(26); + + private final int value; + + DataQualifierKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static DataQualifierKind fromValue(int value) { + for (DataQualifierKind kind : DataQualifierKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid DataQualifierKind value: " + value); + } +} diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/FlowDirectionKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/FlowDirectionKind.java new file mode 100644 index 00000000..4357cac6 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/FlowDirectionKind.java @@ -0,0 +1,237 @@ +/* + * + * Copyright (c) 2025 Green Button Alliance, Inc. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.greenbuttonalliance.espi.common.domain.usage.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for FlowDirectionKind values. + * + * Direction associated with current related Readings. + * Valid values per the standard are defined in FlowDirectionType. + * Per ESPI 4.0 espi.xsd lines 2297-2433. + */ +@XmlType(name = "FlowDirectionKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum FlowDirectionKind { + + /** + * Not Applicable (N/A). + * XSD value: 0 (line 2304) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * "Delivered," or "Imported" as defined 61968-2. + * Forward Active Energy is a positive kWh value as one would naturally expect to find + * as energy is supplied by the utility and consumed at the service. Forward Reactive + * Energy is a positive VArh value as one would naturally expect to find in the presence + * of inductive loading. In polyphase metering, the forward energy register is incremented + * when the sum of the phase energies is greater than zero. + * XSD value: 1 (line 2310) + */ + @XmlEnumValue("1") + FORWARD(1), + + /** + * Typically used to describe that a power factor is lagging the reference value. + * Note 1: When used to describe VA, "lagging" describes a form of measurement where + * reactive power is considered in all four quadrants, but real power is considered + * only in quadrants I and IV. + * Note 2: When used to describe power factor, the term "Lagging" implies that the PF + * is negative. The term "lagging" in this case takes the place of the negative sign. + * If a signed PF value is to be passed by the data producer, then the direction of + * flow enumeration zero (none) should be used in order to avoid the possibility of + * creating an expression that employs a double negative. The data consumer should be + * able to tell from the sign of the data if the PF is leading or lagging. This principle + * is analogous to the concept that "Reverse" energy is an implied negative value, and + * to publish a negative reverse value would be ambiguous. + * Note 3: Lagging power factors typically indicate inductive loading. + * XSD value: 2 (line 2316) + */ + @XmlEnumValue("2") + LAGGING(2), + + /** + * Typically used to describe that a power factor is leading the reference value. + * Note: Leading power factors typically indicate capacitive loading. + * XSD value: 3 (line 2322) + */ + @XmlEnumValue("3") + LEADING(3), + + /** + * |Forward| - |Reverse|, See 61968-2. + * Note: In some systems, the value passed as a "net" value could become negative. + * In other systems the value passed as a "net" value is always a positive number, + * and rolls-over and rolls-under as needed. + * XSD value: 4 (line 2328) + */ + @XmlEnumValue("4") + NET(4), + + /** + * Reactive positive quadrants. (The term "lagging" is preferred.) + * XSD value: 5 (line 2334) + */ + @XmlEnumValue("5") + Q1_PLUS_Q2(5), + + /** + * Quadrants 1 and 3. + * XSD value: 7 (line 2340) + */ + @XmlEnumValue("7") + Q1_PLUS_Q3(7), + + /** + * Quadrants 1 and 4 usually represent forward active energy. + * XSD value: 8 (line 2346) + */ + @XmlEnumValue("8") + Q1_PLUS_Q4(8), + + /** + * Q1 minus Q4. + * XSD value: 9 (line 2352) + */ + @XmlEnumValue("9") + Q1_MINUS_Q4(9), + + /** + * Quadrants 2 and 3 usually represent reverse active energy. + * XSD value: 10 (line 2358) + */ + @XmlEnumValue("10") + Q2_PLUS_Q3(10), + + /** + * Quadrants 2 and 4. + * XSD value: 11 (line 2364) + */ + @XmlEnumValue("11") + Q2_PLUS_Q4(11), + + /** + * Q2 minus Q3. + * XSD value: 12 (line 2370) + */ + @XmlEnumValue("12") + Q2_MINUS_Q3(12), + + /** + * Reactive negative quadrants. (The term "leading" is preferred.) + * XSD value: 13 (line 2376) + */ + @XmlEnumValue("13") + Q3_PLUS_Q4(13), + + /** + * Q3 minus Q2. + * XSD value: 14 (line 2382) + */ + @XmlEnumValue("14") + Q3_MINUS_Q2(14), + + /** + * Q1 only. + * XSD value: 15 (line 2388) + */ + @XmlEnumValue("15") + QUADRANT_1(15), + + /** + * Q2 only. + * XSD value: 16 (line 2394) + */ + @XmlEnumValue("16") + QUADRANT_2(16), + + /** + * Q3 only. + * XSD value: 17 (line 2400) + */ + @XmlEnumValue("17") + QUADRANT_3(17), + + /** + * Q4 only. + * XSD value: 18 (line 2406) + */ + @XmlEnumValue("18") + QUADRANT_4(18), + + /** + * Reverse Active Energy is equivalent to "Received," or "Exported" as defined in 61968-2. + * Reverse Active Energy is a positive kWh value as one would expect to find when energy + * is backfed by the service onto the utility network. Reverse Reactive Energy is a positive + * VArh value as one would expect to find in the presence of capacitive loading and a leading + * Power Factor. In polyphase metering, the reverse energy register is incremented when the + * sum of the phase energies is less than zero. + * Note: The value passed as a reverse value is always a positive value. It is understood + * by the label "reverse" that it represents negative flow. + * XSD value: 19 (line 2412) + */ + @XmlEnumValue("19") + REVERSE(19), + + /** + * |Forward| + |Reverse|, See 61968-2. + * The sum of the commodity in all quadrants Q1+Q2+Q3+Q4. In polyphase metering, the total + * energy register is incremented when the absolute value of the sum of the phase energies + * is greater than zero. + * XSD value: 20 (line 2418) + */ + @XmlEnumValue("20") + TOTAL(20), + + /** + * In polyphase metering, the total by phase energy register is incremented when the sum + * of the absolute values of the phase energies is greater than zero. In single phase + * metering, the formulas for "Total" and "Total by phase" collapse to the same expression. + * For communication purposes however, the "Total" enumeration should be used with single + * phase meter data. + * XSD value: 21 (line 2424) + */ + @XmlEnumValue("21") + TOTAL_BY_PHASE(21); + + private final int value; + + FlowDirectionKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static FlowDirectionKind fromValue(int value) { + for (FlowDirectionKind kind : FlowDirectionKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid FlowDirectionKind value: " + value); + } +} diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/MeasurementKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/MeasurementKind.java new file mode 100644 index 00000000..aea9fda6 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/MeasurementKind.java @@ -0,0 +1,932 @@ +/* + * + * Copyright (c) 2025 Green Button Alliance, Inc. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.greenbuttonalliance.espi.common.domain.usage.enums; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +/** + * Enumeration for MeasurementKind values. + * + * Name of physical measurement representing the type of measurement data being reported. + * This enum includes various measurement types ranging from electrical quantities (power, + * voltage, current) to reliability metrics (IEEE 1366), environmental measurements + * (temperature), and other physical quantities (volume, distance, etc.). + * Per ESPI 4.0 espi.xsd lines 2434-2865. + */ +@XmlType(name = "MeasurementKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum MeasurementKind { + + /** + * Not Applicable. + * XSD value: 0 (line 2441) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * Apparent Power Factor. + * XSD value: 2 (line 2447) + */ + @XmlEnumValue("2") + APPARENT_POWER_FACTOR(2), + + /** + * Currency. + * XSD value: 3 (line 2453) + */ + @XmlEnumValue("3") + CURRENCY(3), + + /** + * Current. + * XSD value: 4 (line 2459) + */ + @XmlEnumValue("4") + CURRENT(4), + + /** + * Current Angle. + * XSD value: 5 (line 2465) + */ + @XmlEnumValue("5") + CURRENT_ANGLE(5), + + /** + * Current Imbalance. + * XSD value: 6 (line 2471) + */ + @XmlEnumValue("6") + CURRENT_IMBALANCE(6), + + /** + * Date. + * XSD value: 7 (line 2477) + */ + @XmlEnumValue("7") + DATE(7), + + /** + * Demand. + * XSD value: 8 (line 2483) + */ + @XmlEnumValue("8") + DEMAND(8), + + /** + * Distance. + * XSD value: 9 (line 2489) + */ + @XmlEnumValue("9") + DISTANCE(9), + + /** + * Distortion Volt Amperes. + * XSD value: 10 (line 2495) + */ + @XmlEnumValue("10") + DISTORTION_VOLT_AMPERES(10), + + /** + * Energization. + * XSD value: 11 (line 2501) + */ + @XmlEnumValue("11") + ENERGIZATION(11), + + /** + * Energy. + * XSD value: 12 (line 2507) + */ + @XmlEnumValue("12") + ENERGY(12), + + /** + * Energization Load Side. + * XSD value: 13 (line 2513) + */ + @XmlEnumValue("13") + ENERGIZATION_LOAD_SIDE(13), + + /** + * Fan. + * XSD value: 14 (line 2519) + */ + @XmlEnumValue("14") + FAN(14), + + /** + * Frequency. + * XSD value: 15 (line 2525) + */ + @XmlEnumValue("15") + FREQUENCY(15), + + /** + * Funds (Duplication of "currency"). + * XSD value: 16 (line 2531) + */ + @XmlEnumValue("16") + FUNDS(16), + + /** + * IEEE 1366 ASAI (Average Service Availability Index). + * XSD value: 17 (line 2537) + */ + @XmlEnumValue("17") + IEEE1366_ASAI(17), + + /** + * IEEE 1366 ASIDI (Average System Interruption Duration Index). + * XSD value: 18 (line 2543) + */ + @XmlEnumValue("18") + IEEE1366_ASIDI(18), + + /** + * IEEE 1366 ASIFI (Average System Interruption Frequency Index). + * XSD value: 19 (line 2549) + */ + @XmlEnumValue("19") + IEEE1366_ASIFI(19), + + /** + * IEEE 1366 CAIDI (Customer Average Interruption Duration Index). + * XSD value: 20 (line 2555) + */ + @XmlEnumValue("20") + IEEE1366_CAIDI(20), + + /** + * IEEE 1366 CAIFI (Customer Average Interruption Frequency Index). + * XSD value: 21 (line 2561) + */ + @XmlEnumValue("21") + IEEE1366_CAIFI(21), + + /** + * IEEE 1366 CEMIn (Customers Experiencing Multiple Interruptions). + * XSD value: 22 (line 2567) + */ + @XmlEnumValue("22") + IEEE1366_CEMIN(22), + + /** + * IEEE 1366 CEMSMIn (Customers Experiencing Multiple Sustained Interruptions and Momentary Interruption events). + * XSD value: 23 (line 2573) + */ + @XmlEnumValue("23") + IEEE1366_CEMSMIN(23), + + /** + * IEEE 1366 CTAIDI (Customer Total Average Interruption Duration Index). + * XSD value: 24 (line 2579) + */ + @XmlEnumValue("24") + IEEE1366_CTAIDI(24), + + /** + * IEEE 1366 MAIFI (Momentary Average Interruption Frequency Index). + * XSD value: 25 (line 2585) + */ + @XmlEnumValue("25") + IEEE1366_MAIFI(25), + + /** + * IEEE 1366 MAIFIe (Momentary Average Interruption Event Frequency Index). + * XSD value: 26 (line 2591) + */ + @XmlEnumValue("26") + IEEE1366_MAIFIE(26), + + /** + * IEEE 1366 SAIDI (System Average Interruption Duration Index). + * XSD value: 27 (line 2597) + */ + @XmlEnumValue("27") + IEEE1366_SAIDI(27), + + /** + * IEEE 1366 SAIFI (System Average Interruption Frequency Index). + * XSD value: 28 (line 2603) + */ + @XmlEnumValue("28") + IEEE1366_SAIFI(28), + + /** + * Line Losses. + * XSD value: 31 (line 2609) + */ + @XmlEnumValue("31") + LINE_LOSSES(31), + + /** + * Losses. + * XSD value: 32 (line 2615) + */ + @XmlEnumValue("32") + LOSSES(32), + + /** + * Negative Sequence. + * XSD value: 33 (line 2621) + */ + @XmlEnumValue("33") + NEGATIVE_SEQUENCE(33), + + /** + * Phasor Power Factor. + * XSD value: 34 (line 2627) + */ + @XmlEnumValue("34") + PHASOR_POWER_FACTOR(34), + + /** + * Phasor Reactive Power. + * XSD value: 35 (line 2633) + */ + @XmlEnumValue("35") + PHASOR_REACTIVE_POWER(35), + + /** + * Positive Sequence. + * XSD value: 36 (line 2639) + */ + @XmlEnumValue("36") + POSITIVE_SEQUENCE(36), + + /** + * Power. + * XSD value: 37 (line 2645) + */ + @XmlEnumValue("37") + POWER(37), + + /** + * Power Factor. + * XSD value: 38 (line 2651) + */ + @XmlEnumValue("38") + POWER_FACTOR(38), + + /** + * Quantity Power. + * XSD value: 40 (line 2657) + */ + @XmlEnumValue("40") + QUANTITY_POWER(40), + + /** + * Sag (Voltage Dip). + * XSD value: 41 (line 2663) + */ + @XmlEnumValue("41") + SAG(41), + + /** + * Swell. + * XSD value: 42 (line 2669) + */ + @XmlEnumValue("42") + SWELL(42), + + /** + * Switch Position. + * XSD value: 43 (line 2675) + */ + @XmlEnumValue("43") + SWITCH_POSITION(43), + + /** + * Tap Position. + * XSD value: 44 (line 2681) + */ + @XmlEnumValue("44") + TAP_POSITION(44), + + /** + * Tariff Rate. + * XSD value: 45 (line 2687) + */ + @XmlEnumValue("45") + TARIFF_RATE(45), + + /** + * Temperature. + * XSD value: 46 (line 2693) + */ + @XmlEnumValue("46") + TEMPERATURE(46), + + /** + * Total Harmonic Distortion. + * XSD value: 47 (line 2699) + */ + @XmlEnumValue("47") + TOTAL_HARMONIC_DISTORTION(47), + + /** + * Transformer Losses. + * XSD value: 48 (line 2705) + */ + @XmlEnumValue("48") + TRANSFORMER_LOSSES(48), + + /** + * Unipede Voltage Dip 10 to 15. + * XSD value: 49 (line 2711) + */ + @XmlEnumValue("49") + UNIPEDE_VOLTAGE_DIP_10_TO_15(49), + + /** + * Unipede Voltage Dip 15 to 30. + * XSD value: 50 (line 2717) + */ + @XmlEnumValue("50") + UNIPEDE_VOLTAGE_DIP_15_TO_30(50), + + /** + * Unipede Voltage Dip 30 to 60. + * XSD value: 51 (line 2723) + */ + @XmlEnumValue("51") + UNIPEDE_VOLTAGE_DIP_30_TO_60(51), + + /** + * Unipede Voltage Dip 60 to 90. + * XSD value: 52 (line 2729) + */ + @XmlEnumValue("52") + UNIPEDE_VOLTAGE_DIP_60_TO_90(52), + + /** + * Unipede Voltage Dip 90 to 100. + * XSD value: 53 (line 2735) + */ + @XmlEnumValue("53") + UNIPEDE_VOLTAGE_DIP_90_TO_100(53), + + /** + * Voltage. + * XSD value: 54 (line 2741) + */ + @XmlEnumValue("54") + VOLTAGE(54), + + /** + * Voltage Angle. + * XSD value: 55 (line 2747) + */ + @XmlEnumValue("55") + VOLTAGE_ANGLE(55), + + /** + * Voltage Excursion. + * XSD value: 56 (line 2753) + */ + @XmlEnumValue("56") + VOLTAGE_EXCURSION(56), + + /** + * Voltage Imbalance. + * XSD value: 57 (line 2759) + */ + @XmlEnumValue("57") + VOLTAGE_IMBALANCE(57), + + /** + * Volume (Clarified from Ed. 1. to indicate fluid volume). + * XSD value: 58 (line 2765) + */ + @XmlEnumValue("58") + VOLUME(58), + + /** + * Zero Flow Duration. + * XSD value: 59 (line 2771) + */ + @XmlEnumValue("59") + ZERO_FLOW_DURATION(59), + + /** + * Zero Sequence. + * XSD value: 60 (line 2777) + */ + @XmlEnumValue("60") + ZERO_SEQUENCE(60), + + /** + * Distortion Power Factor. + * XSD value: 64 (line 2783) + */ + @XmlEnumValue("64") + DISTORTION_POWER_FACTOR(64), + + /** + * Frequency Excursion (Usually expressed as a "count"). + * XSD value: 81 (line 2789) + */ + @XmlEnumValue("81") + FREQUENCY_EXCURSION(81), + + /** + * Application Context. + * XSD value: 90 (line 2795) + */ + @XmlEnumValue("90") + APPLICATION_CONTEXT(90), + + /** + * Ap Title. + * XSD value: 91 (line 2801) + */ + @XmlEnumValue("91") + AP_TITLE(91), + + /** + * Asset Number. + * XSD value: 92 (line 2807) + */ + @XmlEnumValue("92") + ASSET_NUMBER(92), + + /** + * Bandwidth. + * XSD value: 93 (line 2813) + */ + @XmlEnumValue("93") + BANDWIDTH(93), + + /** + * Battery Voltage. + * XSD value: 94 (line 2819) + */ + @XmlEnumValue("94") + BATTERY_VOLTAGE(94), + + /** + * Broadcast Address. + * XSD value: 95 (line 2825) + */ + @XmlEnumValue("95") + BROADCAST_ADDRESS(95), + + /** + * Device Address Type 1. + * XSD value: 96 (line 2831) + */ + @XmlEnumValue("96") + DEVICE_ADDRESS_TYPE_1(96), + + /** + * Device Address Type 2. + * XSD value: 97 (line 2837) + */ + @XmlEnumValue("97") + DEVICE_ADDRESS_TYPE_2(97), + + /** + * Device Address Type 3. + * XSD value: 98 (line 2843) + */ + @XmlEnumValue("98") + DEVICE_ADDRESS_TYPE_3(98), + + /** + * Device Address Type 4. + * XSD value: 99 (line 2849) + */ + @XmlEnumValue("99") + DEVICE_ADDRESS_TYPE_4(99), + + /** + * Device Class. + * XSD value: 100 (line 2855) + */ + @XmlEnumValue("100") + DEVICE_CLASS(100), + + /** + * Electronic Serial Number. + * XSD value: 101 (line 2861) + */ + @XmlEnumValue("101") + ELECTRONIC_SERIAL_NUMBER(101), + + /** + * End Device ID. + * XSD value: 102 (line 2867) + */ + @XmlEnumValue("102") + END_DEVICE_ID(102), + + /** + * Group Address Type 1. + * XSD value: 103 (line 2873) + */ + @XmlEnumValue("103") + GROUP_ADDRESS_TYPE_1(103), + + /** + * Group Address Type 2. + * XSD value: 104 (line 2879) + */ + @XmlEnumValue("104") + GROUP_ADDRESS_TYPE_2(104), + + /** + * Group Address Type 3. + * XSD value: 105 (line 2885) + */ + @XmlEnumValue("105") + GROUP_ADDRESS_TYPE_3(105), + + /** + * Group Address Type 4. + * XSD value: 106 (line 2891) + */ + @XmlEnumValue("106") + GROUP_ADDRESS_TYPE_4(106), + + /** + * IP Address. + * XSD value: 107 (line 2897) + */ + @XmlEnumValue("107") + IP_ADDRESS(107), + + /** + * MAC Address. + * XSD value: 108 (line 2903) + */ + @XmlEnumValue("108") + MAC_ADDRESS(108), + + /** + * Mfg Assigned Configuration ID. + * XSD value: 109 (line 2909) + */ + @XmlEnumValue("109") + MFG_ASSIGNED_CONFIGURATION_ID(109), + + /** + * Mfg Assigned Physical Serial Number. + * XSD value: 110 (line 2915) + */ + @XmlEnumValue("110") + MFG_ASSIGNED_PHYSICAL_SERIAL_NUMBER(110), + + /** + * Mfg Assigned Product Number. + * XSD value: 111 (line 2921) + */ + @XmlEnumValue("111") + MFG_ASSIGNED_PRODUCT_NUMBER(111), + + /** + * Mfg Assigned Unique Communication Address. + * XSD value: 112 (line 2927) + */ + @XmlEnumValue("112") + MFG_ASSIGNED_UNIQUE_COMMUNICATION_ADDRESS(112), + + /** + * Multicast Address. + * XSD value: 113 (line 2933) + */ + @XmlEnumValue("113") + MULTICAST_ADDRESS(113), + + /** + * One Way Address. + * XSD value: 114 (line 2939) + */ + @XmlEnumValue("114") + ONE_WAY_ADDRESS(114), + + /** + * Signal Strength. + * XSD value: 115 (line 2945) + */ + @XmlEnumValue("115") + SIGNAL_STRENGTH(115), + + /** + * Two Way Address. + * XSD value: 116 (line 2951) + */ + @XmlEnumValue("116") + TWO_WAY_ADDRESS(116), + + /** + * Signal to Noise Ratio (moved here from Attribute #9 UOM). + * XSD value: 117 (line 2957) + */ + @XmlEnumValue("117") + SIGNAL_TO_NOISE_RATIO(117), + + /** + * Alarm. + * XSD value: 118 (line 2963) + */ + @XmlEnumValue("118") + ALARM(118), + + /** + * Battery Carryover. + * XSD value: 119 (line 2969) + */ + @XmlEnumValue("119") + BATTERY_CARRYOVER(119), + + /** + * Data Overflow Alarm. + * XSD value: 120 (line 2975) + */ + @XmlEnumValue("120") + DATA_OVERFLOW_ALARM(120), + + /** + * Demand Limit. + * XSD value: 121 (line 2981) + */ + @XmlEnumValue("121") + DEMAND_LIMIT(121), + + /** + * Demand Reset (usually expressed as a count as part of a billing cycle). + * XSD value: 122 (line 2987) + */ + @XmlEnumValue("122") + DEMAND_RESET(122), + + /** + * Diagnostic. + * XSD value: 123 (line 2993) + */ + @XmlEnumValue("123") + DIAGNOSTIC(123), + + /** + * Emergency Limit. + * XSD value: 124 (line 2999) + */ + @XmlEnumValue("124") + EMERGENCY_LIMIT(124), + + /** + * Encoder Tamper. + * XSD value: 125 (line 3005) + */ + @XmlEnumValue("125") + ENCODER_TAMPER(125), + + /** + * IEEE 1366 Momentary Interruption. + * XSD value: 126 (line 3011) + */ + @XmlEnumValue("126") + IEEE1366_MOMENTARY_INTERRUPTION(126), + + /** + * IEEE 1366 Momentary Interruption Event. + * XSD value: 127 (line 3017) + */ + @XmlEnumValue("127") + IEEE1366_MOMENTARY_INTERRUPTION_EVENT(127), + + /** + * IEEE 1366 Sustained Interruption. + * XSD value: 128 (line 3023) + */ + @XmlEnumValue("128") + IEEE1366_SUSTAINED_INTERRUPTION(128), + + /** + * Interruption Behaviour. + * XSD value: 129 (line 3029) + */ + @XmlEnumValue("129") + INTERRUPTION_BEHAVIOUR(129), + + /** + * Inversion Tamper. + * XSD value: 130 (line 3035) + */ + @XmlEnumValue("130") + INVERSION_TAMPER(130), + + /** + * Load Interrupt. + * XSD value: 131 (line 3041) + */ + @XmlEnumValue("131") + LOAD_INTERRUPT(131), + + /** + * Load Shed. + * XSD value: 132 (line 3047) + */ + @XmlEnumValue("132") + LOAD_SHED(132), + + /** + * Maintenance. + * XSD value: 133 (line 3053) + */ + @XmlEnumValue("133") + MAINTENANCE(133), + + /** + * Physical Tamper. + * XSD value: 134 (line 3059) + */ + @XmlEnumValue("134") + PHYSICAL_TAMPER(134), + + /** + * Power Loss Tamper. + * XSD value: 135 (line 3065) + */ + @XmlEnumValue("135") + POWER_LOSS_TAMPER(135), + + /** + * Power Outage. + * XSD value: 136 (line 3071) + */ + @XmlEnumValue("136") + POWER_OUTAGE(136), + + /** + * Power Quality. + * XSD value: 137 (line 3077) + */ + @XmlEnumValue("137") + POWER_QUALITY(137), + + /** + * Power Restoration. + * XSD value: 138 (line 3083) + */ + @XmlEnumValue("138") + POWER_RESTORATION(138), + + /** + * Programmed. + * XSD value: 139 (line 3089) + */ + @XmlEnumValue("139") + PROGRAMMED(139), + + /** + * Push Button. + * XSD value: 140 (line 3095) + */ + @XmlEnumValue("140") + PUSHBUTTON(140), + + /** + * Relay Activation. + * XSD value: 141 (line 3101) + */ + @XmlEnumValue("141") + RELAY_ACTIVATION(141), + + /** + * Relay Cycle (usually expressed as a count). + * XSD value: 142 (line 3107) + */ + @XmlEnumValue("142") + RELAY_CYCLE(142), + + /** + * Removal Tamper. + * XSD value: 143 (line 3113) + */ + @XmlEnumValue("143") + REMOVAL_TAMPER(143), + + /** + * Reprogramming Tamper. + * XSD value: 144 (line 3119) + */ + @XmlEnumValue("144") + REPROGRAMMING_TAMPER(144), + + /** + * Reverse Rotation Tamper. + * XSD value: 145 (line 3125) + */ + @XmlEnumValue("145") + REVERSE_ROTATION_TAMPER(145), + + /** + * Switch Armed. + * XSD value: 146 (line 3131) + */ + @XmlEnumValue("146") + SWITCH_ARMED(146), + + /** + * Switch Disabled. + * XSD value: 147 (line 3137) + */ + @XmlEnumValue("147") + SWITCH_DISABLED(147), + + /** + * Tamper. + * XSD value: 148 (line 3143) + */ + @XmlEnumValue("148") + TAMPER(148), + + /** + * Watchdog Timeout. + * XSD value: 149 (line 3149) + */ + @XmlEnumValue("149") + WATCHDOG_TIMEOUT(149), + + /** + * Customer's bill for the previous billing period (Currency). + * XSD value: 150 (line 3155) + */ + @XmlEnumValue("150") + BILL_LAST_PERIOD(150), + + /** + * Customer's bill, as known thus far within the present billing period (Currency). + * XSD value: 151 (line 3161) + */ + @XmlEnumValue("151") + BILL_TO_DATE(151), + + /** + * Customer's bill for the (Currency). + * XSD value: 152 (line 3167) + */ + @XmlEnumValue("152") + BILL_CARRYOVER(152), + + /** + * Monthly fee for connection to commodity. + * XSD value: 153 (line 3173) + */ + @XmlEnumValue("153") + CONNECTION_FEE(153), + + /** + * Audible Volume (Sound). + * XSD value: 154 (line 3179) + */ + @XmlEnumValue("154") + AUDIBLE_VOLUME(154), + + /** + * Volumetric Flow. + * XSD value: 155 (line 3185) + */ + @XmlEnumValue("155") + VOLUMETRIC_FLOW(155); + + private final int value; + + MeasurementKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static MeasurementKind fromValue(int value) { + for (MeasurementKind kind : MeasurementKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid MeasurementKind value: " + value); + } +}