1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 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;
-
-
-
- public string Code { get => code; set { code = value; Codes = code.Split(','); } }
-
-
-
- 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<double> ValueChanged { get; set; }
-
-
-
- public Action<PVTagInfo, List<TsData>> HistoryValueChanged { get; set; }
- internal void UpdateValue(Dictionary<string, TsData> 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<TsData> vs)
- {
- HistoryValueChanged?.Invoke(this, vs);
- }
- }
-
-
-
- public enum PVTagType
- {
-
-
-
- Other,
-
-
-
- Temperature,
-
-
-
- Power,
-
-
-
- Sunshine,
- }
- }
|