Commit 1085a985 authored by liu's avatar liu

辅助工具添加校零标阀rl11 12开关的功能,修改了外部通讯协议

parent 129cc874
......@@ -67,7 +67,7 @@ namespace GcDevicePc.Common
case ModbusDataType.HoldingRegister:
for (int i = 0; i < e.Data.B.Count; i++)
{
slave.DataStore.HoldingRegisters[e.StartAddress + i + 1] = newslavereadhreg2(Convert.ToUInt16(e.StartAddress + i + 1));
slave.DataStore.HoldingRegisters[e.StartAddress + i + 1] = slavereadhreg(Convert.ToUInt16(e.StartAddress + i + 1));
}
break;
......@@ -126,7 +126,7 @@ namespace GcDevicePc.Common
ushort baseaddress = 23;
address = (ushort)(address - 1);
int listnum = SharedSpace.Data.listValue.Count;
if (address >= 17)
if (address >= 17 && address < 150)
{
ushort[] s = new ushort[2];
float[] f = new float[2];
......@@ -241,7 +241,7 @@ namespace GcDevicePc.Common
case 9: //前进样口
{
//if (CProfileDevice.m_DevParam.syspara.u16InjPortFront == 1)
if (globaldata.m_hwconfig.hwconfiginfo.u16InjPortFront == 1)
if (globaldata.m_hwconfig.hwconfiginfo.u16InjPortFront == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.FPActualTemp * 10);
}
......@@ -288,9 +288,9 @@ namespace GcDevicePc.Common
// }
// //else if (CProfileDevice.m_DevParam.syspara.u16DetFrontType == 1)
// else if (globaldata.m_hwconfig.hwconfiginfo.u16DetFrontType == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp * 10);
}
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp * 10);
}
// else
// {
// value = 0;
......@@ -305,41 +305,41 @@ namespace GcDevicePc.Common
case 13: //中检测器
{
if (CProfileDevice.m_DevParam.syspara.u16DetInter == 1)
//if (globaldata.m_hwconfig.hwconfiginfo.u16DetInter == 1)
{
//if (globaldata.m_hwconfig.hwconfiginfo.u16DetInter == 1)
{
if (CProfileDevice.m_DevParam.syspara.u16DetInterType == 0)
//if (globaldata.m_hwconfig.hwconfiginfo.u16DetInterType == 0)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.iDetActualTemp * 10);
}
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.iDetActualTemp * 10);
}
else if (CProfileDevice.m_DevParam.syspara.u16DetInterType == 1)
//else if (globaldata.m_hwconfig.hwconfiginfo.u16DetInterType == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.iDetActualTemp * 10);
}
else
{
value = 0;
}
}
else if (CProfileDevice.m_DevParam.syspara.u16AuxHeater1 == 1)
//else if (globaldata.m_hwconfig.hwconfiginfo.u16AuxHeater1 == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.AuxActualTemp1 * 10);
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.iDetActualTemp * 10);
}
else
{
value = 0;
}
}
else if (CProfileDevice.m_DevParam.syspara.u16AuxHeater1 == 1)
//else if (globaldata.m_hwconfig.hwconfiginfo.u16AuxHeater1 == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.AuxActualTemp1 * 10);
}
else
{
value = 0;
}
}
break;
case 14: //后检测器
{
if (CProfileDevice.m_DevParam.syspara.u16DetBehind == 1)
//if (globaldata.m_hwconfig.hwconfiginfo.u16DetBehind == 1)
//if (globaldata.m_hwconfig.hwconfiginfo.u16DetBehind == 1)
{
if (CProfileDevice.m_DevParam.syspara.u16DetBehindType == 0)
//if (globaldata.m_hwconfig.hwconfiginfo.u16DetBehindType == 0)
//if (globaldata.m_hwconfig.hwconfiginfo.u16DetBehindType == 0)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.bDetActualTemp * 10);
}
......@@ -390,6 +390,74 @@ namespace GcDevicePc.Common
break;
}
}
if (address >= 1000 && address < 1500)
{
switch (address)
{
case 1000:
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero)
{
value = 0;
}
else if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao)
{
value = 1;
}
else if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
value = 2;
}
break;
case 1001:
value = globaldata.m_dpbuffer.ShowList.showepc.EPC1_2_Cur;
break;
case 1002:
value = globaldata.m_dpbuffer.ShowList.showepc.EPC1_3_Cur;
break;
}
}
if (address >= 1500)
{
switch (address)
{
case 1500:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[0];
break;
case 1501:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[2];
break;
case 1502:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[4];
break;
case 1503:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[6];
break;
case 1504:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[8];
break;
case 1505:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[10];
break;
case 1506:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[12];
break;
case 1507:
value = globaldata.m_hmibuffer.gcinfo.EPCStatus[14];
break;
case 1508:
value = globaldata.m_hmibuffer.gcinfo.HmiAbnormal[0];
break;
case 1509:
value = globaldata.m_hmibuffer.gcinfo.HmiAbnormal[1];
break;
case 1510:
value = globaldata.m_hmibuffer.gcinfo.HmiAbnormal[2];
break;
default:
break;
}
}
return value;
}
catch (Exception e)
......@@ -403,43 +471,56 @@ namespace GcDevicePc.Common
static void slavewirtehreg(ushort address, ushort[] value)
{
if (address >= 50 && address < 99)
//if (address >= 50 && address < 99)
//{
// switch (address)
// {
// case 50:
// globaldata.m_hmibuffer.gcadjust.setpotency = ushortofloat(value);
// CKVocAnalyzer.GlobalCKV.nongdu = (int)globaldata.m_hmibuffer.gcadjust.setpotency;
// CKVocAnalyzer.ExteConfig.Instance.Save();
// break;
// case 52:
// //globaldata.m_hmibuffer.gcadjust.trackpotency = ushortofloat(value);
// break;
// case 54:
// globaldata.m_hmibuffer.gcadjust.settime = ushortolong(value);
// CKVocAnalyzer.GlobalCKV.AutoTimes = (int)globaldata.m_hmibuffer.gcadjust.settime / 60;
// CKVocAnalyzer.ExteConfig.Instance.Save();
// break;
// case 56:
// globaldata.m_hmibuffer.gcadjust.executefun = ushortolong(value);
// break;
// case 58:
// globaldata.m_hmibuffer.gcadjust.funrun = ushortolong(value);
// executefuncation();
// break;
// case 60:
// //globaldata.m_hmibuffer.gcadjust.runtime = ushortolong(value);
// //SharedSpace.MControl.zhouqi* SharedSpace.MControl.runcount <= SharedSpace.MControl.dateend
// break;
// case 62:
// //globaldata.m_hmibuffer.gcadjust.executestat = ushortolong(value);
// break;
// default:
// break;
// }
//}
if (address == 200)
{
switch (address)
if (value[0] == 0)
{
case 50:
globaldata.m_hmibuffer.gcadjust.setpotency = ushortofloat(value);
CKVocAnalyzer.GlobalCKV.nongdu = (int)globaldata.m_hmibuffer.gcadjust.setpotency;
CKVocAnalyzer.ExteConfig.Instance.Save();
break;
case 52:
//globaldata.m_hmibuffer.gcadjust.trackpotency = ushortofloat(value);
break;
case 54:
globaldata.m_hmibuffer.gcadjust.settime = ushortolong(value);
CKVocAnalyzer.GlobalCKV.AutoTimes = (int)globaldata.m_hmibuffer.gcadjust.settime/60;
CKVocAnalyzer.ExteConfig.Instance.Save();
break;
case 56:
globaldata.m_hmibuffer.gcadjust.executefun = ushortolong(value);
break;
case 58:
globaldata.m_hmibuffer.gcadjust.funrun = ushortolong(value);
executefuncation();
break;
case 60:
//globaldata.m_hmibuffer.gcadjust.runtime = ushortolong(value);
//SharedSpace.MControl.zhouqi* SharedSpace.MControl.runcount <= SharedSpace.MControl.dateend
break;
case 62:
//globaldata.m_hmibuffer.gcadjust.executestat = ushortolong(value);
break;
default:
break;
globaldata.usable = false;
}
if (value[0] == 1)
{
globaldata.usable = true;
}
}
//if (address == 100 || address == 99 || address == 101)
//if (address == 100 || address == 99)
//{
// if (value[0] == 1)
// {
......@@ -451,19 +532,19 @@ namespace GcDevicePc.Common
// }
//}
if (address == 102)
{
if (value[0] == 1)
{
globaldata.IsStopOs = true;
}
else if (value[0] == 0)
{
globaldata.IsStopOs = false;
}
}
//if (address == 102)
//{
// if (value[0] == 1)
// {
// globaldata.IsStopOs = true;
// }
// else if (value[0] == 0)
// {
// globaldata.IsStopOs = false;
// }
//}
Log.Info("MoudbusSlave Wirte adder:" + address.ToString() + " value:" + value.ToString());
}
......@@ -542,6 +623,12 @@ namespace GcDevicePc.Common
case 25:
value = globaldata.m_hmibuffer.gcinfo.TenRelay[9];
break;
case 26:
value = globaldata.m_hmibuffer.gcinfo.TenRelay[10];
break;
case 27:
value = globaldata.m_hmibuffer.gcinfo.TenRelay[11];
break;
default:
value = 0;
break;
......@@ -552,370 +639,18 @@ namespace GcDevicePc.Common
}
static ushort newslavereadhreg(ushort address)
{
try
{
ushort value = 0;
ushort signalddress = 36;
ushort baseaddress = 0;
address = (ushort)(address - 1);
int listnum = SharedSpace.Data.listValue.Count;
ushort[] s = new ushort[2];
float[] f = new float[2];
long[] l = new long[1];
if (address < 20 && listnum > 0)
{
int readnum = (address - baseaddress) / 2;
if (readnum <= listnum - 1)
{
f[0] = float.Parse(SharedSpace.Data.listValue[readnum].vale.ToString());
Buffer.BlockCopy(f, 2, s, 0, 2);
Buffer.BlockCopy(f, 0, s, 2, 2);
value = s[(address - baseaddress) % 2];
}
else
{
value = 0;
}
}
else if (address >= 20 && address <= 35)
{
switch (address)
{
case 20:
if ((ushort)SharedSpace.Data.typesint == 1 || (ushort)SharedSpace.Data.typesint == 2)
{
if (SharedSpace.MControl.dateend != 0 && SharedSpace.MControl.zhouqi != 0)
{
value = (ushort)((globaldata.m_hmibuffer.gcinfo.batruncount * 1.0f) /
(ushort)(SharedSpace.MControl.dateend * 1.0f /
SharedSpace.MControl.zhouqi) * 1000);
}
else
{
value = 0;
}
}
else
{
value = 0;
}
break;
case 21:
if (!SharedSpace.MControl.SetOut && !SharedSpace.MControl.SetRun)
{
if ((ushort)SharedSpace.Data.typesint == 3)
value = 5;
else if ((ushort)SharedSpace.Data.typesint == 4)
value = 6;
else
value = (ushort)SharedSpace.Data.typesint;
}
else
{
value = (ushort)SharedSpace.Data.typesint;
}
break;
case 22:
value = SharedSpace.Data.change == true ? (ushort)1 : (ushort)0;
break;
case 23:
value = globaldata.m_hmibuffer.gcinfo.HMIMac[0];
break;
case 24:
value = globaldata.m_hmibuffer.gcinfo.HMIMac[1];
break;
case 25:
value = globaldata.m_hmibuffer.gcinfo.HMIMac[2];
break;
case 26:
value = (ushort)(globaldata.m_hmibuffer.gcinfo.hmioffline ? 1 : 0);
break;
case 27:
value = globaldata.m_hmibuffer.gcinfo.methodstatus;
break;
case 28:
if (CProfileDevice.m_DevParam.syspara.u16InjPortFront == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.FPActualTemp * 10);
}
else
{
value = 0;
}
break;
case 29:
if (CProfileDevice.m_DevParam.syspara.u16InjPortBehind == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.BPActualTemp * 10);
}
else
{
value = 0;
}
break;
case 30:
if (CProfileDevice.m_DevParam.syspara.u16Col == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp * 10);
}
else
{
value = 0;
}
break;
case 31:
if (CProfileDevice.m_DevParam.syspara.u16InjPortFront == 1)
{
if (CProfileDevice.m_DevParam.syspara.u16DetFrontType == 0)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp * 10);
}
else if (CProfileDevice.m_DevParam.syspara.u16DetFrontType == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp * 10);
}
else
{
value = 0;
}
}
else
{
value = 0;
}
break;
case 32:
if (CProfileDevice.m_DevParam.syspara.u16DetInter == 1)
{
if (CProfileDevice.m_DevParam.syspara.u16DetInterType == 0)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.iDetActualTemp * 10);
}
else if (CProfileDevice.m_DevParam.syspara.u16DetInterType == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.iDetActualTemp * 10);
}
else
{
value = 0;
}
}
else if (CProfileDevice.m_DevParam.syspara.u16AuxHeater1 == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.AuxActualTemp1 * 10);
}
else
{
value = 0;
}
break;
case 33:
if (CProfileDevice.m_DevParam.syspara.u16DetBehind == 1)
{
if (CProfileDevice.m_DevParam.syspara.u16DetBehindType == 0)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.bDetActualTemp * 10);
}
else if (CProfileDevice.m_DevParam.syspara.u16DetBehindType == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.bDetActualTemp * 10);
}
else if (CProfileDevice.m_DevParam.syspara.u16AuxHeater2 == 1)
{
value = (ushort)(globaldata.m_dpbuffer.ShowList.showtemp.AuxActualTemp2 * 10);
}
else
{
value = 0;
}
}
else
{
value = 0;
}
break;
case 34:
if (CProfileDevice.m_DevParam.syspara.u16DetFrontType == 1)
{
value = globaldata.m_dpbuffer.ShowList.showDet.fDetStatue;
}
else
{
value = 0;
}
break;
case 35:
if (CProfileDevice.m_DevParam.syspara.u16DetInterType == 1)
{
value = globaldata.m_dpbuffer.ShowList.showDet.fDetStatue;
}
else
{
value = 0;
}
break;
}
}
if (address >= 36)
{
if (address < 48)
{
if (address == 36 || address == 37)
f[0] = float.Parse(globaldata.m_dpbuffer.ShowList.showDet.fDetValue.ToString("0.000"));
if (address == 38 || address == 39)
f[0] = float.Parse(globaldata.m_dpbuffer.ShowList.showDet.iDetValue.ToString("0.000"));
if (address == 40 || address == 41)
f[0] = float.Parse(globaldata.m_dpbuffer.ShowList.showDet.bDetValue.ToString("0.000"));
Buffer.BlockCopy(f, 2, s, 0, 2);
Buffer.BlockCopy(f, 0, s, 2, 2);
value = s[(address - signalddress) % 2];
}
else if (address >= 48)
{
if (address == 48 || address == 49)
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
l[0] = 0x02;
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
l[0] = 0x03;
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
l[0] = 0x00;
break;
default:
l[0] = 0x00;
break;
}
//value = (ushort)globaldata.m_hmibuffer.gcadjust.currentstate;//当前状态
//l[0] = globaldata.m_hmibuffer.gcadjust.executefun;
Buffer.BlockCopy(l, 0, s, 0, 4);
value = s[(address - 48) % 2];
}
//Buffer.BlockCopy(f, 2, s, 0, 2);
//Buffer.BlockCopy(f, 0, s, 2, 2);
//value = s[(address - 48) % 2];
if (address >= 50 && address < 54)
{
if (address == 50 || address == 51)
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.nongdu.ToString("0.000"));
if (address == 52 || address == 53)
{
foreach (var item in CKVocAnalyzer.GlobalCKV.autoVlue)
{
if (item.name == "THC")
{
f[0] = float.Parse(item.biaozhun.ToString("0.000"));
}
}
}
Buffer.BlockCopy(f, 2, s, 0, 2);
Buffer.BlockCopy(f, 0, s, 2, 2);
value = s[(address - 50) % 2];
}
if (address >= 54)
{
switch (address)
{
case 54:
case 55:
l[0] = CKVocAnalyzer.GlobalCKV.AutoTimes*60;
break;
case 56:
case 57:
l[0] = globaldata.m_hmibuffer.gcadjust.executefun;
break;
case 58:
case 59:
l[0] = globaldata.m_hmibuffer.gcadjust.funrun;
break;
case 60:
case 61:
if (SharedSpace.MControl.IsEnd|| SharedSpace.MControl.forceEnd || !CKVocAnalyzer.GlobalCKV.IsAutoAdjust)
{
l[0] = 0;
}
else
{
l[0] = SharedSpace.MControl.dateend - (SharedSpace.MControl.zhouqi * SharedSpace.MControl.runcount);
}
break;
case 62:
case 63:
if (!CKVocAnalyzer.GlobalCKV.IsAutoAdjust)
{
l[0] = 0;
}
else if(CKVocAnalyzer.GlobalCKV.IsAutoAdjust|| (SharedSpace.MControl.SetOut && SharedSpace.MControl.SetRun == false))
{
if (SharedSpace.MControl.zhouqi * SharedSpace.MControl.runcount <= SharedSpace.MControl.dateend)
{
l[0] = 2;
}
else
{
l[0] = 1;
}
}
else if (SharedSpace.MControl.zhouqi * SharedSpace.MControl.runcount >= SharedSpace.MControl.dateend && SharedSpace.MControl.SetOut && SharedSpace.MControl.SetRun)
{
if (!SharedSpace.MControl.SetOut && !SharedSpace.MControl.SetRun)
{
l[0] = 4;
}
else
{
l[0] = 3;
}
}
else if(SharedSpace.MControl.forceEnd)
{
l[0] = 5;
}
//l[0] = globaldata.m_hmibuffer.gcadjust.settime;
break;
}
Buffer.BlockCopy(l, 0, s, 0, 4);
value = s[(address - 54) % 2];
}
}
else
{
value = 0;
}
}
return value;
}
catch
{
return 0;
}
}
/// <summary>
/// 林工新通讯协议
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
static ushort newslavereadhreg2(ushort address)
{
try
{
ushort value = 0;
ushort signalddress = 36;
//ushort signalddress = 36;
ushort baseaddress = 0;
address = (ushort)(address - 1);
int listnum = SharedSpace.Data.listValue.Count;
......@@ -1019,7 +754,6 @@ namespace GcDevicePc.Common
value = 0;
if (address == 48 || address == 49)
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
......@@ -1038,7 +772,7 @@ namespace GcDevicePc.Common
Buffer.BlockCopy(l, 0, s, 0, 4);
value = s[(address - 48) % 2];
value = s[(address - 40) % 2];
}
}
......@@ -1091,7 +825,6 @@ namespace GcDevicePc.Common
{
l[0] = 0;
}
}
else
{
......
......@@ -29,6 +29,8 @@
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtyuzhi = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.cListBoxSign = new System.Windows.Forms.CheckedListBox();
this.cBox自动点火 = new System.Windows.Forms.CheckBox();
this.cBox自动调零 = new System.Windows.Forms.CheckBox();
......@@ -59,8 +61,6 @@
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.txtyuzhi = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
......@@ -105,6 +105,22 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "FID设置";
//
// txtyuzhi
//
this.txtyuzhi.Location = new System.Drawing.Point(423, 84);
this.txtyuzhi.Name = "txtyuzhi";
this.txtyuzhi.Size = new System.Drawing.Size(62, 21);
this.txtyuzhi.TabIndex = 12;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(388, 91);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 12);
this.label5.TabIndex = 11;
this.label5.Text = "阈值";
//
// cListBoxSign
//
this.cListBoxSign.BackColor = System.Drawing.SystemColors.Control;
......@@ -188,6 +204,7 @@
this.tb空气压力设定.Name = "tb空气压力设定";
this.tb空气压力设定.Size = new System.Drawing.Size(62, 21);
this.tb空气压力设定.TabIndex = 2;
this.tb空气压力设定.TextChanged += new System.EventHandler(this.Tb空气压力设定_TextChanged);
this.tb空气压力设定.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxDec_KeyPress);
//
// tb尾吹气压力设定
......@@ -223,6 +240,7 @@
this.tb氢气压力设定.Name = "tb氢气压力设定";
this.tb氢气压力设定.Size = new System.Drawing.Size(62, 21);
this.tb氢气压力设定.TabIndex = 2;
this.tb氢气压力设定.TextChanged += new System.EventHandler(this.Tb氢气压力设定_TextChanged);
this.tb氢气压力设定.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxDec_KeyPress);
//
// cBox空气
......@@ -395,22 +413,6 @@
this.label1.TabIndex = 0;
this.label1.Text = "FID";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(388, 91);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 12);
this.label5.TabIndex = 11;
this.label5.Text = "阈值";
//
// txtyuzhi
//
this.txtyuzhi.Location = new System.Drawing.Point(423, 84);
this.txtyuzhi.Name = "txtyuzhi";
this.txtyuzhi.Size = new System.Drawing.Size(62, 21);
this.txtyuzhi.TabIndex = 12;
//
// FID
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......
......@@ -25,6 +25,12 @@ namespace GcDevicePc.ConfigMethod
this.methodconfig = methodconfig;
}
public FID()
{
InitializeComponent();
}
int configTemp;
public void reflashContent(int index)
......@@ -207,5 +213,72 @@ namespace GcDevicePc.ConfigMethod
}
}
}
private double hlastnum;
private void hText_KeyDown(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
hlastnum = Convert.ToDouble((sender as TextBox).Text);
}
else
{
hlastnum = 0;
}
}
private void hText_KeyUp(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
double nextnum = Convert.ToDouble((sender as TextBox).Text);
if (nextnum < 5)
{
MessageBox.Show("流量设置不能小于5");
(sender as TextBox).Text = hlastnum.ToString();
}
if (nextnum > 200)
{
MessageBox.Show("流量设置不能大于200");
(sender as TextBox).Text = hlastnum.ToString();
}
}
}
private void Tb空气压力设定_TextChanged(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty((sender as TextBox).Text))
//{
// double nextnum = Convert.ToDouble((sender as TextBox).Text);
// if (nextnum < 50)
// {
// MessageBox.Show("空气流量设置不能小于50");
// (sender as TextBox).Text = "50";
// }
// if (nextnum > 500)
// {
// MessageBox.Show("空气流量设置不能大于500");
// (sender as TextBox).Text = "50";
// }
//}
}
private void Tb氢气压力设定_TextChanged(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty((sender as TextBox).Text))
//{
// double nextnum = Convert.ToDouble((sender as TextBox).Text);
// if (nextnum < 5)
// {
// MessageBox.Show("氢气流量设置不能小于5");
// (sender as TextBox).Text = hlastnum.ToString();
// }
// if (nextnum > 200)
// {
// MessageBox.Show("氢气流量设置不能大于200");
// (sender as TextBox).Text = hlastnum.ToString();
// }
//}
}
}
}
......@@ -77,13 +77,12 @@
this.cbHeater.Checked = true;
this.cbHeater.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbHeater.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cbHeater.Location = new System.Drawing.Point(67, 153);
this.cbHeater.Location = new System.Drawing.Point(99, 155);
this.cbHeater.Name = "cbHeater";
this.cbHeater.Size = new System.Drawing.Size(71, 19);
this.cbHeater.TabIndex = 3;
this.cbHeater.Text = "加热器";
this.cbHeater.UseVisualStyleBackColor = true;
this.cbHeater.Visible = false;
//
// txtHeater
//
......@@ -111,8 +110,7 @@
this.txtFlow.Name = "txtFlow";
this.txtFlow.Size = new System.Drawing.Size(100, 24);
this.txtFlow.TabIndex = 8;
this.txtFlow.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Text_KeyDown);
this.txtFlow.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Text_KeyUp);
this.txtFlow.TextChanged += new System.EventHandler(this.TxtFlow_TextChanged);
//
// txtPressure
//
......@@ -121,8 +119,7 @@
this.txtPressure.Name = "txtPressure";
this.txtPressure.Size = new System.Drawing.Size(100, 24);
this.txtPressure.TabIndex = 9;
this.txtPressure.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Text_KeyDown);
this.txtPressure.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Text_KeyUp);
this.txtPressure.TextChanged += new System.EventHandler(this.TxtFlow_TextChanged);
//
// txtSeptumBlowingflow
//
......
......@@ -387,7 +387,7 @@ namespace GcDevicePc.ConfigMethod.injectionport
private double lastnum;
private void Text_KeyDown(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
lastnum = Convert.ToDouble((sender as TextBox).Text);
}
......@@ -402,9 +402,14 @@ namespace GcDevicePc.ConfigMethod.injectionport
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
double nextnum = Convert.ToDouble((sender as TextBox).Text);
if (nextnum > 100)
if (nextnum < 5)
{
MessageBox.Show("流量设置不能小于5");
(sender as TextBox).Text = lastnum.ToString();
}
if (nextnum > 200)
{
MessageBox.Show("流量设置不能大于100");
MessageBox.Show("流量设置不能大于200");
(sender as TextBox).Text = lastnum.ToString();
}
}
......@@ -438,6 +443,24 @@ namespace GcDevicePc.ConfigMethod.injectionport
}
}
private void TxtFlow_TextChanged(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty((sender as TextBox).Text))
//{
// double nextnum = Convert.ToDouble((sender as TextBox).Text);
// if (nextnum < 5)
// {
// MessageBox.Show("流量设置不能小于5");
// (sender as TextBox).Text = "10";
// }
// if (nextnum > 200)
// {
// MessageBox.Show("流量设置不能大于200");
// (sender as TextBox).Text = "10";
// }
//}
}
//private void combControlMode_SelectedIndexChanged(object sender, EventArgs e)
//{
// if (combControlMode.SelectedIndex == 0)
......
......@@ -35,7 +35,7 @@
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(176)))), ((int)(((byte)(197)))));
this.button1.Location = new System.Drawing.Point(70, 133);
this.button1.Location = new System.Drawing.Point(97, 137);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
......@@ -66,7 +66,7 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "EPCTips";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "EPCTips";
this.Text = "警 告";
this.ResumeLayout(false);
this.PerformLayout();
......
......@@ -60,6 +60,8 @@ namespace GcDevicePc
// MessageBox.Show("点火操作禁止,FID已经点火成功");
}
CKVocAnalyzer.AutoAdjust auto;
//自动校准
private void buttonauto_Click(object sender, EventArgs e)
{
......@@ -69,9 +71,28 @@ namespace GcDevicePc
//{
// if (CK_UI.LandIn.Island)
{
//CKVocAnalyzer.CtrlUserAdjust auto = new CKVocAnalyzer.CtrlUserAdjust(CKVocAnalyzer.CtrlUserAdjust.AdjustType.AT_Yang);
CKVocAnalyzer.AutoAdjust auto = new CKVocAnalyzer.AutoAdjust();
//CKVocAnalyzer.CtrlUserAdjust auto = new CKVocAnalyzer.CtrlUserAdjust(CKVocAnalyzer.CtrlUserAdjust.AdjustType.AT_Yang);
if (auto == null)
{
auto = new CKVocAnalyzer.AutoAdjust();
auto.Show();
}
else if (auto.IsDisposed)
{
auto = null;
auto = new CKVocAnalyzer.AutoAdjust();
auto.Show();
}
else
{
auto.Activate();
}
//if (!globaldata.usable)//表示上位机处于运行状态下不可进行自动校准
//{
//}
//Trace.WriteLine(string.Format("用户{0},进入自动校准模式", "calibration"), "sys");
}
//else
......
......@@ -68,6 +68,7 @@
this.toolStripStatusLabelText = new System.Windows.Forms.ToolStripStatusLabel();
this.HmiStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.AdjustStat = new System.Windows.Forms.ToolStripStatusLabel();
this.workProgress = new System.Windows.Forms.ToolStripProgressBar();
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.menuStrip.SuspendLayout();
......@@ -347,7 +348,7 @@
this.toolStripStatusLabelusertime.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripStatusLabelusertime.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.toolStripStatusLabelusertime.Name = "toolStripStatusLabelusertime";
this.toolStripStatusLabelusertime.Size = new System.Drawing.Size(200, 27);
this.toolStripStatusLabelusertime.Size = new System.Drawing.Size(190, 27);
this.toolStripStatusLabelusertime.Text = "toolStripStatusLabel1";
//
// toolStripStatusLabelText
......@@ -356,16 +357,17 @@
this.toolStripStatusLabelText.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
this.toolStripStatusLabelText.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.toolStripStatusLabelText.Name = "toolStripStatusLabelText";
this.toolStripStatusLabelText.Size = new System.Drawing.Size(320, 27);
this.toolStripStatusLabelText.Size = new System.Drawing.Size(300, 27);
this.toolStripStatusLabelText.Text = "toolStripStatusLabel1";
this.toolStripStatusLabelText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// HmiStatus
//
this.HmiStatus.AutoSize = false;
this.HmiStatus.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
this.HmiStatus.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.HmiStatus.Name = "HmiStatus";
this.HmiStatus.Size = new System.Drawing.Size(200, 27);
this.HmiStatus.Size = new System.Drawing.Size(190, 27);
this.HmiStatus.Text = "HmiStatus";
this.HmiStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
......@@ -376,6 +378,7 @@
this.toolStripStatusLabelusertime,
this.toolStripStatusLabelText,
this.HmiStatus,
this.AdjustStat,
this.workProgress});
this.statusStrip.Location = new System.Drawing.Point(0, 487);
this.statusStrip.Name = "statusStrip";
......@@ -383,6 +386,16 @@
this.statusStrip.TabIndex = 2;
this.statusStrip.Text = "StatusStrip";
//
// AdjustStat
//
this.AdjustStat.AutoSize = false;
this.AdjustStat.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
this.AdjustStat.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.AdjustStat.Name = "AdjustStat";
this.AdjustStat.Size = new System.Drawing.Size(131, 27);
this.AdjustStat.Text = "toolStripStatusLabel1";
this.AdjustStat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// workProgress
//
this.workProgress.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
......@@ -461,6 +474,7 @@
private System.Windows.Forms.ToolStripProgressBar workProgress;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.ToolStripMenuItem changeVsi;
private System.Windows.Forms.ToolStripStatusLabel AdjustStat;
}
}
......
......@@ -799,7 +799,38 @@ namespace GcDevicePc
// Trace.WriteLine(string.Format("时间{0},状态{1}", getIdleTick(),LandIn.Island),"sys");
//Console.WriteLine(t2.ToString());
//下方状态显示
if (CKVocAnalyzer.GlobalCKV.FarNear == 0)
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
AdjustStat.Text = "近端校零";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
AdjustStat.Text = "近端校标";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
AdjustStat.Text = "走样";
break;
}
}
else
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
AdjustStat.Text = "远端校零";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
AdjustStat.Text = "远端校标";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
AdjustStat.Text = "走样";
break;
}
}
//监视界面活动
if (getIdleTick()>60*30 && LandIn.Island)
......@@ -1333,6 +1364,8 @@ namespace GcDevicePc
Connect_Status.Start();
}
bool isone_openos = false;
/// <summary>
/// HMI状态监控线程实现
/// </summary>
......@@ -1462,6 +1495,7 @@ namespace GcDevicePc
{
globaldata.IsStopOs = !globaldata.IsStopOs;
globaldata.OS_STOP = true;
isone_openos = true;
hmiopt.WriteEndVal();
WaitHMIFree();
(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 0;
......@@ -1470,6 +1504,14 @@ namespace GcDevicePc
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0;
}
}
else
{
if (isone_openos)
{
isone_openos = !isone_openos;
open();
}
}
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 2)
{
......@@ -3025,6 +3067,21 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = true;//仪器进入校准环境
CurveDisPlay.forcePurge = true;//强制清除数据
AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend);
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
hmiopt.Adjust_ling_biao(0, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
hmiopt.Adjust_ling_biao(1, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
hmiopt.Adjust_ling_biao(0, 0);
break;
default:
break;
}
}
if (SharedSpace.MControl.MethodType == 2)
{
......@@ -3032,26 +3089,24 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = true;//仪器进入校准环境
CurveDisPlay.forcePurge = true;
AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend);
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
hmiopt.Adjust_ling_biao(0, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
hmiopt.Adjust_ling_biao(1, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
hmiopt.Adjust_ling_biao(0, 0);
break;
default:
break;
}
}
//switch (CKVocAnalyzer.GlobalCKV.adjustType)
//{
// case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
// //hmiopt.Sw_RelayAdiust(0);
// //hmiopt.Sw_Samplegas((ushort)65280);
// hmiopt.Adjust_ling_biao(0, (ushort)65280);
// break;
// case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
// //hmiopt.Sw_RelayAdiust(1);
// //hmiopt.Sw_Samplegas((ushort)65280);
// hmiopt.Adjust_ling_biao(1, (ushort)65280);
// break;
// case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
// hmiopt.Adjust_ling_biao(0, 0);
// break;
// default:
// break;
//}
}
else
{
......@@ -3080,6 +3135,11 @@ namespace GcDevicePc
{
CurveDisPlay.curdisp.ConfingAdjust();
}
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
Trace.WriteLine("校准结束", "sys");
}
if (SharedSpace.MControl.MethodType == 2)
......@@ -3090,12 +3150,14 @@ namespace GcDevicePc
{
CurveDisPlay.curdisp.ConfingAdjust();
}
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
Trace.WriteLine("校准结束", "sys");
}
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
//hmiopt.Adjust_ling_biao(0, 0);
}
}
if (SharedSpace.MControl.forceEnd && SharedSpace.MControl.SetOut && SharedSpace.MControl.SetRun)
......@@ -3108,6 +3170,11 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = false;
SharedSpace.Data.typesint = 0;
Trace.WriteLine("强制校准结束", "sys");
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
}
if (SharedSpace.MControl.MethodType == 2)
{
......@@ -3115,11 +3182,13 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = false;
SharedSpace.Data.typesint = 0;
Trace.WriteLine("强制校准结束", "sys");
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
}
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
//hmiopt.Adjust_ling_biao(0, 0);
}
}
globaldata.m_hmibuffer.gcadjust.runtime = (long)(AutoAdjust - DateTime.Now).TotalSeconds < 0 ? 0: (long)(AutoAdjust - DateTime.Now).TotalSeconds;
......
......@@ -984,6 +984,8 @@ namespace GcDevicePc.ProThread
{
bool ret = false;
UInt16[] hmistate = new UInt16[9];
UInt16[] epcdata = new UInt16[16];
ret = GetHMIState(ref hmistate);
if (ret)
......@@ -1015,7 +1017,43 @@ namespace GcDevicePc.ProThread
}
}
ret = GetEPCStatusData(ref epcdata);
if (ret)
{
globaldata.m_hmibuffer.gcinfo.EPCStatus = epcdata;
}
}
private int GetEPCHoldingReg(ushort address, ushort num, ref UInt16[] state)
{
int ret = -1;
int count = 0;
if (setflag)
{
ret = globaldata.global_moudbus.ReadHoldingReg(address, num, this.strIP, this.netPost, ref state);
while (ret != 0)
{
count++;
if (count > 3)
break;
ret = globaldata.global_moudbus.ReadHoldingReg(address, num, this.strIP, this.netPost, ref state);
}
}
return ret;
}
public bool GetEPCStatusData(ref ushort[] data)
{
int ret = -1;
try
{
ret = GetEPCHoldingReg(700, 16, ref data);
}
catch (Exception e)
{
Log.Error(e.Message);
}
return ret == 0;
}
/// <summary>
......
......@@ -23,7 +23,7 @@ namespace GcDevicePc.ProThread
this.strIP = ip;
this.netPost = post;
this.setflag = true;
Monitorr1112Start();
//Monitorr1112Start();
}
else
{
......@@ -232,11 +232,11 @@ namespace GcDevicePc.ProThread
int count = 0;
if (this.setflag)
{
ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata);
ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata);
while (ret != 0)
{
count++;
ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata);
ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata);
Thread.Sleep(200);
if (count == 3)
break;
......@@ -286,11 +286,11 @@ namespace GcDevicePc.ProThread
{
ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata);
ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata);
while (ret != 0)
{
count++;
ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata);
ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata);
Thread.Sleep(200);
if (count == 3)
break;
......@@ -307,21 +307,21 @@ namespace GcDevicePc.ProThread
writestatue = 0;
}
ret = m_modbus.WriteSingleCoil(26, writestatue, this.strIP, this.netPost);
ret = m_modbus.WriteSingleCoil(27, writestatue, this.strIP, this.netPost);
while (ret != 0)
{
count++;
ret = m_modbus.WriteSingleCoil(26, writestatue, this.strIP, this.netPost);
ret = m_modbus.WriteSingleCoil(27, writestatue, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
ret = m_modbus.WriteSingleCoil(27, 0, this.strIP, this.netPost);
ret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
while (ret != 0)
{
count++;
ret = m_modbus.WriteSingleCoil(27, 0, this.strIP, this.netPost);
ret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
......@@ -357,31 +357,6 @@ namespace GcDevicePc.ProThread
if (count == 3)
break;
}
if (getrelaystat(26) != oc)
{
bret = m_modbus.WriteSingleCoil(26, oc, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(26, oc, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
if (getrelaystat(27) != oc)
{
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
}
else if (type == 1)
{
......@@ -404,31 +379,6 @@ namespace GcDevicePc.ProThread
if (count == 3)
break;
}
if (getrelaystat(27) != oc)
{
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
if (getrelaystat(26) != 0)
{
bret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
}
}
......@@ -581,37 +531,6 @@ namespace GcDevicePc.ProThread
}
}
public void Sw_Samplegas(ushort statue)
{
int ret;
ushort switchaddr = 19;
//ushort writestatue = 0;
byte[] nowdata = new byte[1];
int count = 0;
////ret = m_modbus.ReadCoilStatus(switchaddr, 1, this.strIP, this.netPost, ref nowdata);
////while (ret != 0)
////{
//// count++;
//// ret = m_modbus.ReadCoilStatus(switchaddr, 1, this.strIP, this.netPost, ref nowdata);
//// Thread.Sleep(200);
//// if (count == 3)
//// break;
////}
////if (ret == 0)
{
//ret = m_modbus.WriteSingleCoil(switchaddr, statue, this.strIP, this.netPost);
//while (ret != 0)
//{
// count++;
// ret = m_modbus.WriteSingleCoil(switchaddr, statue, this.strIP, this.netPost);
// Thread.Sleep(100);
// if (count == 3)
// break;
//}
}
}
public void Sw_RelayAdiust(int type)
{
int ret;
......
......@@ -12,7 +12,7 @@ namespace GcDevicePc
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
bool createNew;
//Application.Run(new TestForm());
//Application.Run(new ConfigMethod.FID());
{
using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew))
{
......
......@@ -37,6 +37,7 @@
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
......@@ -51,7 +52,7 @@
//
// button2
//
this.button2.Location = new System.Drawing.Point(250, 364);
this.button2.Location = new System.Drawing.Point(128, 314);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
......@@ -108,11 +109,22 @@
this.button6.Text = "button3";
this.button6.UseVisualStyleBackColor = true;
//
// button7
//
this.button7.Location = new System.Drawing.Point(244, 314);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(75, 23);
this.button7.TabIndex = 4;
this.button7.Text = "button7";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.Button7_Click);
//
// TestForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 583);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
......@@ -136,5 +148,6 @@
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
}
}
\ No newline at end of file
......@@ -120,16 +120,7 @@ namespace GcDevicePc
private void button2_Click(object sender, EventArgs e)
{
//MessageBox.Show("asd");
//this.pictureMenu1.PMOptbtnstatus = 4;
//(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3;
//tinfliang
//LMessageBox box = new LMessageBox();
//box.Show(100, 100, this.Location, true, "1230", "3214", LMessageBox.MessageBoxType.MBT_ButtonOK);
NModbusSlave N = new NModbusSlave();
}
int i = 0;
private void Timer1_Tick(object sender, EventArgs e)
......@@ -137,5 +128,10 @@ namespace GcDevicePc
i++;
}
private void Button7_Click(object sender, EventArgs e)
{
}
}
}
......@@ -124,6 +124,8 @@
this.firstfiredelay.Name = "firstfiredelay";
this.firstfiredelay.Size = new System.Drawing.Size(100, 21);
this.firstfiredelay.TabIndex = 10;
this.firstfiredelay.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Text_KeyDown);
this.firstfiredelay.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Text_KeyUp);
//
// label14
//
......
......@@ -758,6 +758,37 @@ namespace GcDevicePc
adsw(0);
}
private double lastnum;
private void Text_KeyDown(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
lastnum = Convert.ToDouble((sender as TextBox).Text);
}
else
{
lastnum = 0;
}
}
private void Text_KeyUp(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
double nextnum = Convert.ToDouble((sender as TextBox).Text);
if (nextnum < 0)
{
MessageBox.Show("延时时间设置不能小于0");
(sender as TextBox).Text = lastnum.ToString();
}
if (nextnum > 20)
{
MessageBox.Show("延时时间设置不能大于20");
(sender as TextBox).Text = lastnum.ToString();
}
}
}
//private void fireupbtnb_Click(object sender, EventArgs e)
//{
// if (String.IsNullOrEmpty(fireuptime.Text) || String.IsNullOrEmpty(hvalvetime.Text))
......
......@@ -125,7 +125,8 @@ namespace GcDevicePc
public static bool newfile = false;
public static bool createfile = false;
public static bool usable = false;
// public static Modbus m_modbus = new Modbus();
//public static UInt32 starttimer = 0x7FFFFFFF; //开始时间
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment