123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using IntelligentControlForsx.Service.WindturbineControl.Domain;
- using Gyee_Control.Svc.Cache;
- namespace IntelligentControlForsx.MyControls
- {
- public partial class ControlLine : UserControl
- {
- public ControlLine()
- {
- InitializeComponent();
- }
- #region 风机编号
- private string windturbineId;
- public string WindturbineId
- {
- set
- {
- windturbineId = value;
- txtWindturbine.Text = value;
- }
- get { return windturbineId; }
- }
- #endregion
- #region 风速
- private string windSpeed;
- public string WindSpeed
- {
- set
- {
- windSpeed = value;
- txtWindSpeed.Text = value;
- }
- get { return windSpeed; }
- }
- #endregion
- #region 功率
- private string power;
- public string Power
- {
- set
- {
- power = value;
- txtPower.Text = value;
- }
- get { return power; }
- }
- #endregion
- #region 状态
- private string status;
- public string Status
- {
- set
- {
- status = value;
- txtStatus.Text = value;
- }
- get { return status; }
- }
- #endregion
- #region 发电机转速
- private string alternatorSpeed;
- public string AlternatorSpeed
- {
- set
- {
- alternatorSpeed = value;
- txtAlternatorSpeed.Text = value;
- }
- get { return alternatorSpeed; }
- }
- #endregion
- #region 叶轮转速
- private string laminaSpeed;
- public string LaminaSpeed
- {
- set
- {
- laminaSpeed = value;
- txtLaminaSpeed.Text = value;
- }
- get { return laminaSpeed; }
- }
- #endregion
- #region 限速值
- private string limitSpeed;
- public string LimitSpeed
- {
- set
- {
- limitSpeed = value;
- txtLimitSpeed.Text = value;
- }
- get { return limitSpeed; }
- }
- #endregion
- #region 桨叶角度1
- private string laminaAngle1;
- public string LaminaAngle1
- {
- set
- {
- laminaAngle1 = value;
- txtLaminaAngle1.Text = value;
- }
- get { return laminaAngle1; }
- }
- #endregion
- #region 桨叶角度2
- private string laminaAngle2;
- public string LaminaAngle2
- {
- set
- {
- laminaAngle2 = value;
- txtLaminaAngle2.Text = value;
- }
- get { return laminaAngle2; }
- }
- #endregion
- #region 桨叶角度3
- private string laminaAngle3;
- public string LaminaAngle3
- {
- set
- {
- laminaAngle3 = value;
- txtLaminaAngle3.Text = value;
- }
- get { return laminaAngle3; }
- }
- #endregion
- #region 对风角
- private string windAngle;
- public string WindAngle
- {
- set
- {
- windAngle = value;
- txtWindAngle.Text = value;
- }
- get { return windAngle; }
- }
- #endregion
- #region 偏航位置
- private string yawPosition;
- public string YawPosition
- {
- set
- {
- yawPosition = value;
- txtYawPosition.Text = value;
- }
- get { return yawPosition; }
- }
- #endregion
- private bool isCheck;
- public bool IsCheck
- {
- set
- {
- isCheck = value;
- ckbWindturbine.Checked = value;
- }
- get { return isCheck; }
- }
- /// <summary>
- /// 绑定数据方法
- /// </summary>
- /// <param name="data">信息</param>
- /// <param name="row">所属行</param>
- /// <param name="isHead">是否为表头</param>
- public void BindData(WindturbinePointData data, int row, bool isHead)
- {
- if (isHead)
- {
- WindturbineId = "风机编号";
- WindSpeed = "实时风速";
- Power = "功率";
- Status = "状态";
- AlternatorSpeed = "发电机转速";
- LaminaSpeed = "叶轮转速";
- LimitSpeed = "限速值";
- LaminaAngle1 = "桨叶1角度";
- LaminaAngle2 = "桨叶2角度";
- LaminaAngle3 = "桨叶2角度";
- WindAngle = "对风角";
- YawPosition = "偏航位置";
- panel1.BackColor = Color.FromArgb(26, 71, 94);
- panel3.BackColor = Color.FromArgb(26, 71, 94);
- ckbWindturbine.Visible = false;
- panel1.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- panel3.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- ckbWindturbine.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtWindturbine.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtWindAngle.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtLaminaAngle3.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtLaminaAngle2.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtLaminaAngle1.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtLimitSpeed.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtLaminaSpeed.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtAlternatorSpeed.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtStatus.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtPower.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtWindSpeed.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- txtYawPosition.Font = new Font("微软雅黑", (float)11.25, FontStyle.Bold);
- }
- else
- {
- if (data.IsSelect)
- {
- panel1.BackColor = Color.FromArgb(51, 144, 255);
- panel3.BackColor = Color.FromArgb(51, 144, 255);
- ckbWindturbine.BackColor = Color.FromArgb(51, 144, 255);
- txtWindturbine.BackColor = Color.FromArgb(51, 144, 255);
- txtWindAngle.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle3.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle2.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle1.BackColor = Color.FromArgb(51, 144, 255);
- txtLimitSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtAlternatorSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtStatus.BackColor = Color.FromArgb(51, 144, 255);
- txtPower.BackColor = Color.FromArgb(51, 144, 255);
- txtWindSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtYawPosition.BackColor = Color.FromArgb(51, 144, 255);
- }
- else
- {
- if (row % 2 == 0)
- {
- panel1.BackColor = Color.FromArgb(0, 52, 73);
- panel3.BackColor = Color.FromArgb(0, 52, 73);
- ckbWindturbine.BackColor = Color.FromArgb(0, 52, 73);
- txtWindturbine.BackColor = Color.FromArgb(0, 52, 73);
- txtWindAngle.BackColor = Color.FromArgb(0, 52, 73);
- txtLaminaAngle3.BackColor = Color.FromArgb(0, 52, 73);
- txtLaminaAngle2.BackColor = Color.FromArgb(0, 52, 73);
- txtLaminaAngle1.BackColor = Color.FromArgb(0, 52, 73);
- txtLimitSpeed.BackColor = Color.FromArgb(0, 52, 73);
- txtLaminaSpeed.BackColor = Color.FromArgb(0, 52, 73);
- txtAlternatorSpeed.BackColor = Color.FromArgb(0, 52, 73);
- txtStatus.BackColor = Color.FromArgb(0, 52, 73);
- txtPower.BackColor = Color.FromArgb(0, 52, 73);
- txtWindSpeed.BackColor = Color.FromArgb(0, 52, 73);
- txtYawPosition.BackColor = Color.FromArgb(0, 52, 73);
- }
- else
- {
- panel1.BackColor = Color.FromArgb(26, 71, 94);
- panel3.BackColor = Color.FromArgb(26, 71, 94);
- ckbWindturbine.BackColor = Color.FromArgb(26, 71, 94);
- txtWindturbine.BackColor = Color.FromArgb(26, 71, 94);
- txtWindAngle.BackColor = Color.FromArgb(26, 71, 94);
- txtLaminaAngle3.BackColor = Color.FromArgb(26, 71, 94);
- txtLaminaAngle2.BackColor = Color.FromArgb(26, 71, 94);
- txtLaminaAngle1.BackColor = Color.FromArgb(26, 71, 94);
- txtLimitSpeed.BackColor = Color.FromArgb(26, 71, 94);
- txtLaminaSpeed.BackColor = Color.FromArgb(26, 71, 94);
- txtAlternatorSpeed.BackColor = Color.FromArgb(26, 71, 94);
- txtStatus.BackColor = Color.FromArgb(26, 71, 94);
- txtPower.BackColor = Color.FromArgb(26, 71, 94);
- txtWindSpeed.BackColor = Color.FromArgb(26, 71, 94);
- txtYawPosition.BackColor = Color.FromArgb(26, 71, 94);
- }
- }
- WindturbineId = data.WindturbineName;
- WindSpeed = data.WindSpeed.ToString("f2") + "m/s";
- Power = data.Power.ToString("f2") + "kW";
- switch (data.Status)
- {
- case WindturbineStatus.Standby:
- Status = "待机";
- break;
- case WindturbineStatus.OnPower:
- Status = "上电";
- break;
- case WindturbineStatus.Maintain:
- Status = "维护";
- break;
- case WindturbineStatus.Fault:
- Status = "故障";
- break;
- case WindturbineStatus.Start:
- Status = "启动";
- break;
- case WindturbineStatus.Online:
- Status = "并网";
- break;
- case WindturbineStatus.Stop:
- Status = "停机";
- break;
- case WindturbineStatus.Offline:
- Status = "离线";
- break;
- }
- AlternatorSpeed = data.AlternatorSpeed.ToString("f2") + " rpm";
- LaminaSpeed = data.LimitSpeed.ToString("f2") + " rpm"; ;
- LimitSpeed = "17 rpm";
- LaminaAngle1 = data.LaminaAngle1.ToString("f2") + "°";
- LaminaAngle2 = data.LaminaAngle2.ToString("f2") + "°";
- LaminaAngle3 = data.LaminaAngle3.ToString("f2") + "°";
- WindAngle = data.WindAngle.ToString("f2") + "°";
- YawPosition = data.YawPosition.ToString("f2") + "°";
- panel1.BackColor = Color.FromArgb(26, 71, 94);
- panel3.BackColor = Color.FromArgb(26, 71, 94);
- }
- }
- private void ckbWindturbine_CheckedChanged(object sender, EventArgs e)
- {
- string windturbineName = this.Name;
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- if (CacheInfo.CacheWindturbineDataList[i].WindturbineName == windturbineName)
- {
- if (CacheInfo.CacheWindturbineDataList[i].IsCheck)
- CacheInfo.CacheWindturbineDataList[i].IsCheck = false;
- else
- CacheInfo.CacheWindturbineDataList[i].IsCheck = true;
- }
- }
- IsCheck = ckbWindturbine.Checked;
- }
- private void ControlLine_Click(object sender, EventArgs e)
- {
- panel1.BackColor = Color.FromArgb(51, 144, 255);
- panel3.BackColor = Color.FromArgb(51, 144, 255);
- ckbWindturbine.BackColor = Color.FromArgb(51, 144, 255);
- txtWindturbine.BackColor = Color.FromArgb(51, 144, 255);
- txtWindAngle.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle3.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle2.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle1.BackColor = Color.FromArgb(51, 144, 255);
- txtLimitSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtAlternatorSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtStatus.BackColor = Color.FromArgb(51, 144, 255);
- txtPower.BackColor = Color.FromArgb(51, 144, 255);
- txtWindSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtYawPosition.BackColor = Color.FromArgb(51, 144, 255);
- }
- public event EventHandler MyClick;
- private void textBox_Click(object sender, EventArgs e)
- {
- panel1.BackColor = Color.FromArgb(51, 144, 255);
- panel3.BackColor = Color.FromArgb(51, 144, 255);
- ckbWindturbine.BackColor = Color.FromArgb(51, 144, 255);
- txtWindturbine.BackColor = Color.FromArgb(51, 144, 255);
- txtWindAngle.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle3.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle2.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaAngle1.BackColor = Color.FromArgb(51, 144, 255);
- txtLimitSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtLaminaSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtAlternatorSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtStatus.BackColor = Color.FromArgb(51, 144, 255);
- txtPower.BackColor = Color.FromArgb(51, 144, 255);
- txtWindSpeed.BackColor = Color.FromArgb(51, 144, 255);
- txtYawPosition.BackColor = Color.FromArgb(51, 144, 255);
- MyClick(this.WindturbineId, e);
- }
- }
- }
|