123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using IntelligentControlForsx.Service.WindturbineControl.Domain;
- using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd;
- using Gyee_Control.Svc.Cache;
- namespace IntelligentControlForsx.Service.WindturbineControl.FormInfoSvc
- {
- public class GridViewDataSvc
- {
- private static GridViewDataSvc gridViewDataSvc = new GridViewDataSvc();
- private GridViewDataSvc()
- {
- }
- public static GridViewDataSvc GetGridViewDataSvc()
- {
- return gridViewDataSvc;
- }
- public DataTable GetDataTableHeaders()
- {
- DataTable dataTable = new DataTable();
- dataTable.Columns.Add("风机名称");
- dataTable.Columns.Add("风速");
- dataTable.Columns.Add("功率");
- dataTable.Columns.Add("状态");
- dataTable.Columns.Add("挂牌");
- dataTable.Columns.Add("发电机转速");
- dataTable.Columns.Add("叶轮转速");
- dataTable.Columns.Add("转速限值");
- dataTable.Columns.Add("桨叶角度1");
- dataTable.Columns.Add("桨叶角度2");
- dataTable.Columns.Add("桨叶角度3");
- dataTable.Columns.Add("对风角度");
- dataTable.Columns.Add("偏航位置");
- return dataTable;
- }
- public DataTable GetDataTableByTimer(string stationCode, string project)
- {
- DataTable resultTable = GetDataTableHeaders();
- bool isNull = false;
- string[] project1 = { "SG01_01", "SG01_02", "SG01_03", "SG01_04", "SG01_05", "SG01_06", "SG01_07", "SG01_08", "SG01_09", "SG01_10", "SG01_11", "SG01_12", "SG01_13", "SG01_14", "SG01_15", "SG01_16", "SG01_17", "SG01_18", "SG01_19", "SG01_20", "SG01_21", "SG01_22", "SG01_23", "SG01_24", "SG01_25", "SG01_26", "SG01_27", "SG01_28", "SG01_29", "SG01_30", "SG01_31", "SG01_32", "SG01_33" };
- string[] project2 = { "SG01_34", "SG01_35", "SG01_36", "SG01_37", "SG01_38", "SG01_39", "SG01_40", "SG01_41", "SG01_42", "SG01_43", "SG01_44", "SG01_45", "SG01_46", "SG01_47", "SG01_48", "SG01_49", "SG01_50", "SG01_51", "SG01_52", "SG01_53", "SG01_54", "SG01_55", "SG01_56", "SG01_57", "SG01_58", "SG01_59", "SG01_60", "SG01_61", "SG01_62", "SG01_63", "SG01_64", "SG01_65", "SG01_66" };
- string[] project3 = { "SG01_67", "SG01_68", "SG01_69", "SG01_70", "SG01_71", "SG01_72", "SG01_73", "SG01_74", "SG01_75", "SG01_76", "SG01_77", "SG01_78", "SG01_79", "SG01_80", "SG01_81", "SG01_82", "SG01_83", "SG01_84", "SG01_85", "SG01_86", "SG01_87", "SG01_88", "SG01_89", "SG01_90", "SG01_91" };
- string[] project4 = { "SG01_100", "SG01_101", "SG01_102", "SG01_103", "SG01_104", "SG01_105", "SG01_106", "SG01_107", "SG01_108", "SG01_109", "SG01_110", "SG01_111", "SG01_112", "SG01_113", "SG01_114", "SG01_115", "SG01_116", "SG01_92", "SG01_93", "SG01_94", "SG01_95", "SG01_96", "SG01_97", "SG01_98", "SG01_99" };
- IList<string> projectList = new List<string>();
- if (project == "1")
- {
- projectList = project1.ToList();
- }
- if (project == "2")
- {
- projectList = project2.ToList();
- }
- if (project == "3")
- {
- projectList = project3.ToList();
- }
- if (project == "4")
- {
- projectList = project4.ToList();
- }
- IList<WindturbinePointData> pointDataList = CacheInfo.CacheWindturbineDataList.Where(s => s.StationId == stationCode && projectList.Contains(s.WindturbineName)).ToList().OrderBy(k => k.WindturbineName).ToList().OrderBy(s => Convert.ToInt32(Regex.Replace(s.WindturbineName, "[a-zA-Z]", "").Replace("_", ""))).ToList();
- //根据风机编号进行排序
- for (int i = 0; i < pointDataList.Count; i++)
- {
- if (pointDataList[i] == null)
- isNull = true;
- }
- if (!isNull)
- {
- for (int i = 0; i < pointDataList.Count; i++)
- {
- #region 生成GridView信息
- DataRow row = resultTable.NewRow();
- row["风机名称"] = pointDataList[i].WindturbineName;
- row["风速"] = pointDataList[i].WindSpeed.ToString("f2") + "m/s";
- row["功率"] = pointDataList[i].Power.ToString("f2") + "kW";
- switch (pointDataList[i].Status)
- {
- case WindturbineStatus.Standby:
- row["状态"] = "待机";
- break;
- case WindturbineStatus.OnPower:
- row["状态"] = "上电";
- break;
- case WindturbineStatus.Maintain:
- row["状态"] = "维护";
- break;
- case WindturbineStatus.Fault:
- row["状态"] = "故障";
- break;
- case WindturbineStatus.Start:
- row["状态"] = "启动";
- break;
- case WindturbineStatus.Online:
- row["状态"] = "并网";
- break;
- case WindturbineStatus.Stop:
- row["状态"] = "停机";
- break;
- case WindturbineStatus.Offline:
- row["状态"] = "离线";
- break;
- }
- switch (pointDataList[i].HungType)
- {
- case HungType.UnLock:
- row["挂牌"] = "正常";
- break;
- case HungType.StationCheckLock:
- row["挂牌"] = "场内受累检修";
- break;
- case HungType.StationFaulLockt:
- row["挂牌"] = "场内受累故障";
- break;
- case HungType.StationPowerLineLock:
- row["挂牌"] = "场外受累电网";
- break;
- case HungType.StationWeatherLock:
- row["挂牌"] = "场外受累天气";
- break;
- case HungType.FaultLock:
- row["挂牌"] = "故障检修";
- break;
- case HungType.CheckLock:
- row["挂牌"] = "检修";
- break;
-
- }
- row["发电机转速"] = pointDataList[i].AlternatorSpeed.ToString("f2") + "rpm";
- row["叶轮转速"] = pointDataList[i].LaminaSpeed.ToString("f2") + "rpm";
- row["转速限值"] = "17rpm";
- row["桨叶角度1"] = pointDataList[i].LaminaAngle1.ToString("f2") + "°";
- row["桨叶角度2"] = pointDataList[i].LaminaAngle2.ToString("f2") + "°";
- row["桨叶角度3"] = pointDataList[i].LaminaAngle3.ToString("f2") + "°";
- row["对风角度"] = pointDataList[i].WindAngle.ToString("f2") + "°";
- row["偏航位置"] = pointDataList[i].YawPosition.ToString("f2") + "°";
- resultTable.Rows.Add(row);
- #endregion
- }
- }
- return resultTable;
- }
- }
- }
|