change -修改曲线

dep_yangw
frankiecao 11 months ago
commit b422b8cf71

@ -36,8 +36,8 @@
this.topFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.topFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.middleFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.middleFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.bottomPanelControl = new DevExpress.XtraEditors.PanelControl(); this.bottomPanelControl = new DevExpress.XtraEditors.PanelControl();
this.Loading = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::ProductionSystem.Forms.CommonForms.WaitForm1), true, true);
this.hslCurveHistory = new HslControls.HslCurveHistory(); this.hslCurveHistory = new HslControls.HslCurveHistory();
this.Loading = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::ProductionSystem.Forms.CommonForms.WaitForm1), true, true);
((System.ComponentModel.ISupportInitialize)(this.topPanelControl)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.topPanelControl)).BeginInit();
this.topPanelControl.SuspendLayout(); this.topPanelControl.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.stackPanel1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.stackPanel1)).BeginInit();
@ -55,9 +55,9 @@
this.topPanelControl.Controls.Add(this.stackPanel1); this.topPanelControl.Controls.Add(this.stackPanel1);
this.topPanelControl.Dock = System.Windows.Forms.DockStyle.Top; this.topPanelControl.Dock = System.Windows.Forms.DockStyle.Top;
this.topPanelControl.Location = new System.Drawing.Point(0, 0); this.topPanelControl.Location = new System.Drawing.Point(0, 0);
this.topPanelControl.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.topPanelControl.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.topPanelControl.Name = "topPanelControl"; this.topPanelControl.Name = "topPanelControl";
this.topPanelControl.Size = new System.Drawing.Size(1044, 33); this.topPanelControl.Size = new System.Drawing.Size(1193, 42);
this.topPanelControl.TabIndex = 6; this.topPanelControl.TabIndex = 6;
// //
// stackPanel1 // stackPanel1
@ -70,27 +70,27 @@
this.stackPanel1.Margin = new System.Windows.Forms.Padding(0); this.stackPanel1.Margin = new System.Windows.Forms.Padding(0);
this.stackPanel1.Name = "stackPanel1"; this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.stackPanel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.stackPanel1.Size = new System.Drawing.Size(1044, 33); this.stackPanel1.Size = new System.Drawing.Size(1193, 42);
this.stackPanel1.TabIndex = 0; this.stackPanel1.TabIndex = 0;
// //
// txtPLCConnectStatus // txtPLCConnectStatus
// //
this.txtPLCConnectStatus.Enabled = false; this.txtPLCConnectStatus.Enabled = false;
this.txtPLCConnectStatus.Location = new System.Drawing.Point(940, 6); this.txtPLCConnectStatus.Location = new System.Drawing.Point(1074, 9);
this.txtPLCConnectStatus.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.txtPLCConnectStatus.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.txtPLCConnectStatus.Name = "txtPLCConnectStatus"; this.txtPLCConnectStatus.Name = "txtPLCConnectStatus";
this.txtPLCConnectStatus.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); this.txtPLCConnectStatus.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
this.txtPLCConnectStatus.Properties.Appearance.Options.UseFont = true; this.txtPLCConnectStatus.Properties.Appearance.Options.UseFont = true;
this.txtPLCConnectStatus.Properties.Appearance.Options.UseTextOptions = true; this.txtPLCConnectStatus.Properties.Appearance.Options.UseTextOptions = true;
this.txtPLCConnectStatus.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.txtPLCConnectStatus.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.txtPLCConnectStatus.Properties.ReadOnly = true; this.txtPLCConnectStatus.Properties.ReadOnly = true;
this.txtPLCConnectStatus.Size = new System.Drawing.Size(100, 20); this.txtPLCConnectStatus.Size = new System.Drawing.Size(114, 24);
this.txtPLCConnectStatus.TabIndex = 2; this.txtPLCConnectStatus.TabIndex = 2;
// //
// cmbProductType // cmbProductType
// //
this.cmbProductType.Location = new System.Drawing.Point(780, 6); this.cmbProductType.Location = new System.Drawing.Point(890, 9);
this.cmbProductType.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.cmbProductType.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.cmbProductType.Name = "cmbProductType"; this.cmbProductType.Name = "cmbProductType";
this.cmbProductType.Properties.AppearanceFocused.Font = new System.Drawing.Font("Tahoma", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic)))); this.cmbProductType.Properties.AppearanceFocused.Font = new System.Drawing.Font("Tahoma", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))));
this.cmbProductType.Properties.AppearanceFocused.Options.UseFont = true; this.cmbProductType.Properties.AppearanceFocused.Options.UseFont = true;
@ -100,19 +100,19 @@
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.cmbProductType.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cmbProductType.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
this.cmbProductType.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmbProductType.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmbProductType.Size = new System.Drawing.Size(152, 20); this.cmbProductType.Size = new System.Drawing.Size(174, 24);
this.cmbProductType.TabIndex = 1; this.cmbProductType.TabIndex = 1;
this.cmbProductType.SelectedIndexChanged += new System.EventHandler(this.cmbProductType_SelectedIndexChanged); this.cmbProductType.SelectedIndexChanged += new System.EventHandler(this.cmbProductType_SelectedIndexChanged);
// //
// txtProductCode // txtProductCode
// //
this.txtProductCode.Location = new System.Drawing.Point(617, 6); this.txtProductCode.Location = new System.Drawing.Point(703, 9);
this.txtProductCode.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.txtProductCode.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.txtProductCode.Name = "txtProductCode"; this.txtProductCode.Name = "txtProductCode";
this.txtProductCode.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); this.txtProductCode.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
this.txtProductCode.Properties.Appearance.Options.UseFont = true; this.txtProductCode.Properties.Appearance.Options.UseFont = true;
this.txtProductCode.Properties.ReadOnly = true; this.txtProductCode.Properties.ReadOnly = true;
this.txtProductCode.Size = new System.Drawing.Size(155, 20); this.txtProductCode.Size = new System.Drawing.Size(177, 24);
this.txtProductCode.TabIndex = 3; this.txtProductCode.TabIndex = 3;
this.txtProductCode.EditValueChanged += new System.EventHandler(this.txtProductCode_EditValueChanged); this.txtProductCode.EditValueChanged += new System.EventHandler(this.txtProductCode_EditValueChanged);
// //
@ -122,10 +122,10 @@
this.topFlowLayoutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.topFlowLayoutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.topFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Top; this.topFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Top;
this.topFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.topFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.topFlowLayoutPanel.Location = new System.Drawing.Point(0, 33); this.topFlowLayoutPanel.Location = new System.Drawing.Point(0, 42);
this.topFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.topFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.topFlowLayoutPanel.Name = "topFlowLayoutPanel"; this.topFlowLayoutPanel.Name = "topFlowLayoutPanel";
this.topFlowLayoutPanel.Size = new System.Drawing.Size(1044, 150); this.topFlowLayoutPanel.Size = new System.Drawing.Size(1193, 192);
this.topFlowLayoutPanel.TabIndex = 8; this.topFlowLayoutPanel.TabIndex = 8;
// //
// middleFlowLayoutPanel // middleFlowLayoutPanel
@ -134,10 +134,10 @@
this.middleFlowLayoutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.middleFlowLayoutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.middleFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.middleFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.middleFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.middleFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.middleFlowLayoutPanel.Location = new System.Drawing.Point(0, 183); this.middleFlowLayoutPanel.Location = new System.Drawing.Point(0, 234);
this.middleFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.middleFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.middleFlowLayoutPanel.Name = "middleFlowLayoutPanel"; this.middleFlowLayoutPanel.Name = "middleFlowLayoutPanel";
this.middleFlowLayoutPanel.Size = new System.Drawing.Size(1044, 67); this.middleFlowLayoutPanel.Size = new System.Drawing.Size(1193, 87);
this.middleFlowLayoutPanel.TabIndex = 10; this.middleFlowLayoutPanel.TabIndex = 10;
this.middleFlowLayoutPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.middleFlowLayoutPanel_Paint); this.middleFlowLayoutPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.middleFlowLayoutPanel_Paint);
// //
@ -146,22 +146,18 @@
this.bottomPanelControl.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.bottomPanelControl.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.bottomPanelControl.Controls.Add(this.hslCurveHistory); this.bottomPanelControl.Controls.Add(this.hslCurveHistory);
this.bottomPanelControl.Dock = System.Windows.Forms.DockStyle.Bottom; this.bottomPanelControl.Dock = System.Windows.Forms.DockStyle.Bottom;
this.bottomPanelControl.Location = new System.Drawing.Point(0, 250); this.bottomPanelControl.Location = new System.Drawing.Point(0, 321);
this.bottomPanelControl.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.bottomPanelControl.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.bottomPanelControl.Name = "bottomPanelControl"; this.bottomPanelControl.Name = "bottomPanelControl";
this.bottomPanelControl.Size = new System.Drawing.Size(1044, 450); this.bottomPanelControl.Size = new System.Drawing.Size(1193, 579);
this.bottomPanelControl.TabIndex = 11; this.bottomPanelControl.TabIndex = 11;
// //
// Loading
//
this.Loading.ClosingDelay = 500;
//
// hslCurveHistory // hslCurveHistory
// //
this.hslCurveHistory.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(46)))), ((int)(((byte)(46))))); this.hslCurveHistory.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(46)))), ((int)(((byte)(46)))));
this.hslCurveHistory.ButtomHeight = 0; this.hslCurveHistory.ButtomHeight = 0;
this.hslCurveHistory.Cursor = System.Windows.Forms.Cursors.Arrow; this.hslCurveHistory.Cursor = System.Windows.Forms.Cursors.Arrow;
this.hslCurveHistory.CurveNameWidth = 100; this.hslCurveHistory.CurveNameWidth = 200;
this.hslCurveHistory.DashCoordinateColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(72)))), ((int)(((byte)(72))))); this.hslCurveHistory.DashCoordinateColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(72)))), ((int)(((byte)(72)))));
this.hslCurveHistory.DataTipWidth = 200; this.hslCurveHistory.DataTipWidth = 200;
this.hslCurveHistory.DateTimeFormate = "HH:mm:ss"; this.hslCurveHistory.DateTimeFormate = "HH:mm:ss";
@ -175,7 +171,7 @@
this.hslCurveHistory.Name = "hslCurveHistory"; this.hslCurveHistory.Name = "hslCurveHistory";
this.hslCurveHistory.RenderRightCoordinate = false; this.hslCurveHistory.RenderRightCoordinate = false;
this.hslCurveHistory.RightWidth = 2; this.hslCurveHistory.RightWidth = 2;
this.hslCurveHistory.Size = new System.Drawing.Size(1044, 450); this.hslCurveHistory.Size = new System.Drawing.Size(1193, 579);
this.hslCurveHistory.TabIndex = 2; this.hslCurveHistory.TabIndex = 2;
this.hslCurveHistory.Text = "hslCurveHistory1"; this.hslCurveHistory.Text = "hslCurveHistory1";
this.hslCurveHistory.TopCurveNameHeight = 20; this.hslCurveHistory.TopCurveNameHeight = 20;
@ -183,19 +179,23 @@
this.hslCurveHistory.ValueMaxRight = 5F; this.hslCurveHistory.ValueMaxRight = 5F;
this.hslCurveHistory.ValueSegment = 10; this.hslCurveHistory.ValueSegment = 10;
// //
// Loading
//
this.Loading.ClosingDelay = 500;
//
// HomeFormInfo // HomeFormInfo
// //
this.Appearance.BackColor = System.Drawing.Color.White; this.Appearance.BackColor = System.Drawing.Color.White;
this.Appearance.Options.UseBackColor = true; this.Appearance.Options.UseBackColor = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1044, 700); this.ClientSize = new System.Drawing.Size(1193, 900);
this.Controls.Add(this.middleFlowLayoutPanel); this.Controls.Add(this.middleFlowLayoutPanel);
this.Controls.Add(this.bottomPanelControl); this.Controls.Add(this.bottomPanelControl);
this.Controls.Add(this.topFlowLayoutPanel); this.Controls.Add(this.topFlowLayoutPanel);
this.Controls.Add(this.topPanelControl); this.Controls.Add(this.topPanelControl);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.Name = "HomeFormInfo"; this.Name = "HomeFormInfo";
this.Text = "HomeForm"; this.Text = "HomeForm";
this.Load += new System.EventHandler(this.HomeForm_Load); this.Load += new System.EventHandler(this.HomeForm_Load);

