Commit 7b0a1056 authored by liu's avatar liu

新增林工通讯的通讯协议,添加zb2040后处理软件的通讯,修改外部用户界面和对外部自动校准的逻辑问题

parent 245b0043
......@@ -42,7 +42,7 @@ namespace GcDevicePc
this.fid1ver.Text = this.FID1version;
this.fid2ver.Text = this.FID2version;
this.tcdver.Text = this.TCD1version;
this.PCver.Text = this.Hmiversion + "/1.5.6";
this.PCver.Text = this.Hmiversion + "/1.5.7";
}
}
}
......@@ -594,7 +594,6 @@ namespace GcDevicePc
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.FwFolder = tmpMainFolder;
}
//Logs
tmpMainFolder = Path.Combine(tmpFolder, "Logs");
CheckFolderandFile(0, tmpMainFolder);
......@@ -615,6 +614,16 @@ namespace GcDevicePc
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.SubStatusFolder);
tmpFolder = null;
//string file = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.StartupPath), "GC_Config\\GC_Set\\启动参数\\startup.ini");
//IniFile ini = new IniFile(file);
//string Version = ini.ReadString("Version", "VersionType");
//if (string.IsNullOrEmpty(Version))
//{
// Version = "1";
//}
globaldata.CurrentVersion = "1";
}
/// <summary>
......@@ -683,6 +692,35 @@ namespace GcDevicePc
return true;
}
public GCMethodConfig InitGetConfig(string filename)
{
GCMethodConfig gCMethodConfig = new GCMethodConfig();
IniFile iniFile = new IniFile(filename);
if (File.Exists(filename))
{
string section = "信号";
gCMethodConfig.signal.u16ChannelA = (ushort)iniFile.ReadInteger(section, "通道A");
gCMethodConfig.signal.u16ChannelB = (ushort)iniFile.ReadInteger(section, "通道B");
for (int i = 0; i < 8; i++)
{
gCMethodConfig.signal.uDetA[i] = (ushort)iniFile.ReadInteger(section, "通道A检测器" + (i + 1).ToString());
gCMethodConfig.signal.uDetB[i] = (ushort)iniFile.ReadInteger(section, "通道B检测器" + (i + 1).ToString());
}
for (int i = 0; i < 8; i++)
{
gCMethodConfig.signal.u16DetTimeLengthA[i] = (ushort)iniFile.ReadInteger(section, "通道A检测时间" + (i + 1).ToString());
gCMethodConfig.signal.u16DetTimeLengthB[i] = (ushort)iniFile.ReadInteger(section, "通道B检测时间" + (i + 1).ToString());
}
}
return gCMethodConfig;
}
/// <summary>
/// 配置文件初始化
/// </summary>
......@@ -722,6 +760,9 @@ namespace GcDevicePc
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName = tmpfile;
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.show_MethodName = "SingleAnal.ini";
}
//SignalDataToHw.methodconfig = InitGetConfig(tmpfile);
SendDataToZB.methodconfig = InitGetConfig(tmpfile);
}
else
{
......@@ -774,17 +815,7 @@ namespace GcDevicePc
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_StatusName = tmpfile;
tmpfile = null;
string file = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.StartupPath), "GC_Config\\GC_Set\\启动参数\\startup.ini");
IniFile ini = new IniFile(file);
string Version = ini.ReadString("Version", "VersionType");
if (string.IsNullOrEmpty(Version))
{
Version = "0";
}
globaldata.CurrentVersion = Version;
}
public void LocalNetworkCheck()
......
......@@ -28,7 +28,7 @@ namespace GcDevicePc.CK_UI
{
//温度显示
Color zcolor = Color.White;
Color waringcolor = Color.LightGreen;
Color waringcolor = Color.White;
//前进样口
......@@ -73,12 +73,12 @@ namespace GcDevicePc.CK_UI
}
else
{
textBoxport.Text = "";
textBoxport.BackColor = Color.LightGray;
textBoxport.Text = "0.0/0";
textBoxport.BackColor = waringcolor; ;
}
//柱箱
......@@ -97,24 +97,24 @@ namespace GcDevicePc.CK_UI
}
else
{
if (globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp >= 1001.0f)
{
textBoven.Text = "铂电阻断开";
}
else
{
if (globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp >= 1001.0f)
{
textBoven.Text = "铂电阻断开";
}
else
{
textBoven.Text = globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp.ToString("#0.0") + "/" + globaldata.m_dpbuffer.ShowList.showtemp.ColSetTemp.ToString("#0");
}
}
if (Math.Abs(globaldata.m_dpbuffer.ShowList.showtemp.ColSetTemp- globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp)<=0.1)
{
textBoven.BackColor = zcolor;
}
else
textBoven.BackColor = waringcolor;
if (Math.Abs(globaldata.m_dpbuffer.ShowList.showtemp.ColSetTemp - globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp) <= 0.1)
{
textBoven.BackColor = zcolor;
}
else
textBoven.BackColor = waringcolor;
}
textBoven.BackColor = waringcolor;
//阀箱
if (globaldata.m_dpbuffer.ShowList.showtemp.AuxSetTemp1 == 0.0f)
......@@ -192,7 +192,7 @@ namespace GcDevicePc.CK_UI
textBFid.BackColor = waringcolor;
//epc
if (globaldata.m_hwconfig.hwconfiginfo.u16StartType != 0)
if (globaldata.m_hwconfig.hwconfiginfo.u16StartType != 2)
{
hflow.Text = (globaldata.m_dpbuffer.ShowList.showepc.EPC1_2_Cur / 10.0f).ToString("#0.0") + "/" + (globaldata.m_dpbuffer.ShowList.showepc.EPC1_2_Set / 10.0f).ToString("#0");
hflow.BackColor = waringcolor;
......@@ -205,10 +205,14 @@ namespace GcDevicePc.CK_UI
}
else
{
hflow.BackColor = Color.LightGray;
airflow.BackColor = Color.LightGray;
foneflow.BackColor = Color.LightGray;
ftwoflow.BackColor = Color.LightGray;
hflow.Enabled = false;
airflow.Enabled = false;
foneflow.Enabled = false;
ftwoflow.Enabled = false;
//hflow.BackColor = waringcolor;
//airflow.BackColor = waringcolor;
//foneflow.BackColor = waringcolor;
//ftwoflow.BackColor = waringcolor;
}
......@@ -288,8 +292,9 @@ namespace GcDevicePc.CK_UI
//setStatus(ref strtext, ref bkcolor);
//txtstats.Text = strtext;
//txtstats.BackColor = bkcolor;
}catch(Exception ex)
}
catch (Exception ex)
{
Trace.Write(ex);
}
......
......@@ -42,8 +42,8 @@
this.label5 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.textBox2 = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
......@@ -132,7 +132,7 @@
this.groupBox1.Size = new System.Drawing.Size(131, 413);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "结果(ppm)";
this.groupBox1.Text = "结果浓度";
//
// textBox6
//
......@@ -188,12 +188,6 @@
this.label1.TabIndex = 9;
this.label1.Text = "苯";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 60000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// textBox2
//
this.textBox2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -202,6 +196,12 @@
this.textBox2.Size = new System.Drawing.Size(116, 29);
this.textBox2.TabIndex = 6;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 60000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// UserCtl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......
......@@ -59,7 +59,7 @@ namespace GcDevicePc.CK_UI
Systemtype = CKVocAnalyzer.GlobalCKV.Systemtype;
isppm = false;
groupBox1.Text = "结果(mg/m³)";
groupBox1.Text = "结果浓度";
switch (Systemtype)
{
default: //非甲烷总烃
......@@ -272,11 +272,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString() + "ppm";
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString();
}
else
{//此处计算成mg/m3 nmhc
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString() + "mg/m³";
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString();
//textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -293,11 +293,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString() + "ppm";
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString();
}
else
{
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString() + "mg/m³";
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString();
//textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -316,11 +316,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString() + "ppm";
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString();
}
else
{
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString() + "mg/m³";
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString();
//textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -391,12 +391,12 @@ namespace GcDevicePc.CK_UI
{
return;
}
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString() + "ppm";
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString() + "ppm";
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString() + "ppm";
textBox4.Text = Math.Round(listben[listben.Count - 1].Y, 2).ToString() + "ppm";
textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y, 2).ToString() + "ppm";
textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y, 2).ToString() + "ppm";
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString();
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString();
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString();
textBox4.Text = Math.Round(listben[listben.Count - 1].Y, 2).ToString();
textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y, 2).ToString();
textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y, 2).ToString();
......@@ -407,11 +407,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString() + "ppm";
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString();
}
else
{
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString() + "mg/m³";
textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y, 2).ToString();
//textBox1.Text = Math.Round(listNmoc[listNmoc.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -428,11 +428,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString() + "ppm";
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString();
}
else
{
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString() + "mg/m³";
textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y, 2).ToString();
//textBox2.Text = Math.Round(listTHC[listTHC.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -449,11 +449,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString() + "ppm";
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString();
}
else
{
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString() + "mg/m³";
textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y, 2).ToString();
//textBox3.Text = Math.Round(listCH4[listCH4.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -471,11 +471,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox4.Text = Math.Round(listben[listben.Count - 1].Y, 2).ToString() + "ppm";
textBox4.Text = Math.Round(listben[listben.Count - 1].Y, 2).ToString();
}
else
{
textBox4.Text = Math.Round(listben[listben.Count - 1].Y, 2).ToString() + "mg/m³";
textBox4.Text = Math.Round(listben[listben.Count - 1].Y, 2).ToString();
//textBox4.Text = Math.Round(listben[listben.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -492,11 +492,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y, 2).ToString() + "ppm";
textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y, 2).ToString();
}
else
{
textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y, 2).ToString() + "mg/m³";
textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y, 2).ToString();
//textBox5.Text = Math.Round(listjiaben[listjiaben.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......@@ -513,11 +513,11 @@ namespace GcDevicePc.CK_UI
{
if (isppm)
{
textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y, 2).ToString() + "ppm";
textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y, 2).ToString();
}
else
{
textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y, 2).ToString() + "mg/m³";
textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y, 2).ToString();
//textBox6.Text = Math.Round(listerjiaben[listerjiaben.Count - 1].Y / (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 12) * (CKVocAnalyzer.GlobalCKV.vocparamlist[i].MWeight / 22.4), 2).ToString() + "mg/m³";
}
......
......@@ -97,7 +97,7 @@ namespace GcDevicePc.Common
switch (e.ModbusDataType)
{
case ModbusDataType.HoldingRegister:
slavewirtehreg(e.StartAddress, e.Data.B.ToArray());
//slavewirtehreg(e.StartAddress, e.Data.B.ToArray());
break;
case ModbusDataType.Coil:
......@@ -117,6 +117,11 @@ namespace GcDevicePc.Common
}
/// <summary>
/// 辰科污染源VOC
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
static ushort slavereadhreg(ushort address)
{
try
......@@ -415,6 +420,24 @@ namespace GcDevicePc.Common
case 1002:
value = globaldata.m_dpbuffer.ShowList.showepc.EPC1_3_Cur;
break;
case 1003:
//value = CKVocAnalyzer.GlobalCKV.adjustTwo.;
value = 0;
break;
case 1004:
value = 0;
//value = globaldata.m_dpbuffer.ShowList.showepc.EPC1_3_Cur;
break;
case 1300:
value = (ushort)globaldata.m_pcbuffer.gcpcinfo.adjust.AdjustType;
break;
case 1301:
value = (ushort)globaldata.m_pcbuffer.gcpcinfo.adjust.AdjustOS;
break;
case 1302:
value = (ushort)(globaldata.m_pcbuffer.gcpcinfo.adjust.AdjustTime*60);
break;
}
}
if (address >= 1500)
......@@ -470,55 +493,64 @@ namespace GcDevicePc.Common
static void slavewirtehreg(ushort address, ushort[] value)
{
if (address >= 50 && address < 99)
{
switch (address)
{
case 50:
globaldata.m_hmibuffer.gcadjust.setpotency = ushortofloat(value);
//int index = CKVocAnalyzer.GlobalCKV.autoVlue.FindIndex(s => s.name == "NMHC");
CKVocAnalyzer.GlobalCKV.nmhcsavevale.biaozhun = Math.Round(globaldata.m_hmibuffer.gcadjust.setpotency, 2);
CKVocAnalyzer.ExteConfig.Instance.Save();
CKVocAnalyzer.AutoAdjust.IsSaveConfig = true;
break;
case 52:
globaldata.m_hmibuffer.gcadjust.trackpotency = ushortofloat(value);
int tindex = CKVocAnalyzer.GlobalCKV.autoVlue.FindIndex(s => s.name == "CH4");
CKVocAnalyzer.GlobalCKV.autoVlue[tindex].biaozhun = Math.Round(globaldata.m_hmibuffer.gcadjust.trackpotency, 2);
CKVocAnalyzer.ExteConfig.Instance.Save();
CKVocAnalyzer.AutoAdjust.IsSaveConfig = true;
break;
case 54:
globaldata.m_hmibuffer.gcadjust.settime = ushortolong(value);
CKVocAnalyzer.GlobalCKV.AutoTimes = (int)globaldata.m_hmibuffer.gcadjust.settime / 60;
CKVocAnalyzer.ExteConfig.Instance.Save();
CKVocAnalyzer.AutoAdjust.IsSaveConfig = true;
//if (address >= 50 && address < 99)
break;
case 56:
globaldata.m_hmibuffer.gcadjust.executefun = ushortolong(value);
break;
case 58:
globaldata.m_hmibuffer.gcadjust.funrun = ushortolong(value);
executefuncation();
globaldata.m_hmibuffer.gcadjust.funrun = 0;
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 == 200)
{
if (value[0] == 0)
{
globaldata.usable = false;
}
if (value[0] == 1)
{
globaldata.usable = true;
}
}
//if (address == 100 || address == 99)
//{
......@@ -550,41 +582,80 @@ namespace GcDevicePc.Common
public static void executefuncation()
{
if (globaldata.m_hmibuffer.gcadjust.funrun==1)
{
switch (globaldata.m_hmibuffer.gcadjust.executefun)
{
//校零
case 0x02:
case 0x0A:
case 0x06:
case 0x0E:
CurveDisPlay.curdisp.SetAutoAdjust(0);
break;
//校标
case 0x03:
case 0x0B:
case 0x07:
case 0x0F:
CurveDisPlay.curdisp.SetAutoAdjust(1);
break;
//样
case 0x00:
case 0x08:
case 0x04:
case 0x0C:
CurveDisPlay.curdisp.SetAutoAdjust(2);
break;
default:
break;
}
}
else
//if (globaldata.m_hmibuffer.gcadjust.funrun==1)
//{
// switch (globaldata.m_hmibuffer.gcadjust.executefun)
// {
// case 0x02:
// case 0x03:
// case 0x00:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Ling;
// break;
// case 0x0A:
// case 0x0E:
// case 0x0B:
// case 0x0F:
// case 0x08:
// case 0x0C:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Xiao;
// break;
// case 0x06:
// case 0x07:
// case 0x04:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Biao;
// break;
// default:
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Default;
// break;
// }
//}
//else
//{
// CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_fang;
//}
switch (globaldata.m_hmibuffer.gcadjust.funrun)
{
CurveDisPlay.curdisp.StopAutoAdjust();
}
case 1:
switch (globaldata.m_hmibuffer.gcadjust.executefun)
{
case 0x02:
case 0x03:
case 0x00:
CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Ling;
break;
case 0x0A:
case 0x0E:
case 0x0B:
case 0x0F:
case 0x08:
case 0x0C:
CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Xiao;
break;
case 0x06:
case 0x07:
case 0x04:
CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Biao;
break;
default:
CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Default;
break;
}
break;
case 2:
CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_fang;
break;
case 3:
CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_fang;
break;
default:
//CKVocAnalyzer.AutoAdjust.Af_Option = CKVocAnalyzer.AutoAdjust.AdjustFromSet.AF_Default;
break;
}
}
public static ushort slavereadcreg(ushort address)
......@@ -686,7 +757,7 @@ namespace GcDevicePc.Common
{
if (CProfileDevice.m_DevParam.syspara.u16InjPortFront == 1)
{
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.FPActualTemp * 10;
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.FPActualTemp;
}
else
{
......@@ -697,7 +768,7 @@ namespace GcDevicePc.Common
{
if (CProfileDevice.m_DevParam.syspara.u16InjPortBehind == 1)
{
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.BPActualTemp * 10;
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.BPActualTemp;
}
else
{
......@@ -708,7 +779,7 @@ namespace GcDevicePc.Common
{
if (CProfileDevice.m_DevParam.syspara.u16Col == 1)
{
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp * 10;
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp;
}
else
{
......@@ -721,11 +792,11 @@ namespace GcDevicePc.Common
{
if (CProfileDevice.m_DevParam.syspara.u16DetFrontType == 0)
{
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp * 10;
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp;
}
else if (CProfileDevice.m_DevParam.syspara.u16DetFrontType == 1)
{
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp * 10;
f[0] = globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp;
}
else
{
......@@ -748,49 +819,90 @@ namespace GcDevicePc.Common
}
}
if (address >= 40 && address < 50)
if (address >= 36 && address < 50)
{
if (address == 40 || address == 41)
value = 0;
if (address == 48 || address == 49)
if (address >= 36 && address < 48)
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
if (address == 36 || address == 37)
{ }
if (address == 38 || address == 39)
{ }
//jiawan
if (address == 40 || address == 41)
{
int index = CKVocAnalyzer.GlobalCKV.adjustTwo.FindIndex(p => p.name == "CH4");
if (index!=-1)
{
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.adjustTwo[index].BValue.ToString("0.00"));
}
else
{
f[0] = 0;
}
}
if (address == 42 || address == 43)
{
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;
int index = CKVocAnalyzer.GlobalCKV.adjustTwo.FindIndex(p => p.name == "CH4");
if (index != -1)
{
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.adjustTwo[index].CValue.ToString("0.00"));
}
else
{
f[0] = 0;
}
}
//zongting
if (address == 44 || address == 45)
{
int index = CKVocAnalyzer.GlobalCKV.adjustTwo.FindIndex(p => p.name == "THC");
if (index != -1)
{
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.adjustTwo[index].BValue.ToString("0.00"));
}
else
{
f[0] = 0;
}
}
if (address == 46 || address == 47)
{
int index = CKVocAnalyzer.GlobalCKV.adjustTwo.FindIndex(p => p.name == "THC");
if (index != -1)
{
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.adjustTwo[index].CValue.ToString("0.00"));
}
else
{
f[0] = 0;
}
}
Buffer.BlockCopy(l, 0, s, 0, 4);
Buffer.BlockCopy(f, 2, s, 0, 2);
Buffer.BlockCopy(f, 0, s, 2, 2);
value = s[(address - 42) % 2];
}
if (address >= 48 && address < 50)
{
if (address == 48 || address == 49)
l[0] = globaldata.m_hmibuffer.gcadjust.executefun;
value = s[(address - 40) % 2];
Buffer.BlockCopy(l, 2, s, 0, 2);
Buffer.BlockCopy(l, 0, s, 2, 2);
value = s[(address - 46) % 2];
}
}
if (address >= 50 && address < 54)
{
if (address == 50 || address == 51)
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.nongdu.ToString("0.000"));
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.nmhcsavevale.biaozhun.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"));
// }
//}
f[0] = 0;
int tindex = CKVocAnalyzer.GlobalCKV.autoVlue.FindIndex(p => p.name == "CH4");
f[0] = float.Parse(CKVocAnalyzer.GlobalCKV.autoVlue[tindex].biaozhun.ToString("0.000"));
}
Buffer.BlockCopy(f, 2, s, 0, 2);
Buffer.BlockCopy(f, 0, s, 2, 2);
......@@ -815,21 +927,23 @@ namespace GcDevicePc.Common
break;
case 60:
case 61:
if ((ushort)SharedSpace.Data.typesint == 1 || (ushort)SharedSpace.Data.typesint == 2)
{
if (SharedSpace.MControl.dateend != 0 && SharedSpace.MControl.zhouqi != 0)
{
l[0]= globaldata.m_hmibuffer.gcadjust.runtime;
}
else
{
l[0] = 0;
}
}
else
{
l[0] = 0;
}
//if ((ushort)SharedSpace.Data.typesint == 1 || (ushort)SharedSpace.Data.typesint == 2)
//{
// if (SharedSpace.MControl.dateend != 0 && SharedSpace.MControl.zhouqi != 0)
// {
// l[0]= globaldata.m_hmibuffer.gcadjust.runtime;
// }
// else
// {
// l[0] = 0;
// }
//}
//else
//{
// l[0] = 0;
//}
l[0] = CKVocAnalyzer.GlobalCKV.TimeCount;
break;
case 62:
case 63:
......@@ -868,7 +982,8 @@ namespace GcDevicePc.Common
break;
}
Buffer.BlockCopy(l, 0, s, 0, 4);
Buffer.BlockCopy(l, 2, s, 0, 2);
Buffer.BlockCopy(l, 0, s, 2, 2);
value = s[(address - 54) % 2];
......@@ -932,32 +1047,17 @@ namespace GcDevicePc.Common
}
}
public struct state
{
public ushort blvalve; //标零阀开关
public ushort yblvalve; //样气阀标零阀切换
public ushort biaoling; //零/标
public ushort Sample_Adjust; //走气/校气
public ushort jzgz; //校准/跟踪
public ushort jzcl_stat; //校准状态/测量状态
public ushort normal_error; //正常/报警
public ushort Long_Short_range; //本地/遥控指示位
}
/// <summary>
/// 设置字节指定位置的值
/// </summary>
/// <param name="data">字节</param>
/// <param name="index">位置</param>
/// <param name="flag">值</param>
void set_bit(ref byte data, int index, bool flag)
{
if (index > 8 || index < 1)
throw new ArgumentOutOfRangeException();
int v = index < 2 ? index : (2 << (index - 2));
data = flag ? (byte)(data | v) : (byte)(data & ~v);
}
//public struct state
//{
// public ushort blvalve; //标零阀开关
// public ushort yblvalve; //样气阀标零阀切换
// public ushort biaoling; //零/标
// public ushort Sample_Adjust; //走气/校气
// public ushort jzgz; //校准/跟踪
// public ushort jzcl_stat; //校准状态/测量状态
// public ushort normal_error; //正常/报警
// public ushort Long_Short_range; //本地/遥控指示位
//}
private static float ushortofloat(ushort[] us)
{
......
......@@ -434,8 +434,8 @@ namespace GcDevicePc.ConfigMethod
globaldata.m_configDlg.m_SignalDlg.reflashContent();
}
SignalDataToHw.methodconfig = this.gcmethodconfig;
//SendDataToZB.methodconfig = this.gcmethodconfig;
//SignalDataToHw.methodconfig = this.gcmethodconfig;
SendDataToZB.methodconfig = this.gcmethodconfig;
//string message = "提交成功!";
//MessageBox.Show(message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
......
......@@ -39,6 +39,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.datalist.FullRowSelect = true;
this.datalist.GridLines = true;
this.datalist.HideSelection = false;
this.datalist.Location = new System.Drawing.Point(0, 0);
this.datalist.Margin = new System.Windows.Forms.Padding(0);
this.datalist.Name = "datalist";
......
......@@ -1072,6 +1072,7 @@ namespace GcDevicePc
this.datalist.Items.Add(tempshow);
#region
//tempshow = new ListViewItem();
//this.datalist.Items.Add(tempshow);
......@@ -2163,6 +2164,41 @@ namespace GcDevicePc
GetSetValue(globaldata.m_dpbuffer.ShowList.showepc.EPC2_2_Set));
this.datalist.Items.Add(tempshow);
}
tempshow.SubItems.Add("");
this.datalist.Items.Add(tempshow);
tempshow = new ListViewItem();
tempshow.Text = GettempName("6路功率");
tempshow.Font = new Font(tempshow.Font, tempshow.Font.Style | FontStyle.Bold);
tempshow.SubItems.Add("");
this.datalist.Items.Add(tempshow);
;
tempshow = new ListViewItem();
tempshow.Text = GettempName("前检测器功率");
tempshow.SubItems.Add(globaldata.m_dpbuffer.ShowList.pwmInfo.fDPower.ToString());
this.datalist.Items.Add(tempshow);
tempshow = new ListViewItem();
tempshow.Text = GettempName("中检测器功率");
tempshow.SubItems.Add(globaldata.m_dpbuffer.ShowList.pwmInfo.iDPower.ToString());
this.datalist.Items.Add(tempshow);
tempshow = new ListViewItem();
tempshow.Text = GettempName("后检测器功率");
tempshow.SubItems.Add(globaldata.m_dpbuffer.ShowList.pwmInfo.bDPower.ToString());
this.datalist.Items.Add(tempshow);
tempshow = new ListViewItem();
tempshow.Text = GettempName("前进样器功率");
tempshow.SubItems.Add(globaldata.m_dpbuffer.ShowList.pwmInfo.fSPower.ToString());
this.datalist.Items.Add(tempshow);
tempshow = new ListViewItem();
tempshow.Text = GettempName("后进样器功率");
tempshow.SubItems.Add(globaldata.m_dpbuffer.ShowList.pwmInfo.bSPower.ToString());
this.datalist.Items.Add(tempshow);
tempshow = new ListViewItem();
tempshow.Text = GettempName("柱箱功率");
tempshow.SubItems.Add(globaldata.m_dpbuffer.ShowList.pwmInfo.CbPower.ToString());
this.datalist.Items.Add(tempshow);
#region
//if (CProfileDevice.m_DevParam.syspara.u16InjPortCtlMode_Behind == 3 &&
// CProfileDevice.m_DevParam.syspara.u16InjPortCtlMode_Front == 3)
......
......@@ -54,7 +54,7 @@
this.buttonauto.Name = "buttonauto";
this.buttonauto.Size = new System.Drawing.Size(89, 34);
this.buttonauto.TabIndex = 3;
this.buttonauto.Text = "自动校准";
this.buttonauto.Text = "校准";
this.buttonauto.UseVisualStyleBackColor = true;
this.buttonauto.Click += new System.EventHandler(this.buttonauto_Click);
//
......
......@@ -60,7 +60,7 @@ namespace GcDevicePc
// MessageBox.Show("点火操作禁止,FID已经点火成功");
}
CKVocAnalyzer.AutoAdjust auto;
public CKVocAnalyzer.AutoAdjust auto;
//自动校准
private void buttonauto_Click(object sender, EventArgs e)
......@@ -75,17 +75,28 @@ namespace GcDevicePc
if (auto == null)
{
auto = new CKVocAnalyzer.AutoAdjust();
auto.Isadmin = false;
auto.Show();
}
else if (auto.IsDisposed)
{
auto = null;
auto = new CKVocAnalyzer.AutoAdjust();
auto.Isadmin = false;
auto.Show();
}
else
{
auto.Activate();
//auto.Activate();
if (!auto.Visible)
{
auto.Isadmin = false;
auto.Show();
auto.IsinitShow();
//auto.ShowKB();
}
}
//if (!globaldata.usable)//表示上位机处于运行状态下不可进行自动校准
......
......@@ -165,14 +165,29 @@ namespace GcDevicePc.GCBuffer
public ushort bDetPol;
}
public struct PwmInfo
{
public int fDPower;
public int iDPower;
public int bDPower;
public int fSPower;
public int bSPower;
public int CbPower;
}
public struct ShowInfo
{
public TiemInfo showtime;
public TempInfo showtemp;
public ValveShowInfo showValve;
public ISportInfo showISport;
public DetInfo showDet;
public EPCInfo showepc;
public TiemInfo showtime;
public TempInfo showtemp;
public ValveShowInfo showValve;
public ISportInfo showISport;
public DetInfo showDet;
public EPCInfo showepc;
public PwmInfo pwmInfo;
}
public ShowInfo ShowList = new ShowInfo();
......@@ -289,6 +304,13 @@ namespace GcDevicePc.GCBuffer
this.ShowList.showDet.bDetSwitch = false;
// this.ShowList.errorifo.ErrorStatus = new byte[9];
this.ShowList.pwmInfo.bDPower = 0;
this.ShowList.pwmInfo.fDPower = 0;
this.ShowList.pwmInfo.iDPower = 0;
this.ShowList.pwmInfo.bSPower = 0;
this.ShowList.pwmInfo.fDPower = 0;
this.ShowList.pwmInfo.CbPower = 0;
}
public DPBuffer()
......
......@@ -44,6 +44,7 @@ namespace GcDevicePc.GCBuffer
public ushort work_Statue; //系统工作状态
public ushort RunType; //运行类型 0 打开运行 1 智能运行 2 批处理
public bool sendtohw;
public bool sendtoZb;
public bool info_log;
public bool error_log;
public string hmimac;
......@@ -78,11 +79,19 @@ namespace GcDevicePc.GCBuffer
public ThreadInfo pcthreadinfo;
public OutPutInfo outputinfo;
public Adjust adjust;
}
public PCInfo gcpcinfo = new PCInfo();
public struct Adjust
{
public int AdjustType;
public int AdjustOS;
public int AdjustTime;
}
public PCBuffer()
{
......@@ -117,7 +126,9 @@ namespace GcDevicePc.GCBuffer
gcpcinfo.moduleinfo.ip = "";
gcpcinfo.outputinfo.port = 0;
gcpcinfo.adjust.AdjustOS = 0;
gcpcinfo.adjust.AdjustType = 0;
gcpcinfo.adjust.AdjustTime = 0;
try
{
......@@ -131,7 +142,8 @@ namespace GcDevicePc.GCBuffer
int opensys = ini.ReadInteger("StartUp", "打开系统");
int runtype = ini.ReadInteger("StartUp", "运行类型");
int senddata = ini.ReadInteger("StartUp", "SendData");
int senddatatohw = ini.ReadInteger("StartUp", "SendDataToHw");
int senddatatozb = ini.ReadInteger("StartUp", "SendDataToZB");
gcpcinfo.pcfolderinfo.DataFolder = ini.ReadString("DataFolder", "历史数据");
gcpcinfo.pcworkinfo.hmimac = ini.ReadString("NetWorkConfig", "MAC地址");
......@@ -145,13 +157,18 @@ namespace GcDevicePc.GCBuffer
gcpcinfo.pcworkinfo.RunType = 0;
}
if (senddata == 1)
if (senddatatohw == 1)
{
gcpcinfo.pcworkinfo.sendtohw = true;
}
else if (senddatatozb == 1)
{
gcpcinfo.pcworkinfo.sendtoZb = true;
}
else
{
gcpcinfo.pcworkinfo.sendtohw = false;
gcpcinfo.pcworkinfo.sendtoZb = false;
}
//INIOperation test = new INIOperation(file);
......@@ -223,6 +240,7 @@ namespace GcDevicePc.GCBuffer
{
gcpcinfo.pcworkinfo.RunType = 0;
gcpcinfo.pcworkinfo.sendtohw = false;
gcpcinfo.pcworkinfo.sendtoZb = false;
gcpcinfo.pcfolderinfo.DataFolder = null;
}
}
......
......@@ -39,6 +39,7 @@
this.SystemStopMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AuxToolMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ParameterSettingMenu = new System.Windows.Forms.ToolStripMenuItem();
this.自动校准ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SettingMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.NetWorkMenu = new System.Windows.Forms.ToolStripMenuItem();
this.MethodBatMenu = new System.Windows.Forms.ToolStripMenuItem();
......@@ -56,9 +57,11 @@
this.SingleStart = new System.Windows.Forms.ToolStripMenuItem();
this.SingleStop = new System.Windows.Forms.ToolStripMenuItem();
this.SingleCancel = new System.Windows.Forms.ToolStripMenuItem();
this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.HelpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AboutMenu = new System.Windows.Forms.ToolStripMenuItem();
this.changeVsi = new System.Windows.Forms.ToolStripMenuItem();
this.单位换算ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
......@@ -71,8 +74,6 @@
this.AdjustStat = new System.Windows.Forms.ToolStripStatusLabel();
this.workProgress = new System.Windows.Forms.ToolStripProgressBar();
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.单位换算ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.自动校准ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.statusStrip.SuspendLayout();
this.SuspendLayout();
......@@ -133,31 +134,38 @@
// SystemStartMenu
//
this.SystemStartMenu.Name = "SystemStartMenu";
this.SystemStartMenu.Size = new System.Drawing.Size(180, 26);
this.SystemStartMenu.Size = new System.Drawing.Size(144, 26);
this.SystemStartMenu.Text = "系统开启";
this.SystemStartMenu.Click += new System.EventHandler(this.SystemStartMenu_Click);
//
// SystemStopMenu
//
this.SystemStopMenu.Name = "SystemStopMenu";
this.SystemStopMenu.Size = new System.Drawing.Size(180, 26);
this.SystemStopMenu.Size = new System.Drawing.Size(144, 26);
this.SystemStopMenu.Text = "系统关闭";
this.SystemStopMenu.Click += new System.EventHandler(this.SystemStopMenu_Click);
//
// AuxToolMenu
//
this.AuxToolMenu.Name = "AuxToolMenu";
this.AuxToolMenu.Size = new System.Drawing.Size(180, 26);
this.AuxToolMenu.Size = new System.Drawing.Size(144, 26);
this.AuxToolMenu.Text = "辅助工具";
this.AuxToolMenu.Click += new System.EventHandler(this.AuxToolMenu_Click);
//
// ParameterSettingMenu
//
this.ParameterSettingMenu.Name = "ParameterSettingMenu";
this.ParameterSettingMenu.Size = new System.Drawing.Size(180, 26);
this.ParameterSettingMenu.Size = new System.Drawing.Size(144, 26);
this.ParameterSettingMenu.Text = "参数设置";
this.ParameterSettingMenu.Click += new System.EventHandler(this.ParameterSettingMenu_Click);
//
// 自动校准ToolStripMenuItem
//
this.自动校准ToolStripMenuItem.Name = "自动校准ToolStripMenuItem";
this.自动校准ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.自动校准ToolStripMenuItem.Text = "系统校准";
this.自动校准ToolStripMenuItem.Click += new System.EventHandler(this.自动校准ToolStripMenuItem_Click);
//
// SettingMainMenu
//
this.SettingMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
......@@ -176,47 +184,47 @@
// NetWorkMenu
//
this.NetWorkMenu.Name = "NetWorkMenu";
this.NetWorkMenu.Size = new System.Drawing.Size(180, 26);
this.NetWorkMenu.Size = new System.Drawing.Size(176, 26);
this.NetWorkMenu.Text = "通讯设置";
this.NetWorkMenu.Click += new System.EventHandler(this.NetWorkMenu_Click);
//
// MethodBatMenu
//
this.MethodBatMenu.Name = "MethodBatMenu";
this.MethodBatMenu.Size = new System.Drawing.Size(180, 26);
this.MethodBatMenu.Size = new System.Drawing.Size(176, 26);
this.MethodBatMenu.Text = "方法批处理";
this.MethodBatMenu.Click += new System.EventHandler(this.MethodBatMenu_Click);
//
// NewMethodMenu
//
this.NewMethodMenu.Name = "NewMethodMenu";
this.NewMethodMenu.Size = new System.Drawing.Size(180, 26);
this.NewMethodMenu.Size = new System.Drawing.Size(176, 26);
this.NewMethodMenu.Text = "新建方法";
this.NewMethodMenu.Click += new System.EventHandler(this.NewMethodMenu_Click);
//
// OpenMethodMenu
//
this.OpenMethodMenu.Name = "OpenMethodMenu";
this.OpenMethodMenu.Size = new System.Drawing.Size(180, 26);
this.OpenMethodMenu.Size = new System.Drawing.Size(176, 26);
this.OpenMethodMenu.Text = "打开方法文件";
this.OpenMethodMenu.Click += new System.EventHandler(this.OpenMethodMenu_Click);
//
// MethodBrowseMenuItem
//
this.MethodBrowseMenuItem.Name = "MethodBrowseMenuItem";
this.MethodBrowseMenuItem.Size = new System.Drawing.Size(180, 26);
this.MethodBrowseMenuItem.Size = new System.Drawing.Size(176, 26);
this.MethodBrowseMenuItem.Text = "方法查阅";
this.MethodBrowseMenuItem.Click += new System.EventHandler(this.MethodBrowseMenuItem_Click);
//
// SettingSeparator
//
this.SettingSeparator.Name = "SettingSeparator";
this.SettingSeparator.Size = new System.Drawing.Size(177, 6);
this.SettingSeparator.Size = new System.Drawing.Size(173, 6);
//
// GCConfigMenuItem
//
this.GCConfigMenuItem.Name = "GCConfigMenuItem";
this.GCConfigMenuItem.Size = new System.Drawing.Size(180, 26);
this.GCConfigMenuItem.Size = new System.Drawing.Size(176, 26);
this.GCConfigMenuItem.Text = "仪器配置";
this.GCConfigMenuItem.Click += new System.EventHandler(this.ConfigCreateSubMenuItem_Click);
//
......@@ -255,7 +263,8 @@
// DebugMainMenu
//
this.DebugMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SingleControlMenu});
this.SingleControlMenu,
this.testToolStripMenuItem});
this.DebugMainMenu.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.DebugMainMenu.Name = "DebugMainMenu";
this.DebugMainMenu.Size = new System.Drawing.Size(54, 25);
......@@ -268,7 +277,7 @@
this.SingleStop,
this.SingleCancel});
this.SingleControlMenu.Name = "SingleControlMenu";
this.SingleControlMenu.Size = new System.Drawing.Size(180, 26);
this.SingleControlMenu.Size = new System.Drawing.Size(176, 26);
this.SingleControlMenu.Text = "单次流程控制";
//
// SingleStart
......@@ -292,6 +301,14 @@
this.SingleCancel.Text = "取消";
this.SingleCancel.Click += new System.EventHandler(this.SingleCancel_Click);
//
// testToolStripMenuItem
//
this.testToolStripMenuItem.Name = "testToolStripMenuItem";
this.testToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.testToolStripMenuItem.Text = "test";
this.testToolStripMenuItem.Visible = false;
this.testToolStripMenuItem.Click += new System.EventHandler(this.TestToolStripMenuItem_Click);
//
// HelpMainMenu
//
this.HelpMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
......@@ -306,17 +323,25 @@
// AboutMenu
//
this.AboutMenu.Name = "AboutMenu";
this.AboutMenu.Size = new System.Drawing.Size(180, 26);
this.AboutMenu.Size = new System.Drawing.Size(144, 26);
this.AboutMenu.Text = "关于";
this.AboutMenu.Click += new System.EventHandler(this.AboutMenu_Click);
//
// changeVsi
//
this.changeVsi.Name = "changeVsi";
this.changeVsi.Size = new System.Drawing.Size(180, 26);
this.changeVsi.Size = new System.Drawing.Size(144, 26);
this.changeVsi.Text = "切换版本";
this.changeVsi.Visible = false;
this.changeVsi.Click += new System.EventHandler(this.changeVsi_Click);
//
// 单位换算ToolStripMenuItem
//
this.单位换算ToolStripMenuItem.Name = "单位换算ToolStripMenuItem";
this.单位换算ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.单位换算ToolStripMenuItem.Text = "单位换算";
this.单位换算ToolStripMenuItem.Click += new System.EventHandler(this.单位换算ToolStripMenuItem_Click);
//
// timer1
//
this.timer1.Enabled = true;
......@@ -412,20 +437,6 @@
this.timer2.Interval = 1000;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// 单位换算ToolStripMenuItem
//
this.单位换算ToolStripMenuItem.Name = "单位换算ToolStripMenuItem";
this.单位换算ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.单位换算ToolStripMenuItem.Text = "单位换算";
this.单位换算ToolStripMenuItem.Click += new System.EventHandler(this.单位换算ToolStripMenuItem_Click);
//
// 自动校准ToolStripMenuItem
//
this.自动校准ToolStripMenuItem.Name = "自动校准ToolStripMenuItem";
this.自动校准ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.自动校准ToolStripMenuItem.Text = "自动校准";
this.自动校准ToolStripMenuItem.Click += new System.EventHandler(this.自动校准ToolStripMenuItem_Click);
//
// MDIBase
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -495,6 +506,7 @@
private System.Windows.Forms.ToolStripStatusLabel AdjustStat;
private System.Windows.Forms.ToolStripMenuItem 单位换算ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 自动校准ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem testToolStripMenuItem;
}
}
......
......@@ -85,7 +85,7 @@ namespace GcDevicePc
private DataOutput wtd624xOutput = new DataOutput();
private SignalDataToHw signalDataTohw = new SignalDataToHw();
//private SendDataToZB signalDataTozb = new SendDataToZB();
private SendDataToZB signalDataTozb = new SendDataToZB();
#endregion
#region Author by zjx
......@@ -326,6 +326,10 @@ namespace GcDevicePc
if (globaldata.CurrentVersion == "1")
{
_userForm.Show();
_userForm.auto = new CKVocAnalyzer.AutoAdjust();
_userForm.auto.Show();
_userForm.auto.Hide();
}
_EPCTipsForm = new EPCTips();
......@@ -773,7 +777,7 @@ namespace GcDevicePc
/// 1.0.2.3 添加了周期完成后,重新绘图功能
private void timer1_Tick(object sender, EventArgs e)
{
this.Text = String.Format("Tetchrom色谱工作站-1.5.6 {0}", Formstr);
this.Text = String.Format("Vocs色谱工作站-1.5.7 {0}", Formstr);
//if (LandIn.Island)
//{
// HmiStatus.Text = String.Format("状态:{0}", statestr);
......@@ -801,37 +805,19 @@ namespace GcDevicePc
//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)
{
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;
}
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)
{
......@@ -1264,10 +1250,16 @@ namespace GcDevicePc
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.sendtohw)
{
signalDataTohw.DataToHwStart();
//signalDataTozb.DataToZBStart();
//signalDataTohw.DataToHwStart();
signalDataTozb.DataToZBStart();
}
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.sendtoZb)
{
//signalDataTohw.DataToHwStart();
signalDataTozb.DataToZBStart();
}
try
{
if (globaldata.CurrentVersion == "1")
......@@ -2233,9 +2225,11 @@ namespace GcDevicePc
{
hmiopt.AdjustSwitch(val);
}
public bool Isadmin = false;
private void UserLoginMenu_Click(object sender, EventArgs e)
{
string lgpwd = DateTime.Now.ToString("HHmm");
string lgpwd = "666666";
while (true)
{
DialogResult dr = new LandIn("admin", lgpwd).ShowDialog();
......@@ -2250,12 +2244,14 @@ namespace GcDevicePc
_debugForm.Activate();
title.Activate();
}
Isadmin = true;
SetMenu(LandIn.Island);
Trace.WriteLine(string.Format("用户{0},进入调试模式", "admin"), "sys");
return;
}
else
{
Isadmin = false;
MessageBox.Show("密码错误!");
}
}
......@@ -2280,6 +2276,7 @@ namespace GcDevicePc
//userForm.Show();
Trace.WriteLine("注销登录,进入用户模式", "sys");
}
Isadmin = false;
LandIn.Island = false;
SetMenu(LandIn.Island);
......@@ -2829,13 +2826,28 @@ namespace GcDevicePc
Log.Error(ex.Message);
}
}
CKVocAnalyzer.SetInfoForm sf;
private void ParameterSettingMenu_Click(object sender, EventArgs e)
{
try
{
CKVocAnalyzer.SetInfoForm sf = new CKVocAnalyzer.SetInfoForm();
sf.Show();
if (showConfig == null)
{
sf = new CKVocAnalyzer.SetInfoForm();
sf.Show();
}
else if (showConfig.IsDisposed)
{
sf = null;
sf = new CKVocAnalyzer.SetInfoForm();
sf.Show();
}
else
{
sf.Activate();
}
}
catch (Exception ex)
......@@ -3048,6 +3060,7 @@ namespace GcDevicePc
/// </summary>
DateTime AutoAdjust;
bool cancv = false;
private void timerWorker_Tick(object sender, EventArgs e)
{
try
......@@ -3067,21 +3080,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;
}
cancv = true;
//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)
{
......@@ -3089,21 +3102,8 @@ 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;
}
cancv = true;
}
......@@ -3135,11 +3135,11 @@ namespace GcDevicePc
{
CurveDisPlay.curdisp.ConfingAdjust();
}
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
cancv = true;
//if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
//{
// hmiopt.Adjust_ling_biao(0, 0);
//}
Trace.WriteLine("校准结束", "sys");
}
if (SharedSpace.MControl.MethodType == 2)
......@@ -3150,11 +3150,11 @@ namespace GcDevicePc
{
CurveDisPlay.curdisp.ConfingAdjust();
}
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
cancv = true;
//if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
//{
// hmiopt.Adjust_ling_biao(0, 0);
//}
Trace.WriteLine("校准结束", "sys");
}
......@@ -3169,28 +3169,47 @@ namespace GcDevicePc
SharedSpace.MControl.SetOut = false;
SharedSpace.MControl.SetRun = false;
SharedSpace.Data.typesint = 0;
Trace.WriteLine("强制校准结束", "sys");
cancv = true;
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.MethodType == 2)
{
SharedSpace.MControl.SetOut = false;
SharedSpace.MControl.SetRun = false;
SharedSpace.Data.typesint = 0;
Trace.WriteLine("强制校准结束", "sys");
cancv = true;
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);
//}
}
}
globaldata.m_hmibuffer.gcadjust.runtime = (long)(AutoAdjust - DateTime.Now).TotalSeconds < 0 ? 0: (long)(AutoAdjust - DateTime.Now).TotalSeconds;
if (cancv)
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
cancv = !hmiopt.Adjust_ling_biao(0, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
cancv = !hmiopt.Adjust_ling_biao(1, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
cancv = !hmiopt.Adjust_ling_biao(0, 0);
break;
default:
break;
}
}
}
catch (Exception ex)
......@@ -3202,6 +3221,8 @@ namespace GcDevicePc
}
private int epct;
private bool epcs;
private Process[] MyProcesses;
private bool Zbexe = false;
private void timer2_Tick(object sender, EventArgs e)
{
epct++;
......@@ -3221,9 +3242,28 @@ namespace GcDevicePc
tips_Show(globaldata.m_hmibuffer.gcinfo.EPCStatus);
}
}
}
if (!Zbexe)
{
MyProcesses = Process.GetProcessesByName("通用5.2");//需要监控的程序名,该方法带出该程序所有用到的进程
foreach (Process myprocess in MyProcesses)
{
//textBox1.Text += myprocess.ProcessName + "\r\n";
if (myprocess.ProcessName.ToLower() == "通用5.2")
{
Zbexe = true;
//MessageBox.Show("通用5.2");
myprocess.EnableRaisingEvents = true;//设置进程终止时触发的时间
myprocess.Exited += new EventHandler(myprocess_Exited);//发现外部程序关闭即触发方法myprocess_Exited
}
}
}
}
private void myprocess_Exited(object sender, EventArgs e)//被触发的程序
{
Zbexe = false;
MessageBox.Show("后处理软件已退出,请重启本软件和后处理软件");
}
private void changeVsi_Click(object sender, EventArgs e)
{
DialogResult dl = MessageBox.Show("是否切换", "版本切换", MessageBoxButtons.OKCancel);
......@@ -3267,26 +3307,43 @@ namespace GcDevicePc
ft.Activate();
}
}
CKVocAnalyzer.AutoAdjust auto;
//CKVocAnalyzer.AutoAdjust auto;
private void 自动校准ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (auto == null)
if (_userForm.auto == null)
{
auto = new CKVocAnalyzer.AutoAdjust();
auto.Show();
_userForm.auto = new CKVocAnalyzer.AutoAdjust();
//_userForm.auto
_userForm.auto.Isadmin = Isadmin;
_userForm.auto.Show();
}
else if (auto.IsDisposed)
else if (_userForm.auto.IsDisposed)
{
auto = null;
auto = new CKVocAnalyzer.AutoAdjust();
auto.Show();
_userForm.auto = null;
_userForm.auto = new CKVocAnalyzer.AutoAdjust();
_userForm.auto.Isadmin = Isadmin;
_userForm.auto.Show();
}
else
{
auto.Activate();
if (!_userForm.auto.Visible)
{
_userForm.auto.Isadmin = Isadmin;
_userForm.auto.Show();
_userForm.auto.IsinitShow();
//_userForm.auto.ShowKB();
}
}
}
private void TestToolStripMenuItem_Click(object sender, EventArgs e)
{
CKVocAnalyzer.testsjshow testsjshow = new CKVocAnalyzer.testsjshow();
testsjshow.Show();
}
//private void debugSubMenu_Click(object sender, EventArgs e)
//{
// try
......
......@@ -247,6 +247,17 @@ namespace GcDevicePc.ProThread
globaldata.channelB_A.Add((long)(fidv[i] * 1000000));
}
}
else if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.sendtoZb)
{
lock (globaldata.channelA_A)
{
globaldata.channelA_A.Add((long)(fidv[i] * 1000000));
}
lock (globaldata.channelB_A)
{
globaldata.channelB_A.Add((long)(fidv[i] * 1000000));
}
}
}
}
}
......@@ -306,6 +317,18 @@ namespace GcDevicePc.ProThread
globaldata.channelA_B.Add((long)(fidv[i] * 1000000));
}
lock (globaldata.channelB_B)
{
globaldata.channelB_B.Add((long)(fidv[i] * 1000000));
}
}
else if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.sendtoZb)
{
lock (globaldata.channelA_B)
{
globaldata.channelA_B.Add((long)(fidv[i] * 1000000));
}
lock (globaldata.channelB_B)
{
globaldata.channelB_B.Add((long)(fidv[i] * 1000000));
......@@ -374,6 +397,17 @@ namespace GcDevicePc.ProThread
globaldata.channelB_C.Add((long)(fidv[i] * 1000000));
}
}
else if(globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.sendtoZb)
{
lock (globaldata.channelA_C)
{
globaldata.channelA_C.Add((long)(fidv[i] * 1000000));
}
lock (globaldata.channelB_C)
{
globaldata.channelB_C.Add((long)(fidv[i] * 1000000));
}
}
}
}
}
......@@ -729,6 +763,7 @@ namespace GcDevicePc.ProThread
ushort[] firestatus = new ushort[4] { 0, 0, 0, 0 };
ushort[] dacstatus = new ushort[6] { 0, 0, 0, 0, 0, 0 };
ushort[] hmiabnormal = new ushort[3];
ushort[] hmipower = new ushort[6] { 0,0,0,0,0,0};
//ushort[] epcdata = new ushort[36];
ushort[] epc1 = new ushort[6];
......@@ -974,6 +1009,48 @@ namespace GcDevicePc.ProThread
{
globaldata.m_hmibuffer.gcinfo.HmiAbnormal = hmiabnormal;
}
if (GetHmiPower(ref hmipower) == 0)
{
globaldata.m_dpbuffer.ShowList.pwmInfo.fDPower = hmipower[0];
globaldata.m_dpbuffer.ShowList.pwmInfo.iDPower = hmipower[1];
globaldata.m_dpbuffer.ShowList.pwmInfo.bDPower = hmipower[2];
globaldata.m_dpbuffer.ShowList.pwmInfo.fSPower = hmipower[3];
globaldata.m_dpbuffer.ShowList.pwmInfo.fSPower = hmipower[4];
globaldata.m_dpbuffer.ShowList.pwmInfo.CbPower = hmipower[5];
}
}
private int GetHmiPower(ref ushort[] hmipower)
{
int ret = -1;
try
{
ret = GetHmiPowerHoldingReg(1151, 6, ref hmipower);
}
catch (Exception e)
{
Log.Error(e.Message);
}
return ret;
}
private int GetHmiPowerHoldingReg(ushort address, ushort num, ref ushort[] state)
{
int ret = -1;
int count = 0;
if (setflag)
{
ret = globaldata.global_moudbus.ReadHoldingReg(address, num, this.strIP, netPost, ref state);
while (ret != 0)
{
count++;
if (count > 3)
break;
ret = globaldata.global_moudbus.ReadHoldingReg(address, num, this.strIP, netPost, ref state);
}
}
return ret;
}
......
......@@ -331,10 +331,10 @@ namespace GcDevicePc.ProThread
}
public void Adjust_ling_biao(int type,ushort oc)
public bool Adjust_ling_biao(int type,ushort oc)
{
int lret;
int bret;
int lret = 0;
int bret = 0;
int count = 0;
if (type == 0)
{
......@@ -380,6 +380,16 @@ namespace GcDevicePc.ProThread
break;
}
}
if (lret == 0 && bret == 0)
{
return true;
}
else
{
return false;
}
}
......
......@@ -27,7 +27,8 @@ namespace GcDevicePc.ProThread
{
GcSendDataToZb(1, 0, 1);
GcSendDataToZb(0, 1, 1);
//GcSendDataToZb(0, 1, 3);
//GcSendDataToZb(1, 0, 3);
//GcSendDataToZb(1, 1, 1);
}
......@@ -36,29 +37,89 @@ namespace GcDevicePc.ProThread
{
GcSendDataToZb(1, 0, 2);
GcSendDataToZb(0, 1, 2);
//GcSendDataToZb(0, 1, 4);
//GcSendDataToZb(1, 0, 4);
//GcSendDataToZb(1, 1, 2);
}
private void SendDataToZB_A(Int32 data)
{
GcSendDataToZb(data, 0, 3);
GcSendDataToZb(0, 0, 4);
//GcSendDataToZb(data, 0, 3);
//GcSendDataToZb(0, 0, 4);
GcSendDataToZb(1, 0, 1);
GcSendDataToZb(0, 1, 2);
}
private void SendDataToZB_B(Int32 data)
{
GcSendDataToZb(0, data, 4);
GcSendDataToZb(0, 0, 3);
GcSendDataToZb(0, 1, 1);
GcSendDataToZb(1, 0, 2);
}
private void SendDataToZB_AB(Int32 dataA, Int32 dataB)
{
//GcSendDataToZb(1, 1, 1);
//double bz = 8388608 / 1120400;
//int da = dataA * 0.298;//8388608 = 2^23
//int db = dataB * 0.298;
int da = Convert.ToInt32(dataA);
int db = Convert.ToInt32(dataB);
GcSendDataToZb(da, db, 0);
//GcSendDataToZb(10, 20, 0);
}
public void testzb(Int32 dataA, Int32 dataB)
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb(dataA, dataB, 0);
//GcSendDataToZb(dataA, dataB, 0);
GcSendDataToZb(10, 20, 0);
//GcSendDataToZb(10, 20, 0);
}
public void testzba()
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb(1, 0, 1);
GcSendDataToZb(1, 0, 3);
GcSendDataToZb(0, 1, 2);
GcSendDataToZb(0, 1, 4);
//GcSendDataToZb(10, 20, 0);
}
public void testzbb()
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb(0, 1, 1);
GcSendDataToZb(1, 0, 2);
//GcSendDataToZb(0, 1, 3);
//GcSendDataToZb(1, 0, 4);
//GcSendDataToZb(10, 20, 0);
}
public void testzbb(int a,int b,int c)
{
//GcSendDataToZb(1, 1, 1);
GcSendDataToZb(a, b, c);
//GcSendDataToZb(0, 1, 3);
//GcSendDataToZb(1, 0, 4);
//GcSendDataToZb(10, 20, 0);
}
#endregion
......@@ -123,74 +184,80 @@ namespace GcDevicePc.ProThread
int i = 0;
for (i = 0; i < 5; i++)
{
switch (methodconfig.signal.uDetA[0])
try
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_A[globaldata.channelA_A.Count - 1].ToString());
globaldata.channelA_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_B[globaldata.channelA_B.Count - 1].ToString());
globaldata.channelA_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_C[globaldata.channelA_C.Count - 1].ToString());
globaldata.channelA_C.RemoveAt(0);
}
break;
}
switch (methodconfig.signal.uDetA[0])
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_A[globaldata.channelA_A.Count - 1].ToString());
globaldata.channelA_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_B[globaldata.channelA_B.Count - 1].ToString());
globaldata.channelA_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_C[globaldata.channelA_C.Count - 1].ToString());
globaldata.channelA_C.RemoveAt(0);
}
break;
}
switch (methodconfig.signal.uDetB[0])
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_A[globaldata.channelB_A.Count - 1].ToString());
globaldata.channelB_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_B[globaldata.channelB_B.Count - 1].ToString());
globaldata.channelB_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_C[globaldata.channelB_C.Count - 1].ToString());
globaldata.channelB_C.RemoveAt(0);
}
break;
switch (methodconfig.signal.uDetB[0])
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_A[globaldata.channelB_A.Count - 1].ToString());
globaldata.channelB_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_B[globaldata.channelB_B.Count - 1].ToString());
globaldata.channelB_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_C[globaldata.channelB_C.Count - 1].ToString());
globaldata.channelB_C.RemoveAt(0);
}
break;
}
}
if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB == 1)
catch
{
SendDataToZB_AB(mydataA, mydataB);
Thread.Sleep(50);
}
//写入A
if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB != 1)
{
SendDataToZB_A(mydataA);
Thread.Sleep(50);
}
//写入B
if (methodconfig.signal.u16ChannelA != 1 && methodconfig.signal.u16ChannelB == 1)
////写入A
//if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB != 1)
//{
// SendDataToZB_A(mydataA);
// Thread.Sleep(50);
//}
////写入B
//if (methodconfig.signal.u16ChannelA != 1 && methodconfig.signal.u16ChannelB == 1)
//{
// SendDataToZB_B(mydataB);
// Thread.Sleep(50);
//}
if (methodconfig.signal.u16ChannelA == 1 || methodconfig.signal.u16ChannelB == 1)
{
SendDataToZB_B(mydataB);
SendDataToZB_AB(mydataA, mydataB);
Thread.Sleep(50);
}
}
......@@ -255,23 +322,25 @@ namespace GcDevicePc.ProThread
break;
}
if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB == 1)
{
SendDataToZB_AB(mydataA, mydataB);
Thread.Sleep(50);
}
//写入A
if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB != 1)
{
SendDataToZB_A(mydataA);
Thread.Sleep(50);
}
//写入B
if (methodconfig.signal.u16ChannelA != 1 && methodconfig.signal.u16ChannelB == 1)
////写入A
//if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB != 1)
//{
// SendDataToZB_A(mydataA);
// Thread.Sleep(50);
//}
////写入B
//if (methodconfig.signal.u16ChannelA != 1 && methodconfig.signal.u16ChannelB == 1)
//{
// SendDataToZB_B(mydataB);
// Thread.Sleep(50);
//}
if (methodconfig.signal.u16ChannelA == 1 || methodconfig.signal.u16ChannelB == 1)
{
SendDataToZB_B(mydataB);
SendDataToZB_AB(mydataA, mydataB);
Thread.Sleep(50);
}
}
......@@ -352,282 +421,293 @@ namespace GcDevicePc.ProThread
tsB = StartTimeB.Subtract(EndTimeB).Duration();
secB = (int)tsB.TotalSeconds;
if (StepA < SendNumA)
try
{
if (secA <= methodconfig.signal.u16DetTimeLengthA[StepA])
if (StepA < SendNumA)
{
int mydataA_old;
//Console.WriteLine("总共:" + SendNumA.ToString() + " 阶段,现在是第" + StepA.ToString() + "个阶段:" + secA.ToString() + "/" + methodconfig.signal.u16DetTimeLengthA[StepA].ToString());
switch (methodconfig.signal.uDetA[StepA])
if (secA <= methodconfig.signal.u16DetTimeLengthA[StepA])
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_A[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_A[0].ToString()) - offetA;
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
int mydataA_old;
//Console.WriteLine("总共:" + SendNumA.ToString() + " 阶段,现在是第" + StepA.ToString() + "个阶段:" + secA.ToString() + "/" + methodconfig.signal.u16DetTimeLengthA[StepA].ToString());
if (onea > saveA)
switch (methodconfig.signal.uDetA[StepA])
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
mydataA = mydataA - (onea - saveA);
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_A[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_A[0].ToString()) - offetA;
}
else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
}
if (onea > saveA)
{
mydataA = mydataA - (onea - saveA);
mydataA_old = mydataA;
}
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_B[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_B[0].ToString()) - offetA;
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
}
else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
if (onea > saveA)
{
mydataA = mydataA - (onea - saveA);
}
mydataA_old = mydataA;
}
else if (onea < saveA)
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
mydataA = mydataA + (saveA - onea);
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_B[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_B[0].ToString()) - offetA;
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
if (onea > saveA)
{
mydataA = mydataA - (onea - saveA);
}
else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
}
mydataA_old = mydataA;
}
mydataA_old = mydataA;
}
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_C[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_C[0].ToString()) - offetA;
if (ackoneA)
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
onea = mydataA;
ackoneA = false;
}
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_C[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_C[0].ToString()) - offetA;
if (onea > saveA)
{
mydataA = mydataA - (onea - saveA);
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
}
else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
if (onea > saveA)
{
mydataA = mydataA - (onea - saveA);
}
else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
}
mydataA_old = mydataA;
}
break;
}
mydataA_old = mydataA;
if (globaldata.channelA_A.Count >= 1)
{
globaldata.channelA_A.RemoveAt(0);
}
}
break;
}
if (globaldata.channelA_B.Count >= 1)
{
globaldata.channelA_B.RemoveAt(0);
}
if (globaldata.channelA_A.Count >= 1)
{
globaldata.channelA_A.RemoveAt(0);
}
if (globaldata.channelA_C.Count >= 1)
{
globaldata.channelA_C.RemoveAt(0);
}
if (globaldata.channelA_B.Count >= 1)
{
globaldata.channelA_B.RemoveAt(0);
recordA = mydataA;
}
if (globaldata.channelA_C.Count >= 1)
else
{
globaldata.channelA_C.RemoveAt(0);
// LogHelper.I("StepA++ ", StepA.ToString() + " " + SendNumA.ToString());
saveA = recordA;
ackoneA = true;
StepA++;
StartTimeA = DateTime.Now;
}
recordA = mydataA;
}
else
{
// LogHelper.I("StepA++ ", StepA.ToString() + " " + SendNumA.ToString());
saveA = recordA;
ackoneA = true;
StepA++;
StartTimeA = DateTime.Now;
}
}
if (StepB < SendNumB)
{
if (secB <= methodconfig.signal.u16DetTimeLengthB[StepB])
if (StepB < SendNumB)
{
int mydataB_old;
//Console.WriteLine("总共:" + SendNumB.ToString() + " 阶段,现在是第" + StepB.ToString() + "个阶段:" + secB.ToString() + "/" + methodconfig.signal.u16DetTimeLengthB[i].ToString());
switch (methodconfig.signal.uDetB[StepB])
if (secB <= methodconfig.signal.u16DetTimeLengthB[StepB])
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_A[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_A[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
int mydataB_old;
//Console.WriteLine("总共:" + SendNumB.ToString() + " 阶段,现在是第" + StepB.ToString() + "个阶段:" + secB.ToString() + "/" + methodconfig.signal.u16DetTimeLengthB[i].ToString());
if (oneb > saveB)
switch (methodconfig.signal.uDetB[StepB])
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
mydataB = mydataB - (oneb - saveB);
}
else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
}
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_B[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_B[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_A[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_A[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
if (oneb > saveB)
{
mydataB = mydataB - (oneb - saveB);
}
else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
if (oneb > saveB)
{
mydataB = mydataB - (oneb - saveB);
}
else if (oneb < saveB)
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
}
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_C[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_C[0].ToString()) - offetB;
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_B[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_B[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
if (oneb > saveB)
{
mydataB = mydataB - (oneb - saveB);
}
else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
if (oneb > saveB)
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
mydataB = mydataB - (oneb - saveB);
}
else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_C[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_C[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
if (oneb > saveB)
{
mydataB = mydataB - (oneb - saveB);
}
else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
mydataB_old = mydataB;
}
break;
}
if (globaldata.channelB_A.Count >= 1)
{
globaldata.channelB_A.RemoveAt(0);
}
if (globaldata.channelB_B.Count >= 1)
{
globaldata.channelB_B.RemoveAt(0);
}
break;
}
if (globaldata.channelB_A.Count >= 1)
{
globaldata.channelB_A.RemoveAt(0);
}
if (globaldata.channelB_B.Count >= 1)
{
globaldata.channelB_B.RemoveAt(0);
}
if (globaldata.channelB_C.Count >= 1)
{
globaldata.channelB_C.RemoveAt(0);
}
recordB = mydataB;
}
if (globaldata.channelB_C.Count >= 1)
else
{
globaldata.channelB_C.RemoveAt(0);
// LogHelper.I("StepB ", StepB.ToString() + " " + SendNumB.ToString());
saveB = recordB;
ackoneB = true;
StepB++;
StartTimeB = DateTime.Now;
}
recordB = mydataB;
}
else
{
// LogHelper.I("StepB ", StepB.ToString() + " " + SendNumB.ToString());
saveB = recordB;
ackoneB = true;
StepB++;
StartTimeB = DateTime.Now;
}
}
//写入AB
if (StepA < SendNumA && StepB < SendNumB)
catch
{
//Console.WriteLine("SendDataToHW A B", secA.ToString() + " "+ secB.ToString());
SendDataToZB_AB(mydataA, mydataB);
Thread.Sleep(50);
}
//写入A
if (StepA < SendNumA && StepB >= SendNumB)
{
// LogHelper.I("SendDataToHW_A", secA.ToString());
SendDataToZB_A(mydataA);
//if (StepA < SendNumA && StepB >= SendNumB)
//{
// // LogHelper.I("SendDataToHW_A", secA.ToString());
// SendDataToZB_A(mydataA);
Thread.Sleep(50);
}
// Thread.Sleep(50);
//}
//写入B
if (StepB < SendNumB && StepA >= SendNumA)
////写入B
//if (StepB < SendNumB && StepA >= SendNumA)
//{
// // LogHelper.I("SendDataToHW_B", secB.ToString());
// SendDataToZB_B(mydataB);
// Thread.Sleep(50);
//}
//写入AB
if (StepA < SendNumA || StepB < SendNumB)
{
// LogHelper.I("SendDataToHW_B", secB.ToString());
SendDataToZB_B(mydataB);
//Console.WriteLine("SendDataToHW A B", secA.ToString() + " "+ secB.ToString());
SendDataToZB_AB(mydataA, mydataB);
Thread.Sleep(50);
}
......
......@@ -112,57 +112,64 @@ namespace GcDevicePc.ProThread
int i = 0;
for (i = 0; i < 5; i++)
{
switch (methodconfig.signal.uDetA[0])
try
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_A[globaldata.channelA_A.Count - 1].ToString());
globaldata.channelA_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_B[globaldata.channelA_B.Count - 1].ToString());
globaldata.channelA_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_C[globaldata.channelA_C.Count - 1].ToString());
globaldata.channelA_C.RemoveAt(0);
}
break;
}
switch (methodconfig.signal.uDetA[0])
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_A[globaldata.channelA_A.Count - 1].ToString());
globaldata.channelA_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_B[globaldata.channelA_B.Count - 1].ToString());
globaldata.channelA_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
mydataA = Int32.Parse(globaldata.channelA_C[globaldata.channelA_C.Count - 1].ToString());
globaldata.channelA_C.RemoveAt(0);
}
break;
}
switch (methodconfig.signal.uDetB[0])
switch (methodconfig.signal.uDetB[0])
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_A[globaldata.channelB_A.Count - 1].ToString());
globaldata.channelB_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_B[globaldata.channelB_B.Count - 1].ToString());
globaldata.channelB_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_C[globaldata.channelB_C.Count - 1].ToString());
globaldata.channelB_C.RemoveAt(0);
}
break;
}
}
catch
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_A[globaldata.channelB_A.Count - 1].ToString());
globaldata.channelB_A.RemoveAt(0);
}
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_B[globaldata.channelB_B.Count - 1].ToString());
globaldata.channelB_B.RemoveAt(0);
}
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
mydataB = Int32.Parse(globaldata.channelB_C[globaldata.channelB_C.Count - 1].ToString());
globaldata.channelB_C.RemoveAt(0);
}
break;
}
if (methodconfig.signal.u16ChannelA == 1 && methodconfig.signal.u16ChannelB == 1)
{
SendDataToHW_AB(mydataA, mydataB);
......@@ -340,258 +347,266 @@ namespace GcDevicePc.ProThread
tsB = StartTimeB.Subtract(EndTimeB).Duration();
secB = (int)tsB.TotalSeconds;
if (StepA < SendNumA)
try
{
if (secA <= methodconfig.signal.u16DetTimeLengthA[StepA])
if (StepA < SendNumA)
{
int mydataA_old;
//Console.WriteLine("总共:" + SendNumA.ToString() + " 阶段,现在是第" + StepA.ToString() + "个阶段:" + secA.ToString() + "/" + methodconfig.signal.u16DetTimeLengthA[StepA].ToString());
switch (methodconfig.signal.uDetA[StepA])
if (secA <= methodconfig.signal.u16DetTimeLengthA[StepA])
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_A[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_A[0].ToString()) - offetA;
if (ackoneA)
int mydataA_old;
//Console.WriteLine("总共:" + SendNumA.ToString() + " 阶段,现在是第" + StepA.ToString() + "个阶段:" + secA.ToString() + "/" + methodconfig.signal.u16DetTimeLengthA[StepA].ToString());
switch (methodconfig.signal.uDetA[StepA])
{
case 1:
if (globaldata.channelA_A.Count >= 1)
{
onea = mydataA;
ackoneA = false;
}
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_A[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_A[0].ToString()) - offetA;
//if (onea > saveA)
//{
// mydataA = mydataA - (onea - saveA);
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
//}
//else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
//if (onea > saveA)
//{
// mydataA = mydataA - (onea - saveA);
}
//}
//else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
mydataA_old = mydataA;
}
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_B[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_B[0].ToString()) - offetA;
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
}
//if (onea > saveA)
//{
// mydataA = mydataA - (onea - saveA);
mydataA_old = mydataA;
//}
//else if (onea < saveA)
}
break;
case 2:
if (globaldata.channelA_B.Count >= 1)
{
mydataA = mydataA + (saveA - onea);
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_B[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_B[0].ToString()) - offetA;
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
//if (onea > saveA)
//{
// mydataA = mydataA - (onea - saveA);
//}
//else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
}
mydataA_old = mydataA;
}
mydataA_old = mydataA;
}
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_C[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_C[0].ToString()) - offetA;
if (ackoneA)
break;
case 3:
if (globaldata.channelA_C.Count >= 1)
{
onea = mydataA;
ackoneA = false;
}
//if (changeA_flag)
//{
// offetA = Int32.Parse(globaldata.channelA_C[0].ToString()) - mydataA_old;
// changeA_flag = false;
//}
mydataA = Int32.Parse(globaldata.channelA_C[0].ToString()) - offetA;
//if (onea > saveA)
//{
// mydataA = mydataA - (onea - saveA);
if (ackoneA)
{
onea = mydataA;
ackoneA = false;
}
//}
//else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
//if (onea > saveA)
//{
// mydataA = mydataA - (onea - saveA);
//}
//else if (onea < saveA)
{
mydataA = mydataA + (saveA - onea);
}
mydataA_old = mydataA;
}
break;
}
mydataA_old = mydataA;
if (globaldata.channelA_A.Count >= 1)
{
globaldata.channelA_A.RemoveAt(0);
}
}
break;
}
if (globaldata.channelA_B.Count >= 1)
{
globaldata.channelA_B.RemoveAt(0);
}
if (globaldata.channelA_A.Count >= 1)
{
globaldata.channelA_A.RemoveAt(0);
}
if (globaldata.channelA_C.Count >= 1)
{
globaldata.channelA_C.RemoveAt(0);
}
if (globaldata.channelA_B.Count >= 1)
{
globaldata.channelA_B.RemoveAt(0);
recordA = mydataA;
}
if (globaldata.channelA_C.Count >= 1)
else
{
globaldata.channelA_C.RemoveAt(0);
// LogHelper.I("StepA++ ", StepA.ToString() + " " + SendNumA.ToString());
saveA = recordA;
ackoneA = true;
StepA++;
StartTimeA = DateTime.Now;
}
recordA = mydataA;
}
else
{
// LogHelper.I("StepA++ ", StepA.ToString() + " " + SendNumA.ToString());
saveA = recordA;
ackoneA = true;
StepA++;
StartTimeA = DateTime.Now;
}
}
if (StepB < SendNumB)
{
if (secB <= methodconfig.signal.u16DetTimeLengthB[StepB])
if (StepB < SendNumB)
{
int mydataB_old;
//Console.WriteLine("总共:" + SendNumB.ToString() + " 阶段,现在是第" + StepB.ToString() + "个阶段:" + secB.ToString() + "/" + methodconfig.signal.u16DetTimeLengthB[i].ToString());
switch (methodconfig.signal.uDetB[StepB])
if (secB <= methodconfig.signal.u16DetTimeLengthB[StepB])
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_A[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_A[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
int mydataB_old;
//Console.WriteLine("总共:" + SendNumB.ToString() + " 阶段,现在是第" + StepB.ToString() + "个阶段:" + secB.ToString() + "/" + methodconfig.signal.u16DetTimeLengthB[i].ToString());
//if (oneb > saveB)
//{
// mydataB = mydataB - (oneb - saveB);
//}
//else if (oneb < saveB)
switch (methodconfig.signal.uDetB[StepB])
{
case 1:
if (globaldata.channelB_A.Count >= 1)
{
mydataB = mydataB + (saveB - oneb);
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_A[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_A[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
//if (oneb > saveB)
//{
// mydataB = mydataB - (oneb - saveB);
//}
//else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
}
mydataB_old = mydataB;
}
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_B[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_B[0].ToString()) - offetB;
if (ackoneB)
break;
case 2:
if (globaldata.channelB_B.Count >= 1)
{
oneb = mydataB;
ackoneB = false;
}
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_B[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_B[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
//if (oneb > saveB)
//{
// mydataB = mydataB - (oneb - saveB);
//}
//else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
//if (oneb > saveB)
//{
// mydataB = mydataB - (oneb - saveB);
//}
//else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
}
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_C[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_C[0].ToString()) - offetB;
if (ackoneB)
break;
case 3:
if (globaldata.channelB_C.Count >= 1)
{
oneb = mydataB;
ackoneB = false;
}
//if (changeB_flag)
//{
// offetB = Int32.Parse(globaldata.channelB_C[0].ToString()) - mydataB_old;
// changeB_flag = false;
//}
mydataB = Int32.Parse(globaldata.channelB_C[0].ToString()) - offetB;
if (ackoneB)
{
oneb = mydataB;
ackoneB = false;
}
//if (oneb > saveB)
//{
// mydataB = mydataB - (oneb - saveB);
//}
//else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
//if (oneb > saveB)
//{
// mydataB = mydataB - (oneb - saveB);
//}
//else if (oneb < saveB)
{
mydataB = mydataB + (saveB - oneb);
}
mydataB_old = mydataB;
}
break;
}
if (globaldata.channelB_A.Count >= 1)
{
globaldata.channelB_A.RemoveAt(0);
}
if (globaldata.channelB_B.Count >= 1)
{
globaldata.channelB_B.RemoveAt(0);
break;
}
if (globaldata.channelB_A.Count >= 1)
{
globaldata.channelB_A.RemoveAt(0);
}
if (globaldata.channelB_B.Count >= 1)
{
globaldata.channelB_B.RemoveAt(0);
}
if (globaldata.channelB_C.Count >= 1)
{
globaldata.channelB_C.RemoveAt(0);
}
recordB = mydataB;
}
if (globaldata.channelB_C.Count >= 1)
else
{
globaldata.channelB_C.RemoveAt(0);
// LogHelper.I("StepB ", StepB.ToString() + " " + SendNumB.ToString());
saveB = recordB;
ackoneB = true;
StepB++;
StartTimeB = DateTime.Now;
}
recordB = mydataB;
}
else
{
// LogHelper.I("StepB ", StepB.ToString() + " " + SendNumB.ToString());
saveB = recordB;
ackoneB = true;
StepB++;
StartTimeB = DateTime.Now;
}
}
catch
{
}
//写入AB
if (StepA < SendNumA && StepB < SendNumB)
......
......@@ -132,7 +132,7 @@ namespace GcDevicePc
RunTableView.Rows[index].Cells[1].Value = runtable.INIGetStringValue("运行表", key[i], "无");
RunTableView.Rows[index].Cells[2].Value = runtable.INIGetStringValue("运行时间", key[i], "无");
RunTableView.Rows[index].Cells[3].Value = runtable.INIGetStringValue("循环", key[i], "无");
RunTableView.Rows[index].Cells[4].Value = "1";
RunTableView.Rows[index].Cells[4].Value = runtable.INIGetStringValue("间隔时间", key[i], "无"); ;
}
this.updategv.Enabled = false;
......@@ -406,7 +406,7 @@ namespace GcDevicePc
tmp.filename = (string)LocalMethodView.Rows[i].Cells[1].Value;
tmp.runtime = "0";
tmp.runcount = "1";
tmp.rundelay = "1";
tmp.rundelay = "0";
RunTabList.Add(tmp);
}
}
......
......@@ -3,6 +3,8 @@ using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.IO;
using Ini.Net;
namespace GcDevicePc
{
......@@ -147,7 +149,8 @@ namespace GcDevicePc
private void PreLoadingProc()
{
bool ret = false;
// globaldata.m_appinit.InitAppFolderGC();
//globaldata.m_appinit.InitAppFolderGC();
_appInitInfo = "系统初始化开始";
_appInitInfo = "检测本地网络";
globaldata.m_appinit.LocalNetworkCheck();
......
......@@ -31,7 +31,6 @@
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.gcTitle1 = new GcDevicePc.Controls.GCTitle();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
......@@ -39,6 +38,15 @@
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.gcTitle1 = new GcDevicePc.Controls.GCTitle();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.button16 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
......@@ -53,7 +61,7 @@
//
// button2
//
this.button2.Location = new System.Drawing.Point(128, 314);
this.button2.Location = new System.Drawing.Point(110, 231);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
......@@ -61,14 +69,6 @@
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// gcTitle1
//
this.gcTitle1.Dock = System.Windows.Forms.DockStyle.Top;
this.gcTitle1.Location = new System.Drawing.Point(0, 0);
this.gcTitle1.Name = "gcTitle1";
this.gcTitle1.Size = new System.Drawing.Size(800, 20);
this.gcTitle1.TabIndex = 2;
//
// timer1
//
this.timer1.Interval = 5000;
......@@ -112,7 +112,7 @@
//
// button7
//
this.button7.Location = new System.Drawing.Point(244, 314);
this.button7.Location = new System.Drawing.Point(191, 231);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(75, 23);
this.button7.TabIndex = 4;
......@@ -122,7 +122,7 @@
//
// button8
//
this.button8.Location = new System.Drawing.Point(389, 314);
this.button8.Location = new System.Drawing.Point(272, 231);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(75, 23);
this.button8.TabIndex = 5;
......@@ -130,11 +130,107 @@
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.Button8_Click);
//
// gcTitle1
//
this.gcTitle1.Dock = System.Windows.Forms.DockStyle.Top;
this.gcTitle1.Location = new System.Drawing.Point(0, 0);
this.gcTitle1.Name = "gcTitle1";
this.gcTitle1.Size = new System.Drawing.Size(800, 20);
this.gcTitle1.TabIndex = 2;
//
// button9
//
this.button9.Location = new System.Drawing.Point(110, 352);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(75, 23);
this.button9.TabIndex = 6;
this.button9.Text = "button9";
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.Button9_Click);
//
// button10
//
this.button10.Location = new System.Drawing.Point(110, 381);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(75, 23);
this.button10.TabIndex = 6;
this.button10.Text = "button9";
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.Button10_Click);
//
// button11
//
this.button11.Location = new System.Drawing.Point(272, 352);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(75, 23);
this.button11.TabIndex = 6;
this.button11.Text = "button9";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.Button11_Click);
//
// button12
//
this.button12.Location = new System.Drawing.Point(272, 381);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(75, 23);
this.button12.TabIndex = 6;
this.button12.Text = "button9";
this.button12.UseVisualStyleBackColor = true;
this.button12.Click += new System.EventHandler(this.Button12_Click);
//
// button13
//
this.button13.Location = new System.Drawing.Point(395, 352);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(75, 23);
this.button13.TabIndex = 6;
this.button13.Text = "button9";
this.button13.UseVisualStyleBackColor = true;
this.button13.Click += new System.EventHandler(this.Button13_Click);
//
// button14
//
this.button14.Location = new System.Drawing.Point(395, 381);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(75, 23);
this.button14.TabIndex = 6;
this.button14.Text = "button9";
this.button14.UseVisualStyleBackColor = true;
this.button14.Click += new System.EventHandler(this.Button14_Click);
//
// button15
//
this.button15.Location = new System.Drawing.Point(557, 352);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(75, 23);
this.button15.TabIndex = 6;
this.button15.Text = "button9";
this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.Button15_Click);
//
// button16
//
this.button16.Location = new System.Drawing.Point(557, 381);
this.button16.Name = "button16";
this.button16.Size = new System.Drawing.Size(75, 23);
this.button16.TabIndex = 6;
this.button16.Text = "button9";
this.button16.UseVisualStyleBackColor = true;
this.button16.Click += new System.EventHandler(this.Button16_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.button16);
this.Controls.Add(this.button14);
this.Controls.Add(this.button12);
this.Controls.Add(this.button15);
this.Controls.Add(this.button13);
this.Controls.Add(this.button11);
this.Controls.Add(this.button10);
this.Controls.Add(this.button9);
this.Controls.Add(this.button8);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
......@@ -162,5 +258,13 @@
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.Button button13;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Button button16;
}
}
\ No newline at end of file
using GcDevicePc.Common;
using GcDevicePc.ConfigMethod;
using GcDevicePc.Controls;
using GcDevicePc.GCBuffer;
using GcDevicePc.ProThread;
using Ini.Net;
using System;
using System.Collections.Generic;
using System.ComponentModel;
......@@ -10,6 +12,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -121,6 +124,7 @@ namespace GcDevicePc
private void button2_Click(object sender, EventArgs e)
{
dataToZB.testzba();
}
int i = 0;
......@@ -132,7 +136,7 @@ namespace GcDevicePc
private void Button7_Click(object sender, EventArgs e)
{
dataToZB.testzbb();
}
SendDataToZB dataToZB = new SendDataToZB();
......@@ -140,6 +144,64 @@ namespace GcDevicePc
{
//dataToZB.InitsendData();
dataToZB.StartSendDataToZB();
starttr();
}
Thread tr;
private void starttr()
{
tr = new Thread(ths);
tr.Start();
}
private void ths()
{
while (true)
{
dataToZB.testzb(2,10);
Thread.Sleep(50);
}
}
private void Button9_Click(object sender, EventArgs e)
{
dataToZB.testzbb(1, 0, 1);
}
private void Button10_Click(object sender, EventArgs e)
{
dataToZB.testzbb(1, 0, 2);
}
private void Button11_Click(object sender, EventArgs e)
{
dataToZB.testzbb(0, 1, 1);
}
private void Button12_Click(object sender, EventArgs e)
{
dataToZB.testzbb(0, 1, 2);
}
private void Button13_Click(object sender, EventArgs e)
{
dataToZB.testzbb(1, 0, 3);
}
private void Button14_Click(object sender, EventArgs e)
{
dataToZB.testzbb(1, 0, 4);
}
private void Button15_Click(object sender, EventArgs e)
{
dataToZB.testzbb(0, 1, 3);
}
private void Button16_Click(object sender, EventArgs e)
{
dataToZB.testzbb(0, 1, 4);
}
}
}
......@@ -95,7 +95,7 @@ namespace GcDevicePc
public static PCBuffer m_pcbuffer = new PCBuffer();
public static SignalBuffer m_signalbuffer = new SignalBuffer();
public static bool IsShowPower = false;//暂时判断是否显示功率
//
public static HWConfig m_hwconfig = new HWConfig();
......
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