data

package
v0.0.0-...-478090f Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sys_rtd_topic_nil   = "必须指定设备编号!"
	Sys_rtd_cache_nil   = "有统计结果,应该有该设备的实时数据(没有发现该设备的实时数据记录)"
	Sys_rtd_redis_error = "更新redis中实时数据出现错误:%s"
	Sys_rtd_dt_error    = "解析nsq message 数据结构错误: %s"

	Sys_rtd_hd_time_fn = "窗口函数计算item时 ,提取 msg.body出错:%s"
	Sys_kd_redis       = "缓存实时状态错误:%s"
)
View Source
const (
	Uid          = "217480784078982112"             //阿里云iot账号
	AccessKey    = "LTAI4FqwXfmLeZWrxc93vtC9"       //opt账号key
	AccessSecret = "JGVByGJFNhh0qA6h74BUQe3vLQRZUC" //iot账号秘钥
	Region       = "cn-shanghai"                    //阿里云iot区域代码

	//NsqIP = "47.92.101.16:14150" //nsq 服务器地址 可以配置多个
	NsqIP        = "192.168.225.16:4150"        //nsq 服务器地址 可以配置多个
	NatsIp       = "nats://192.168.225.16:4222" //nots 服务器地址 可以多配
	MqttName     = "admin"                      //mqtt服务器的用户名
	MqttPassword = "public"                     //mqtt服务器的密码
	MqttUrl      = "tcp://192.168.225.16:11883" //mqtt服务器地址

	SettingSpeed       = 12000 //机器的锭子的理论定速
	Diff               = 33    //nsq服务器时钟与本地时钟的时间差值 秒(最好能统一时钟)
	RindexStart        = 1000  //机床左右两侧第二侧 相对于第一次的纱锭其实编码(左侧从0开始,右侧从1000开始)
	LRPostTimeInterval = 15    //机床左右两侧数据最大的时间间隔(大于这个时间的左右两条数据将被视为两次上报)
	DTLimitSpeed       = 60    //断头的阈值(纱锭转速低于该值,则判定为断头锭子)
	GZDTimeLimit       = 60    //故障锭子的判断周期 默认60分钟
	GZDCountLimit      = 5     //故障锭子判定周期时间内,数量界限,默认为5个

	KDTimeLimit = time.Second * 50 //空锭的时间间隔 秒

	TH1 = time.Second * 20 //滑锭的判断周期 默认一分钟
	CH1 = 5                //滑锭判定的边界值 (%)
	TH2 = time.Minute * 3  //严重滑锭的判断周期 默认一分钟
	CH2 = 10               //严重滑锭判定的边界值 (%)

	Da = 250 //主轴直径  mm
	Dp = 19  //锭带盘直径  mm
)

Variables

View Source
var (
	Redis       *gredis.Redis
	RedisConfig = gredis.Config{
		Host: "192.168.225.16",
		Port: 6379,
		Db:   1,
	}
)

Functions

func CheckBeforeHDToRedis

func CheckBeforeHDToRedis(m interface{}) (string, error)

更新redis 滑锭数据 之前,检查数据的有效性 m : 要发送到redis的数据

func NilByDefault

func NilByDefault(str string, defaultStr string) (reStr string, err error)

判断是否有值,没有则用默认值代替

func WaterMark

func WaterMark(emt interface{}) int64

提取当前记录的时间水印

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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