Documentation ¶
Overview ¶
Package nmi delivers nmi capabilities to the aemo library.
NMI Structure ¶
The NMI is a ten (10) character identifier assigned by Local Network Service Providers (LNSPs) in accordance with this procedure. The publication of this procedure and assignment of NMIs is authorized by the National Electricity Rules at clause 7.3.1(d), (da), and (db).
The NMI may be used in conjunction with other identifiers or suffixes. These include:
• The NMI checksum, a single numeral used to assist with data validation when the NMI is manually entered into a computer system.
• The NMI data stream suffix used to identify a particular data stream associated with a connection point.
Generally the NMI is an all numeric identifier; the limited circumstances under which alpha characters may be used are listed later in this procedure.
The key attributes of the NMI are:
• The NMI must embody only numeric characters, except as explicitly provided within this document, and must not contain spaces.
• Character letters ‘O’ and ‘I’ are not permitted in order to avoid confusion with numbers 0 and 1.
• ‘W’ is a reserved character to be used as the fifth digit of the Allocated Identifier for wholesale transmission connection metering points only. It may only be used if the NMI is allocated from an alphanumeric block.
• Embedded characters or meanings should not be used in allocating NMIs.
• Where AEMO has allocated a block of NMIs to an LNSP, the LNSP must only use numeric characters in the NMIs allocated to the market unless AEMO has directed the block to be alphanumeric.
• Where AEMO has allocated a block of NMIs to an LNSP, and directed the block to be alphanumeric, the LNSP may use all-numeric or alphanumeric characters in the NMIs allocated to the market.
Network Service Providers must maintain a register of all NMIs released. AEMO maintains a Register of all ‘on-market’ NMIs within AEMO’s market systems.
The base NMI is ten characters. In some circumstances the NMI checksum is appended to the NMI to form an eleven-character NMI, or the two character NMI data stream suffix may be appended to form a twelve-character NMI. NMI checksum is not used with the data stream suffix because the data stream suffix is intended for use only with electronic data transfer.
In the initial allocation of alphanumeric NMIs the first character was a jurisdiction indicator. Jurisdiction indicators were abolished in October.
AEMO may allocate blocks of NMIs to LNSPs from any unused range.
The range 5 XXX XXX XXX has been reserved for use within the gas industry. To avoid the risk of confusion, AEMO has agreed not to issue NMIs commencing with 5.
The range 9 XXX XXX XXX has been reserved as a “break-out” if it becomes necessary to move to an 11 character NMI.
Index ¶
- Constants
- Variables
- func Checksum(s string) int
- type Allocations
- type DLFC
- type Energy
- type Meter
- type MeterRegister
- type Meters
- type Nmi
- func (n *Nmi) AddMeter(m *Meter) error
- func (n *Nmi) AllMeters() ([]*Meter, error)
- func (n *Nmi) Checksum() int
- func (n *Nmi) ChecksumValid(i int) bool
- func (n *Nmi) GoString() string
- func (n *Nmi) Participant() (Participant, error)
- func (n *Nmi) Region() (region.Region, error)
- func (n *Nmi) RemoveMeter(m *Meter) error
- func (n *Nmi) String() string
- func (n *Nmi) Valid() bool
- func (n *Nmi) Validate() error
- type Participant
- func (p Participant) Allocations() Allocations
- func (p Participant) Energy() Energy
- func (p Participant) GoString() string
- func (p Participant) Info() (*ParticipantInfo, error)
- func (p Participant) LongName() string
- func (p Participant) ParticipantID() string
- func (p Participant) Region() region.Region
- func (p Participant) ShortName() string
- func (p Participant) String() string
- func (p Participant) Valid() bool
- type ParticipantInfo
- type Pattern
- type Role
- type TNI
Constants ¶
const ( // NMICHECKSUMINVALID is returned when a valid checksum cannot be determined. NMICHECKSUMINVALID = -1 // NmiLength is the standard length of a Nmi. NmiLength = 10 // NmiValidPattern the pattern for valid Nmis. NmiValidPattern = `^([A-HJ-NP-Z\d]{10})` )
Variables ¶
var ( // EnergyName maps Energy to strings. EnergyName = map[Energy]string{ EnergyUndefined: "UNDEFINED", EnergyElectricity: "ELECTRICITY", EnergyGas: "GAS", } // EnergyValue maps strings to Energy. EnergyValue = map[string]Energy{ "UNDEFINED": EnergyUndefined, "ELECTRICITY": EnergyElectricity, "GAS": EnergyGas, } )
var ( // ErrIsDuplicated if is duplicated. ErrIsDuplicated = errors.New("is duplicated") // ErrIsInvalid if is invalid. ErrIsInvalid = errors.New("is invalid") // ErrIsMissing if is missing. ErrIsMissing = errors.New("is missing") // ErrIsNil if is nil. ErrIsNil = errors.New("is nil") // ErrParseFailed if parse has failed. ErrParseFailed = errors.New("parse has failed") // ErrEnergyInvalid if energy is invalid. ErrEnergyInvalid = fmt.Errorf("energy %w", ErrIsInvalid) // ErrNmiInvalid if nmi is invalid. ErrNmiInvalid = fmt.Errorf("nmi %w", ErrIsInvalid) // ErrNmiInvalidChar if nmi has invalid character. ErrNmiInvalidChar = fmt.Errorf("nmi has character that %w", ErrIsInvalid) // ErrNmiInvalidLength if nmi has invalid length. ErrNmiInvalidLength = fmt.Errorf("nmi length %w", ErrIsInvalid) // ErrMeterNil if meter is nil. ErrMeterNil = fmt.Errorf("meter %w", ErrIsNil) // ErrNmiMeterFound if nmi meter is found. ErrNmiMeterFound = errors.New("nmi meter is found") // ErrNmiMeterNotFound if nmi meter is not found. ErrNmiMeterNotFound = fmt.Errorf("nmi meter is not found") // ErrNmiMeterIdentifierEmpty if nmi meter identifier is empty. ErrNmiMeterIdentifierEmpty = fmt.Errorf("nmi meter identifier %w", ErrIsMissing) // ErrNmiNil if nmi is nil. ErrNmiNil = fmt.Errorf("nmi %w", ErrIsNil) // ErrNmiParticipantNotFound if nmi participant is not found. ErrNmiParticipantNotFound = fmt.Errorf("nmi participant is not found") // ErrParticipantInvalid if participant is invalid. ErrParticipantInvalid = fmt.Errorf("participant %w", ErrIsInvalid) // ErrPatternInvalid if pattern is invalid. ErrPatternInvalid = fmt.Errorf("pattern %w", ErrIsInvalid) // ErrRegionInvalid if region is invalid. ErrRegionInvalid = fmt.Errorf("region %w", ErrIsInvalid) )
var ( // ParticipantName maps Participants to strings. ParticipantName = map[Participant]string{ ParticipantUndefined: "UNDEFINED", ParticipantACTEWP: "ACTEWP", ParticipantAEMORESERVED: "AEMORESERVED", ParticipantAURORAP: "AURORAP", ParticipantCITIPP: "CITIPP", ParticipantCNRGYP: "CNRGYP", ParticipantEASTERN: "EASTERN", ParticipantENERGEXP: "ENERGEXP", ParticipantENERGYAP: "ENERGYAP", ParticipantERGONETP: "ERGONETP", ParticipantETSATP: "ETSATP", ParticipantEXEMPTNETWORKS: "EXEMPTNETWORKS", ParticipantFEDAIRPORTS: "FEDAIRPORTS", ParticipantGASNSW: "GASNSW", ParticipantGASQLD: "GASQLD", ParticipantGASSA: "GASSA", ParticipantGASTAS: "GASTAS", ParticipantGASVIC: "GASVIC", ParticipantGASWA: "GASWA", ParticipantGPUPP: "GPUPP", ParticipantHORIZONPOWER: "HORIZONPOWER", ParticipantINTEGP: "INTEGP", ParticipantNTRESERVED: "NTRESERVED", ParticipantPLINKP: "PLINKP", ParticipantPOWCP: "POWCP", ParticipantSNOWY: "SNOWY", ParticipantSOLARISP: "SOLARISP", ParticipantTRANSEND: "TRANSEND", ParticipantTRANSGP: "TRANSGP", ParticipantUMPLP: "UMPLP", ParticipantUNITED: "UNITED", ParticipantWESTERNPOWER: "WESTERNPOWER", } // ParticipantValue maps strings to Participants. ParticipantValue = map[string]Participant{ "UNDEFINED": ParticipantUndefined, "ACTEWP": ParticipantACTEWP, "AEMORESERVED": ParticipantAEMORESERVED, "AURORAP": ParticipantAURORAP, "CITIPP": ParticipantCITIPP, "CNRGYP": ParticipantCNRGYP, "EASTERN": ParticipantEASTERN, "ENERGEXP": ParticipantENERGEXP, "ENERGYAP": ParticipantENERGYAP, "ERGONETP": ParticipantERGONETP, "ETSATP": ParticipantETSATP, "EXEMPTNETWORKS": ParticipantEXEMPTNETWORKS, "FEDAIRPORTS": ParticipantFEDAIRPORTS, "GASNSW": ParticipantGASNSW, "GASQLD": ParticipantGASQLD, "GASSA": ParticipantGASSA, "GASTAS": ParticipantGASTAS, "GASVIC": ParticipantGASVIC, "GASWA": ParticipantGASWA, "GPUPP": ParticipantGPUPP, "HORIZONPOWER": ParticipantHORIZONPOWER, "INTEGP": ParticipantINTEGP, "NTRESERVED": ParticipantNTRESERVED, "PLINKP": ParticipantPLINKP, "POWCP": ParticipantPOWCP, "SNOWY": ParticipantSNOWY, "SOLARISP": ParticipantSOLARISP, "TRANSEND": ParticipantTRANSEND, "TRANSGP": ParticipantTRANSGP, "UMPLP": ParticipantUMPLP, "UNITED": ParticipantUNITED, "WESTERNPOWER": ParticipantWESTERNPOWER, } // ParticipantIDs lists all participant ids. ParticipantIDs = []string{ "UNDEFINED", "ACTEWP", "AEMORESERVED", "AURORAP", "CITIPP", "CNRGYP", "EASTERN", "ENERGEXP", "ENERGYAP", "ERGONETP", "ETSATP", "EXEMPTNETWORKS", "FEDAIRPORTS", "GASNSW", "GASQLD", "GASSA", "GASTAS", "GASVIC", "GASWA", "GPUPP", "HORIZONPOWER", "INTEGP", "NTRESERVED", "PLINKP", "POWCP", "SNOWY", "SOLARISP", "TRANSEND", "TRANSGP", "UMPLP", "UNITED", "WESTERNPOWER", } )
var ( // NmiValidRegexp is the regular expression that Nmi strings may contain. NmiValidRegexp = regexp.MustCompile(NmiValidPattern) )
Functions ¶
Types ¶
type Energy ¶
type Energy int32
Energy represents the type of energy for a nmi.
type Meter ¶
type Meter struct { Nmi string `json:"nmi,omitempty"` Identifier string `json:"identifier,omitempty"` Registers []*MeterRegister `json:"registers,omitempty"` SerialNumber *string `json:"serialNumber,omitempty"` FromDateTime *time.Time `json:"fromDateTime,omitempty"` ToDateTime *time.Time `json:"toDateTime,omitempty"` LastTestDate *time.Time `json:"lastTestDate,omitempty"` AdditionalSiteInfo *string `json:"additionalSiteInformation,omitempty"` }
Meter for a NMI.
type MeterRegister ¶
type MeterRegister struct { RegisterID string `json:"registerID,omitempty"` MeasurementStream string `json:"measurementStream,omitempty"` NetworkTariffCode string `json:"networkTariffCode,omitempty"` UnitOfMeasure string `json:"unitOfMeasure,omitempty"` TimeOfDay string `json:"timeOfDay,omitempty"` Multiplier int `json:"multiplier,omitempty"` DialFormat string `json:"dialFormat,omitempty"` ControlledLoad bool `json:"controlledLoad,omitempty"` ConsumptionType string `json:"consumptionType,omitempty"` Status string `json:"status,omitempty"` }
MeterRegister for a Meter for a NMI.
func (*MeterRegister) GoString ¶
func (mr *MeterRegister) GoString() string
GoString meets the gostring interface.
func (*MeterRegister) String ¶
func (mr *MeterRegister) String() string
String meets the stringer interface.
type Nmi ¶
type Nmi struct { Identifier string `json:"identifier,omitempty"` MSATSDetail string `json:"msatsDetail,omitempty"` TransmissionNodeIdentifier TNI `json:"tni,omitempty"` DistributionLossFactorCode DLFC `json:"dlfc,omitempty"` CustomerClassificationCode string `json:"customerClassificationCode,omitempty"` CustomerThresholdCode string `json:"customerThresholdCode,omitempty"` JurisdictionCode string `json:"jurisdictionCode,omitempty"` ClassificationCode string `json:"classificationCode,omitempty"` Meters Meters `json:"meters,omitempty"` DataStreams string `json:"datastreams,omitempty"` }
Nmi is a national meter identifier as per AEMO. Ref: - https://aemo.com.au/-/media/files/electricity/nem/retail_and_metering/metering-procedures/2016/0610-0008-pdf.pdf
func (*Nmi) ChecksumValid ¶
ChecksumValid returns true if the provided checksum is valid.
func (*Nmi) Participant ¶
func (n *Nmi) Participant() (Participant, error)
Participant returns the pariticipant for the Nmi.
func (*Nmi) RemoveMeter ¶
RemoveMeter removes a meter, returning an error if not in the list.
type Participant ¶
type Participant int32
Participant is an index for the participant.
const ( // ParticipantUndefined when participant is undefined. ParticipantUndefined Participant = iota // ParticipantACTEWP for the participant code ACTEWP. ParticipantACTEWP // ParticipantAEMORESERVED for the participant code AEMORESERVED. ParticipantAEMORESERVED // ParticipantAURORAP for the participant code AURORAP. ParticipantAURORAP // ParticipantCITIPP for the participant code CITIPP. ParticipantCITIPP // ParticipantCNRGYP for the participant code CNRGYP. ParticipantCNRGYP // ParticipantEASTERN for the participant code EASTERN. ParticipantEASTERN // ParticipantENERGEXP for the participant code ENERGEXP. ParticipantENERGEXP // ParticipantENERGYAP for the participant code ENERGYAP. ParticipantENERGYAP // ParticipantERGONETP for the participant code ERGONETP. ParticipantERGONETP // ParticipantETSATP for the participant code ETSATP. ParticipantETSATP // ParticipantEXEMPTNETWORKS for the participant code EXEMPTNETWORKS. ParticipantEXEMPTNETWORKS // ParticipantFEDAIRPORTS for the participant code FEDAIRPORTS. ParticipantFEDAIRPORTS // ParticipantGASNSW for the participant code GASNSW. ParticipantGASNSW // ParticipantGASQLD for the participant code GASQLD. ParticipantGASQLD // ParticipantGASSA for the participant code GASSA. ParticipantGASSA // ParticipantGASTAS for the participant code GASTAS. ParticipantGASTAS // ParticipantGASVIC for the participant code GASVIC. ParticipantGASVIC // ParticipantGASWA for the participant code GASWA. ParticipantGASWA // ParticipantGPUPP for the participant code GPUPP. ParticipantGPUPP // ParticipantHORIZONPOWER for the participant code HORIZONPOWER. ParticipantHORIZONPOWER // ParticipantINTEGP for the participant code INTEGP. ParticipantINTEGP // ParticipantNTRESERVED for the participant code NTRESERVED. ParticipantNTRESERVED // ParticipantPLINKP for the participant code PLINKP. ParticipantPLINKP // ParticipantPOWCP for the participant code POWCP. ParticipantPOWCP // ParticipantSNOWY for the participant code SNOWY. ParticipantSNOWY // ParticipantSOLARISP for the participant code SOLARISP. ParticipantSOLARISP // ParticipantTRANSEND for the participant code TRANSEND. ParticipantTRANSEND // ParticipantTRANSGP for the participant code TRANSGP. ParticipantTRANSGP // ParticipantUMPLP for the participant code UMPLP. ParticipantUMPLP // ParticipantUNITED for the participant code UNITED. ParticipantUNITED // ParticipantWESTERNPOWER for the participant code WESTERNPOWER. ParticipantWESTERNPOWER )
func NewParticipant ¶
func NewParticipant(s string) (Participant, error)
NewParticipant returns a participant for a string (AEMO Participant ID).
func ParticipantsForRegion ¶
func ParticipantsForRegion(r region.Region) []Participant
ParticipantsForRegion returns the pariticipants that operate in a region.
func (Participant) Allocations ¶
func (p Participant) Allocations() Allocations
Allocations returns the participant's allocations.
func (Participant) Energy ¶
func (p Participant) Energy() Energy
Energy returns the energy type of the participant's allocations.
func (Participant) GoString ¶
func (p Participant) GoString() string
GoString meets the gostring interface.
func (Participant) Info ¶
func (p Participant) Info() (*ParticipantInfo, error)
Info struct for a participant.
func (Participant) LongName ¶
func (p Participant) LongName() string
LongName returns the long (full) name of the participant.
func (Participant) ParticipantID ¶
func (p Participant) ParticipantID() string
ParticipantID returns the Participant ID.
func (Participant) Region ¶
func (p Participant) Region() region.Region
Region returns the Participant's Region.
func (Participant) ShortName ¶
func (p Participant) ShortName() string
ShortName returns the short (useful) name of the participant.
func (Participant) String ¶
func (p Participant) String() string
String meets the stringer interface.
func (Participant) Valid ¶
func (p Participant) Valid() bool
Valid returns true if a valid participant.
type ParticipantInfo ¶
type ParticipantInfo struct { Participant Participant `json:"participant"` ParticipantID string `json:"participantID"` Region region.Region `json:"region"` LongName string `json:"longName"` ShortName string `json:"shortName"` Energy Energy `json:"energy"` Allocations Allocations `json:"allocations"` }
ParticipantInfo provides structure for participant information.
type Pattern ¶
type Pattern string
Pattern for making regexes nicer with pattern matching.
func NewPattern ¶
NewPattern validates a new pattern, return invalid pattern if required.