Skip to content

Commit f2361a9

Browse files
dfcoffinclaude
andauthored
feat: ESPI 4.0 Schema Compliance - Phase 12: ElectricPowerQualitySummary (#79)
Aligned ElectricPowerQualitySummaryEntity field order with ESPI 4.0 XSD schema specification (espi.xsd). Moved summaryInterval field to correct position between shortInterruptions and supplyVoltageDips to match schema sequence. Changes: - ElectricPowerQualitySummaryEntity: Reordered summaryInterval field to match XSD element sequence (lines 121-139) - V3__Create_additiional_Base_Tables.sql: Updated table column order to match XSD schema (summary_interval columns now between short_interruptions and supply_voltage_dips) Validation: - ElectricPowerQualitySummaryDto already compliant with XSD propOrder - ElectricPowerQualitySummaryMapper uses default MapStruct field mapping - All repository queries preserved for test usage - All 533 tests passing (unit + integration with H2, MySQL, PostgreSQL) Schema Element Order (ESPI 4.0 espi.xsd): 1. flickerPlt 2. flickerPst 3. harmonicVoltage 4. longInterruptions 5. mainsVoltage 6. measurementProtocol 7. powerFrequency 8. rapidVoltageChanges 9. shortInterruptions 10. summaryInterval (DateTimeInterval - REQUIRED) 11. supplyVoltageDips 12. supplyVoltageImbalance 13. supplyVoltageVariations 14. tempOvervoltage References: - ESPI 4.0 XSD: espi.xsd ElectricPowerQualitySummary complexType - Phase plan: Issue #28 Phase 12 - Related: Phase 11 (UsageSummary) Co-authored-by: Claude Sonnet 4.5 <[email protected]>
1 parent 1a4b309 commit f2361a9

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/ElectricPowerQualitySummaryEntity.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ public class ElectricPowerQualitySummaryEntity extends IdentifiedObject {
113113
@Column(name = "short_interruptions")
114114
private Long shortInterruptions;
115115

116+
/**
117+
* Summary interval for this power quality summary.
118+
* Time period covered by these measurements.
119+
*/
120+
@Embedded
121+
@AttributeOverrides({
122+
@AttributeOverride(name = "start", column = @Column(name = "summary_interval_start")),
123+
@AttributeOverride(name = "duration", column = @Column(name = "summary_interval_duration"))
124+
})
125+
private DateTimeInterval summaryInterval;
126+
116127
/**
117128
* Number of supply voltage dips during the summary period.
118129
* Temporary reductions in RMS voltage.
@@ -142,17 +153,6 @@ public class ElectricPowerQualitySummaryEntity extends IdentifiedObject {
142153
@Column(name = "temp_overvoltage")
143154
private Long tempOvervoltage;
144155

145-
/**
146-
* Summary interval for this power quality summary.
147-
* Time period covered by these measurements.
148-
*/
149-
@Embedded
150-
@AttributeOverrides({
151-
@AttributeOverride(name = "start", column = @Column(name = "summary_interval_start")),
152-
@AttributeOverride(name = "duration", column = @Column(name = "summary_interval_duration"))
153-
})
154-
private DateTimeInterval summaryInterval;
155-
156156
/**
157157
* Usage point that this power quality summary belongs to.
158158
* Many summaries can belong to one usage point.

openespi-common/src/main/resources/db/migration/V3__Create_additiional_Base_Tables.sql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,16 @@ CREATE TABLE electric_power_quality_summaries
340340
power_frequency BIGINT,
341341
rapid_voltage_changes BIGINT,
342342
short_interruptions BIGINT,
343-
supply_voltage_dips BIGINT,
344-
supply_voltage_imbalance BIGINT,
345-
supply_voltage_variations BIGINT,
346-
temp_overvoltage BIGINT,
347343

348344
-- Embedded DateTimeInterval: summaryInterval
349345
summary_interval_start BIGINT,
350346
summary_interval_duration BIGINT,
351347

348+
supply_voltage_dips BIGINT,
349+
supply_voltage_imbalance BIGINT,
350+
supply_voltage_variations BIGINT,
351+
temp_overvoltage BIGINT,
352+
352353
-- Foreign key relationships
353354
usage_point_id CHAR(36),
354355

0 commit comments

Comments
 (0)