sungrow/sungrow_map.go

44 lines
1.4 KiB
Go
Raw Normal View History

2021-01-01 16:51:16 +11:00
package main
type register struct {
name string
conv func([]byte) float64
mult float64
unit string
}
func (r *register) read(data []byte) float64 {
return r.conv(data) * r.mult
}
var sungrowInputRegs = map[uint16]*register{
// 4990 - 4999: serial number in ASCII
5001: {"nominal_power", u16, 0.1, "kW"},
5003: {"daily_power_yield", u16, 0.1, "kWh"},
5004: {"total_power_yield", u32, 1, "kWh"},
5006: {"total_running_time", u32, 1, "h"},
5008: {"internal_temperature", u16, 0.1, "°C"},
5011: {"pv1_potential", u16, 0.1, "V"},
5012: {"pv1_current", u16, 0.1, "A"},
5013: {"pv2_potential", u16, 0.1, "V"},
5014: {"pv2_current", u16, 0.1, "A"},
//5015: {"pv3_potential", u16, 0.1, "V"},
//5016: {"pv3_current", u16, 0.1, "A"},
5017: {"total_dc_power", u32, 1, "W"},
5019: {"phase_a_potential", u16, 0.1, "V"},
//5020: {"phase_b_potential", u16, 0.1, "V"},
//5021: {"phase_c_potential", u16, 0.1, "V"},
5022: {"phase_a_current", u16, 0.1, "A"},
//5023: {"phase_b_current", u16, 0.1, "A"},
//5024: {"phase_c_current", u16, 0.1, "A"},
5031: {"output_real_power", u32, 1, "VA"},
5033: {"output_reactive_power", s32, 1, "VA"},
5035: {"power_factor", s16, 0.001, ""},
5036: {"frequency", u16, 0.1, "Hz"},
5049: {"nominal_reactive_power", s16, 0.1, "kVA"},
2021-01-01 19:50:24 +11:00
2021-01-01 16:51:16 +11:00
5113: {"daily_running_time", u16, 1, "m"},
5144: {"total_power_yield_2", u32, 0.1, "kWh"},
5148: {"frequency_2", u16, 0.01, "Hz"},
}