123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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<WindturbineStatus> GetWindturbineStatus(IList<string> wtIds, string stationId)
- {
- IList<WindturbineStatus> result = new List<WindturbineStatus>();
- 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;
- }
- }
- }
|