20230327Change

This commit is contained in:
17860779768 2023-03-27 09:18:12 +08:00
parent 249b04a370
commit 03a74cc536
4 changed files with 144 additions and 125 deletions

View File

@ -1985,8 +1985,8 @@ namespace BRS.Process.A020
{
ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0
//ProcessWriteInt(MelsecPLC, "D171", "int", "3000");//最大扭矩3000
ProcessWriteInt(MelsecPLC, "D55", "int", "1");//自动拧紧螺丝D55置1
ProcessWriteInt(MelsecPLC, "D155", "int", "10");//扭矩到目标设定值计时设定值设为1秒
//ProcessWriteInt(MelsecPLC, "D55", "int", "1");//自动拧紧螺丝D55置1
ProcessWriteInt(MelsecPLC, "D155", "int", "20");//扭矩到目标设定值计时设定值设为1秒
//ProcessWriteInt(MelsecPLC, "D161", "int", "200");//D161,旋转所需圈数最小值
//ProcessWriteInt(MelsecPLC, "D163", "int", "400");//D163,旋转所需圈数最大值
//ProcessWriteInt(MelsecPLC, "D151", "int", "200");//高速拧紧超时计时设定值设为20s
@ -2006,7 +2006,7 @@ namespace BRS.Process.A020
Task.Run(() =>
{
ShaftOperateOnce(MelsecPLC, "D1", 500);//D1置1延时500后置0
//ShaftOperateOnce(MelsecPLC, "D55", 500);//自动拧紧螺丝标志位先置10.5s后置0
ShaftOperateOnce(MelsecPLC, "D55", 500);//自动拧紧螺丝标志位先置10.5s后置0
});
IsSingleStepOperating = false;
}

View File

