aurora

package module
v0.0.0-...-d70766d Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: MIT Imports: 6 Imported by: 0

README

Go Report Card Build Status Build Status Coverage Status MIT licensed

Aurora

An interface for communicating with Power-One Aurora inverters.

Documentation

[GoDoc] (http://godoc.org/github.com/freman/go-aurora)

Full go doc style documentation for the project can be viewed online without installing this package by using the excellent GoDoc site here: http://godoc.org/github.com/freman/go-aurora

You can also view the documentation locally once the package is installed with the godoc tool by running godoc -http=":6060" and pointing your browser to http://localhost:6060/pkg/github.com/freman/go-aurora

Installation

$ go get -u github.com/freman/go-aurora

Documentation

Overview

Package aurora provides an interface for communicating with Power-One Aurora inverters.

Index

Constants

View Source
const InverterEpochOffset = 946706400

InverterEpochOffset is the number of seconds since unix epoch that Power-One started the Aurora firmware epoch

Variables

View Source
var ErrCRCFailure = errors.New("CRC Failure")

ErrCRCFailure is returned whenever the data read in from the serial port might have been corrupted en route and no longer matches the crc

Functions

This section is empty.

Types

type AlarmState

type AlarmState byte

AlarmState is a state of alarm returned by the inverter as part of the State struct or as an array of 4 AlarmStates in response to the Last4Alarms request

const (
	AlarmNone AlarmState = iota
	AlarmSunLow1
	AlarmInputOverCurrent
	AlarmInputUnderVoltage
	AlarmInputOverVoltage
	AlarmSunLow5
	AlarmNoParameters
	AlarmBulkOverVoltage
	AlarmCommError
	AlarmOutputOverCurrent
	AlarmIGBTSat
	AlarmBulkUV11
	AlarmE009
	AlarmGridFail
	AlarmBulkLow
	AlarmRampFail
	AlarmDCDCFail16
	AlarmWrongMode
	AlarmGroundFault18
	AlarmOverTemp
	AlarmBulkCapFail
	AlarmInverterFail
	AlarmStartTimeout
	AlarmGroundFault23
	AlarmDegaussError
	AlarmIleakSensFail
	AlarmDCDCFail25
	AlarmSelfTestError1
	AlarmSelfTestError2
	AlarmSelfTestError3
	AlarmSelfTestError4
	AlarmDCInjError
	AlarmGridOverVoltage
	AlarmGridUnderVoltage
	AlarmGridOF
	AlarmGridUF
	AlarmZGridHi
	AlarmE024
	AlarmRisoLow
	ALarmVrefError
	AlarmErrorMeasV
	AlarmErrorMeasF
	AlarmErrorMeasI
	AlarmErrorMeasIleak
	AlarmReadErrorV
	AlarmReadErrorI
	AlarmTableFail
	AlarmFanFail
	AlarmUTH
	AlarmInterlockFail
	AlarmRemoteOff
	AlarmVoutAvgError
	AlarmBatteryLow
	AlarmClkFail
	AlarmInputUC
	AlarmZeroPower
	AlarmFanStucked
	AlarmDCSwitchOpen
	AlarmBulkUV58
	AlarmAutoexclusion
	AlarmGridDFDT
	AlarmDenSwitchOpen
	AlarmJboxFail
)

Alarm states

func (AlarmState) String

func (a AlarmState) String() string

type AlarmStates

type AlarmStates []AlarmState

AlarmStates an array of AlarmState returned byt he Last4Alarms request

func (AlarmStates) String

func (a AlarmStates) String() string

type Argument

type Argument interface {
	Byte() byte
}

Argument is an interface that exposes Byte() to return a single byte representation of the given argument

type Byte

type Byte byte

Byte is a concrete Argument

func (Byte) Byte

func (b Byte) Byte() byte

Byte implement Argument.Byte()

type Command

type Command byte

Command is a command to send to the inverter

const (
	GetState Command = 50 + iota // Get the inverter state

	GetPartNumber // Get the inverters part number

	GetVersion // Get the hardware build version
	GetDSP     // Get a value from the DSP

	GetSerialNumber // Get the inverters serial number

	GetManufacturingDate // Get the year and month of manufacture

	GetTime            // Get the time from the inverter
	SetTime            // Set the time for the inverter
	GetFirmwareVersion // Get the inverters firmware version

	GetLast10SecEnergy // Get the amount of energy exported in the past 10 seconds
	GetConfiguration   // Get the inverter configuration
	GetCumulatedEnergy // Get a value from the cumulated energy table

	GetCounters // Get a counter

	GetLast4Alarms // Get the last 4 alarms
)

Command values

type ConfigurationState

type ConfigurationState byte

ConfigurationState is a state of configuration returned by the inverter

const (
	ConfigBoth ConfigurationState = iota
	ConfigString1
	ConfigString2
)

Configuration states

func (ConfigurationState) String

func (c ConfigurationState) String() string

type Counter

type Counter byte

Counter is a counter parameter to request from the inverter with the GetCounter command

const (
	CounterTotal Counter = iota
	CounterPartial
	CounterGrid
	CounterReset
)

Counter values

func (Counter) Byte

func (c Counter) Byte() byte

Byte implement Argument.Byte()

type CumulationPeriod

type CumulationPeriod byte

CumulationPeriod is a period parameters to request from the inverter

const (
	CumulatedDaily CumulationPeriod = iota
	CumulatedWeekly

	CumulatedMonthly
	CumulatedYearly
	CumulatedTotal
	CumulatedPartial
)

Available cumulation values

func (CumulationPeriod) Byte

func (c CumulationPeriod) Byte() byte

Byte implement Argument.Byte()

type DCDCState

type DCDCState byte

DCDCState is a DCDC status flag from the inverter as part of the State struct

const (
	DCDCOff DCDCState = iota
	DCDCRampStart
	DCDCMPPT

	DCDCInputOverCurrent
	DCDCInputUnderVoltage
	DCDCInputOverVoltage
	DCDCInputLow
	DCDCNoParameters
	DCDCBulkOverVoltage
	DCDCCommunicationError
	DCDCRampFail
	DCDCInternalError
	DCDCInputModeError
	DCDCGroundFault
	DCDCInverterFail
	DCDCIGBTSat
	DCDCILEAKFail
	DCDCGridFail
	DCDCCommError
)

DCDC states

func (DCDCState) String

func (d DCDCState) String() string

type DSParameter

type DSParameter byte

DSParameter is a DSP parameter to request from the inverter

const (
	DSPGridVoltage DSParameter = (1 + iota)
	DSPGridCurrent
	DSPGridPower
	DSPFrequency
	DSPVbulk
	DSPIleakDCDC
	DSPIleakInverter
	DSPPin1
	DSPPin2

	DSPInverterTemperature DSParameter
	DSPBoosterTemperature
	DSPInput1Voltage

	DSPInput1Current
	DSPInput2Voltage
	DSPInput2Current
	DSPGridVoltageDCDC
	DSPGridFrequencyDCDC
	DSPIsolationResistance
	DSPVbulkDCDC
	DSPAverageGridVoltage
	DSPVbulkMid
	DSPPowerPeak
	DSPPowerPeakToday
	DSPGridVoltageNeutral
	DSPWindGeneratorFrequency
	DSPGridVoltageNeutralPhase
	DSPGridCurrentPhaseR
	DSPGridCurrentPhaseS
	DSPGridCurrentPhaseT
	DSPFrequencyPhaseR
	DSPFrequencyPhaseS
	DSPFrequencyPhaseT
	DSPVbulkPositive
	DSPVbulkNegative
	DSPSupervisorTemperature
	DSPAlimTemperature
	DSPHeatSinkTemperature
	DSPTemperature1
	DSPTemperature2
	DSPTemperature3
	DSPFan1Speed
	DSPFan2Speed
	DSPFan3Speed
	DSPFan4Speed
	DSPFan5Speed
	DSPPowerSaturationLimit
	DSPRiferimentoAnelloBulk
	DSPVpanelMicro
	DSPGridVoltagePhaseR
	DSPGridVoltagePhaseS
	DSPGridVoltagePhaseT
)

Available DSP values

func (DSParameter) Byte

func (d DSParameter) Byte() byte

Byte implements Argument.Byte()

func (DSParameter) String

func (d DSParameter) String() string

type GlobalState

type GlobalState byte

GlobalState is a global status flag returned by the inverter as part of the State sturct

const (
	GSSendingParameters GlobalState = iota
	GSWaitingSunGrid
	GSCheckingGrid
	GSMeasuringRiso
	GSDCDCStart
	GSInverterTurnOn
	GSRun
	GSRecovery
	GSPause
	GSGroundFault
	GSOTHFault
	GSAddressSetting
	GSSelfTest
	GSSelfTestFail
	GSSensorTestMeasureRiso
	GSLeakFault
	GSWaitingManualReset
	GSInternalErrorE026
	GSInternalErrorE027
	GSInternalErrorE028
	GSInternalErrorE029
	GSInternalErrorE030
	GSSendingWindTable
	GSFailedSendingTable
	GSUTHFault
	GSRemoteOff
	GSInterlockFail
	GSExecutingAutotest

	GSWaitingSun
	GSTemperatureFault
	GSFanStaucked
	GSIntComFail
	GSSlaveInsertion
	GSDCSwitchOpen
	GSTrasSwitchOpen
	GSMasterExclusion
	GSAutoExclusion

	GSErasingInternalEEprom GlobalState
	GSErasingExternalEEprom
	GSCountingEEprom
	GSFreeze
)

Global states

func (GlobalState) String

func (g GlobalState) String() string

type InputType

type InputType byte

InputType is a value returned as part of the Version struct

const (
	InputPhotovoltaic InputType = 78
	InputWind         InputType = 87
)

Inverter input types

func (InputType) String

func (m InputType) String() string

type Inverter

type Inverter struct {
	Conn    io.ReadWriter
	Address byte
}

Inverter structure for connecting to an inverter

func (*Inverter) BoosterTemperature

func (i *Inverter) BoosterTemperature() (float32, error)

BoosterTemperature returns the current temperature of the booster in celsius

func (*Inverter) CommCheck

func (i *Inverter) CommCheck() error

CommCheck calls the simplest command supported by the inverter "GetVersion" just as a quick check to make sure it's connected and working. You might want to wrap a deadline around this call.

func (*Inverter) Communicate

func (i *Inverter) Communicate(command Command, args ...Argument) ([]byte, error)

Communicate encodes and transmits given commands returning a response having checked the CRC and transmission state if applicable

func (*Inverter) CommunicateVar

func (i *Inverter) CommunicateVar(v interface{}, command Command, args ...Argument) error

CommunicateVar works much like Communicate but expects an interface to write the response to

func (*Inverter) Configuration

func (i *Inverter) Configuration() (ConfigurationState, error)

Configuration returns the current configuration state from the inverter

func (*Inverter) DailyEnergy

func (i *Inverter) DailyEnergy() (uint32, error)

DailyEnergy returns the daily cumulated energy

func (*Inverter) FirmwareVersion

func (i *Inverter) FirmwareVersion() (string, error)

FirmwareVersion returns the inverters firmware version

func (*Inverter) Frequency

func (i *Inverter) Frequency() (float32, error)

Frequency returns the operating frequency

func (*Inverter) GetCounterData

func (i *Inverter) GetCounterData(counter Counter) (uint32, error)

GetCounterData returns the value (seconds?) from one of the counters being total, partial, grid, and reset runtimes.

func (*Inverter) GetCumulatedEnergy

func (i *Inverter) GetCumulatedEnergy(period CumulationPeriod) (uint32, error)

GetCumulatedEnergy returns the cumulated energy for a given period

func (*Inverter) GetDSPData

func (i *Inverter) GetDSPData(parameter DSParameter) (float32, error)

GetDSPData returns data for various DSParameters

func (*Inverter) GetTime

func (i *Inverter) GetTime() (time.Time, error)

GetTime returns the current timestamp from the inverter, returns as a unix epoch based timestamp

func (*Inverter) GridCurrent

func (i *Inverter) GridCurrent() (float32, error)

GridCurrent returns the amount of current (in amps) being pushed to the grid.

func (*Inverter) GridPower

func (i *Inverter) GridPower() (float32, error)

GridPower returns the amount of power (in watts) being pushed to the grid.

func (*Inverter) GridRunTime

func (i *Inverter) GridRunTime() (time.Duration, error)

GridRunTime returns the amount of time the inverter has been on grid

func (*Inverter) GridVoltage

func (i *Inverter) GridVoltage() (float32, error)

GridVoltage returns the voltage from the grid

func (*Inverter) Input1Current

func (i *Inverter) Input1Current() (float32, error)

Input1Current returns the amount of current (in amps) being received from input 1

func (*Inverter) Input1Voltage

func (i *Inverter) Input1Voltage() (float32, error)

Input1Voltage returns the voltage received on input 1 from your solar array/wind turbine

func (*Inverter) Input2Current

func (i *Inverter) Input2Current() (float32, error)

Input2Current returns the amount of current (in amps) being received from input 2

func (*Inverter) Input2Voltage

func (i *Inverter) Input2Voltage() (float32, error)

Input2Voltage returns the voltage received on input 2 from your solar array/wind turbine

func (*Inverter) InverterTemperature

func (i *Inverter) InverterTemperature() (float32, error)

InverterTemperature returns the current temperature of the inverter in celsius

func (*Inverter) Joules

func (i *Inverter) Joules() (uint16, error)

Joules returns the amount of power produced in the last 10 seconds as Joules

func (*Inverter) Last4Alarms

func (i *Inverter) Last4Alarms() ([]AlarmState, error)

Last4Alarms returns the last 4 alarm states

func (*Inverter) ManufactureDate

func (i *Inverter) ManufactureDate() (string, string, error)

ManufactureDate returns the inverters date of manufacture

func (*Inverter) MonthlyEnergy

func (i *Inverter) MonthlyEnergy() (uint32, error)

MonthlyEnergy returns the monthly cumulated energy

func (*Inverter) PartNumber

func (i *Inverter) PartNumber() (string, error)

PartNumber returns the inverters part number

func (*Inverter) PartialEnergy

func (i *Inverter) PartialEnergy() (uint32, error)

PartialEnergy returns the cumulated energy since last reset

func (*Inverter) PartialRunTime

func (i *Inverter) PartialRunTime() (time.Duration, error)

PartialRunTime returns the partial runtime of the inverter...

func (*Inverter) ResetRunTime

func (i *Inverter) ResetRunTime() error

ResetRunTime resets the counter

func (*Inverter) SerialNumber

func (i *Inverter) SerialNumber() (string, error)

SerialNumber returns the inverters serial number

func (*Inverter) SetTime

func (i *Inverter) SetTime(t time.Time) error

SetTime sets the time in the inverter to the given timestamp. Warning: this may result in the resetting of partial counters/cumulaters.

func (*Inverter) State

func (i *Inverter) State() (*State, error)

State returns the current state for the inverter

func (*Inverter) TotalEnergy

func (i *Inverter) TotalEnergy() (uint32, error)

TotalEnergy returns the total cumulated energy

func (*Inverter) TotalRunTime

func (i *Inverter) TotalRunTime() (time.Duration, error)

TotalRunTime returns the total runtime for the inverter

func (*Inverter) Version

func (i *Inverter) Version() (*Version, error)

Version returns the inverters version

func (*Inverter) WeeklyEnergy

func (i *Inverter) WeeklyEnergy() (uint32, error)

WeeklyEnergy returns the weekly cumulated energy

func (*Inverter) YearlyEnergy

func (i *Inverter) YearlyEnergy() (uint32, error)

YearlyEnergy returns the yearly cumulated energy

type InverterState

type InverterState byte

InverterState is a status flag returned by the inverter as part of the State struct

const (
	ISStandBy InverterState = iota
	ISCheckingGrid
	ISRun
	ISBulkOverVoltage
	ISOutOverCurrent
	ISIGBTSat
	ISBulkUnderVoltage
	ISDegaussError
	ISNoParameters
	ISBulkLow
	ISGridOverVoltage
	ISCommunicationError
	ISDegaussing
	ISStarting
	ISBulkCapFail
	ISLeakFail
	ISDCDCFail
	ISIleakSensorFail
	ISSelfTestRelayInverter
	ISSelfTestWaitSensorTest
	ISSelfTestTestRelayDCDCSensor
	ISSelfTestRelayInverterFail
	ISSelfTestTimeoutFail
	ISSelfTestRelayDCDCFail
	ISSelfTest1
	ISWaitingSelfTestStart
	ISDCInjection
	ISSelfTest2
	ISSelfTest3
	ISSelfTest4
	ISInternalError30
	ISInternalError31

	ISForbiddenState InverterState
	ISInputUC
	ISZeroPower
	ISGridNotPresent
	ISWaitingStart
	ISMPPT
	ISGRIDFAIL
	ISINPUTOC
)

Inverter states

func (InverterState) String

func (i InverterState) String() string

type InverterType

type InverterType byte

InverterType is a value returned as part of the Version struct

const (
	InverterTransformerless InverterType = 78
	InverterTransformer     InverterType = 84
)

Inverter types

func (InverterType) String

func (i InverterType) String() string

type Product

type Product byte

Product is a product/model as returned by the inverter as part of the Version struct

const (
	Product2kWIndoor       Product = 'i'
	Product2kWOutdoor      Product = 'o'
	Product3_6kWIndoor     Product = 'I'
	Product3_6kWOutdoor    Product = 'O'
	Product5kWOutdoor      Product = '5'
	Product6kWOutdoor      Product = '6'
	Product3PhaseInterface Product = 'P'
	Product50kWModule      Product = 'C'
	Product4_2kWNew        Product = '4'
	Product3_6kWNew        Product = '3'
	Product3_3kWNew        Product = '2'
	Product3_0kWNew        Product = '1'
	Product12kW            Product = 'D'
	Product10kW            Product = 'X'
)

Known products/models

func (Product) String

func (p Product) String() string

type ProductSpec

type ProductSpec byte

ProductSpec is a product specification/standard returned by the inverter as part of the Version struct

const (
	ProductSpecUL1741      ProductSpec = 'A'
	ProductSpecVDE0126     ProductSpec = 'E'
	ProductSpecDR1663_2000 ProductSpec = 'S'
	ProductSpecENELDK5950  ProductSpec = 'I'
	ProductSpecUKG83       ProductSpec = 'U'
	ProductSpecAS4777      ProductSpec = 'K'
	ProductSpecVDEFrench   ProductSpec = 'F'
)

Known product specifications/regulations

func (ProductSpec) String

func (p ProductSpec) String() string

type State

type State struct {
	Global   GlobalState
	Inverter InverterState
	Channel1 DCDCState
	Channel2 DCDCState
	Alarm    AlarmState
}

State holds the structure for the inverter state, returned by the State() func

func (*State) String

func (s *State) String() string

String returns state as an easy to read string

type TransmissionState

type TransmissionState byte

TransmissionState is a status flag returned by the inverter

const (
	TSOk                    TransmissionState = 0
	TSCommandNotImplemented TransmissionState = (51 + iota)
	TSVariableDoesNotExist
	TSValueOutOfRange
	TSEEpromNotAccessible
	TSMicroError
	TSNotExecuted
	TSVariableNotAvailable
)

Transmission states

func (TransmissionState) String

func (t TransmissionState) String() string

type Version

type Version struct {
	Model       Product
	Regulation  ProductSpec
	Transformer InverterType
	Type        InputType
}

Version holds the structure for the inverter version/model, returned byt he Version() func

func (*Version) String

func (v *Version) String() string

String returns the version as an easy to read string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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