phocus_messages

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Zlib Imports: 10 Imported by: 2

README

Worklow Status

Messages for Phocus

Phocos Inverter variant

Documentation

Overview

Package phocus_messages contains the various queries and commands that that can be sent with phocus

Index

Constants

This section is empty.

Variables

View Source
var ACOutputModes = map[string]ACOutputMode{
	"0": "Single Any-Grid unit",
	"1": "Parallel output",
	"2": "Phase 1 of 3-phase output",
	"3": "Phase 2 of 3-phase output",
	"4": "Phase 3 of 3-phase output",
}
View Source
var BatteryChargerSourcePriorities = map[string]BatteryChargerSourcePriority{
	"1": "Solar first",
	"2": "Solar and Utility",
	"3": "Solar only",
}
View Source
var BatteryStatuses = map[string]BatteryStatus{
	"03": "Battery charging and discharging disabled by battery attached to BMS port of unit",
	"02": "Battery disconnected",
	"01": "Battery voltage low",
	"00": "Battery voltage normal",
}
View Source
var FaultCodes = map[string]FaultCode{
	"1":  "Fan locked while inverter off",
	"2":  "Over-temperature",
	"3":  "Battery voltage too high",
	"4":  "Battery voltage too low",
	"5":  "AC output short-circuit",
	"6":  "AC output voltage too high",
	"7":  "AC output overload",
	"8":  "Internal bus voltage too high",
	"9":  "Internal bus soft-start failed",
	"10": "PV over-current",
	"11": "PV over-voltage",
	"12": "Internal DC converter over-current",
	"13": "Battery discharge over-current",
	"51": "Over-current",
	"52": "Internal bus voltage too low",
	"53": "Inverter soft-start failed",
	"55": "DC over-voltage at AC output",
	"57": "Current sensor failed",
	"58": "AC Output voltage too low",
	"60": "Reverse-current protection active",
	"71": "Firmware version inconsistent",
	"72": "Current sharing fault",
	"80": "CAN communication fault",
	"81": "Host loss",
	"82": "Synchronization loss",
	"83": "Battery voltage detected inconsistent",
	"84": "AC in. voltage/frequency inconsistent",
	"85": "AC output current imbalance",
	"86": "AC output mode inconsistent",
}
View Source
var GridAvailabilities = map[string]GridAvailability{
	"1": "disconnected",
	"0": "connected",
}
View Source
var OperationModes = map[string]OperationMode{
	"P": "Powered on",
	"S": "Stand-By",
	"L": "Grid",
	"B": "Off-grid",
	"F": "Fault",
	"D": "Shutdown",
}
View Source
var Statuses = map[string]Status{
	"1": "on",
	"0": "off",
}

Functions

func HandleQPGS

func HandleQPGS(inverterNum int) error

HandleQPGS writes the query to the inverter and reads the response, deserialises it into a response object and sends it to MQTT

func Interpret

func Interpret(input Message) error

Interpret converts the generic `phocus` message into a specific inverter message TODO add even more generalisation and separated implementation details here

Types

type ACOutputMode

type ACOutputMode string

type BatteryChargerSourcePriority

type BatteryChargerSourcePriority string

type BatteryStatus

type BatteryStatus string

type Command

type Command interface {
	New()
	Print()
}

Command interface is a WIP

type FaultCode

type FaultCode string

type GridAvailability

type GridAvailability string

type InverterStatus

type InverterStatus struct {
	MPPT          Status
	ACCharging    Status
	SolarCharging Status
	BatteryStatus BatteryStatus // 2 bits
	ACInput       GridAvailability
	ACOutput      Status
	Reserved      Reserved
}

type Message

type Message struct {
	ID      uuid.UUID `json:"id"`
	Command string    `json:"command"`
	Payload string    `json:"payload"`
}

Message is the shape of a message for phocus to interpret and handle queuing of

type OperationMode

type OperationMode string

type QPGSnResponse

type QPGSnResponse struct {
	// (A BBBBBBBBBBBBBB C DD EEE.E FF.FF GGG.G HH.HH IIII JJJJ KKK LL.L MMM NNN OOO.O PPP QQQQQ RRRRR SSS b7b6b5b4b3b2b1b0 T U VVV WWW XX YY.Y ZZZ<CRC><cr>
	// start byte
	OtherUnits                          bool
	SerialNumber                        string
	OperationMode                       OperationMode
	FaultCode                           FaultCode
	ACInputVoltage                      string
	ACInputFrequency                    string
	ACOutputVoltage                     string
	ACOutputFrequency                   string
	ACOutputApparentPower               string
	ACOutputActivePower                 string
	PercentageOfNominalOutputPower      string
	BatteryVoltage                      string
	BatteryChargingCurrent              string
	BatteryStateOfCharge                string
	PVInputVoltage                      string
	TotalChargingCurrent                string
	TotalACOutputApparentPower          string
	TotalACOutputActivePower            string
	TotalPercentageOfNominalOutputPower string
	InverterStatus                      InverterStatus
	ACOutputMode                        ACOutputMode
	BatteryChargerSourcePriority        BatteryChargerSourcePriority
	MaxChargingCurrentSet               string
	MaxChargingCurrentPossible          string
	MaxACChargingCurrentSet             string
	PVInputCurrent                      string
	BatteryDischargeCurrent             string
	Checksum                            string
}

func NewQPGSnResponse

func NewQPGSnResponse(input string) (*QPGSnResponse, error)

type Reserved

type Reserved string

type Status

type Status string

Jump to

Keyboard shortcuts

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