nem12

package
v0.0.0-...-66d665b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidReadingType

func IsValidReadingType(val string) bool

Types

type B2bDetailsRecord

type B2bDetailsRecord struct {
	TransCode       string
	RetServiceOrder string
	ReadDataTime    time.Time
	IndexRead       string
}

B2B details record (500)

type HeaderRecord

type HeaderRecord struct {
	VersionHeader   string
	DateTime        time.Time
	FromParticipant string
	ToParticipant   string
}

Header record (100)

type HourlyReading

type HourlyReading struct {
	StartTime time.Time
	EndTime   time.Time
	EnergyKWh float64
	// The hourly reading can consist of multiple measurements with different quality methods and
	// reason codes/descriptions so we include them all here
	QualityMethod     []string
	ReasonCode        []int
	ReasonDescription []string
}

type IntervalDataRecord

type IntervalDataRecord struct {
	IntervalDate      time.Time
	IntervalValues    []IntervalValue
	QualityMethod     string
	ReasonCode        *int
	ReasonDescription string
	UpdateDateTime    time.Time
	MSATSLoadDateTime time.Time
}

Interval data record (300)

type IntervalEventRecord

type IntervalEventRecord struct {
	StartInterval     int
	EndInterval       int
	QualityMethod     string
	ReasonCode        *int
	ReasonDescription string
}

Interval event record (400)

type IntervalValue

type IntervalValue struct {
	Value float64
	// A 400 record can adjust the quality method, reason code, and reason description per-value,
	// so we store those along with each value if applicable. Otherwise it's set to null.
	Quality *QualityData
}

type NMI

type NMI string

National Meter Identifier. Unique for each connection point.

type NMIDataDetailsRecord

type NMIDataDetailsRecord struct {
	NMI                     string
	NMIConfiguration        string
	RegisterID              string
	NMISuffix               string
	MDMDataStreamIdentifier string
	MeterSerialNumber       string
	UOM                     string
	IntervalLength          int
	NextScheduledReadDate   time.Time
}

NMI data details record (200)

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(logger *slog.Logger, file *os.File) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (UsageData, error)

type QualityData

type QualityData struct {
	QualityMethod     string
	ReasonCode        *int
	ReasonDescription string
}

type ReadingType

type ReadingType string

Describes the type of interval data the record applies to. Mapped from the NMI suffix.

const (
	GeneralUsage    ReadingType = "E1"
	ControlledLoad  ReadingType = "E2"
	PrimaryExport   ReadingType = "B1"
	SecondaryExport ReadingType = "B2"
)

We interpret NMI suffixes in a broad, generalised way that will be mostly correct for our purposes

type UsageData

type UsageData map[NMI]map[ReadingType][]HourlyReading

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL