From ae94e25a21695a3e713370883f6f7d6e339cbaa2 Mon Sep 17 00:00:00 2001 From: Joel Courtney Date: Mon, 19 Sep 2022 13:39:07 +1000 Subject: [PATCH] feat: add method flags to support 5 min settlement and same day churn (#9) --- .github/workflows/golangci-lint.yml | 8 +- CHANGELOG.md | 15 +- nem12/method.go | 272 ++++++++++++++++------------ 3 files changed, 172 insertions(+), 123 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index dc9441d..675bde6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -17,14 +17,18 @@ permissions: jobs: golangci: name: 'lint' - runs-on: 'ubuntu-latest' + strategy: + matrix: + go-version: ["1.17.x"] # linting in 1 go version is enough + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} steps: - uses: 'actions/checkout@v2' - name: 'golangci-lint' uses: 'golangci/golangci-lint-action@v2' with: # Optional: 'version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version' - version: 'v1.44' + version: 'v1.43' # Optional: 'working directory, useful for monorepos' # working-directory: 'somedir' diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f8d768..ba5e3cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,24 @@ # go-aemo changelog +## [v0.2.0] (2022-09-20) + +### Added + +* New method flags: + + | Type | `EST` and/or `SUB` | Descriptor | + | --- | --- | --- | + | Type 20 | `SUB` | Churn Correction (Like Day) | + | Type 21 | `SUB` | Five-minute No Historical Data | + | Type 59 | `SUB`, `EST` | Five-minute No Historical Data | + | Type 69 | `SUB` | Linear extrapolation | + ## [v0.1.1] (2022-02-04) ### Fixed * `MDMDataStreamIdentifier` field updated due to variation by AEMO in their documenation - (Ref: ) + (Ref: ) (#4). ### Changed diff --git a/nem12/method.go b/nem12/method.go index d0789db..9a480d7 100644 --- a/nem12/method.go +++ b/nem12/method.go @@ -25,6 +25,10 @@ const ( Method18Alternate = Method(18) // Method19Zero for zero. Method19Zero = Method(19) + // Method20ChurnCorrection for churn correction (like day). + Method20ChurnCorrection = Method(20) + // Method21FiveMinuteNoHistoricalData for five-minute no historical data. + Method21FiveMinuteNoHistoricalData = Method(21) // Method51PreviousYear for previous year. Method51PreviousYear = Method(51) // Method52PreviousRead for previous read. @@ -41,6 +45,8 @@ const ( Method57CustomerClass = Method(57) // Method58Zero for zero. Method58Zero = Method(58) + // Method59FiveMinuteNoHistoricalData for five-minute no historical data. + Method59FiveMinuteNoHistoricalData = Method(59) // Method61PreviousYear for previous year. Method61PreviousYear = Method(61) // Method62PreviousRead for previous read. @@ -57,6 +63,8 @@ const ( Method67CustomerRead = Method(67) // Method68Zero for zero. Method68Zero = Method(68) + // Method69LinearExtrapolation for linear extrapolation. + MetMethod69LinearExtrapolation = Method(69) // Method71Recalculation for recalculation. Method71Recalculation = Method(71) // Method72RevisedTable for revised table. @@ -81,6 +89,8 @@ var ( Method17Linear, Method18Alternate, Method19Zero, + Method20ChurnCorrection, + Method21FiveMinuteNoHistoricalData, Method51PreviousYear, Method52PreviousRead, Method53Revision, @@ -89,6 +99,7 @@ var ( Method56PriortoFirstReadAgreed, Method57CustomerClass, Method58Zero, + Method59FiveMinuteNoHistoricalData, Method61PreviousYear, Method62PreviousRead, Method63CustomerClass, @@ -97,6 +108,7 @@ var ( Method66Revision, Method67CustomerRead, Method68Zero, + MetMethod69LinearExtrapolation, Method71Recalculation, Method72RevisedTable, Method73RevisedAlgorithm, @@ -106,36 +118,40 @@ var ( // MethodName maps a method to its string equivalent. MethodName = map[Method]string{ //nolint:gochecknoglobals - Method11Check: "11", - Method12Calculated: "12", - Method13SCADA: "13", - Method14LikeDay: "14", - Method15AverageLikeDay: "15", - Method16Agreed: "16", - Method17Linear: "17", - Method18Alternate: "18", - Method19Zero: "19", - Method51PreviousYear: "51", - Method52PreviousRead: "52", - Method53Revision: "53", - Method54Linear: "54", - Method55Agreed: "55", - Method56PriortoFirstReadAgreed: "56", - Method57CustomerClass: "57", - Method58Zero: "58", - Method61PreviousYear: "61", - Method62PreviousRead: "62", - Method63CustomerClass: "63", - Method64Agreed: "64", - Method65ADL: "65", - Method66Revision: "66", - Method67CustomerRead: "67", - Method68Zero: "68", - Method71Recalculation: "71", - Method72RevisedTable: "72", - Method73RevisedAlgorithm: "73", - Method74Agreed: "74", - Method75ExistingTable: "75", + Method11Check: "11", + Method12Calculated: "12", + Method13SCADA: "13", + Method14LikeDay: "14", + Method15AverageLikeDay: "15", + Method16Agreed: "16", + Method17Linear: "17", + Method18Alternate: "18", + Method19Zero: "19", + Method20ChurnCorrection: "20", + Method21FiveMinuteNoHistoricalData: "21", + Method51PreviousYear: "51", + Method52PreviousRead: "52", + Method53Revision: "53", + Method54Linear: "54", + Method55Agreed: "55", + Method56PriortoFirstReadAgreed: "56", + Method57CustomerClass: "57", + Method58Zero: "58", + Method59FiveMinuteNoHistoricalData: "59", + Method61PreviousYear: "61", + Method62PreviousRead: "62", + Method63CustomerClass: "63", + Method64Agreed: "64", + Method65ADL: "65", + Method66Revision: "66", + Method67CustomerRead: "67", + Method68Zero: "68", + MetMethod69LinearExtrapolation: "69", + Method71Recalculation: "71", + Method72RevisedTable: "72", + Method73RevisedAlgorithm: "73", + Method74Agreed: "74", + Method75ExistingTable: "75", } // MethodValue maps a method from its string equivalent. @@ -149,6 +165,8 @@ var ( "17": Method17Linear, "18": Method18Alternate, "19": Method19Zero, + "20": Method20ChurnCorrection, + "21": Method21FiveMinuteNoHistoricalData, "51": Method51PreviousYear, "52": Method52PreviousRead, "53": Method53Revision, @@ -157,6 +175,7 @@ var ( "56": Method56PriortoFirstReadAgreed, "57": Method57CustomerClass, "58": Method58Zero, + "59": Method59FiveMinuteNoHistoricalData, "61": Method61PreviousYear, "62": Method62PreviousRead, "63": Method63CustomerClass, @@ -165,6 +184,7 @@ var ( "66": Method66Revision, "67": Method67CustomerRead, "68": Method68Zero, + "69": MetMethod69LinearExtrapolation, "71": Method71Recalculation, "72": Method72RevisedTable, "73": Method73RevisedAlgorithm, @@ -174,103 +194,115 @@ var ( // methodDescriptions maps each method to its description. methodDescriptions = map[Method]string{ //nolint:gochecknoglobals - Method11Check: "check", - Method12Calculated: "calculated", - Method13SCADA: "scada", - Method14LikeDay: "like day", - Method15AverageLikeDay: "average like day", - Method16Agreed: "agreed", - Method17Linear: "linear", - Method18Alternate: "alternate", - Method19Zero: "zero", - Method51PreviousYear: "previous year", - Method52PreviousRead: "previous read", - Method53Revision: "revision", - Method54Linear: "linear", - Method55Agreed: "agreed", - Method56PriortoFirstReadAgreed: "prior to first read - agreed", - Method57CustomerClass: "customer class", - Method58Zero: "zero", - Method61PreviousYear: "previous year", - Method62PreviousRead: "previous read", - Method63CustomerClass: "customer class", - Method64Agreed: "agreed", - Method65ADL: "adl", - Method66Revision: "revision", - Method67CustomerRead: "customer read", - Method68Zero: "zero", - Method71Recalculation: "recalculation", - Method72RevisedTable: "revised table", - Method73RevisedAlgorithm: "revised algorithm", - Method74Agreed: "agreed", - Method75ExistingTable: "existing table", + Method11Check: "check", + Method12Calculated: "calculated", + Method13SCADA: "scada", + Method14LikeDay: "like day", + Method15AverageLikeDay: "average like day", + Method16Agreed: "agreed", + Method17Linear: "linear", + Method18Alternate: "alternate", + Method19Zero: "zero", + Method20ChurnCorrection: "churn correction (like day)", + Method21FiveMinuteNoHistoricalData: "five-minute no historical data", + Method51PreviousYear: "previous year", + Method52PreviousRead: "previous read", + Method53Revision: "revision", + Method54Linear: "linear", + Method55Agreed: "agreed", + Method56PriortoFirstReadAgreed: "prior to first read - agreed", + Method57CustomerClass: "customer class", + Method58Zero: "zero", + Method59FiveMinuteNoHistoricalData: "five-minute no historical data", + Method61PreviousYear: "previous year", + Method62PreviousRead: "previous read", + Method63CustomerClass: "customer class", + Method64Agreed: "agreed", + Method65ADL: "adl", + Method66Revision: "revision", + Method67CustomerRead: "customer read", + Method68Zero: "zero", + MetMethod69LinearExtrapolation: "linear extrapolation", + Method71Recalculation: "recalculation", + Method72RevisedTable: "revised table", + Method73RevisedAlgorithm: "revised algorithm", + Method74Agreed: "agreed", + Method75ExistingTable: "existing table", } // methodInstallationTypes maps each method to the installation types. methodInstallationTypes = map[Method][]Install{ //nolint:gochecknoglobals - Method11Check: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method12Calculated: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method13SCADA: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method14LikeDay: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method15AverageLikeDay: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method16Agreed: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method17Linear: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method18Alternate: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method19Zero: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, - Method51PreviousYear: {InstallMRIM}, - Method52PreviousRead: {InstallMRIM}, - Method53Revision: {InstallMRIM}, - Method54Linear: {InstallMRIM}, - Method55Agreed: {InstallMRIM}, - Method56PriortoFirstReadAgreed: {InstallMRIM}, - Method57CustomerClass: {InstallMRIM}, - Method58Zero: {InstallMRIM}, - Method61PreviousYear: {InstallBasic}, - Method62PreviousRead: {InstallBasic}, - Method63CustomerClass: {InstallBasic}, - Method64Agreed: {InstallBasic}, - Method65ADL: {InstallBasic}, - Method66Revision: {InstallBasic}, - Method67CustomerRead: {InstallBasic}, - Method68Zero: {InstallBasic}, - Method71Recalculation: {InstallUnmetered}, - Method72RevisedTable: {InstallUnmetered}, - Method73RevisedAlgorithm: {InstallUnmetered}, - Method74Agreed: {InstallUnmetered}, - Method75ExistingTable: {InstallUnmetered}, + Method11Check: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method12Calculated: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method13SCADA: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method14LikeDay: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method15AverageLikeDay: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method16Agreed: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method17Linear: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method18Alternate: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method19Zero: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method20ChurnCorrection: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method21FiveMinuteNoHistoricalData: {InstallComms1, InstallComms2, InstallComms3, InstallComms4}, + Method51PreviousYear: {InstallMRIM}, + Method52PreviousRead: {InstallMRIM}, + Method53Revision: {InstallMRIM}, + Method54Linear: {InstallMRIM}, + Method55Agreed: {InstallMRIM}, + Method56PriortoFirstReadAgreed: {InstallMRIM}, + Method57CustomerClass: {InstallMRIM}, + Method58Zero: {InstallMRIM}, + Method59FiveMinuteNoHistoricalData: {InstallMRIM}, + Method61PreviousYear: {InstallBasic}, + Method62PreviousRead: {InstallBasic}, + Method63CustomerClass: {InstallBasic}, + Method64Agreed: {InstallBasic}, + Method65ADL: {InstallBasic}, + Method66Revision: {InstallBasic}, + Method67CustomerRead: {InstallBasic}, + Method68Zero: {InstallBasic}, + MetMethod69LinearExtrapolation: {InstallBasic}, + Method71Recalculation: {InstallUnmetered}, + Method72RevisedTable: {InstallUnmetered}, + Method73RevisedAlgorithm: {InstallUnmetered}, + Method74Agreed: {InstallUnmetered}, + Method75ExistingTable: {InstallUnmetered}, } methodMethodTypes = map[Method][]MethodType{ //nolint:gochecknoglobals - Method11Check: {MethodTypeSubstituted}, - Method12Calculated: {MethodTypeSubstituted}, - Method13SCADA: {MethodTypeSubstituted}, - Method14LikeDay: {MethodTypeSubstituted}, - Method15AverageLikeDay: {MethodTypeSubstituted}, - Method16Agreed: {MethodTypeSubstituted}, - Method17Linear: {MethodTypeSubstituted}, - Method18Alternate: {MethodTypeSubstituted}, - Method19Zero: {MethodTypeSubstituted}, - Method51PreviousYear: {MethodTypeEstimated, MethodTypeSubstituted}, - Method52PreviousRead: {MethodTypeEstimated, MethodTypeSubstituted}, - Method53Revision: {MethodTypeSubstituted}, - Method54Linear: {MethodTypeSubstituted}, - Method55Agreed: {MethodTypeSubstituted}, - Method56PriortoFirstReadAgreed: {MethodTypeEstimated, MethodTypeSubstituted}, - Method57CustomerClass: {MethodTypeEstimated, MethodTypeSubstituted}, - Method58Zero: {MethodTypeEstimated, MethodTypeSubstituted}, - Method61PreviousYear: {MethodTypeEstimated, MethodTypeSubstituted}, - Method62PreviousRead: {MethodTypeEstimated, MethodTypeSubstituted}, - Method63CustomerClass: {MethodTypeEstimated, MethodTypeSubstituted}, - Method64Agreed: {MethodTypeSubstituted}, - Method65ADL: {MethodTypeEstimated}, - Method66Revision: {MethodTypeSubstituted}, - Method67CustomerRead: {MethodTypeSubstituted}, - Method68Zero: {MethodTypeEstimated, MethodTypeSubstituted}, - Method71Recalculation: {MethodTypeSubstituted}, - Method72RevisedTable: {MethodTypeSubstituted}, - Method73RevisedAlgorithm: {MethodTypeSubstituted}, - Method74Agreed: {MethodTypeSubstituted}, - Method75ExistingTable: {MethodTypeEstimated}, + Method11Check: {MethodTypeSubstituted}, + Method12Calculated: {MethodTypeSubstituted}, + Method13SCADA: {MethodTypeSubstituted}, + Method14LikeDay: {MethodTypeSubstituted}, + Method15AverageLikeDay: {MethodTypeSubstituted}, + Method16Agreed: {MethodTypeSubstituted}, + Method17Linear: {MethodTypeSubstituted}, + Method18Alternate: {MethodTypeSubstituted}, + Method19Zero: {MethodTypeSubstituted}, + Method20ChurnCorrection: {MethodTypeSubstituted}, + Method21FiveMinuteNoHistoricalData: {MethodTypeSubstituted}, + Method51PreviousYear: {MethodTypeEstimated, MethodTypeSubstituted}, + Method52PreviousRead: {MethodTypeEstimated, MethodTypeSubstituted}, + Method53Revision: {MethodTypeSubstituted}, + Method54Linear: {MethodTypeSubstituted}, + Method55Agreed: {MethodTypeSubstituted}, + Method56PriortoFirstReadAgreed: {MethodTypeEstimated, MethodTypeSubstituted}, + Method57CustomerClass: {MethodTypeEstimated, MethodTypeSubstituted}, + Method58Zero: {MethodTypeEstimated, MethodTypeSubstituted}, + Method59FiveMinuteNoHistoricalData: {MethodTypeEstimated, MethodTypeSubstituted}, + Method61PreviousYear: {MethodTypeEstimated, MethodTypeSubstituted}, + Method62PreviousRead: {MethodTypeEstimated, MethodTypeSubstituted}, + Method63CustomerClass: {MethodTypeEstimated, MethodTypeSubstituted}, + Method64Agreed: {MethodTypeSubstituted}, + Method65ADL: {MethodTypeEstimated}, + Method66Revision: {MethodTypeSubstituted}, + Method67CustomerRead: {MethodTypeSubstituted}, + Method68Zero: {MethodTypeEstimated, MethodTypeSubstituted}, + MetMethod69LinearExtrapolation: {MethodTypeSubstituted}, + Method71Recalculation: {MethodTypeSubstituted}, + Method72RevisedTable: {MethodTypeSubstituted}, + Method73RevisedAlgorithm: {MethodTypeSubstituted}, + Method74Agreed: {MethodTypeSubstituted}, + Method75ExistingTable: {MethodTypeEstimated}, } )