Esempio n. 1
0
        private void GetData(EnumCellIndex index, string Data, DataComp NeedComp)
        {
            double temp;

            ClassCommonSetting.ProgramLog(LogFile.Level.Info, "测厚", $"{index}测厚GetData得到的数据:{Data}");
            if (!double.TryParse(Data.Replace("?", ""), out temp))
            {
                ClassCommonSetting.ProgramLog(LogFile.Level.Info, "测厚", "GetData得到的数据转换为double失败,数据没有处理");
                return;
            }
            ThicknessDataStations[index].CellData.Data.CellThickness.Value = temp;// double.Parse(Data.Replace("?", ""));
            if (NeedComp != DataComp.NoComp && ClassCommonSetting.SysParam.CurrentUsedGauge != null)
            {
                double reference = 0;
                double slope = 0, intercept = 0;
                bool   enable = false;
                switch (index)
                {
                case EnumCellIndex.中电芯:
                    reference = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMeasRefMid;
                    slope     = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMidLinear.Slope;
                    intercept = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMidLinear.Intercept;
                    enable    = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMidLinear.Enable;
                    break;

                case EnumCellIndex.右电芯:
                    reference = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMeasRefRight;
                    slope     = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessRightLinear.Slope;
                    intercept = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessRightLinear.Intercept;
                    enable    = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessRightLinear.Enable;
                    break;

                case EnumCellIndex.左电芯:
                    reference = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMeasRefLeft;
                    slope     = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessLeftLinear.Slope;
                    intercept = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessLeftLinear.Intercept;
                    enable    = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessLeftLinear.Enable;
                    break;
                }
                if ((NeedComp & DataComp.AddRef) != DataComp.NoComp)
                {
                    ThicknessDataStations[index].CellData.Data.CellThickness.Value = reference - ThicknessDataStations[index].CellData.Data.CellThickness.Value;
                }
                if ((NeedComp & DataComp.AddComp) != DataComp.NoComp && enable)
                {
                    ThicknessDataStations[index].CellData.Data.CellThickness.Value = ThicknessDataStations[index].CellData.Data.CellThickness.Value * slope + intercept;
                }
            }
            ClassCommonSetting.ProgramLog(LogFile.Level.Info, "测厚", $"获取原始数据{temp},最终数据{ThicknessDataStations[index].CellData.Data.CellThickness.Value:0.000}");
            ThicknessDataStations[index].Refresh();
        }
Esempio n. 2
0
 public ErrorInfoWithPause ActionOneCCDMeas(EnumCellIndex cellindex, DataComp NeedComp)
 {
     if (CCDMeasDataStations[cellindex].CellData != null)
     {
         if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑)
         {
             Comps[(int)cellindex] = NeedComp;
             SnapShot((int)cellindex, CCDMeasDataStations[cellindex].CellData.Barcode);
         }
         else
         {
             TimeClass.Delay(400);
             MeasDone[(int)cellindex] = true;
         }
     }
     return(null);
 }
Esempio n. 3
0
 public ErrorInfoWithPause StartThicknessReading(DataComp NeedComp)
 {
     if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.正常)
     {
         return(null);
     }
     //ErrorInfoWithPause result;
     for (int i = 0; i < CELLCOUNT; i++)
     {
         if (ThicknessDataStations[i].CellData != null)
         {
             StartSerialReading((EnumCellIndex)i, HardwareSerialProtocolName.ThicknessRead, NeedComp);
         }
         else
         {
             ReadDone[i] = true;
         }
     }
     System.Threading.Thread.Sleep(10);
     //while (!ReadDone[0] || !ReadDone[1] || !ReadDone[2])
     //    System.Windows.Forms.Application.DoEvents();
     return(null);
 }
