vfdio

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package vfdio contains the Huanyango library. It can control a Huanyang VFD via RS485.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HyInverter

type HyInverter struct {
	// contains filtered or unexported fields
}

HyInverter is the base of a VFD controller. It contains the configuration and run time variables. Example usage:

handle := &HyInverter{}
handle.Open("/dev/ttyUSB0", 11520, 3.47222, 750)
defer handle.Close()
handle.GCode("M3 S300")

func NewVfd

func NewVfd() *HyInverter

NewVfd creates an empty data struct. Please call Open and defer Close.

func (*HyInverter) Close

func (o *HyInverter) Close()

Close closes all handles and goroutines.

func (*HyInverter) GCode

func (o *HyInverter) GCode(cmd string) (ok bool)

GCode is the external control input. It accepts string messages in the standard G-Code format. Accepted commands: M2, M3, M4, M5, Sxxx. Aliases for M5: M0, M1, M30, M60. Returns true if the command stack has space for the new input.

func (*HyInverter) Online

func (o *HyInverter) Online() bool

Online returns true if the last received message by the VFD was lately.

func (*HyInverter) Open

func (o *HyInverter) Open(portName string, maxRpm uint16, rpmToHertz float64, rpmPollInterval int64) (err error)

Open inits a serial port handle and creates all required goroutines. Param portName: OS specific refence to a serial port (examples - Windows: COM3, Linux: /dev/ttyUSB0). Param maxRpm: Maximum allowed and outputed rpm - for instance 11520 /min. Param rpmToHertz: This constant is used to calculate the set frequency for the VFD. If unknown, set to 1 and check the VFD display to calculate this value afterwards. Param rpmPollInterval: This is used to regularly check the is value of the output frequency.

func (*HyInverter) OutputFrequency

func (o *HyInverter) OutputFrequency() uint16

OutputFrequency returns the raw value from the VFD. Please also check Online() to see if the value is valid.

func (*HyInverter) OutputRpm

func (o *HyInverter) OutputRpm() uint16

OutputRpm returns the converted output frequency (rpm := output_frequency / rpm-to-hertz). Please also check Online() to see if the value is valid.

Jump to

Keyboard shortcuts

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