Skip to content

Commit 544ce1f

Browse files
dfcoffinclaude
andauthored
feat(phase-0.3): Generate usage domain enums batch 2 (#107)
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 <noreply@anthropic.com>
1 parent 33f5d4f commit 544ce1f

4 files changed

Lines changed: 711 additions & 0 deletions

File tree

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
/*
2+
*
3+
* Copyright (c) 2025 Green Button Alliance, Inc.
4+
*
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*/
19+
20+
package org.greenbuttonalliance.espi.common.domain.usage.enums;
21+
22+
import jakarta.xml.bind.annotation.XmlEnum;
23+
import jakarta.xml.bind.annotation.XmlEnumValue;
24+
import jakarta.xml.bind.annotation.XmlType;
25+
26+
/**
27+
* Enumeration for PhaseCodeKind values.
28+
*
29+
* Enumeration of phase identifiers. Allows designation of phases for both transmission and
30+
* distribution equipment, circuits and loads. Residential and small commercial loads are often
31+
* served from single-phase, or split-phase, secondary circuits. Phases 1 and 2 refer to hot
32+
* wires that are 180 degrees out of phase, while N refers to the neutral wire. Through
33+
* single-phase transformer connections, these secondary circuits may be served from one or
34+
* two of the primary phases A, B, and C. For three-phase loads, use the A, B, C phase codes
35+
* instead of s12N.
36+
* Per ESPI 4.0 espi.xsd lines 3195-3339.
37+
*/
38+
@XmlType(name = "PhaseCodeKind", namespace = "http://naesb.org/espi")
39+
@XmlEnum
40+
public enum PhaseCodeKind {
41+
42+
/**
43+
* ABC to Neutral.
44+
* XSD value: 225 (line 3202)
45+
*/
46+
@XmlEnumValue("225")
47+
ABCN(225),
48+
49+
/**
50+
* Involving all phases.
51+
* XSD value: 224 (line 3208)
52+
*/
53+
@XmlEnumValue("224")
54+
ABC(224),
55+
56+
/**
57+
* AB to Neutral.
58+
* XSD value: 193 (line 3214)
59+
*/
60+
@XmlEnumValue("193")
61+
ABN(193),
62+
63+
/**
64+
* Phases A, C and neutral.
65+
* XSD value: 41 (line 3220)
66+
*/
67+
@XmlEnumValue("41")
68+
ACN(41),
69+
70+
/**
71+
* BC to neutral.
72+
* XSD value: 97 (line 3226)
73+
*/
74+
@XmlEnumValue("97")
75+
BCN(97),
76+
77+
/**
78+
* Phases A to B.
79+
* XSD value: 132 (line 3232)
80+
*/
81+
@XmlEnumValue("132")
82+
AB(132),
83+
84+
/**
85+
* Phases A and C.
86+
* XSD value: 96 (line 3238)
87+
*/
88+
@XmlEnumValue("96")
89+
AC(96),
90+
91+
/**
92+
* Phases B to C.
93+
* XSD value: 66 (line 3244)
94+
*/
95+
@XmlEnumValue("66")
96+
BC(66),
97+
98+
/**
99+
* Phases A to neutral.
100+
* XSD value: 129 (line 3250)
101+
*/
102+
@XmlEnumValue("129")
103+
AN(129),
104+
105+
/**
106+
* Phases B to neutral.
107+
* XSD value: 65 (line 3256)
108+
*/
109+
@XmlEnumValue("65")
110+
BN(65),
111+
112+
/**
113+
* Phases C to neutral.
114+
* XSD value: 33 (line 3262)
115+
*/
116+
@XmlEnumValue("33")
117+
CN(33),
118+
119+
/**
120+
* Phase A.
121+
* XSD value: 128 (line 3268)
122+
*/
123+
@XmlEnumValue("128")
124+
A(128),
125+
126+
/**
127+
* Phase B.
128+
* XSD value: 64 (line 3274)
129+
*/
130+
@XmlEnumValue("64")
131+
B(64),
132+
133+
/**
134+
* Phase C.
135+
* XSD value: 32 (line 3280)
136+
*/
137+
@XmlEnumValue("32")
138+
C(32),
139+
140+
/**
141+
* Neutral.
142+
* XSD value: 16 (line 3286)
143+
*/
144+
@XmlEnumValue("16")
145+
N(16),
146+
147+
/**
148+
* Phase S2 to neutral.
149+
* XSD value: 272 (line 3292)
150+
*/
151+
@XmlEnumValue("272")
152+
S2N(272),
153+
154+
/**
155+
* Phase S1, S2 to neutral.
156+
* XSD value: 784 (line 3298)
157+
*/
158+
@XmlEnumValue("784")
159+
S12N_784(784),
160+
161+
/**
162+
* Phase S1 to Neutral.
163+
* XSD value: 528 (line 3304)
164+
*/
165+
@XmlEnumValue("528")
166+
S1N(528),
167+
168+
/**
169+
* Phase S2.
170+
* XSD value: 256 (line 3310)
171+
*/
172+
@XmlEnumValue("256")
173+
S2(256),
174+
175+
/**
176+
* Phase S1 to S2.
177+
* XSD value: 768 (line 3316)
178+
*/
179+
@XmlEnumValue("768")
180+
S12(768),
181+
182+
/**
183+
* Phase S1, S2 to N.
184+
* XSD value: 769 (line 3322)
185+
*/
186+
@XmlEnumValue("769")
187+
S12N_769(769),
188+
189+
/**
190+
* Not applicable to any phase.
191+
* XSD value: 0 (line 3328)
192+
*/
193+
@XmlEnumValue("0")
194+
NONE(0),
195+
196+
/**
197+
* Phase A current relative to Phase A voltage.
198+
* XSD value: 136 (line 3334)
199+
*/
200+
@XmlEnumValue("136")
201+
A_TO_AV(136);
202+
203+
private final int value;
204+
205+
PhaseCodeKind(int value) {
206+
this.value = value;
207+
}
208+
209+
public int getValue() {
210+
return value;
211+
}
212+
213+
public static PhaseCodeKind fromValue(int value) {
214+
for (PhaseCodeKind kind : PhaseCodeKind.values()) {
215+
if (kind.value == value) {
216+
return kind;
217+
}
218+
}
219+
throw new IllegalArgumentException("Invalid PhaseCodeKind value: " + value);
220+
}
221+
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
*
3+
* Copyright (c) 2025 Green Button Alliance, Inc.
4+
*
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*/
19+
20+
package org.greenbuttonalliance.espi.common.domain.usage.enums;
21+
22+
import jakarta.xml.bind.annotation.XmlEnum;
23+
import jakarta.xml.bind.annotation.XmlEnumValue;
24+
import jakarta.xml.bind.annotation.XmlType;
25+
26+
/**
27+
* Enumeration for QualityOfReading values.
28+
*
29+
* List of codes indicating the quality of the reading.
30+
* Per ESPI 4.0 espi.xsd lines 3457-3540.
31+
*/
32+
@XmlType(name = "QualityOfReading", namespace = "http://naesb.org/espi")
33+
@XmlEnum
34+
public enum QualityOfReading {
35+
36+
/**
37+
* Data that has gone through all required validation checks and either passed them all
38+
* or has been verified.
39+
* XSD value: 0 (line 3464)
40+
*/
41+
@XmlEnumValue("0")
42+
VALID(0),
43+
44+
/**
45+
* Replaced or approved by a human.
46+
* XSD value: 7 (line 3470)
47+
*/
48+
@XmlEnumValue("7")
49+
MANUALLY_EDITED(7),
50+
51+
/**
52+
* Data value was replaced by a machine computed value based on analysis of historical
53+
* data using the same type of measurement.
54+
* XSD value: 8 (line 3476)
55+
*/
56+
@XmlEnumValue("8")
57+
ESTIMATED_USING_REFERENCE_DAY(8),
58+
59+
/**
60+
* Data value was computed using linear interpolation based on the readings before and
61+
* after it.
62+
* XSD value: 9 (line 3482)
63+
*/
64+
@XmlEnumValue("9")
65+
ESTIMATED_USING_LINEAR_INTERPOLATION(9),
66+
67+
/**
68+
* Data that has failed one or more checks.
69+
* XSD value: 10 (line 3488)
70+
*/
71+
@XmlEnumValue("10")
72+
QUESTIONABLE(10),
73+
74+
/**
75+
* Data that has been calculated (using logic or mathematical operations).
76+
* XSD value: 11 (line 3494)
77+
*/
78+
@XmlEnumValue("11")
79+
DERIVED(11),
80+
81+
/**
82+
* Data that has been calculated as a projection or forecast of future readings.
83+
* XSD value: 12 (line 3500)
84+
*/
85+
@XmlEnumValue("12")
86+
PROJECTED_FORECAST(12),
87+
88+
/**
89+
* Indicates that the quality of this reading has mixed characteristics.
90+
* XSD value: 13 (line 3506)
91+
*/
92+
@XmlEnumValue("13")
93+
MIXED(13),
94+
95+
/**
96+
* Data that has not gone through the validation.
97+
* XSD value: 14 (line 3512)
98+
*/
99+
@XmlEnumValue("14")
100+
RAW(14),
101+
102+
/**
103+
* The values have been adjusted to account for weather.
104+
* XSD value: 15 (line 3518)
105+
*/
106+
@XmlEnumValue("15")
107+
NORMALIZED_FOR_WEATHER(15),
108+
109+
/**
110+
* Specifies that a characteristic applies other than those defined.
111+
* XSD value: 16 (line 3524)
112+
*/
113+
@XmlEnumValue("16")
114+
OTHER(16),
115+
116+
/**
117+
* Data that has been validated and possibly edited and/or estimated in accordance with
118+
* approved procedures.
119+
* XSD value: 17 (line 3530)
120+
*/
121+
@XmlEnumValue("17")
122+
VALIDATED(17),
123+
124+
/**
125+
* Data that failed at least one of the required validation checks but was determined to
126+
* represent actual usage.
127+
* XSD value: 18 (line 3536)
128+
*/
129+
@XmlEnumValue("18")
130+
VERIFIED(18);
131+
132+
private final int value;
133+
134+
QualityOfReading(int value) {
135+
this.value = value;
136+
}
137+
138+
public int getValue() {
139+
return value;
140+
}
141+
142+
public static QualityOfReading fromValue(int value) {
143+
for (QualityOfReading quality : QualityOfReading.values()) {
144+
if (quality.value == value) {
145+
return quality;
146+
}
147+
}
148+
throw new IllegalArgumentException("Invalid QualityOfReading value: " + value);
149+
}
150+
}

0 commit comments

Comments
 (0)