Esempio n. 4
0
        public ErrorInfoWithPause ActionStartThicknessMeas(DataComp NeedComp, bool CheckVacuum = true)
        {
            DataNeedComp = NeedComp;
            DateTime start = DateTime.Now;

            if (!HavePart())
            {
                return(null);
            }
            ErrorInfoWithPause res;
            //if (CheckVacuum)
            //{
            //    res = CheckVacuumStatus();
            //    if (res != null) return res;
            //}
            TimeSpan span1 = DateTime.Now - start;

            res = ActionLoad();
            TimeSpan span2 = DateTime.Now - start;

            if (res != null)
            {
                return(res);
            }
            #region 开始实时读取
            //if (ThicknessDataStations[0].CellData != null)
            //{
            //    SerialPort[0].SerialDataReceiveEvent += ClassZone厚度测量_SerialDataReceiveEvent0;
            //    StartSerialRealSend(SerialPort[0], HardwareSerialProtocolName.ThicknessRead);
            //}
            //if (ThicknessDataStations[1].CellData != null)
            //{
            //    SerialPort[1].SerialDataReceiveEvent += ClassZone厚度测量_SerialDataReceiveEvent1;
            //    StartSerialRealSend(SerialPort[1], HardwareSerialProtocolName.ThicknessRead);
            //}
            //if (ThicknessDataStations[2].CellData != null)
            //{
            //    SerialPort[2].SerialDataReceiveEvent += ClassZone厚度测量_SerialDataReceiveEvent2;
            //    StartSerialRealSend(SerialPort[2], HardwareSerialProtocolName.ThicknessRead);
            //}
            #endregion 开始实时读取
            TimeClass.Delay(ClassCommonSetting.SysParam.ThicknessMeasDelayTime);
            //for (int i = 0; i < CELLCOUNT; i++)
            //    if (ThicknessDataStations[i].CellData != null)
            //        GetData((EnumCellIndex)i, SerialPort[i].Data, NeedComp);
            #region 实时读取结束
            //for (int i = 0; i < CELLCOUNT; i++)
            //    if (ThicknessDataStations[i].CellData != null)
            //        StopSerialRealSend(SerialPort[i]);
            //if (ThicknessDataStations[0].CellData != null)
            //    SerialPort[0].SerialDataReceiveEvent -= ClassZone厚度测量_SerialDataReceiveEvent0;
            //if (ThicknessDataStations[1].CellData != null)
            //    SerialPort[1].SerialDataReceiveEvent -= ClassZone厚度测量_SerialDataReceiveEvent1;
            //if (ThicknessDataStations[2].CellData != null)
            //    SerialPort[2].SerialDataReceiveEvent -= ClassZone厚度测量_SerialDataReceiveEvent2;
            #endregion 实时读取结束
            TimeSpan span3 = DateTime.Now - start;
            res = StartThicknessReading(NeedComp);
            TimeSpan span4 = DateTime.Now - start;
            if (res != null)
            {
                return(res);
            }
            res = ActionUnload();
            TimeSpan span5 = DateTime.Now - start;
            TimeUsage.UpdateTimeUsage(TimeUsageItem.ZoneThickness, span5.TotalSeconds,
                                      string.Format("检查真空: {0:0.00}s\n加载电芯: {1:0.00}s\n延时等待: {2:0.00}s\n读取厚度: {3:0.00}s\n卸载电芯: {4:0.00}s",
                                                    span1.TotalSeconds,
                                                    (span2 - span1).TotalSeconds,
                                                    (span3 - span2).TotalSeconds,
                                                    (span4 - span3).TotalSeconds,
                                                    (span5 - span4).TotalSeconds));
            for (int i = 0; i < ClassBaseWorkZone.CELLCOUNT; i++)
            {
                ThicknessCellVacuums[i].SetOutPortStatus(false);
            }
            return(res);
        }
Esempio n. 5
0
        protected string StartSerialReading(EnumCellIndex index, HardwareSerialProtocolName protocol, DataComp NeedComp)
        {
            string Data = "";
            int    i    = (int)index;

            ReadDone[i] = false;
            string res = StartSerialReading(SerialPort[i], HardwareSerialProtocolName.ThicknessRead, ref Data);

            if (res != "")
            {
                ClassErrorHandle.ShowError("读取测厚数据", String.Format("读取{0}测量数据出错:{1}", index, res), ErrorLevel.Error);
            }
            else
            {
                GetData(index, Data, NeedComp);
                ReadDone[i] = true;
            }
            ReadDone[i] = true;
            return(res);
        }
Esempio n. 6
0
 private void AsyncStartSerialReading(EnumCellIndex index, HardwareSerialProtocolName protocol, DataComp NeedComp)
 {
     if (_serialReading != null)
     {
         _serialReading.BeginInvoke(index, protocol, NeedComp, SerialReadingAsyncReturn, _serialReading);
     }
 }