@ -47,6 +47,7 @@ namespace BRS.Process.A020.UI
this.chart2 = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.uiPanel1 = new Sunny.UI.UIPanel();
this.BtnSeries = new Sunny.UI.UIPanel();
this.label13 = new System.Windows.Forms.Label();
this.ManualLoosenBtn = new Sunny.UI.UIButton();
this.AutoToughBtn1 = new Sunny.UI.UIButton();
this.AutoLoosenBtn1 = new Sunny.UI.UIButton();
@ -66,21 +67,17 @@ namespace BRS.Process.A020.UI
this.textBox3 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.LightSeries = new Sunny.UI.UIPanel();
this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.ToughLight1 = new BRS.Process.A020.UI.CircleButton();
this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton();
this.label12 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.uiPanel2 = new Sunny.UI.UIPanel();
this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton();
this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton();
this.label14 = new System.Windows.Forms.Label();
this.TestBtn = new Sunny.UI.UIButton();
this.StopBtn2 = new Sunny.UI.UIButton();
this.StartBtn1 = new Sunny.UI.UIButton();
this.ESBtn = new BRS.Process.A020.UI.CircleButton();
this.AutoLoosenBtn = new Sunny.UI.UIButton();
this.AutoToughBtn = new Sunny.UI.UIButton();
this.uiLabel2 = new Sunny.UI.UILabel();
@ -91,10 +88,13 @@ namespace BRS.Process.A020.UI
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.ManualLight = new BRS.Process.A020.UI.CircleButton();
this.AutoLight = new BRS.Process.A020.UI.CircleButton();
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.ToughLight1 = new BRS.Process.A020.UI.CircleButton();
this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton();
this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton();
this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton();
this.ESBtn = new BRS.Process.A020.UI.CircleButton();
((System.ComponentModel.ISupportInitialize)(this.chart2)).BeginInit();
this.uiPanel1.SuspendLayout();
this.BtnSeries.SuspendLayout();
@ -268,6 +268,17 @@ namespace BRS.Process.A020.UI
this.BtnSeries.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.BtnSeries.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// label13
//
this.label13.BackColor = System.Drawing.Color.Transparent;
this.label13.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label13.Location = new System.Drawing.Point(1, 3);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(123, 47);
this.label13.TabIndex = 37;
this.label13.Text = "操作按钮";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ManualLoosenBtn
//
this.ManualLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand;
@ -384,6 +395,7 @@ namespace BRS.Process.A020.UI
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(134, 30);
this.textBox1.TabIndex = 24;
this.textBox1.Text = "2000";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label5
@ -429,6 +441,7 @@ namespace BRS.Process.A020.UI
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(134, 30);
this.textBox5.TabIndex = 34;
this.textBox5.Text = "200";
this.textBox5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// textBox2
@ -438,6 +451,7 @@ namespace BRS.Process.A020.UI
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(134, 30);
this.textBox2.TabIndex = 28;
this.textBox2.Text = "5";
this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label9
@ -469,6 +483,7 @@ namespace BRS.Process.A020.UI
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(134, 30);
this.textBox4.TabIndex = 32;
this.textBox4.Text = "160";
this.textBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// textBox3
@ -478,6 +493,7 @@ namespace BRS.Process.A020.UI
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(134, 30);
this.textBox3.TabIndex = 30;
this.textBox3.Text = "15";
this.textBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label8
@ -516,41 +532,27 @@ namespace BRS.Process.A020.UI
this.LightSeries.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.LightSeries.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// MoveStateLight1
// label12
//
this.MoveStateLight1.BackColor = System.Drawing.Color.Gray;
this.MoveStateLight1.Location = new System.Drawing.Point(17, 7);
this.MoveStateLight1.Name = "MoveStateLight1";
this.MoveStateLight1.Size = new System.Drawing.Size(90, 90);
this.MoveStateLight1.TabIndex = 3;
this.MoveStateLight1.UseVisualStyleBackColor = false;
this.label12.AutoSize = true;
this.label12.BackColor = System.Drawing.Color.Silver;
this.label12.Location = new System.Drawing.Point(668, 100);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(106, 42);
this.label12.TabIndex = 27;
this.label12.Text = "自动拧松状态\r\n指示灯";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// StopStateLight1
// label11
//
this.StopStateLight1.BackColor = System.Drawing.Color.Gray;
this.StopStateLight1.Location = new System.Drawing.Point(148, 7);
this.StopStateLight1.Name = "StopStateLight1";
this.StopStateLight1.Size = new System.Drawing.Size(90, 90);
this.StopStateLight1.TabIndex = 15;
this.StopStateLight1.UseVisualStyleBackColor = false;
//
// ToughLight1
//
this.ToughLight1.BackColor = System.Drawing.Color.Gray;
this.ToughLight1.Location = new System.Drawing.Point(279, 7);
this.ToughLight1.Name = "ToughLight1";
this.ToughLight1.Size = new System.Drawing.Size(90, 90);
this.ToughLight1.TabIndex = 16;
this.ToughLight1.UseVisualStyleBackColor = false;
//
// LoosenLight1
//
this.LoosenLight1.BackColor = System.Drawing.Color.Gray;
this.LoosenLight1.Location = new System.Drawing.Point(410, 7);
this.LoosenLight1.Name = "LoosenLight1";
this.LoosenLight1.Size = new System.Drawing.Size(90, 90);
this.LoosenLight1.TabIndex = 17;
this.LoosenLight1.UseVisualStyleBackColor = false;
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Silver;
this.label11.Location = new System.Drawing.Point(537, 100);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(106, 42);
this.label11.TabIndex = 26;
this.label11.Text = "自动拧紧状态\r\n指示灯";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
@ -613,29 +615,16 @@ namespace BRS.Process.A020.UI
this.uiPanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiPanel2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// AutoBtn1
// label14
//
this.AutoBtn1.BackColor = System.Drawing.Color.Gray;
this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.AutoBtn1.Location = new System.Drawing.Point(3, 73);
this.AutoBtn1.Name = "AutoBtn1";
this.AutoBtn1.Size = new System.Drawing.Size(104, 104);
this.AutoBtn1.TabIndex = 18;
this.AutoBtn1.Text = "自动按钮";
this.AutoBtn1.UseVisualStyleBackColor = false;
this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click);
//
// ManualBtn1
//
this.ManualBtn1.BackColor = System.Drawing.Color.Gray;
this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.ManualBtn1.Location = new System.Drawing.Point(3, 183);
this.ManualBtn1.Name = "ManualBtn1";
this.ManualBtn1.Size = new System.Drawing.Size(104, 104);
this.ManualBtn1.TabIndex = 19;
this.ManualBtn1.Text = "手动按钮";
this.ManualBtn1.UseVisualStyleBackColor = false;
this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click);
this.label14.BackColor = System.Drawing.Color.Transparent;
this.label14.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label14.Location = new System.Drawing.Point(3, 3);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(123, 47);
this.label14.TabIndex = 38;
this.label14.Text = "操作按钮";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// TestBtn
//
@ -678,18 +667,6 @@ namespace BRS.Process.A020.UI
this.StartBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.StartBtn1.Click += new System.EventHandler(this.StartBtn1_Click);
//
// ESBtn
//
this.ESBtn.BackColor = System.Drawing.Color.Red;
this.ESBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.ESBtn.Location = new System.Drawing.Point(150, 107);
this.ESBtn.Name = "ESBtn";
this.ESBtn.Size = new System.Drawing.Size(137, 137);
this.ESBtn.TabIndex = 0;
this.ESBtn.Text = "急停";
this.ESBtn.UseVisualStyleBackColor = false;
this.ESBtn.Click += new System.EventHandler(this.ESBtn_Click);
//
// AutoLoosenBtn
//
this.AutoLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand;
@ -803,49 +780,77 @@ namespace BRS.Process.A020.UI
this.AutoLight.TabIndex = 24;
this.AutoLight.UseVisualStyleBackColor = false;
//
// label11
// MoveStateLight1
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Silver;
this.label11.Location = new System.Drawing.Point(537, 100);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(106, 42);
this.label11.TabIndex = 26;
this.label11.Text = "自动拧紧状态\r\n指示灯";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.MoveStateLight1.BackColor = System.Drawing.Color.Gray;
this.MoveStateLight1.Location = new System.Drawing.Point(17, 7);
this.MoveStateLight1.Name = "MoveStateLight1";
this.MoveStateLight1.Size = new System.Drawing.Size(90, 90);
this.MoveStateLight1.TabIndex = 3;
this.MoveStateLight1.UseVisualStyleBackColor = false;
//
// label12
// StopStateLight1
//
this.label12.AutoSize = true;
this.label12.BackColor = System.Drawing.Color.Silver;
this.label12.Location = new System.Drawing.Point(668, 100);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(106, 42);
this.label12.TabIndex = 27;
this.label12.Text = "自动拧松状态\r\n指示灯";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.StopStateLight1.BackColor = System.Drawing.Color.Gray;
this.StopStateLight1.Location = new System.Drawing.Point(148, 7);
this.StopStateLight1.Name = "StopStateLight1";
this.StopStateLight1.Size = new System.Drawing.Size(90, 90);
this.StopStateLight1.TabIndex = 15;
this.StopStateLight1.UseVisualStyleBackColor = false;
//
// label13
// ToughLight1
//
this.label13.BackColor = System.Drawing.Color.Transparent;
this.label13.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label13.Location = new System.Drawing.Point(1, 3);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(123, 47);
this.label13.TabIndex = 37;
this.label13.Text = "操作按钮";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.ToughLight1.BackColor = System.Drawing.Color.Gray;
this.ToughLight1.Location = new System.Drawing.Point(279, 7);
this.ToughLight1.Name = "ToughLight1";
this.ToughLight1.Size = new System.Drawing.Size(90, 90);
this.ToughLight1.TabIndex = 16;
this.ToughLight1.UseVisualStyleBackColor = false;
//
// label14
// LoosenLight1
//
this.label14.BackColor = System.Drawing.Color.Transparent;
this.label14.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label14.Location = new System.Drawing.Point(3, 3);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(123, 47);
this.label14.TabIndex = 38;
this.label14.Text = "操作按钮";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.LoosenLight1.BackColor = System.Drawing.Color.Gray;
this.LoosenLight1.Location = new System.Drawing.Point(410, 7);
this.LoosenLight1.Name = "LoosenLight1";
this.LoosenLight1.Size = new System.Drawing.Size(90, 90);
this.LoosenLight1.TabIndex = 17;
this.LoosenLight1.UseVisualStyleBackColor = false;
//
// AutoBtn1
//
this.AutoBtn1.BackColor = System.Drawing.Color.Gray;
this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.AutoBtn1.Location = new System.Drawing.Point(3, 73);
this.AutoBtn1.Name = "AutoBtn1";
this.AutoBtn1.Size = new System.Drawing.Size(104, 104);
this.AutoBtn1.TabIndex = 18;
this.AutoBtn1.Text = "自动按钮";
this.AutoBtn1.UseVisualStyleBackColor = false;
this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click);
//
// ManualBtn1
//
this.ManualBtn1.BackColor = System.Drawing.Color.Gray;
this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.ManualBtn1.Location = new System.Drawing.Point(3, 183);
this.ManualBtn1.Name = "ManualBtn1";
this.ManualBtn1.Size = new System.Drawing.Size(104, 104);
this.ManualBtn1.TabIndex = 19;
this.ManualBtn1.Text = "手动按钮";
this.ManualBtn1.UseVisualStyleBackColor = false;
this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click);
//
// ESBtn
//
this.ESBtn.BackColor = System.Drawing.Color.Red;
this.ESBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.ESBtn.Location = new System.Drawing.Point(150, 107);
this.ESBtn.Name = "ESBtn";
this.ESBtn.Size = new System.Drawing.Size(137, 137);
this.ESBtn.TabIndex = 0;
this.ESBtn.Text = "急停";
this.ESBtn.UseVisualStyleBackColor = false;
this.ESBtn.Click += new System.EventHandler(this.ESBtn_Click);
//
// 扭矩轴控制
//
@ -857,6 +862,7 @@ namespace BRS.Process.A020.UI
this.Controls.Add(this.chart2);
this.Name = "扭矩轴控制";
this.Text = "ContorlShaft";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this._FormClosing);
this.Load += new System.EventHandler(this._Load);
((System.ComponentModel.ISupportInitialize)(this.chart2)).EndInit();
this.uiPanel1.ResumeLayout(false);

