Skip to content

Commit

Permalink
Consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jan 21, 2020
1 parent 7972567 commit 70bbc29
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion meters/rs485/abb.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *ABBProducer) Type() string {

// Description implements Producer interface
func (p *ABBProducer) Description() string {
return "ABB A/B-Series meters"
return "ABB A/B-Series"
}

// wrapTransform validates if reading result is undefined and returns NaN in that case
Expand Down
2 changes: 1 addition & 1 deletion meters/rs485/dzg.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (p *DZGProducer) Type() string {

// Description implements Producer interface
func (p *DZGProducer) Description() string {
return "DZG Metering GmbH DVH4013 meters"
return "DZG Metering GmbH DVH4013"
}

func (p *DZGProducer) snip(iec Measurement, scaler ...float64) Operation {
Expand Down
2 changes: 1 addition & 1 deletion meters/rs485/janitza.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (p *JanitzaProducer) Type() string {

// Description implements Producer interface
func (p *JanitzaProducer) Description() string {
return "Janitza B-Series meters"
return "Janitza B-Series"
}

func (p *JanitzaProducer) snip(iec Measurement) Operation {
Expand Down
2 changes: 1 addition & 1 deletion meters/rs485/mpm3pm.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (p *MPM3MPProducer) Type() string {

// Description implements Producer interface
func (p *MPM3MPProducer) Description() string {
return "Bernecker Engineering MPM3PM meters"
return "Bernecker Engineering MPM3PM"
}

func (p *MPM3MPProducer) snip(iec Measurement, readlen uint16, transform RTUTransform, scaler ...float64) Operation {
Expand Down
32 changes: 25 additions & 7 deletions meters/rs485/sbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const (
)

type SBCProducer struct {
typ string
phases int
Opcodes
}

Expand Down Expand Up @@ -47,7 +49,11 @@ func NewSBCProducer() Producer {
Power: 51, // scaler 100
ReactivePower: 52, // scaler 100
}
return &SBCProducer{Opcodes: ops}
return &SBCProducer{
typ: "ALE3", // assume ALE3
phases: 3, // assume 3 phase device
Opcodes: ops,
}
}

// Type implements Producer interface
Expand All @@ -57,7 +63,7 @@ func (p *SBCProducer) Type() string {

// Description implements Producer interface
func (p *SBCProducer) Description() string {
return "Saia Burgess Controls ALE3 meters"
return "Saia Burgess " + p.typ
}

// snip creates modbus operation
Expand Down Expand Up @@ -96,11 +102,23 @@ func (p *SBCProducer) snip32(iec Measurement, scaler ...float64) Operation {

// Identify implements Identifier interface
func (p *SBCProducer) Identify(bytes []byte) bool {
const b = "ALD1" // single phase
const b = "ALE3" // three phase direct
const b = "AWE3" // three phase converter
"D5" // oneway
"W5" // twoway
if len(bytes) < 4 {
return false
}

switch string(bytes[:4]) {
case "ALD1":
// single phase
p.phases = 1
case "ALE3", "AWE3":
// three phase direct/ converter
p.phases = 3
default:
return false
}

p.typ = string(bytes[:4])
return true
}

// Probe implements Producer interface
Expand Down
2 changes: 1 addition & 1 deletion meters/rs485/sdm.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (p *SDMProducer) Type() string {
}

func (p *SDMProducer) Description() string {
return "Eastron SDM meters"
return "Eastron SDM"
}

func (p *SDMProducer) snip(iec Measurement) Operation {
Expand Down

0 comments on commit 70bbc29

Please sign in to comment.