using NEIntelligentControl2.Models.Datas; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NEIntelligentControl2.Models.PV { /// /// 光伏标签点信息 /// public class PVTagInfo { /// /// 名称 /// public string Name { get; set; } private string code; /// /// UniformCode /// public string Code { get => code; set { code = value; Codes = code.Split(','); } } /// /// UniformCode们 /// public string[] Codes { get; set; } /// /// 单位 /// public string Unit { get; set; } /// /// 是否忽视此标签点 /// public bool IsIgnore { get; set; } /// /// 标签类型 /// public PVTagType Type { get; set; } /// /// 值 /// private double value; public double Value { get { return value; } set { this.value = value; ValueChanged?.Invoke(this.value); } } /// /// 值改变 /// public Action ValueChanged { get; set; } /// /// 数据历史值改变 /// public Action> HistoryValueChanged { get; set; } internal void UpdateValue(Dictionary vs) { if (vs == null || this.Code == null) return; double d = 0; foreach (var v in Codes) { if (!vs.ContainsKey(v)) continue; d += vs[v].Value; } this.Value = d; } /// /// 更新历史数据 /// internal void UpdateHistoryData(List vs) { HistoryValueChanged?.Invoke(this, vs); } } /// /// 光伏标签类型 /// public enum PVTagType { /// /// 其他(默认) /// Other, /// /// 温度 /// Temperature, /// /// 功率 /// Power, /// /// 光照强度 /// Sunshine, } }