@ -1921,6 +1921,36 @@ namespace ProductionSystem.Forms
return tagDict; return tagDict;
} }
private string GetStep()
{
var dic = GetTagDict();
string str = "";
foreach (var item in dic)
{
string key = item.Key;
string value = item.Value;
var entity =
Program.CommandPointKeyValues.FirstOrDefault(m => m.Key == value);
if (entity != null)
{
var va = OmronHelper.GetPlcVal(entity.DataType, entity.Address);
if (va.Item2.ToDouble().ToInt() == 1)
{
str = key;
break;
}
}
}
return str;
}
@ -2471,30 +2501,46 @@ namespace ProductionSystem.Forms
//模拟数据 //模拟数据
for (int i = 0; i < Program.Times.Length; i++) for (int i = 0; i < Program.Times.Length; i++)
{ {
//Program.OutPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 200); var step = GetStep();
//Program.InPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 400);
//Program.GastankPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 600);
//Program.XVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 800);
//Program.YVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 1000);
var sbElecttricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(),GetStep());
var electricity = sbElecttricity.Electricity;
Program.CurrentData[i] = float.Parse(electricity);
Program.Times[i] = DateTime.Now.AddSeconds(i - 1000);
if (step == "BZ1")
{
var electricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(), step).Electricity;
Program.Current1Data[i] = float.Parse(electricity);
}
else if(step == "BZ2")
{
var electricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(), step).Electricity;
Program.Current2Data[i] = float.Parse(electricity);
}
else if (step == "BZ3")
{
var electricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(), step).Electricity;
Program.Current3Data[i] = float.Parse(electricity);
}
Program.Times[i] = DateTime.Now.AddSeconds(i - 1000);
} }
//if (Program.VoltageData.Length > 0) //if (Program.VoltageData.Length > 0)
//{ //{
// hslCurveHistory.SetLeftCurve("电压", Program.VoltageData, Color.DarkOliveGreen, CurveStyle.Curve, "{0:F2} V"); // hslCurveHistory.SetLeftCurve("电压", Program.VoltageData, Color.DarkOliveGreen, CurveStyle.Curve, "{0:F2} V");
//} //}
if (Program.CurrentData.Length > 0) if (Program.Current1Data.Length > 0)
{
hslCurveHistory.SetLeftCurve("水泵1电流", Program.Current1Data, Color.OrangeRed, CurveStyle.Curve, "{0:F2} A");
}
if (Program.Current2Data.Length > 0)
{
hslCurveHistory.SetLeftCurve("水泵2电流", Program.Current2Data, Color.YellowGreen, CurveStyle.Curve, "{0:F2} A");
}
if (Program.Current3Data.Length > 0)
{ {
hslCurveHistory.SetLeftCurve("电流", Program.CurrentData, Color.Yellow, CurveStyle.Curve, "{0:F2} A"); hslCurveHistory.SetLeftCurve("水泵3电流", Program.Current3Data, Color.LightBlue, CurveStyle.Curve, "{0:F2} A");
} }
if (Program.Times.Length > 0) if (Program.Times.Length > 0)
{ {
hslCurveHistory.SetDateTimes(Program.Times); hslCurveHistory.SetDateTimes(Program.Times);
} }
hslCurveHistory.ScrollToRight(); //hslCurveHistory.ScrollToRight();
// 将曲线显示出来 // 将曲线显示出来
hslCurveHistory.RenderCurveUI(); hslCurveHistory.RenderCurveUI();
} }

@ -427,7 +427,9 @@ namespace ProductionSystem
//public static float[] YVibrateData = new float[1000];//Y轴震动 //public static float[] YVibrateData = new float[1000];//Y轴震动
//public static float[] ZVibrateData = new float[1000];//Z轴震动 //public static float[] ZVibrateData = new float[1000];//Z轴震动
public static float[] VoltageData = new float[1000];//电压 public static float[] VoltageData = new float[1000];//电压
public static float[] CurrentData = new float[1000];//电流 public static float[] Current1Data = new float[1000];//水泵1电流
public static float[] Current2Data = new float[1000];//水泵2电流
public static float[] Current3Data = new float[1000];//水泵3电流
//public static float[] NoiseData = new float[1000];//噪音 //public static float[] NoiseData = new float[1000];//噪音
public static DateTime[] Times = new DateTime[1000]; public static DateTime[] Times = new DateTime[1000];

Loading…
Cancel
Save