glt

package module
v0.0.0-...-8b87b47 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GLT

DLT645-2007 or DLT645-1997 protocol support using golang

DL/T-1997和DL/T-2007数据标识尚未补全,但基础参数已可以使用,包含如下:

可获取参数
(当前)正向有功总电能
(当前)反向有功总电能
A相电压
B相电压
C相电压
A相电流
B相电流
C相电流
瞬时有功功率
A相有功功率
B相有功功率
C相有功功率
瞬时无功功率
A相无功功率
B相无功功率
C相无功功率
总功率因数

Documentation

Index

Constants

View Source
const (
	Protocol2007 = "DL/T-2007"
	Protocol1997 = "DL/T-1997"
)

Variables

This section is empty.

Functions

func Add33H

func Add33H(marker []byte) []byte

func BytesReverse

func BytesReverse(str string) ([]byte, error)

func CheckSum

func CheckSum(bytes []byte) byte

func DLT1997

func DLT1997(address string, dataMarker string) []byte

func DLT2007

func DLT2007(address string, dataMarker string) []byte

func GetValue

func GetValue(protocol string, b []byte) []byte

DL/T-1997和DL/T-2007第9个字节均代表实际参数长度

func IgnoreFrontGuide

func IgnoreFrontGuide(b []byte) []byte

func NewSerial

func NewSerial(serial *SerialPort) error

func Response

func Response(protocol string, response []byte, register string) (no string, value float64, err error)

func Sub33H

func Sub33H(marker []byte) []byte

func VerifyResponse

func VerifyResponse(b []byte) bool

Types

type Frame

type Frame interface {
	RequestFrameAssemble()
}

type Master

type Master struct {
	MasterRequestFrame []byte

	SlaveResponseFrame chan []byte

	SerialPort
}
var DLT645Master *Master

type SerialPort

type SerialPort struct {
	Locker   sync.Mutex
	Address  string
	Port     serial.Port
	BaudRate int
	DataBit  int
	StopBits int
	Parity   string
}

func (*SerialPort) Open

func (s *SerialPort) Open() (serial.Port, error)

func (*SerialPort) Read

func (s *SerialPort) Read() ([]byte, error)

func (*SerialPort) Request

func (s *SerialPort) Request(protocol string, address string, dataMarker string) (no string, vlaue float64, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址