|
|
@@ -5,6 +5,7 @@ import (
|
|
|
"MeterService/dataStruct"
|
|
|
"MeterService/service/rtuService"
|
|
|
"errors"
|
|
|
+ "math"
|
|
|
"reflect"
|
|
|
"runtime"
|
|
|
)
|
|
|
@@ -34,13 +35,13 @@ func CollectTest(w rtuService.RtuNetPgr, ref *dataStruct.MeterRef) (*dataStruct.
|
|
|
func test001(adu []byte, s *dataStruct.CollectData) {
|
|
|
var (
|
|
|
index = 0
|
|
|
- m int16
|
|
|
)
|
|
|
- m = int16(uint16(adu[index])<<8 | uint16(adu[index+1]))
|
|
|
- s.Ua = float32(m)
|
|
|
- index += 16
|
|
|
- s.Ia = float32(m)
|
|
|
- logger.Debug("TEST 采集成功 DATA:%v %v", s.Ua, s.Ia)
|
|
|
-}
|
|
|
+ m := uint32(adu[index])<<24 | uint32(adu[index+1])<<16 | uint32(adu[index+2])<<8 | uint32(adu[index+3])
|
|
|
|
|
|
-//
|
|
|
+ ua := math.Float32frombits(m)
|
|
|
+ logger.Debug("TEST 01采集成功 UA:%v %v", ua, m)
|
|
|
+ index += 32
|
|
|
+ n := uint32(adu[index])<<24 | uint32(adu[index+1])<<16 | uint32(adu[index+2])<<8 | uint32(adu[index+3])
|
|
|
+ ia := math.Float32frombits(n)
|
|
|
+ logger.Debug("TEST 01采集成功 IA:%v %v", ia, n)
|
|
|
+}
|