pvdata

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

README

PV-Data

Small GO database that fetches PV related data and makes it available via a simple HTTP interface.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooEarly    = errors.New("requested time is too early")
	ErrTooLate     = errors.New("requested time is too late")
	ErrTooFarApart = errors.New("time difference too high for interpolation")
)

Functions

This section is empty.

Types

type Forecasts

type Forecasts struct {
	Mu sync.Mutex
	// contains filtered or unexported fields
}

func NewForecasts

func NewForecasts(db *sql.DB, stationID string, interval time.Duration) *Forecasts

func (*Forecasts) InterpolatedMLForcast

func (f *Forecasts) InterpolatedMLForcast(t time.Time) (*ScaledForecast, error)

InterpolatedMLForecast returns a version of a curated forecasts for the specified time, if possible. This version is scaled so that all factors are within the 0-1 range, as this is what would be needed for the training or usage of a Go neural network like the github.com/patrikeh/go-deep one. It returns an error if no interpolation is available and the only available forecast is more than 15 minutes away from the requested time. Interpolation is refused when there are more than 4 hours between the available adjacent forecasts (if any of the cornering forecasts is within a 15 minute window of the requested time, that cornering forecast is returned though).

func (*Forecasts) LoadForecastsSince

func (f *Forecasts) LoadForecastsSince(t time.Time) error

LoadAllForecasts loads all existing forecasts from the database that happened at or after t.

func (*Forecasts) NextForecast

func (f *Forecasts) NextForecast() *mosmix.CuratedForecast

func (*Forecasts) Refresher

func (f *Forecasts) Refresher(ctx context.Context)

type PVProductionEntry added in v0.0.3

type PVProductionEntry struct {
	Time         time.Time
	CurrentPower float64
}

type Pvdb

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

func NewPVDB

func NewPVDB(db *sql.DB) *Pvdb

func (*Pvdb) EnsureTables

func (p *Pvdb) EnsureTables()

func (*Pvdb) GetPVDataSince added in v0.0.3

func (p *Pvdb) GetPVDataSince(t time.Time) (map[string][]*PVProductionEntry, error)

func (*Pvdb) UpdatePVData

func (p *Pvdb) UpdatePVData(data *loxonepv.PVDataList)

type ScaledForecast

type ScaledForecast mosmix.CuratedForecast // alias to differentiate clearly

func (*ScaledForecast) String

func (sf *ScaledForecast) String() string

Directories

Path Synopsis
examples
getforecast command
pvdata command

Jump to

Keyboard shortcuts

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