Beispiel #1
0
 private void setTolMonitorMin(GateType gateType, DGateType dGateType, double tolMonitorMin)
 {
     if ((TolMonitorMode)tolMonitorMode1 == TolMonitorMode.Gate)
     {
         SetGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, gateType, tolMonitorMin);
     }
     else
     {
         SetDGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, dGateType, tolMonitorMin);
     }
 }
Beispiel #2
0
        /**Caculate tolMonitorMax and tolMonitorMin accordint to dGateType.
         * @param gateType1 and gateType2 accord to dGateType.
         * */
        private void tolMonitorAccordToDGate(GateType gateType1, GateType gateType2, DGateType dGateType, int tolMonitorIndex)
        {
            int      error_code;
            GateType gateType;
            double   tolMonitorMax;
            double   tolMonitorMin;
            int      gate1 = 0;
            int      gate2 = 1;

            double[] delay = new double[2] {
                0, 0
            };                                     //index=0,delay of gateType1;index=1,delay of gateType2
            double[] width = new double[2] {
                0, 0
            };
            double[] gateEnd = new double[2] {
                0, 0
            };

            for (int i = 0; i < 2; i++)
            {
                if (i == 0)
                {
                    gateType = gateType1;
                }
                else
                {
                    gateType = gateType2;
                }

                error_code = GetGateDAQ.Delay(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref delay[i]);
                if (error_code != 0)
                {
                    return;
                }

                error_code = GetGateDAQ.Width(SelectAscan.sessionIndex, SelectAscan.port, gateType, ref width[i]);
                if (error_code != 0)
                {
                    return;
                }

                gateEnd[i] = delay[i] + width[i];
            }

            //caculate tolMonitorMax and tolMonitorMin
            if (delay[gate1] > delay[gate2])
            {
                if (delay[gate1] > gateEnd[gate2])
                {
                    tolMonitorMax = gateEnd[gate1] - delay[gate2];
                    tolMonitorMin = delay[gate1] - gateEnd[gate2];
                }
                else if (delay[gate1] <= gateEnd[gate2] && gateEnd[gate2] <= gateEnd[gate1])
                {
                    tolMonitorMax = gateEnd[gate1] - delay[gate2];
                    tolMonitorMin = 0;
                }
                else
                {
                    tolMonitorMax = gateEnd[gate2] - delay[gate2];
                    tolMonitorMin = 0;
                }
            }
            else
            {
                if (delay[gate2] > gateEnd[gate1])
                {
                    tolMonitorMax = gateEnd[gate2] - delay[gate1];
                    tolMonitorMin = delay[gate2] - gateEnd[gate1];
                }
                else if (delay[gate2] <= gateEnd[gate1] && gateEnd[gate1] <= gateEnd[gate2])
                {
                    tolMonitorMax = gateEnd[gate2] - delay[gate1];
                    tolMonitorMin = 0;
                }
                else
                {
                    tolMonitorMax = gateEnd[gate1] - delay[gate1];
                    tolMonitorMin = 0;
                }
            }

            ((NumericUpDown)(Controls.Find("numUpDownMax" + tolMonitorIndex, true)[0])).Text = tolMonitorMax.ToString();
            ((NumericUpDown)(Controls.Find("numUpDownMin" + tolMonitorIndex, true)[0])).Text = tolMonitorMin.ToString();

            SetDGateDAQ.TolMonitorMax(SelectAscan.sessionIndex, SelectAscan.port, dGateType, tolMonitorMax);
            SetDGateDAQ.TolMonitorMin(SelectAscan.sessionIndex, SelectAscan.port, dGateType, tolMonitorMin);
        }