Esempio n. 7
0
        public ErrorInfoWithPause ActionStartCCDMeas(DataComp NeedComp)
        {
            if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑)
            {
                //Open vacuum
                CellBlow.SetOutPortStatus(false);
                CellVacuums[EnumCellIndex.左电芯].SetOutPortStatus(CCDMeasDataStations[(int)EnumCellIndex.左电芯].CellData != null);
                CellVacuums[EnumCellIndex.中电芯].SetOutPortStatus(CCDMeasDataStations[(int)EnumCellIndex.中电芯].CellData != null);
                CellVacuums[EnumCellIndex.右电芯].SetOutPortStatus(CCDMeasDataStations[(int)EnumCellIndex.右电芯].CellData != null);
            }
            ErrorInfoWithPause res = null;// = CheckVacuumStatus();
            //if (res != null) return res;
            //for (int i = 0; i < CELLCOUNT; i++)
            //{
            //    _camTrigFinish[i] = CCDMeasDataStations[i].CellData == null;
            //    MeasDone[i] = CCDMeasDataStations[i].CellData == null;
            //    BufferDatas[i] = CCDMeasDataStations[i].CellData;
            //}
            DateTime start = DateTime.Now;

            _camTrigFinish[CELLCOUNT] = false;
            if (CCDMeasDataStations[EnumCellIndex.右电芯].CellData != null)
            {
                while (!AxisOutlineMeasX.MoveTo(EnumPointX.Start))
                //return DispMotionError(AxisOutlineMeasX, EnumCellIndex.右电芯);
                {
                    res = DispMotionError(AxisOutlineMeasX, EnumCellIndex.右电芯);
                    if (res != null)
                    {
                        return(res);
                    }
                }
                ActionOneCCDMeas(EnumCellIndex.右电芯, NeedComp);
            }
            TimeSpan span1 = DateTime.Now - start;

            if (CCDMeasDataStations[EnumCellIndex.中电芯].CellData != null)
            {
                while (!AxisOutlineMeasX.MoveTo(EnumPointX.Start, true, AxisOutlineMeasX.PointList[EnumPointX.Pitch].Position))
                //return DispMotionError(AxisOutlineMeasX, EnumCellIndex.中电芯);
                {
                    res = DispMotionError(AxisOutlineMeasX, EnumCellIndex.中电芯);
                    if (res != null)
                    {
                        return(res);
                    }
                }
                ActionOneCCDMeas(EnumCellIndex.中电芯, NeedComp);
            }
            TimeSpan span2 = DateTime.Now - start;

            if (CCDMeasDataStations[EnumCellIndex.左电芯].CellData != null)
            {
                while (!AxisOutlineMeasX.MoveTo(EnumPointX.Start, true, AxisOutlineMeasX.PointList[EnumPointX.Pitch].Position * 2))
                //return DispMotionError(AxisOutlineMeasX, EnumCellIndex.左电芯);
                {
                    res = DispMotionError(AxisOutlineMeasX, EnumCellIndex.左电芯);
                    if (res != null)
                    {
                        return(res);
                    }
                }
                ActionOneCCDMeas(EnumCellIndex.左电芯, NeedComp);
            }
            TimeSpan span3 = DateTime.Now - start;

            while (!AxisOutlineMeasX.MoveTo(EnumPointX.PartOut))
            //return DispMotionError(AxisOutlineMeasX, EnumPointX.PartOut);
            {
                res = DispMotionError(AxisOutlineMeasX, EnumPointX.PartOut);
                if (res != null)
                {
                    return(res);
                }
            }
            //while (!_measDone[0] || !_measDone[1] || !_measDone[2])
            //    Thread.Sleep(1);
            //if (AfterCCDMeas != null)
            //{
            //    _afterCallBack = AfterCCDMeas;
            //    _afterCallBack.BeginInvoke(WorkZoneActionAsyncReturn, _afterCallBack);
            //}
            TimeSpan span4 = DateTime.Now - start;

            TimeUsage.UpdateTimeUsage(TimeUsageItem.ZoneCCD, span4.TotalSeconds,
                                      string.Format("右电芯测量: {0:0.00}s\n中电芯测量: {1:0.00}s\n左电芯测量: {2:0.00}s\n移到出料位: {3:0.00}s",
                                                    span1.TotalSeconds,
                                                    (span2 - span1).TotalSeconds,
                                                    (span3 - span2).TotalSeconds,
                                                    (span4 - span3).TotalSeconds));
            for (int i = 0; i < ClassBaseWorkZone.CELLCOUNT; i++)
            {
                CellVacuums[i].SetOutPortStatus(false);
            }
            return(null);
        }