You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.6 KiB
68 lines
1.6 KiB
1 month ago
|
package common_models
|
||
|
|
||
|
import "encoding/json"
|
||
|
|
||
|
const (
|
||
|
Filter_CalcMedian = 1 // 取中值
|
||
|
|
||
|
Filter_LimitAmp = 2 // 限幅
|
||
|
|
||
|
Filter_CalcMeanValue = 3 // 滑动平均
|
||
|
|
||
|
Filter_CalcStvMean = 4 // 方差判断平均
|
||
|
|
||
|
Filter_CalcWindow = 5 // 滤波算法
|
||
|
|
||
|
Filter_ExtreAverage = 6 // 去极值移动平均
|
||
|
|
||
|
Filter_WeightAverage = 7 // 加权滑动平均
|
||
|
|
||
|
Filter_MedianMean = 8 // 中值平均
|
||
|
|
||
|
Filter_RangeMean = 9 // 限幅平均
|
||
|
|
||
|
Filter_Interrupt = 10 // 中断
|
||
|
|
||
|
Filter_RandomReplacer = 9999 // 特殊算法: 数据替换
|
||
|
)
|
||
|
|
||
|
type Filter struct {
|
||
|
Items FilterItems
|
||
|
}
|
||
|
type FilterItems []FilterItem
|
||
|
|
||
|
func (t *FilterItems) MarshalBinary() (data []byte, err error) {
|
||
|
return json.Marshal(t)
|
||
|
}
|
||
|
|
||
|
func (t *FilterItems) UnmarshalBinary(data []byte) error {
|
||
|
return json.Unmarshal(data, t)
|
||
|
}
|
||
|
|
||
|
type FilterItem struct {
|
||
|
Item int `json:"item"`
|
||
|
FieldName string `json:"field_name"`
|
||
|
Name string `json:"name"`
|
||
|
MethodId int `json:"method"`
|
||
|
Params FilterParams `json:"Params"`
|
||
|
WindowSize int `json:"window_size"`
|
||
|
Iswork string `json:"iswork"` //没用,默认都是false,只要存在都是启用的
|
||
|
RInit float64 `json:"RInit"`
|
||
|
InternalParams InternalParams `json:"internal_params"`
|
||
|
R float64 `json:"R"`
|
||
|
InvalidCount int `json:"InvalidCount"`
|
||
|
}
|
||
|
|
||
|
type FilterParams struct {
|
||
|
Kt string `json:"Kt"`
|
||
|
Rt string `json:"Rt"`
|
||
|
Dt string `json:"Dt"`
|
||
|
Ru string `json:"Ru"`
|
||
|
}
|
||
|
type InternalParams struct {
|
||
|
Kt string `json:"kt"`
|
||
|
Rt string `json:"rt"`
|
||
|
Dt string `json:"dt"`
|
||
|
Ru string `json:"ru"`
|
||
|
}
|