using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using EntityDataSet; using IntelligentControlForsx.Model; using IntelligentControlForsx.Common; using WisdomClient.data; using WisdomClient; using log4net; namespace IntelligentControlForsx.Service { public class PredictService { //private ILog logger = LogManager.GetLogger("AppInfoLog"); public static Random random = new Random(); public static StationPredict GetStationPredict(String stationId) { StationPredict sp = new StationPredict(stationId); try { StationStatus ss = CacheService.Instance.StationStatusDictionary[stationId]; ss.RefreshBasicWindturbineStatus(); var wsDict = ss.WindturbineStatusDictionary; foreach(var ws in wsDict.Values) { //限电5》运行1》待机0》维护4》故障2》离线3 // case 0: //停机状态 // return Color.FromArgb(176, 151, 63); //case 1: //上电状态 // return Color.FromArgb(177, 14, 126); //case 2: //待机状态 // return Color.FromArgb(15, 141, 106); //case 3: //启动状态 // return Color.FromArgb(14, 72, 91); //case 4: //并网状态 // return Color.FromArgb(15, 135, 170); //case 5: //故障状态 // return Color.FromArgb(170, 15, 59); //case 6: //维护状态 // return Color.FromArgb(204, 83, 51); //case 7: //离线状态 // return Color.FromArgb(134, 150, 165); if (ws.GetStatus() == 4 || ws.GetStatus() == 3) { if (sp.StopList.Count < 10) { sp.StopList.Add(ws); } } else if (ws.GetStatus() == 2) { if (sp.StartupList.Count < 10) { sp.StartupList.Add(ws); } if (sp.MaintainList.Count < 10) { sp.MaintainList.Add(ws); } } else if (ws.GetStatus() == 5) { sp.ResetList.Add(ws); } else if (ws.GetStatus() == 6) { if (sp.CancelMaintainList.Count < 10) { sp.CancelMaintainList.Add(ws); } } else { } } } catch (Exception ex) { Console.WriteLine(ex.Message); //logger.Error(ex); } return sp; } public static IList GetWindturbineStatus(IList wtIds, string stationId) { IList result = new List(); try { StationStatus ss = CacheService.Instance.StationStatusDictionary[stationId]; ss.RefreshBasicWindturbineStatus(); var wsDict = ss.WindturbineStatusDictionary; foreach (var ws in wsDict.Values) { if (wtIds.Contains(ws.WindturbineId)) { result.Add(ws); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } return result; } } }