View File

@ -150,8 +150,9 @@ namespace BRS.Process.A020.UI
private void _Load(object sender, EventArgs e)
{
InitChart();
}
#if false
@ -505,7 +506,7 @@ namespace BRS.Process.A020.UI
}
StartBtn1.Enabled = false;
try
{
//ProcessOperation(true);//点击开始按钮后执行
@ -534,8 +535,13 @@ namespace BRS.Process.A020.UI
ESBtn.BackColor = Color.Red;
ESBtn.Text = "急停";
ProcessWriteInt(MelsecPLC, "D19", "int", "0");
string d171 = textBox1.Text;
ProcessWriteInt(MelsecPLC, "D171", "int", d171);
//string d171 = textBox1.Text;
//ProcessWriteInt(MelsecPLC, "D171", "int", d171);
ProcessWriteInt(MelsecPLC, "D171", "int", textBox1.Text);
ProcessWriteInt(MelsecPLC, "D161", "int", textBox2.Text);
ProcessWriteInt(MelsecPLC, "D163", "int", textBox3.Text);
ProcessWriteInt(MelsecPLC, "D173", "int", textBox4.Text);
ProcessWriteInt(MelsecPLC, "D151", "int", textBox5.Text);
}
}
@ -555,6 +561,8 @@ namespace BRS.Process.A020.UI
ProcessWriteInt(MelsecPLC, "D3", "int", "1");
ProcessWriteInt(MelsecPLC, "D55", "int", "0");
ProcessWriteInt(MelsecPLC, "D171", "int", "0");
ProcessWriteInt(MelsecPLC, "D151", "int", "0");
this.StopStateLight1.BackColor = Color.Red;
this.MoveStateLight1.BackColor = Color.Gray;
timer1.Stop();
@ -860,11 +868,11 @@ namespace BRS.Process.A020.UI
int overtime = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D151", "int"));//拧紧超时设定值,当空转达到设定的值时会停止
int MaxSettingTorsionValue = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D173", "int"));//最大扭矩设定值,当达到这一个值时会停止
int torsionTime = Convert.ToInt32(ProcessReadInt(MelsecPLC, "D155", "int"));//扭矩到目标设定值计时设定值
if (resValue1 >= MaxSettingTorsionValue)
{
//ProcessA020.StopProcess();
ProcessWriteInt(MelsecPLC, "D55", "int", "0");//到位时D55置0停止
//ProcessWriteInt(MelsecPLC, "D55", "int", "0");//到位时D55置0停止
//ProcessWriteInt(MelsecPLC, "D171", "int", "0");
LogAsync(DateTime.Now, LogLevel.Information, "已完成");
if (MinAngleValue <= resValue2 && resValue2 <= MaxAngleValue)
@ -880,6 +888,7 @@ namespace BRS.Process.A020.UI
{
timer2.Stop();
timer1.Stop();
//ProcessWriteInt(MelsecPLC, "D171", "int", "0");
LogAsync(DateTime.Now, LogLevel.Error, "螺丝卡丝");
isOpenAuto = false;
return;
@ -918,7 +927,7 @@ namespace BRS.Process.A020.UI
ProcessWriteInt(MelsecPLC, "D7", "int", "0");
ProcessWriteInt(MelsecPLC, "D51", "int", "0");
ProcessWriteInt(MelsecPLC, "D53", "int", "0");
ProcessWriteInt(MelsecPLC, "D55", "int", "0");
//ProcessWriteInt(MelsecPLC, "D55", "int", "0");
ProcessWriteInt(MelsecPLC, "D171", "int", "0");
shaftState = ShaftMachineState.Emergency;
@ -1035,6 +1044,10 @@ namespace BRS.Process.A020.UI
}
}
private void _FormClosing(object sender, FormClosingEventArgs e)
{
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
ProcessWriteInt(MelsecPLC, "D7", "int", "0");
}
}
}

View File

@ -188,7 +188,7 @@ namespace XKRS.Device.MelsecPLC
int repeatTime = 3;
Stopwatch sw = new Stopwatch();
//sw.Start();
do
{
try