From 8172e18a2064fa5e9325606db6cdc920b0abd46e Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 9 Aug 2020 13:13:16 +0200 Subject: [PATCH 1/3] Fix model 203 current mixed with power --- meters/sunspec/models.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meters/sunspec/models.go b/meters/sunspec/models.go index cc8148d1..fea179fc 100644 --- a/meters/sunspec/models.go +++ b/meters/sunspec/models.go @@ -140,13 +140,13 @@ var modelMap = map[sunspec.ModelId]map[int]map[string]meters.Measurement{ model203.TotWhImpPhB: meters.ImportL2, model203.TotWhImpPhC: meters.ImportL3, model203.VA: meters.ApparentPower, + model203.VAphA: meters.ApparentPowerL1, + model203.VAphB: meters.ApparentPowerL2, + model203.VAphC: meters.ApparentPowerL3, model203.VAR: meters.ReactivePower, model203.VARphA: meters.ReactivePowerL1, model203.VARphB: meters.ReactivePowerL2, model203.VARphC: meters.ReactivePowerL3, - model203.VAphA: meters.CurrentL1, - model203.VAphB: meters.CurrentL2, - model203.VAphC: meters.CurrentL3, model203.W: meters.Power, model203.WphA: meters.PowerL1, model203.WphB: meters.PowerL2, From 5e2245ef84ad019c0063ac88b3ea19cdd7ede3f0 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 9 Aug 2020 13:13:38 +0200 Subject: [PATCH 2/3] Add model 201 --- meters/sunspec/models.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/meters/sunspec/models.go b/meters/sunspec/models.go index fea179fc..d37d9814 100644 --- a/meters/sunspec/models.go +++ b/meters/sunspec/models.go @@ -8,6 +8,7 @@ import ( "github.com/andig/gosunspec/models/model113" "github.com/andig/gosunspec/models/model124" "github.com/andig/gosunspec/models/model160" + "github.com/andig/gosunspec/models/model201" "github.com/andig/gosunspec/models/model203" "github.com/volkszaehler/mbmd/meters" @@ -115,6 +116,20 @@ var modelMap = map[sunspec.ModelId]map[int]map[string]meters.Measurement{ model160.DCWH: meters.DCEnergyS3, }, }, + // single phase (AN or AB) meter + model201.ModelID: { + 0: { + model201.A: meters.Current, + model201.Hz: meters.Frequency, + model201.PF: meters.Cosphi, + model201.PhV: meters.Voltage, + model201.TotWhExp: meters.Export, + model201.TotWhImp: meters.Import, + model201.VA: meters.ApparentPower, + model201.VAR: meters.ReactivePower, + model201.W: meters.Power, + }, + }, // wye-connect three phase (abcn) meter model203.ModelID: { 0: { From a7f64282c499f71a66ab3e601cbb1bdc0ab9dc7e Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 9 Aug 2020 13:13:51 +0200 Subject: [PATCH 3/3] Use model-specific point IDs --- meters/sunspec/models.go | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/meters/sunspec/models.go b/meters/sunspec/models.go index d37d9814..9e9b7475 100644 --- a/meters/sunspec/models.go +++ b/meters/sunspec/models.go @@ -37,19 +37,19 @@ var modelMap = map[sunspec.ModelId]map[int]map[string]meters.Measurement{ // single phase inverter - float model111.ModelID: { 0: { - model101.A: meters.Current, - model101.AphA: meters.CurrentL1, - model101.PhVphA: meters.VoltageL1, - model101.Hz: meters.Frequency, - model101.W: meters.Power, - model101.VA: meters.ApparentPower, - model101.VAr: meters.ReactivePower, - model101.PF: meters.Cosphi, - model101.WH: meters.Export, - model101.DCA: meters.DCCurrent, - model101.DCV: meters.DCVoltage, - model101.DCW: meters.DCPower, - model101.TmpCab: meters.HeatSinkTemp, + model111.A: meters.Current, + model111.AphA: meters.CurrentL1, + model111.PhVphA: meters.VoltageL1, + model111.Hz: meters.Frequency, + model111.W: meters.Power, + model111.VA: meters.ApparentPower, + model111.VAr: meters.ReactivePower, + model111.PF: meters.Cosphi, + model111.WH: meters.Export, + model111.DCA: meters.DCCurrent, + model111.DCV: meters.DCVoltage, + model111.DCW: meters.DCPower, + model111.TmpCab: meters.HeatSinkTemp, }, }, // three phase inverter @@ -77,23 +77,23 @@ var modelMap = map[sunspec.ModelId]map[int]map[string]meters.Measurement{ // three phase inverter - float model113.ModelID: { 0: { - model103.A: meters.Current, - model103.AphA: meters.CurrentL1, - model103.AphB: meters.CurrentL2, - model103.AphC: meters.CurrentL3, - model103.PhVphA: meters.VoltageL1, - model103.PhVphB: meters.VoltageL2, - model103.PhVphC: meters.VoltageL3, - model103.Hz: meters.Frequency, - model103.W: meters.Power, - model103.VA: meters.ApparentPower, - model103.VAr: meters.ReactivePower, - model103.PF: meters.Cosphi, - model103.WH: meters.Export, - model103.DCA: meters.DCCurrent, - model103.DCV: meters.DCVoltage, - model103.DCW: meters.DCPower, - model103.TmpCab: meters.HeatSinkTemp, + model113.A: meters.Current, + model113.AphA: meters.CurrentL1, + model113.AphB: meters.CurrentL2, + model113.AphC: meters.CurrentL3, + model113.PhVphA: meters.VoltageL1, + model113.PhVphB: meters.VoltageL2, + model113.PhVphC: meters.VoltageL3, + model113.Hz: meters.Frequency, + model113.W: meters.Power, + model113.VA: meters.ApparentPower, + model113.VAr: meters.ReactivePower, + model113.PF: meters.Cosphi, + model113.WH: meters.Export, + model113.DCA: meters.DCCurrent, + model113.DCV: meters.DCVoltage, + model113.DCW: meters.DCPower, + model113.TmpCab: meters.HeatSinkTemp, }, }, model160.ModelID: {