Skip to content

Commit

Permalink
Merge pull request #148 from andig/fix/model-203
Browse files Browse the repository at this point in the history
Repair broken model 203 measurement mapping
  • Loading branch information
andig authored Aug 9, 2020
2 parents 11c627c + a7f6428 commit 8267e39
Showing 1 changed file with 48 additions and 33 deletions.
81 changes: 48 additions & 33 deletions meters/sunspec/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -36,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
Expand Down Expand Up @@ -76,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: {
Expand All @@ -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: {
Expand All @@ -140,13 +155,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,
Expand Down

0 comments on commit 8267e39

Please sign in to comment.