models

package
v0.0.0-...-47008de Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inverter

type Inverter struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Serial          string             `bson:"serial" json:"serial"`
	Power           float64            `bson:"power" json:"power"`
	Voltage         float64            `bson:"voltage" json:"voltage"`
	Frequency       float64            `bson:"frequency" json:"frequncy"`
	Communication   bool               `bson:"communication" json:"communication"`
	Status          bool               `bson:"status" json:"status"`
	Switch          bool               `bson:"switch" json:"switch"`
	EnergyToday     float64            `bson:"energyToday" json:"energyToday"`
	EnergyThisMonth float64            `bson:"energyThisMonth" json:"energyThisMonth"`
	EnergyThisYear  float64            `bson:"energyThisYear" json:"energyThisYear"`
	TotalEnergy     float64            `bson:"totalEnergy" json:"totalEnergy"`
}

Inverter : model of an inverter installed in the PV system

func ListInverters

func ListInverters(db *mongo.Database) ([]*Inverter, error)

ListInverters : reads all the current inverters in the DB

func (*Inverter) AddInverterToDB

func (i *Inverter) AddInverterToDB(db *mongo.Database) (primitive.ObjectID, error)

AddInverterToDB : adds info about a inverter to the DB

func (*Inverter) ReadInverter

func (i *Inverter) ReadInverter(db *mongo.Database) error

ReadInverter : reads data from a specific inverter serial

type TelemetryData

type TelemetryData struct {
	ID                primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Serial            string             `bson:"serial" json:"serial"`
	Module            string             `bson:"module" json:"module"`
	LastTelemetryTime int64              `bson:"lastTelemetryTime" json:"lastTelemetryTime"`
	OutputVoltage     float64            `bson:"outputVoltage" json:"outputVoltage"`
	InputVoltage      float64            `bson:"inputVoltage" json:"inputVoltage"`
	InputCurrent      float64            `bson:"inputCurrent" json:"inputCurrent"`
}

TelemetryData : PV system state captured by the data acquisition service

func ListTelemetryData

func ListTelemetryData(db *mongo.Database, filter bson.M) ([]*TelemetryData, error)

ListTelemetryData : reads telemetry data from DB using an filter

func (*TelemetryData) AddDataToDB

func (t *TelemetryData) AddDataToDB(db *mongo.Database) (primitive.ObjectID, error)

AddDataToDB : adds a telemetry read to the DB

Jump to

Keyboard shortcuts

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