Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Eastron SDM54 #352

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ manuals for definitive guidance):

| Meter | Phases | Voltage | Current | Power | Power Factor | Total Import | Total Export | Per-phase Import/Export | Line/Neutral THD |
|---|---|---|---|---|---|---|---|---|---|
| SDM54 | 3 | + | + | + | + | + | + | + | + |
| SDM72 | 3 | - | - | + | - | + | + | - | - |
| SDM120/220 | 1 | + | + | + | + | + | + | - | - |
| SDM530 | 3 | + | + | + | + | + | + | - | - |
Expand All @@ -255,6 +256,7 @@ manuals for definitive guidance):
| ORNO WE-516/517 | 3 | + | + | + | + | + | + | + | - |
| iEM3000 Series | 3 | + | + | + | + | + | + | (+) | + |

- **SDM54**: Compact (3TE), 3P meter with a lot of features. Can be configured using the builtin display.
- **SDM72**: Compact (4TE), 3P meter with bare minium of total measurements, no currents. Can be configured using the builtin display.
- **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.
Expand Down
1 change: 1 addition & 0 deletions docs/mbmd_inspect.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ mbmd inspect [flags]
SDM220 Eastron SDM220
SDM230 Eastron SDM230
SDM72 Eastron SDM72
SDM54 Eastron SDM54
SEMTR SolarEdge SE-MTR-3Y
X961A Eastron SMART X96-1A
TCP
Expand Down
1 change: 1 addition & 0 deletions docs/mbmd_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mbmd run [flags]
SDM220 Eastron SDM220
SDM230 Eastron SDM230
SDM72 Eastron SDM72
SDM54 Eastron SDM54
SEMTR SolarEdge SE-MTR-3Y
X961A Eastron SMART X96-1A
TCP
Expand Down
90 changes: 90 additions & 0 deletions meters/rs485/sdm54.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package rs485

import . "github.com/volkszaehler/mbmd/meters"

func init() {
Register("SDM54", NewSDM54Producer)
}

type SDM54Producer struct {
Opcodes
}

func NewSDM54Producer() Producer {
/**
* Opcodes as defined by Eastron SDM54.
* See https://www.eastrongroup.com/eastrongroup/2024/08/21/eastronsdm54seriesusermanualv1.2.pdf
* This is to a large extent a superset of all SDM devices, however there are
* subtle differences (see 220, 230). Some opcodes might not work on some devices.
*/
ops := Opcodes{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please gofmt the code (or use VScode with Go plugin)

Copy link
Contributor Author

@kiezematze kiezematze Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comment, I have done that. As this is my first time adapting go code I would need some support: I have really no clue why the porcelain test fails. Could you please help me out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I figured it out. Is there anything else?

VoltageL1: 0x0000, // 220, 230
VoltageL2: 0x0002,
VoltageL3: 0x0004,
CurrentL1: 0x0006, // 220, 230
CurrentL2: 0x0008,
CurrentL3: 0x000A,
PowerL1: 0x000C, // 230
PowerL2: 0x000E,
PowerL3: 0x0010,
ApparentPowerL1: 0x0012,
ApparentPowerL2: 0x0014,
ApparentPowerL3: 0x0016,
ReactivePowerL1: 0x0018,
ReactivePowerL2: 0x001A,
ReactivePowerL3: 0x001C,
CosphiL1: 0x001e, // 230
CosphiL2: 0x0020,
CosphiL3: 0x0022,
Power: 0x0034,
ApparentPower: 0x0038,
ReactivePower: 0x003C,
ImportPower: 0x0054,
ImportL1: 0x015a,
ImportL2: 0x015c,
ImportL3: 0x015e,
Import: 0x0048, // 220, 230
ExportL1: 0x0160,
ExportL2: 0x0162,
ExportL3: 0x0164,
Export: 0x004a, // 220, 230
SumL1: 0x0166,
SumL2: 0x0168,
SumL3: 0x016a,
Sum: 0x0156, // 220
Cosphi: 0x003e,
THDL1: 0x00ea, // voltage
THDL2: 0x00ec, // voltage
THDL3: 0x00ee, // voltage
THD: 0x00F8, // voltage
Frequency: 0x0046, // 230
}
return &SDM54Producer{Opcodes: ops}
}

func (p *SDM54Producer) Description() string {
return "Eastron SDM54"
}

func (p *SDM54Producer) snip(iec Measurement) Operation {
operation := Operation{
FuncCode: ReadInputReg,
OpCode: p.Opcode(iec),
ReadLen: 2,
IEC61850: iec,
Transform: RTUIeee754ToFloat64,
}
return operation
}

func (p *SDM54Producer) Probe() Operation {
return p.snip(VoltageL1)
}

func (p *SDM54Producer) Produce() (res []Operation) {
for op := range p.Opcodes {
res = append(res, p.snip(op))
}

return res
}
Loading