From b8e94c59bafa5521ba5a70bd2eb396ffbbc46ac7 Mon Sep 17 00:00:00 2001 From: "Donald F. Coffin" Date: Thu, 5 Feb 2026 11:13:09 -0500 Subject: [PATCH] feat(phase-0.3): Generate usage domain enums batch 2 Generated 4 ESPI usage domain enumerations: - PhaseCodeKind (23 values) - Phase identifiers - QualityOfReading (14 values) - Reading quality codes - TimeAttributeKind (20 values) - Time interval methods - UnitMultiplierKind (13 values) - Power of ten multipliers 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. Co-Authored-By: Claude Sonnet 4.5 --- .../domain/usage/enums/PhaseCodeKind.java | 221 ++++++++++++++++++ .../domain/usage/enums/QualityOfReading.java | 150 ++++++++++++ .../domain/usage/enums/TimeAttributeKind.java | 195 ++++++++++++++++ .../usage/enums/UnitMultiplierKind.java | 145 ++++++++++++ 4 files changed, 711 insertions(+) create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/PhaseCodeKind.java create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/QualityOfReading.java create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/TimeAttributeKind.java create mode 100644 openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/UnitMultiplierKind.java diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/PhaseCodeKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/PhaseCodeKind.java new file mode 100644 index 00000000..8881db61 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/PhaseCodeKind.java @@ -0,0 +1,221 @@ +/* + * + * 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 PhaseCodeKind values. + * + * Enumeration of phase identifiers. Allows designation of phases for both transmission and + * distribution equipment, circuits and loads. Residential and small commercial loads are often + * served from single-phase, or split-phase, secondary circuits. Phases 1 and 2 refer to hot + * wires that are 180 degrees out of phase, while N refers to the neutral wire. Through + * single-phase transformer connections, these secondary circuits may be served from one or + * two of the primary phases A, B, and C. For three-phase loads, use the A, B, C phase codes + * instead of s12N. + * Per ESPI 4.0 espi.xsd lines 3195-3339. + */ +@XmlType(name = "PhaseCodeKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum PhaseCodeKind { + + /** + * ABC to Neutral. + * XSD value: 225 (line 3202) + */ + @XmlEnumValue("225") + ABCN(225), + + /** + * Involving all phases. + * XSD value: 224 (line 3208) + */ + @XmlEnumValue("224") + ABC(224), + + /** + * AB to Neutral. + * XSD value: 193 (line 3214) + */ + @XmlEnumValue("193") + ABN(193), + + /** + * Phases A, C and neutral. + * XSD value: 41 (line 3220) + */ + @XmlEnumValue("41") + ACN(41), + + /** + * BC to neutral. + * XSD value: 97 (line 3226) + */ + @XmlEnumValue("97") + BCN(97), + + /** + * Phases A to B. + * XSD value: 132 (line 3232) + */ + @XmlEnumValue("132") + AB(132), + + /** + * Phases A and C. + * XSD value: 96 (line 3238) + */ + @XmlEnumValue("96") + AC(96), + + /** + * Phases B to C. + * XSD value: 66 (line 3244) + */ + @XmlEnumValue("66") + BC(66), + + /** + * Phases A to neutral. + * XSD value: 129 (line 3250) + */ + @XmlEnumValue("129") + AN(129), + + /** + * Phases B to neutral. + * XSD value: 65 (line 3256) + */ + @XmlEnumValue("65") + BN(65), + + /** + * Phases C to neutral. + * XSD value: 33 (line 3262) + */ + @XmlEnumValue("33") + CN(33), + + /** + * Phase A. + * XSD value: 128 (line 3268) + */ + @XmlEnumValue("128") + A(128), + + /** + * Phase B. + * XSD value: 64 (line 3274) + */ + @XmlEnumValue("64") + B(64), + + /** + * Phase C. + * XSD value: 32 (line 3280) + */ + @XmlEnumValue("32") + C(32), + + /** + * Neutral. + * XSD value: 16 (line 3286) + */ + @XmlEnumValue("16") + N(16), + + /** + * Phase S2 to neutral. + * XSD value: 272 (line 3292) + */ + @XmlEnumValue("272") + S2N(272), + + /** + * Phase S1, S2 to neutral. + * XSD value: 784 (line 3298) + */ + @XmlEnumValue("784") + S12N_784(784), + + /** + * Phase S1 to Neutral. + * XSD value: 528 (line 3304) + */ + @XmlEnumValue("528") + S1N(528), + + /** + * Phase S2. + * XSD value: 256 (line 3310) + */ + @XmlEnumValue("256") + S2(256), + + /** + * Phase S1 to S2. + * XSD value: 768 (line 3316) + */ + @XmlEnumValue("768") + S12(768), + + /** + * Phase S1, S2 to N. + * XSD value: 769 (line 3322) + */ + @XmlEnumValue("769") + S12N_769(769), + + /** + * Not applicable to any phase. + * XSD value: 0 (line 3328) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * Phase A current relative to Phase A voltage. + * XSD value: 136 (line 3334) + */ + @XmlEnumValue("136") + A_TO_AV(136); + + private final int value; + + PhaseCodeKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static PhaseCodeKind fromValue(int value) { + for (PhaseCodeKind kind : PhaseCodeKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid PhaseCodeKind value: " + value); + } +} diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/QualityOfReading.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/QualityOfReading.java new file mode 100644 index 00000000..ee359ef3 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/QualityOfReading.java @@ -0,0 +1,150 @@ +/* + * + * 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 QualityOfReading values. + * + * List of codes indicating the quality of the reading. + * Per ESPI 4.0 espi.xsd lines 3457-3540. + */ +@XmlType(name = "QualityOfReading", namespace = "http://naesb.org/espi") +@XmlEnum +public enum QualityOfReading { + + /** + * Data that has gone through all required validation checks and either passed them all + * or has been verified. + * XSD value: 0 (line 3464) + */ + @XmlEnumValue("0") + VALID(0), + + /** + * Replaced or approved by a human. + * XSD value: 7 (line 3470) + */ + @XmlEnumValue("7") + MANUALLY_EDITED(7), + + /** + * Data value was replaced by a machine computed value based on analysis of historical + * data using the same type of measurement. + * XSD value: 8 (line 3476) + */ + @XmlEnumValue("8") + ESTIMATED_USING_REFERENCE_DAY(8), + + /** + * Data value was computed using linear interpolation based on the readings before and + * after it. + * XSD value: 9 (line 3482) + */ + @XmlEnumValue("9") + ESTIMATED_USING_LINEAR_INTERPOLATION(9), + + /** + * Data that has failed one or more checks. + * XSD value: 10 (line 3488) + */ + @XmlEnumValue("10") + QUESTIONABLE(10), + + /** + * Data that has been calculated (using logic or mathematical operations). + * XSD value: 11 (line 3494) + */ + @XmlEnumValue("11") + DERIVED(11), + + /** + * Data that has been calculated as a projection or forecast of future readings. + * XSD value: 12 (line 3500) + */ + @XmlEnumValue("12") + PROJECTED_FORECAST(12), + + /** + * Indicates that the quality of this reading has mixed characteristics. + * XSD value: 13 (line 3506) + */ + @XmlEnumValue("13") + MIXED(13), + + /** + * Data that has not gone through the validation. + * XSD value: 14 (line 3512) + */ + @XmlEnumValue("14") + RAW(14), + + /** + * The values have been adjusted to account for weather. + * XSD value: 15 (line 3518) + */ + @XmlEnumValue("15") + NORMALIZED_FOR_WEATHER(15), + + /** + * Specifies that a characteristic applies other than those defined. + * XSD value: 16 (line 3524) + */ + @XmlEnumValue("16") + OTHER(16), + + /** + * Data that has been validated and possibly edited and/or estimated in accordance with + * approved procedures. + * XSD value: 17 (line 3530) + */ + @XmlEnumValue("17") + VALIDATED(17), + + /** + * Data that failed at least one of the required validation checks but was determined to + * represent actual usage. + * XSD value: 18 (line 3536) + */ + @XmlEnumValue("18") + VERIFIED(18); + + private final int value; + + QualityOfReading(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static QualityOfReading fromValue(int value) { + for (QualityOfReading quality : QualityOfReading.values()) { + if (quality.value == value) { + return quality; + } + } + throw new IllegalArgumentException("Invalid QualityOfReading value: " + value); + } +} diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/TimeAttributeKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/TimeAttributeKind.java new file mode 100644 index 00000000..5ea843d0 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/TimeAttributeKind.java @@ -0,0 +1,195 @@ +/* + * + * 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 TimeAttributeKind values. + * + * Code used to specify a particular type of time interval method for Readings of ReadingType. + * Valid values per the standard are defined in TimeAttributeType. + * Per ESPI 4.0 espi.xsd lines 3623-3748. + */ +@XmlType(name = "TimeAttributeKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum TimeAttributeKind { + + /** + * Not Applicable. + * XSD value: 0 (line 3630) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * 10-minute. + * XSD value: 1 (line 3636) + */ + @XmlEnumValue("1") + TEN_MINUTE(1), + + /** + * 15-minute. + * XSD value: 2 (line 3642) + */ + @XmlEnumValue("2") + FIFTEEN_MINUTE(2), + + /** + * 1-minute. + * XSD value: 3 (line 3648) + */ + @XmlEnumValue("3") + ONE_MINUTE(3), + + /** + * 24-hour. + * XSD value: 4 (line 3654) + */ + @XmlEnumValue("4") + TWENTY_FOUR_HOUR(4), + + /** + * 30-minute. + * XSD value: 5 (line 3660) + */ + @XmlEnumValue("5") + THIRTY_MINUTE(5), + + /** + * 5-minute. + * XSD value: 6 (line 3666) + */ + @XmlEnumValue("6") + FIVE_MINUTE(6), + + /** + * 60-minute. + * XSD value: 7 (line 3672) + */ + @XmlEnumValue("7") + SIXTY_MINUTE(7), + + /** + * 2-minute. + * XSD value: 10 (line 3678) + */ + @XmlEnumValue("10") + TWO_MINUTE(10), + + /** + * 3-minute. + * XSD value: 14 (line 3684) + */ + @XmlEnumValue("14") + THREE_MINUTE(14), + + /** + * Within the present period of time. + * XSD value: 15 (line 3690) + */ + @XmlEnumValue("15") + PRESENT(15), + + /** + * Shifted within the previous monthly cycle and data set. + * XSD value: 16 (line 3696) + */ + @XmlEnumValue("16") + PREVIOUS(16), + + /** + * 20-minute interval. + * XSD value: 31 (line 3702) + */ + @XmlEnumValue("31") + TWENTY_MINUTE(31), + + /** + * 60-minute Fixed Block. + * XSD value: 50 (line 3708) + */ + @XmlEnumValue("50") + FIXED_BLOCK_60_MIN(50), + + /** + * 30-minute Fixed Block. + * XSD value: 51 (line 3714) + */ + @XmlEnumValue("51") + FIXED_BLOCK_30_MIN(51), + + /** + * 20-minute Fixed Block. + * XSD value: 52 (line 3720) + */ + @XmlEnumValue("52") + FIXED_BLOCK_20_MIN(52), + + /** + * 15-minute Fixed Block. + * XSD value: 53 (line 3726) + */ + @XmlEnumValue("53") + FIXED_BLOCK_15_MIN(53), + + /** + * 10-minute Fixed Block. + * XSD value: 54 (line 3732) + */ + @XmlEnumValue("54") + FIXED_BLOCK_10_MIN(54), + + /** + * 5-minute Fixed Block. + * XSD value: 55 (line 3738) + */ + @XmlEnumValue("55") + FIXED_BLOCK_5_MIN(55), + + /** + * 1-minute Fixed Block. + * XSD value: 56 (line 3744) + */ + @XmlEnumValue("56") + FIXED_BLOCK_1_MIN(56); + + private final int value; + + TimeAttributeKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static TimeAttributeKind fromValue(int value) { + for (TimeAttributeKind kind : TimeAttributeKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid TimeAttributeKind value: " + value); + } +} \ No newline at end of file diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/UnitMultiplierKind.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/UnitMultiplierKind.java new file mode 100644 index 00000000..c672d768 --- /dev/null +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/enums/UnitMultiplierKind.java @@ -0,0 +1,145 @@ +/* + * + * 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 UnitMultiplierKind values. + * + * The power of ten unit multipliers. + * Per ESPI 4.0 espi.xsd lines 3368-3456. + */ +@XmlType(name = "UnitMultiplierKind", namespace = "http://naesb.org/espi") +@XmlEnum +public enum UnitMultiplierKind { + + /** + * Pico 10**-12. + * XSD value: -12 (line 3375) + */ + @XmlEnumValue("-12") + PICO(-12), + + /** + * Nano 10**-9. + * XSD value: -9 (line 3381) + */ + @XmlEnumValue("-9") + NANO(-9), + + /** + * Micro 10**-6. + * XSD value: -6 (line 3387) + */ + @XmlEnumValue("-6") + MICRO(-6), + + /** + * Milli 10**-3. + * XSD value: -3 (line 3393) + */ + @XmlEnumValue("-3") + MILLI(-3), + + /** + * Centi 10**-2. + * XSD value: -2 (line 3399) + */ + @XmlEnumValue("-2") + CENTI(-2), + + /** + * Deci 10**-1. + * XSD value: -1 (line 3405) + */ + @XmlEnumValue("-1") + DECI(-1), + + /** + * Kilo 10**3. + * XSD value: 3 (line 3411) + */ + @XmlEnumValue("3") + KILO(3), + + /** + * Mega 10**6. + * XSD value: 6 (line 3417) + */ + @XmlEnumValue("6") + MEGA(6), + + /** + * Giga 10**9. + * XSD value: 9 (line 3423) + */ + @XmlEnumValue("9") + GIGA(9), + + /** + * Tera 10**12. + * XSD value: 12 (line 3429) + */ + @XmlEnumValue("12") + TERA(12), + + /** + * Not Applicable or "x1". + * XSD value: 0 (line 3435) + */ + @XmlEnumValue("0") + NONE(0), + + /** + * Deca 10**1. + * XSD value: 1 (line 3441) + */ + @XmlEnumValue("1") + DECA(1), + + /** + * Hecto 10**2. + * XSD value: 2 (line 3447) + */ + @XmlEnumValue("2") + HECTO(2); + + private final int value; + + UnitMultiplierKind(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static UnitMultiplierKind fromValue(int value) { + for (UnitMultiplierKind kind : UnitMultiplierKind.values()) { + if (kind.value == value) { + return kind; + } + } + throw new IllegalArgumentException("Invalid UnitMultiplierKind value: " + value); + } +} \ No newline at end of file