From 8090e7067aaac55a01b515c0ed5d9a291b1c63cb Mon Sep 17 00:00:00 2001 From: Karsten Hinz Date: Thu, 2 Jan 2020 10:32:22 +0100 Subject: [PATCH] Add support for KOSTAL Smart Energy Meter (#61) --- README.md | 2 + meters/sunspec/models.go | 105 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/README.md b/README.md index bd1685b9..79f1a66e 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ manuals for definitive guidance): | SBC ALE3 | 3 | + | + | + | + | + | + | - | - | | ABB A/B-Series | 3 | + | + | + | + | + | + | + | + | | BE MPM3MP | 3 | + | + | + | + | + | + | - | - | +| KOSTAL Smart Energy Meter | 3 | + | + | + | + | + | + | + | - | - **SDM120**: Cheap and small (1TE), but communication parameters can only be set over MODBUS, which is currently not supported by this project. You can use e.g. [SDM120C](https://github.com/gianfrdp/SDM120C) to change parameters. @@ -261,6 +262,7 @@ this as the meter ID. - **SBC ALE3**: This compact Saia Burgess Controls meter is comparable to the SDM630. It has two tariffs, both import and export depending on meter version and compact (4TE). It's often used with Viessmann heat pumps. - **BE MPM3PM**: Compact (4TE) three phase meter. +- **KOSTAL Smart Energy Meter**: Import Export of total apparent energy is currently not implemented. ## Modbus TCP Grid Inverters diff --git a/meters/sunspec/models.go b/meters/sunspec/models.go index e801a039..3205f72e 100644 --- a/meters/sunspec/models.go +++ b/meters/sunspec/models.go @@ -4,6 +4,7 @@ import ( "github.com/andig/gosunspec/models/model101" "github.com/andig/gosunspec/models/model103" "github.com/andig/gosunspec/models/model124" + "github.com/andig/gosunspec/models/model203" "github.com/volkszaehler/mbmd/meters" ) @@ -45,6 +46,81 @@ var modelPoints = map[int][]string{ model103.DCW, model103.TmpCab, }, + // wye-connect three phase (abcn) meter + model203.ModelID: { + model203.A, + //model203.A_SF, + model203.AphA, + model203.AphB, + model203.AphC, + //model203.Evt, + model203.Hz, + //model203.Hz_SF, + model203.PF, + //model203.PF_SF, + model203.PFphA, + model203.PFphB, + model203.PFphC, + //model203.PPV, + model203.PhV, + model203.PhVphA, + //model203.PhVphAB, + model203.PhVphB, + //model203.PhVphBC, + model203.PhVphC, + //model203.PhVphCA, + //model203.TotVAhExp, + //model203.TotVAhExpPhA, + //model203.TotVAhExpPhB, + //model203.TotVAhExpPhC, + //model203.TotVAhImp, + //model203.TotVAhImpPhA, + //model203.TotVAhImpPhB, + //model203.TotVAhImpPhC, + //model203.TotVAh_SF, + //model203.TotVArhExpQ3, + //model203.TotVArhExpQ3PhA, + //model203.TotVArhExpQ3PhB, + //model203.TotVArhExpQ3PhC, + //model203.TotVArhExpQ4, + //model203.TotVArhExpQ4PhA, + //model203.TotVArhExpQ4PhB, + //model203.TotVArhExpQ4PhC, + //model203.TotVArhImpQ1, + //model203.TotVArhImpQ1PhA, + //model203.TotVArhImpQ1PhB, + //model203.TotVArhImpQ1PhC, + //model203.TotVArhImpQ2, + //model203.TotVArhImpQ2PhA, + //model203.TotVArhImpQ2PhB, + //model203.TotVArhImpQ2PhC, + //model203.TotVArh_SF, + model203.TotWhExp, + model203.TotWhExpPhA, + model203.TotWhExpPhB, + model203.TotWhExpPhC, + model203.TotWhImp, + model203.TotWhImpPhA, + model203.TotWhImpPhB, + model203.TotWhImpPhC, + //model203.TotWh_SF, + model203.VA, + model203.VAR, + //model203.VAR_SF, + model203.VARphA, + model203.VARphB, + model203.VARphC, + //model203.VA_SF, + model203.VAphA, + model203.VAphB, + model203.VAphC, + //model203.V_SF, + model203.W, + //model203.W_SF, + model203.WphA, + model203.WphB, + model203.WphC, + }, // storage model124.ModelID: { model124.ChaState, @@ -57,14 +133,28 @@ var opcodeMap = map[string]meters.Measurement{ model103.AphA: meters.CurrentL1, model103.AphB: meters.CurrentL2, model103.AphC: meters.CurrentL3, + model203.PhV: meters.Voltage, model103.PhVphA: meters.VoltageL1, model103.PhVphB: meters.VoltageL2, model103.PhVphC: meters.VoltageL3, model103.Hz: meters.Frequency, model103.W: meters.Power, + model203.WphA: meters.PowerL1, + model203.WphB: meters.PowerL2, + model203.WphC: meters.PowerL3, model103.VA: meters.ApparentPower, + model203.VAphA: meters.ApparentPowerL1, + model203.VAphB: meters.ApparentPowerL2, + model203.VAphC: meters.ApparentPowerL3, model103.VAr: meters.ReactivePower, + model203.VAR: meters.ReactivePower, + model203.VARphA: meters.ReactivePowerL1, + model203.VARphB: meters.ReactivePowerL2, + model203.VARphC: meters.ReactivePowerL3, model103.PF: meters.Cosphi, + model203.PFphA: meters.CosphiL1, + model203.PFphB: meters.CosphiL2, + model203.PFphC: meters.CosphiL3, model103.WH: meters.Export, model103.DCA: meters.DCCurrent, model103.DCV: meters.DCVoltage, @@ -72,8 +162,23 @@ var opcodeMap = map[string]meters.Measurement{ model103.TmpCab: meters.HeatSinkTemp, model124.ChaState: meters.ChargeState, model124.InBatV: meters.BatteryVoltage, + model203.TotWhImp: meters.Import, + model203.TotWhImpPhA: meters.ImportL1, + model203.TotWhImpPhB: meters.ImportL2, + model203.TotWhImpPhC: meters.ImportL3, + model203.TotWhExp: meters.Export, + model203.TotWhExpPhA: meters.ExportL1, + model203.TotWhExpPhB: meters.ExportL2, + model203.TotWhExpPhC: meters.ExportL3, } var dividerMap = map[meters.Measurement]float64{ meters.Export: 1000, + meters.ExportL1: 1000, + meters.ExportL2: 1000, + meters.ExportL3: 1000, + meters.Import: 1000, + meters.ImportL1: 1000, + meters.ImportL2: 1000, + meters.ImportL3: 1000, }