예제 #1
0
        internal static double TValueToRValue(double t, ABCParam param, ConvertMethod method)
        {
            double rnew, tnew;

            if (method == ConvertMethod.ITS90)
            {
                double ac, bc, cc;
                param.targetT = t;
                ac            = param.a;
                bc            = param.b;
                cc            = param.c;
                rnew          = GetWr(t);
                return(rnew + ac * (rnew - 1) + bc * (rnew - 1) * (rnew - 1) + cc * (rnew - 1) * (rnew - 1) * (rnew - 1));
            }
            if (method == ConvertMethod.DIN68 || method == ConvertMethod.DIN90 || method == ConvertMethod.ASTM)
            {
                double alpha, A, B, C;
                alpha = A = B = C = 0;
                if (method == ConvertMethod.DIN68)
                {
                    alpha     = 0.003850;
                    param.rtp = 100;
                    A         = 3.90802e-3;
                    B         = -5.8020e-7;
                    C         = -4.2735e-12;
                }
                if (method == ConvertMethod.DIN90)
                {
                    alpha     = 0;
                    param.rtp = 100;
                    A         = 3.90823e-3;
                    B         = -5.7750e-7;
                    C         = -4.1830e-12;
                    if (t >= 0)
                    {
                        C = 0;
                    }
                }
                if (method == ConvertMethod.ASTM)
                {
                    alpha     = 0.003911;
                    param.rtp = 100;
                    A         = 3.9692e-3;
                    B         = -5.8495e-7;
                    C         = -4.2325e-12;
                }
                tnew = t;

                return(param.rtp * (1 + A * tnew + B * tnew * tnew + C * (tnew - 100) * tnew * tnew * tnew));
            }
            throw new Exception("Unexpected convert method " + method.ToString());
        }
예제 #2
0
        private Decimal GetStdMultiply(ABCParam param)
        {
            if (bridge is DQF700)
            {
                return(100);

                /*
                 * if (Math.Abs(param.rtp - 25) < 1)
                 *  return 25;
                 * if (Math.Abs(param.rtp - 100) < 1)
                 *  return 100;
                 * else
                 *  throw new Exception("未知探头类型");
                 */
            }
            else if (bridge is FL1560)
            {
                return(1);
            }
            else
            {
                throw new Exception("不支持的电桥");
            }
        }
예제 #3
0
        internal static double RValueToTValue(double r, ABCParam param, ConvertMethod method)
        {
            if (method == ConvertMethod.ITS90)
            {
                //set the search range of T between GetT(r) +/- 1 degree
                double tlow = GetT(r) - 1;
                double tup  = tlow + 2;

                double ac, bc, cc;
                param.targetT = tlow;
                ac            = param.a;
                bc            = param.b;
                cc            = param.c;

                double rnew;
                double tnew;
                int    count = 0;

                while ((tup - tlow > 0.00005) && (count++ < 100))
                {
                    tnew = (tlow + tup) / 2.0;
                    rnew = GetWr(tnew);
                    rnew = rnew + ac * (rnew - 1) + bc * (rnew - 1) * (rnew - 1) + cc * (rnew - 1) * (rnew - 1) * (rnew - 1);
                    if (r < rnew)
                    {
                        tup = tnew;
                    }
                    else
                    {
                        tlow = tnew;
                    }
                }
                return((tlow + tup) / 2.0);
            }
            if (method == ConvertMethod.DIN68 || method == ConvertMethod.DIN90 || method == ConvertMethod.ASTM)
            {
                double alpha, A, B, C;
                alpha = A = B = C = 0;
                if (method == ConvertMethod.DIN68)
                {
                    alpha     = 0.003850;
                    param.rtp = 100;
                    A         = 3.90802e-3;
                    B         = -5.8020e-7;
                    C         = -4.2735e-12;
                }
                if (method == ConvertMethod.DIN90)
                {
                    alpha     = 0;
                    param.rtp = 100;
                    A         = 3.90823e-3;
                    B         = -5.7750e-7;
                    C         = -4.1830e-12;
                }
                if (method == ConvertMethod.ASTM)
                {
                    alpha     = 0.003911;
                    param.rtp = 100;
                    A         = 3.9692e-3;
                    B         = -5.8495e-7;
                    C         = -4.2325e-12;
                }
                double tlow = -201;
                double tup  = 1000;

                double rnew;
                double tnew;
                int    count = 0;

                while ((tup - tlow > 0.00005) && (count++ < 150))
                {
                    tnew = (tlow + tup) / 2.0;
                    if (tnew > 0)
                    {
                        rnew = param.rtp * (1 + A * tnew + B * tnew * tnew);
                    }
                    else
                    {
                        rnew = param.rtp * (1 + A * tnew + B * tnew * tnew + C * (tnew - 100) * tnew * tnew * tnew);
                    }

                    if (r < rnew)
                    {
                        tup = tnew;
                    }
                    else
                    {
                        tlow = tnew;
                    }
                }
                return((tlow + tup) / 2.0);
            }
            if (method == ConvertMethod.PT100)
            {
                double ac, bc, cc, tlow, tup, rnew, tnew;
                int    count;
                ac = 3.908e-3;
                bc = -5.775E-7;
                cc = -4.183E-12;

                param.rtp = 100;
                tlow      = -200;
                tup       = 850;
                count     = 0;

                while ((tup - tlow > 0.00005) && (count++ < 100))
                {
                    tnew = (tlow + tup) / 2.0;
                    rnew = param.rtp + param.rtp * ac * tnew + param.rtp * bc * tnew * tnew;
                    if (tnew < 0)
                    {
                        rnew = rnew + param.rtp * cc * (tnew - 100) * tnew * tnew * tnew;
                    }

                    if (r < rnew)
                    {
                        tup = tnew;
                    }
                    else
                    {
                        tlow = tnew;
                    }
                }
                return(Math.Floor((tlow * 10000.0 + tup * 10000) / 2.0 + 0.5) / 10000.0);
            }
            if (method == ConvertMethod.PT25)
            {
                //todo
            }
            return(-9999.9999);
        }
예제 #4
0
        public void StartProcess(BackgroundWorker formworker)
        {
            /*
             * ABCParam ppp = new ABCParam();
             * ppp.LoadFromIni("PROBE_TEST2");
             * double uu = Wendu.RValueToTValue(40.083 / ppp.rtp, ppp, ConvertMethod.ITS90);
             * return;
             */
            worker = formworker;

            FormAction("show_status", "测试进行中..."); // FormAction("show_message", "请到原始记录页,测量并填入500度时的实际温度和阻值");

            Dictionary <string, string> checkedpts = new Dictionary <string, string>();

            for (int ipage = 0; ipage < 6; ipage++)
            {
                string         pgid  = "abcdef"[ipage].ToString();
                List <TEMPRDG> trdgs = new List <TEMPRDG>();
                ABCParam       param = new ABCParam();
                if (!testdoc.IsValueAvailable(new string[] { "m_" + pgid + "_bzqbh" }))
                {
                    continue;
                }
                if (!param.LoadFromIni("PROBE_" + testdoc.StrValue("m_" + pgid + "_bzqbh")))
                {
                    throw new Exception(String.Format("第{0}页无效的标准器编号", (ipage + 1).ToString()));
                }

                for (int ipoint = 1; ipoint <= TestDocument.MAX_PT_1PAGE; ipoint++) //check every ipoint
                {
                    string sdwd = "m_" + pgid + "_" + ipoint.ToString() + "jddwd";
                    if (!testdoc.IsValueAvailable(new string[] { sdwd }))
                    {
                        continue;
                    }
                    if (checkedpts.ContainsKey(testdoc.StrValue(sdwd))) //tested before
                    {
                        continue;
                    }
                    checkedpts.Add(testdoc.StrValue(sdwd), "m_" + pgid + "_bzqbh");
                    Decimal setpoint;
                    if (!Decimal.TryParse(testdoc.StrValue(sdwd), out setpoint))
                    {
                        continue;
                    }
                    string choice = FormAction("show_message", String.Format("请将所有探头放入恒温槽,并将温度设置到 {0} ℃。\n点击'跳过'直接重测下一点", setpoint.ToString()));
                    if (choice == "skip")
                    {
                        continue;
                    }
                    FormAction("clear_graph", "");

                    CheckCancel(2);
                    trdgs.Clear();
                    //wait temp stable
                    scanner.ScanTo(0, WIREMODE.MODE_4WIRE); //force 1st channel (standard) to be 4 wire
                    double tempnow;

                    double period    = Double.Parse(Util.ConstIni.StringValue("CONDITION", "PERIOD"));
                    double pplimit   = Double.Parse(Util.ConstIni.StringValue("CONDITION", "PPLIMIT"));
                    int    scandelay = Int32.Parse(Util.ConstIni.StringValue("CONDITION", "SCANDELAY"));
                    int    goodcnt   = Int32.Parse(Util.ConstIni.StringValue("CONDITION", "GOODCNT"));

                    bridge.ClearBuffer();
                    while (true)
                    {
                        tempnow = Convert.ToDouble(ReadF700(1) * GetStdMultiply(param)) / param.rtp;
                        tempnow = Wendu.RValueToTValue(tempnow, param, ConvertMethod.ITS90);
                        //convert to temperature
                        trdgs.Add(new TEMPRDG(Convert.ToDecimal(tempnow), DateTime.Now));
                        FormGraphAction(0, tempnow, "c");
                        FormAction("show_status", String.Format("等待温度稳定....{0} ℃", tempnow.ToString("F03")));

                        while ((trdgs.Count > 0) && trdgs[0].time < DateTime.Now.AddMinutes(-period))
                        {
                            trdgs.RemoveAt(0);
                        }

                        if ((trdgs.Count > 10) &&
                            (trdgs[trdgs.Count - 1].time.Subtract(trdgs[0].time).TotalMinutes > (period - 0.1)) &&
                            IsDiffSmall(trdgs[trdgs.Count - 1].reading, setpoint, 2) &&
                            ((Util.my_max(trdgs, 0) - Util.my_min(trdgs, 0)) < pplimit))
                        {
                            break;
                        }
                        CheckCancel(1);
                    }
                    FormAction("clear_graph", "");
                    //start to collect data
                    Decimal rnow;
                    for (int round = 1; round <= 4; round++)
                    {
                        int sindex = 0;
                        for (int sch = 0; sch < 24; sch++)
                        {
                            if (sch > 0)
                            {
                                if (!testdoc.IsValueAvailable(new string[] { "m_" + sch.ToString() + "_dj" }))
                                {
                                    continue;
                                }

                                string cdpt = "m_" + "abcdef"[(sch - 1) / 4].ToString();
                                if (testdoc.IsValueAvailable(new string[] { cdpt + "_1jddwd" }) && (testdoc.StrValue(cdpt + "_1jddwd") == testdoc.StrValue(sdwd)))
                                {
                                    sindex++;
                                }
                                else if (testdoc.IsValueAvailable(new string[] { cdpt + "_2jddwd" }) && (testdoc.StrValue(cdpt + "_2jddwd") == testdoc.StrValue(sdwd)))
                                {
                                    sindex++;
                                }
                                else if (testdoc.IsValueAvailable(new string[] { cdpt + "_3jddwd" }) && (testdoc.StrValue(cdpt + "_3jddwd") == testdoc.StrValue(sdwd)))
                                {
                                    sindex++;
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            if (sindex == 0)
                            {
                                FormAction("show_status", String.Format("正在采集标准温度计数据..."));
                                scanner.ScanTo(sindex, WIREMODE.MODE_4WIRE);
                            }
                            else
                            {
                                FormAction("show_status", String.Format("正在采集被检温度计 {0} 数据...", sindex));
                                scanner.ScanTo(sindex, wire);
                            }
                            CheckCancel(scandelay);
                            bridge.ClearBuffer();
                            rnow = ReadF700(goodcnt);
                            if (sindex == 0)
                            {
                                this["c_" + pgid + "_" + ipoint.ToString() + "sjwd_" + round.ToString()] = Convert.ToDecimal(Wendu.RValueToTValue(Convert.ToDouble(rnow * GetStdMultiply(param)) / param.rtp, param, ConvertMethod.ITS90));
                                FormGraphAction(sindex, Convert.ToDouble(rnow * GetStdMultiply(param)), "ohm");
                            }
                            else
                            {
                                if (wire == WIREMODE.MODE_3WIRE)
                                {
                                    this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw3_" + round.ToString()] = rnow * GetMultiply();
                                }
                                else
                                {
                                    this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bc_" + round.ToString()] = rnow * GetMultiply();
                                }
                                FormGraphAction(sindex, Convert.ToDouble(rnow * GetMultiply()), "ohm");
                            }
                            CheckCancel(2);
                        }
                        if (wire == WIREMODE.MODE_3WIRE) //another roudn for 2 wire measure
                        {
                            int nsindex = 0;
                            for (int sch = 0; sch < 24; sch++)
                            {
                                if (sch > 0)
                                {
                                    if (!testdoc.IsValueAvailable(new string[] { "m_" + sch.ToString() + "_dj" }))
                                    {
                                        continue;
                                    }

                                    string cdpt = "m_" + "abcdef"[(sch - 1) / 4].ToString();
                                    if (testdoc.IsValueAvailable(new string[] { cdpt + "_1jddwd" }) && (testdoc.StrValue(cdpt + "_1jddwd") == testdoc.StrValue(sdwd)))
                                    {
                                        nsindex++;
                                    }
                                    else if (testdoc.IsValueAvailable(new string[] { cdpt + "_2jddwd" }) && (testdoc.StrValue(cdpt + "_2jddwd") == testdoc.StrValue(sdwd)))
                                    {
                                        nsindex++;
                                    }
                                    else if (testdoc.IsValueAvailable(new string[] { cdpt + "_3jddwd" }) && (testdoc.StrValue(cdpt + "_3jddwd") == testdoc.StrValue(sdwd)))
                                    {
                                        nsindex++;
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                if (nsindex == 0)
                                {
                                    continue;
                                }
                                else
                                {
                                    FormAction("show_status", String.Format("正在采集被检温度计 {0} 数据...", sindex));
                                    scanner.ScanTo(nsindex, WIREMODE.MODE_2WIRE);
                                }
                                CheckCancel(scandelay);
                                bridge.ClearBuffer();
                                rnow = ReadF700(goodcnt);
                                this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw2_" + round.ToString()] = rnow * GetMultiply();
                                FormGraphAction(sindex, Convert.ToDouble(rnow * GetMultiply()), "ohm");
                                CheckCancel(2);
                                testdoc.AutoCaculation(true);
                            }
                        }
                    }
                    testdoc.AutoCaculation(false);
                }
            }
            scanner.ScanTo(0, WIREMODE.MODE_4WIRE);
            Thread.Sleep(1000);
        }
예제 #5
0
파일: WenDu.cs 프로젝트: imdmmp/kpgweigher
        internal static double RValueToTValue(double r, ABCParam param, ConvertMethod method)
        {

            if (method == ConvertMethod.ITS90)
            {

                //set the search range of T between GetT(r) +/- 1 degree
                double tlow = GetT(r) - 1;
                double tup = tlow + 2;

                double ac, bc, cc;
                param.targetT = tlow;
                ac = param.a;
                bc = param.b;
                cc = param.c;

                double rnew;
                double tnew;
                int count = 0;

                while ((tup - tlow > 0.00005) && (count++ < 100))
                {
                    tnew = (tlow + tup) / 2.0;
                    rnew = GetWr(tnew);
                    rnew = rnew + ac * (rnew - 1) + bc * (rnew - 1) * (rnew - 1) + cc * (rnew - 1) * (rnew - 1) * (rnew - 1);
                    if (r < rnew)
                        tup = tnew;
                    else
                        tlow = tnew;
                }
                return (tlow + tup) / 2.0;
            }
            if (method == ConvertMethod.DIN68 || method == ConvertMethod.DIN90 || method == ConvertMethod.ASTM)
            {
                double alpha, A, B, C;
                alpha = A = B = C = 0;
                if (method == ConvertMethod.DIN68)
                {
                    alpha = 0.003850;
                    param.rtp = 100;
                    A = 3.90802e-3;
                    B = -5.8020e-7;
                    C = -4.2735e-12;
                }
                if (method == ConvertMethod.DIN90)
                {
                    alpha = 0;
                    param.rtp = 100;
                    A = 3.90823e-3;
                    B = -5.7750e-7;
                    C = -4.1830e-12;
                }
                if (method == ConvertMethod.ASTM)
                {
                    alpha = 0.003911;
                    param.rtp = 100;
                    A = 3.9692e-3;
                    B = -5.8495e-7;
                    C = -4.2325e-12;
                }
                double tlow = -201;
                double tup = 1000;

                double rnew;
                double tnew;
                int count = 0;

                while ((tup - tlow > 0.00005) && (count++ < 150))
                {
                    tnew = (tlow + tup) / 2.0;
                    if (tnew > 0)
                        rnew = param.rtp * (1 + A * tnew + B * tnew * tnew);
                    else
                        rnew = param.rtp * (1 + A * tnew + B * tnew * tnew + C * (tnew - 100) * tnew * tnew * tnew);

                    if (r < rnew)
                        tup = tnew;
                    else
                        tlow = tnew;
                }
                return (tlow + tup) / 2.0;
            }
            if (method == ConvertMethod.PT100)
            {
                double ac, bc, cc, tlow, tup, rnew, tnew;
                int count;
                ac = 3.908e-3;
                bc = -5.775E-7;
                cc = -4.183E-12;

                param.rtp = 100;
                tlow = -200;
                tup = 850;
                count = 0;

                while ((tup - tlow > 0.00005) && (count++ < 100))
                {
                    tnew = (tlow + tup) / 2.0;
                    rnew = param.rtp + param.rtp * ac * tnew + param.rtp * bc * tnew * tnew;
                    if (tnew < 0)
                        rnew = rnew + param.rtp * cc * (tnew - 100) * tnew * tnew * tnew;

                    if (r < rnew)
                        tup = tnew;
                    else
                        tlow = tnew;
                }
                return Math.Floor((tlow * 10000.0 + tup * 10000) / 2.0 + 0.5) / 10000.0;
            }
            if (method == ConvertMethod.PT25)
            {
                //todo
            }
            return -9999.9999;
        }
예제 #6
0
        internal void AutoCaculation()
        {
            #region average caculation

            //c_1_1sjwd, c_1_1bc1,c_1_2bc1,c_1_3bc1 ... c_1_3bc4
            string[] avg_key = new string[] { "1_{0}bc", "2_{0}bc", "3_{0}bc", "4_{0}bc", "1_{0}wd", "2_{0}wd", "3_{0}wd", "4_{0}wd",
            "1_{0}sqh", "2_{0}sqh", "3_{0}sqh", "4_{0}xqh","1_{0}xqh", "2_{0}xqh", "3_{0}xqh", "4_{0}xqh"};
            for (int i = 0; i < avg_key.Length; i++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    Decimal sum = 0;
                    Decimal count = 0;
                    int rounds = 4;
                    if(avg_key[i].IndexOf("qh") > 0)
                        rounds = 2;
                    for (int j = 1; j < rounds; j++)
                    {
                        string key = "c_" + avg_key[i] + "_" + j.ToString();
                        key = key.Replace("{0}", ipoint.ToString());
                        if (IsValueAvailable(new string[] { key }))
                        {
                            sum = sum + Value(key);
                            count = count + 1;
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (count > 0)
                    {
                        sum = sum / count;
                        string avgid = ("c_" + avg_key[i]).Replace("{0}", ipoint.ToString());
                        this[avgid] = sum;
                    }
                }
            }
            #endregion
            //caculate all temperature related column
            string[] temp_key = new string[] { "" };
            string mkey;
            ABCParam param = new ABCParam();

            for (int ibc = 1; ibc < MAX_BC; ibc++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    string prefix = "c_" + ibc.ToString()+"_"+ipoint.ToString();
                    mkey = "m_"+ibc.ToString() +"_" + ipoint.ToString() + "wdd";
                    if (IsValueAvailable(new string[] { mkey, prefix + "wd" })) //has setpoint information
                    {
                        this[prefix + "sjwd"] = Value(prefix + "wd");
                    }

                    if (IsValueAvailable(new string[] { mkey, prefix + "bc" , prefix + "sjwd"})) //no setpoint information
                    {
                        this[prefix + "bcwc"] = Value(prefix + "sjwd") - Value(prefix + "bc"); //误差值
                    }

                    mkey = "m_" + ibc.ToString() +"_" +ipoint.ToString() + "qhwd"; //上切换
                    if (IsValueAvailable(new string[] { mkey, prefix + "sqh", prefix + "xqh" })) //no setpoint information
                    {
                        this[prefix + "qhc"] = Value(prefix + "sqh") - Value(prefix + "xqh"); //误差值
                        this[prefix + "qhwc"] = (Value(prefix + "sqh") + Value( prefix + "xqh"))/2 - Value(mkey);
                    }
                }
            }
        }
예제 #7
0
파일: WenDu.cs 프로젝트: imdmmp/kpgweigher
        internal static double TValueToRValue(double t, ABCParam param, ConvertMethod method)
        {
            double rnew,tnew;
            if (method == ConvertMethod.ITS90)
            {
                double ac, bc, cc;
                param.targetT = t;
                ac = param.a;
                bc = param.b;
                cc = param.c;
                rnew = GetWr(t);
                return rnew + ac * (rnew - 1) + bc * (rnew - 1) * (rnew - 1) + cc * (rnew - 1) * (rnew - 1) * (rnew - 1);
            }
            if (method == ConvertMethod.DIN68 || method == ConvertMethod.DIN90 || method == ConvertMethod.ASTM)
            {
                double alpha, A, B, C;
                alpha = A = B = C = 0;
                if (method == ConvertMethod.DIN68)
                {
                    alpha = 0.003850;
                    param.rtp = 100;
                    A = 3.90802e-3;
                    B = -5.8020e-7;
                    C = -4.2735e-12;
                }
                if (method == ConvertMethod.DIN90)
                {
                    alpha = 0;
                    param.rtp = 100;
                    A = 3.90823e-3;
                    B = -5.7750e-7;
                    C = -4.1830e-12;
                    if (t >= 0)
                        C = 0;

                }
                if (method == ConvertMethod.ASTM)
                {
                    alpha = 0.003911;
                    param.rtp = 100;
                    A = 3.9692e-3;
                    B = -5.8495e-7;
                    C = -4.2325e-12;
                    
                }
                tnew = t;

                return param.rtp * (1 + A * tnew + B * tnew * tnew + C * (tnew - 100) * tnew * tnew * tnew);
            }
            throw new Exception("Unexpected convert method " + method.ToString());
        }
예제 #8
0
        internal void AutoCaculation()
        {
            #region average caculation

            //c_1_1sjwd, c_1_1bc1,c_1_2bc1,c_1_3bc1 ... c_1_3bc4
            string[] avg_key = new string[] { "1_{0}bc", "2_{0}bc", "3_{0}bc", "4_{0}bc", "1_{0}wd", "2_{0}wd", "3_{0}wd", "4_{0}wd",
                                              "1_{0}sqh", "2_{0}sqh", "3_{0}sqh", "4_{0}xqh", "1_{0}xqh", "2_{0}xqh", "3_{0}xqh", "4_{0}xqh" };
            for (int i = 0; i < avg_key.Length; i++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    Decimal sum    = 0;
                    Decimal count  = 0;
                    int     rounds = 4;
                    if (avg_key[i].IndexOf("qh") > 0)
                    {
                        rounds = 2;
                    }
                    for (int j = 1; j < rounds; j++)
                    {
                        string key = "c_" + avg_key[i] + "_" + j.ToString();
                        key = key.Replace("{0}", ipoint.ToString());
                        if (IsValueAvailable(new string[] { key }))
                        {
                            sum   = sum + Value(key);
                            count = count + 1;
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (count > 0)
                    {
                        sum = sum / count;
                        string avgid = ("c_" + avg_key[i]).Replace("{0}", ipoint.ToString());
                        this[avgid] = sum;
                    }
                }
            }
            #endregion
            //caculate all temperature related column
            string[] temp_key = new string[] { "" };
            string   mkey;
            ABCParam param = new ABCParam();

            for (int ibc = 1; ibc < MAX_BC; ibc++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    string prefix = "c_" + ibc.ToString() + "_" + ipoint.ToString();
                    mkey = "m_" + ibc.ToString() + "_" + ipoint.ToString() + "wdd";
                    if (IsValueAvailable(new string[] { mkey, prefix + "wd" })) //has setpoint information
                    {
                        this[prefix + "sjwd"] = Value(prefix + "wd");
                    }

                    if (IsValueAvailable(new string[] { mkey, prefix + "bc", prefix + "sjwd" })) //no setpoint information
                    {
                        this[prefix + "bcwc"] = Value(prefix + "sjwd") - Value(prefix + "bc");   //误差值
                    }

                    mkey = "m_" + ibc.ToString() + "_" + ipoint.ToString() + "qhwd";             //上切换
                    if (IsValueAvailable(new string[] { mkey, prefix + "sqh", prefix + "xqh" })) //no setpoint information
                    {
                        this[prefix + "qhc"]  = Value(prefix + "sqh") - Value(prefix + "xqh");   //误差值
                        this[prefix + "qhwc"] = (Value(prefix + "sqh") + Value(prefix + "xqh")) / 2 - Value(mkey);
                    }
                }
            }
        }
예제 #9
0
        public void StartProcess(BackgroundWorker formworker)
        {
            /*
            ABCParam ppp = new ABCParam();
            ppp.LoadFromIni("PROBE_TEST2");
            double uu = Wendu.RValueToTValue(40.083 / ppp.rtp, ppp, ConvertMethod.ITS90);
            return;
             */
            worker = formworker;
            
            FormAction("show_status", "测试进行中..."); // FormAction("show_message", "请到原始记录页,测量并填入500度时的实际温度和阻值");

            Dictionary<string, string> checkedpts = new Dictionary<string, string>();
            for (int ipage = 0; ipage < 6; ipage++)
            {
                string pgid = "abcdef"[ipage].ToString();
                List<TEMPRDG> trdgs = new List<TEMPRDG>();
                ABCParam param = new ABCParam();
                if (!testdoc.IsValueAvailable(new string[] { "m_" + pgid + "_bzqbh" }))
                    continue;
                 if(!param.LoadFromIni("PROBE_" + testdoc.StrValue("m_" + pgid + "_bzqbh")))
                    throw new Exception(String.Format("第{0}页无效的标准器编号",(ipage+1).ToString()));

            for(int ipoint = 1; ipoint <= TestDocument.MAX_PT_1PAGE;ipoint++) //check every ipoint
            {
                string sdwd = "m_" + pgid+ "_" + ipoint.ToString() + "jddwd";
                if(!testdoc.IsValueAvailable(new string[]{sdwd}))
                    continue;
                if(checkedpts.ContainsKey(testdoc.StrValue(sdwd))) //tested before
                    continue;
                checkedpts.Add(testdoc.StrValue(sdwd), "m_" + pgid + "_bzqbh");
                Decimal setpoint;
                if (!Decimal.TryParse(testdoc.StrValue(sdwd), out setpoint))
                        continue;
                    string choice = FormAction("show_message", String.Format("请将所有探头放入恒温槽,并将温度设置到 {0} ℃。\n点击'跳过'直接重测下一点", setpoint.ToString()));
                    if (choice == "skip")
                        continue;
                    FormAction("clear_graph", "");
                
                    CheckCancel(2);
                    trdgs.Clear();
                    //wait temp stable
                    scanner.ScanTo(0, WIREMODE.MODE_4WIRE); //force 1st channel (standard) to be 4 wire
                    double tempnow;

                    double period = Double.Parse(Util.ConstIni.StringValue("CONDITION", "PERIOD"));
                    double pplimit = Double.Parse(Util.ConstIni.StringValue("CONDITION", "PPLIMIT"));
                    int scandelay = Int32.Parse(Util.ConstIni.StringValue("CONDITION", "SCANDELAY"));
                    int goodcnt = Int32.Parse(Util.ConstIni.StringValue("CONDITION", "GOODCNT"));

                    bridge.ClearBuffer();
                    while (true)
                    {
                        tempnow = Convert.ToDouble(ReadF700(1)* GetStdMultiply(param)) / param.rtp;
                        tempnow = Wendu.RValueToTValue(tempnow, param, ConvertMethod.ITS90);
                        //convert to temperature
                        trdgs.Add(new TEMPRDG(Convert.ToDecimal(tempnow), DateTime.Now));
                        FormGraphAction(0, tempnow,"c");
                        FormAction("show_status", String.Format("等待温度稳定....{0} ℃", tempnow.ToString("F03")));

                        while ((trdgs.Count > 0) && trdgs[0].time < DateTime.Now.AddMinutes(-period)) 
                            trdgs.RemoveAt(0);

                        if ((trdgs.Count > 10) && 
                            (trdgs[trdgs.Count - 1].time.Subtract(trdgs[0].time).TotalMinutes > (period-0.1)) &&
                            IsDiffSmall(trdgs[trdgs.Count - 1].reading, setpoint, 2) &&
                            ((Util.my_max(trdgs, 0) - Util.my_min(trdgs, 0)) < pplimit))
                        {
                            break;
                        }
                        CheckCancel(1);
                    }
                    FormAction("clear_graph", "");
                    //start to collect data
                    Decimal rnow;
                    for (int round = 1; round <= 4; round++)
                    {
                        int sindex = 0;
                        for (int sch = 0; sch < 24; sch++)
                        {
                            if (sch > 0)
                            {
                                if (!testdoc.IsValueAvailable(new string[] { "m_" + sch.ToString() + "_dj" }))
                                    continue;

                                string cdpt = "m_"+"abcdef"[(sch - 1) / 4].ToString() ;
                                if (testdoc.IsValueAvailable(new string[] { cdpt + "_1jddwd" }) && (testdoc.StrValue(cdpt + "_1jddwd") == testdoc.StrValue(sdwd)))
                                    sindex++;
                                else if (testdoc.IsValueAvailable(new string[] { cdpt + "_2jddwd" }) && (testdoc.StrValue(cdpt + "_2jddwd") == testdoc.StrValue(sdwd)))
                                    sindex++;
                                else if (testdoc.IsValueAvailable(new string[] { cdpt + "_3jddwd" }) && (testdoc.StrValue(cdpt + "_3jddwd") == testdoc.StrValue(sdwd)))
                                    sindex++;
                                else
                                    continue;
                            }
                            if (sindex == 0)
                            {
                                FormAction("show_status", String.Format("正在采集标准温度计数据..."));
                                scanner.ScanTo(sindex, WIREMODE.MODE_4WIRE);
                            }
                            else
                            {
                                FormAction("show_status", String.Format("正在采集被检温度计 {0} 数据...", sindex));
                                scanner.ScanTo(sindex, wire);
                            }
                            CheckCancel(scandelay);
                            bridge.ClearBuffer();
                            rnow = ReadF700(goodcnt);
                            if (sindex == 0)
                            {
                                this["c_" +pgid+ "_"+ ipoint.ToString() + "sjwd_" + round.ToString()] = Convert.ToDecimal(Wendu.RValueToTValue(Convert.ToDouble(rnow*GetStdMultiply(param))/param.rtp, param, ConvertMethod.ITS90));
                                FormGraphAction(sindex, Convert.ToDouble(rnow * GetStdMultiply(param)), "ohm");
                            }
                            else
                            {
                                if(wire == WIREMODE.MODE_3WIRE)
                                {
                                    this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw3_" + round.ToString()] = rnow*GetMultiply();
                                }
                                else{
                                    this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bc_" + round.ToString()] = rnow * GetMultiply();
                                }
                                FormGraphAction(sindex, Convert.ToDouble(rnow * GetMultiply()), "ohm");
                            }
                            CheckCancel(2);
                        }
                        if (wire == WIREMODE.MODE_3WIRE) //another roudn for 2 wire measure
                        {
                            int nsindex = 0;
                            for (int sch = 0; sch < 24; sch++)
                            {
                                if (sch > 0)
                                {
                                    if (!testdoc.IsValueAvailable(new string[] { "m_" + sch.ToString() + "_dj" }))
                                        continue;

                                    string cdpt = "m_" + "abcdef"[(sch - 1) / 4].ToString();
                                    if (testdoc.IsValueAvailable(new string[] { cdpt + "_1jddwd" }) && (testdoc.StrValue(cdpt + "_1jddwd") == testdoc.StrValue(sdwd)))
                                        nsindex++;
                                    else if (testdoc.IsValueAvailable(new string[] { cdpt + "_2jddwd" }) && (testdoc.StrValue(cdpt + "_2jddwd") == testdoc.StrValue(sdwd)))
                                        nsindex++;
                                    else if (testdoc.IsValueAvailable(new string[] { cdpt + "_3jddwd" }) && (testdoc.StrValue(cdpt + "_3jddwd") == testdoc.StrValue(sdwd)))
                                        nsindex++;
                                    else
                                        continue;
                                }
                                if (nsindex == 0)
                                {
                                    continue;
                                }
                                else
                                {
                                    FormAction("show_status", String.Format("正在采集被检温度计 {0} 数据...", sindex));
                                    scanner.ScanTo(nsindex, WIREMODE.MODE_2WIRE);
                                }
                                CheckCancel(scandelay);
                                bridge.ClearBuffer();
                                rnow = ReadF700(goodcnt);
                                this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw2_" + round.ToString()] = rnow * GetMultiply();
                                FormGraphAction(sindex, Convert.ToDouble(rnow * GetMultiply()), "ohm");
                                CheckCancel(2);
                                testdoc.AutoCaculation(true);
                            }
                        }
                    }
                    testdoc.AutoCaculation(false);
                }
            }
            scanner.ScanTo(0,WIREMODE.MODE_4WIRE);
            Thread.Sleep(1000);
        }
예제 #10
0
        private Decimal GetStdMultiply(ABCParam param)
        {
            if (bridge is DQF700)
            {
                return 100;
                /*
                if (Math.Abs(param.rtp - 25) < 1)
                    return 25;
                if (Math.Abs(param.rtp - 100) < 1)
                    return 100;
                else
                    throw new Exception("未知探头类型");
                 */
            }else if (bridge is FL1560)
            {
                    return 1;
            }
            else
                    throw new Exception("不支持的电桥");

        }
예제 #11
0
        internal void AutoCaculation(bool min)
        {
            #region 3 WIRE caculation
            //this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw3_" + round.ToString()] = rnow*GetMultiply();
            for (int round = 1; round <= 4; round++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    Decimal sum   = 0;
                    Decimal count = 0;
                    for (int sch = 0; sch < 24; sch++)
                    {
                        string w3 = "c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw3_" + round.ToString();
                        string w2 = "c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw2_" + round.ToString();
                        if (IsValueAvailable(new string[] { w3, w2 }))
                        {
                            this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bc_" + round.ToString()] = 2 * Value(w3) - Value(w2);
                        }
                    }
                }
            }
            #endregion

            if (min)
            {
                return;
            }
            #region average caculation
            //c_1_1sjwd, c_1_1bc1,c_1_2bc1,c_1_3bc1 ... c_1_3bc4
            string[] avg_key = new string[] { "a_{0}sjwd", "b_{0}sjwd", "c_{0}sjwd", "d_{0}sjwd", "1_{0}bc", "2_{0}bc", "3_{0}bc", "4_{0}bc", "5_{0}bc", "6_{0}bc", "7_{0}bc", "8_{0}bc", "9_{0}bc", "10_{0}bc", "11_{0}bc", "12_{0}bc" };
            for (int i = 0; i < avg_key.Length; i++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    Decimal sum   = 0;
                    Decimal count = 0;
                    for (int j = 1; j < 5; j++)
                    {
                        string key = "c_" + avg_key[i] + "_" + j.ToString();
                        key = key.Replace("{0}", ipoint.ToString());
                        if (IsValueAvailable(new string[] { key }))
                        {
                            sum   = sum + Value(key);
                            count = count + 1;
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (count > 0)
                    {
                        sum = sum / count;
                        string avgid = ("c_" + avg_key[i]).Replace("{0}", ipoint.ToString());
                        this[avgid] = sum;
                    }
                }
            }
            #endregion
            //caculate all temperature related column
            string[] temp_key = new string[] { "" };

            string pageid = "abcdef";
            for (int page = 0; page < pageid.Length; page++)
            {
                string   pg = pageid[page].ToString();
                string   mkey;
                string   r0_prefix   = "";
                string   r100_prefix = "";
                ABCParam param       = new ABCParam();

                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    string prefix = "c_" + pg + "_" + ipoint.ToString();


                    mkey = "m_" + pg + "_" + ipoint.ToString() + "jddwd";
                    if (!IsValueAvailable(new string[] { mkey, prefix + "sjwd" })) //no setpoint information
                    {
                        continue;
                    }

                    if (StrValue(mkey).ToString().Trim() == "0")
                    {
                        r0_prefix = "c_" + pg + "_" + ipoint.ToString();
                    }
                    if (StrValue(mkey).ToString().Trim() == "100")
                    {
                        r100_prefix = "c_" + pg + "_" + ipoint.ToString();
                    }

                    this[prefix + "xzwd"] = Decimal.Parse(StrValue(mkey)) - Value(prefix + "sjwd"); //修正值


                    if (!param.LoadFromIni("PROBE_" + StrValue("m_a_bzqbh")))
                    {
                        throw new Exception("无效的标准器编号");
                    }
                    double dydz = Wendu.TValueToRValue(ToDouble(Value(mkey)), param, ConvertMethod.DIN90) -
                                  Wendu.TValueToRValue(ToDouble(Value(prefix + "sjwd")), param, ConvertMethod.DIN90); //对应电阻值
                    this[prefix + "dydz"] = dydz;


                    //caculate all bei ce related column
                    for (int ibc = 4 * page + 1; ibc <= 4 * page + 4; ibc++)
                    {
                        prefix = "c_" + ibc.ToString() + "_" + ipoint.ToString();
                        if (!IsValueAvailable(new string[] { prefix + "bc" }))
                        {
                            continue;
                        }
                        this[prefix + "sjzbc"] = Value(prefix + "bc") + ToDecimal(dydz);
                    }
                }
                if (r0_prefix != "" && r100_prefix != "")
                {
                    for (int ibc = 4 * page + 1; ibc <= 4 * page + 4; ibc++)
                    {
                        if (!IsValueAvailable(new string[] { r100_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc",
                                                             r0_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc",
                                                             "m_" + ibc.ToString() + "_dj" }))
                        {
                            continue;
                        }
                        double r100  = ToDouble(Value(r100_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc"));
                        double r0    = ToDouble(Value(r0_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc"));
                        double alpha = (r100 - r0) / (100 * r0);
                        this["c_" + ibc.ToString() + "_alphabc"] = ToDecimal(alpha);
                        double deltat0 = (r0 - Wendu.TValueToRValue(ToDouble(0), param, ConvertMethod.DIN90)) / 0.39083;
                        bool   valid1  = false;
                        bool   valid2  = false;
                        bool   valid3  = false;
                        string dg      = StrValue("m_" + ibc.ToString() + "_dj").ToString().Trim().ToUpper();

                        if (dg == "AA")
                        {
                            valid1 = (Math.Abs(r0 - 100) <= 0.039);
                        }
                        if (dg == "A")
                        {
                            valid1 = (Math.Abs(r0 - 100) <= 0.059);
                        }
                        if (dg == "B")
                        {
                            valid1 = (Math.Abs(r0 - 100) <= 0.117);
                        }
                        if (dg == "C")
                        {
                            valid1 = (Math.Abs(r0 - 100) <= 0.234);
                        }

                        if (dg == "AA")
                        {
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.102);
                        }
                        if (dg == "A")
                        {
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.133);
                        }
                        if (dg == "B")
                        {
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.303);
                        }
                        if (dg == "C")
                        {
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.607);
                        }

                        if (dg == "AA")
                        {
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 30 * 1e-6) <= 7.0);
                        }
                        if (dg == "A")
                        {
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 23 * 1e-6) <= 7.0);
                        }
                        if (dg == "B")
                        {
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 21 * 1e-6) <= 14.0);
                        }
                        if (dg == "C")
                        {
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 21 * 1e-6) <= 32.0);
                        }

                        if (valid1 && valid2 && valid3)
                        {
                            this["c_" + ibc.ToString() + "_jl"] = "合格";
                        }
                        else
                        {
                            string fail = "";
                            if (!valid1)
                            {
                                fail = "0度超差";
                            }
                            if (!valid2)
                            {
                                fail = fail + ";100度超差";
                            }
                            if (!valid3)
                            {
                                fail = fail + ";α超差";
                            }

                            this["c_" + ibc.ToString() + "_jl"] = fail.Trim(new char[] { ';' });
                        }
                    }
                }
            }
        }
예제 #12
0
        internal void AutoCaculation(bool min)
        {
            
            #region 3 WIRE caculation
            //this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw3_" + round.ToString()] = rnow*GetMultiply();
            for (int round = 1; round <= 4; round++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    Decimal sum = 0;
                    Decimal count = 0;
                    for (int sch = 0; sch < 24; sch++)
                    {
                        string w3 = "c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw3_" + round.ToString();
                        string w2 = "c_" + sch.ToString() + "_" + ipoint.ToString() + "bcw2_" + round.ToString();
                        if (IsValueAvailable(new string[] { w3,w2}))
                        {
                            this["c_" + sch.ToString() + "_" + ipoint.ToString() + "bc_" + round.ToString()]= 2 * Value(w3)-Value(w2);
                        }
                    }
                }
            }
            #endregion

            if (min)
                return;
            #region average caculation
            //c_1_1sjwd, c_1_1bc1,c_1_2bc1,c_1_3bc1 ... c_1_3bc4
            string[] avg_key = new string[] { "a_{0}sjwd", "b_{0}sjwd","c_{0}sjwd","d_{0}sjwd", "1_{0}bc", "2_{0}bc", "3_{0}bc", "4_{0}bc", "5_{0}bc", "6_{0}bc", "7_{0}bc", "8_{0}bc", "9_{0}bc", "10_{0}bc","11_{0}bc","12_{0}bc" };
            for (int i = 0; i < avg_key.Length; i++)
            {
                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {
                    Decimal sum = 0;
                    Decimal count = 0;
                    for (int j = 1; j < 5; j++)
                    {
                        string key = "c_" + avg_key[i] + "_" + j.ToString();
                        key = key.Replace("{0}", ipoint.ToString());
                        if (IsValueAvailable(new string[] { key }))
                        {
                            sum = sum + Value(key);
                            count = count + 1;
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (count > 0)
                    {
                        sum = sum / count;
                        string avgid = ("c_" + avg_key[i]).Replace("{0}", ipoint.ToString());
                        this[avgid] = sum;
                    }
                }
            }
            #endregion
            //caculate all temperature related column
            string[] temp_key = new string[] { "" };

            string pageid = "abcdef";
            for (int page = 0; page < pageid.Length; page++)
            {
                string pg = pageid[page].ToString() ;
                string mkey;
                string r0_prefix = "";
                string r100_prefix = "";
                ABCParam param = new ABCParam();

                for (int ipoint = 1; ipoint <= MAX_PT_1PAGE; ipoint++)
                {

                    string prefix = "c_" + pg + "_" + ipoint.ToString();
                    

                    mkey = "m_" + pg  +"_"+ ipoint.ToString() + "jddwd";
                    if (!IsValueAvailable(new string[] { mkey , prefix+"sjwd"})) //no setpoint information
                        continue;

                    if (StrValue(mkey).ToString().Trim() == "0")
                        r0_prefix = "c_" + pg + "_" + ipoint.ToString();
                    if (StrValue(mkey).ToString().Trim() == "100")
                        r100_prefix = "c_" + pg + "_" + ipoint.ToString();

                    this[prefix + "xzwd"] = Decimal.Parse(StrValue(mkey)) - Value(prefix + "sjwd"); //修正值


                    if (!param.LoadFromIni("PROBE_" + StrValue("m_a_bzqbh")))
                        throw new Exception("无效的标准器编号");
                    double dydz = Wendu.TValueToRValue(ToDouble(Value(mkey)), param, ConvertMethod.DIN90) -
                                  Wendu.TValueToRValue(ToDouble(Value(prefix + "sjwd")), param, ConvertMethod.DIN90); //对应电阻值
                    this[prefix + "dydz"] = dydz;

                    
                    //caculate all bei ce related column
                    for (int ibc = 4*page+1; ibc <= 4*page+4; ibc++)
                    {
                        prefix = "c_" + ibc.ToString() + "_" + ipoint.ToString();
                        if (!IsValueAvailable(new string[] { prefix + "bc" }))
                            continue;
                        this[prefix + "sjzbc" ] = Value(prefix + "bc" ) + ToDecimal(dydz);
                    }
                }
                if (r0_prefix != "" && r100_prefix != "")
                {
                    for (int ibc = 4 * page + 1; ibc <= 4 * page + 4; ibc++)
                    {
                        if (!IsValueAvailable(new string[] { r100_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc",
                        r0_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc",
                        "m_" + ibc.ToString() + "_dj"}))
                            continue;
                        double r100 = ToDouble(Value(r100_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc"));
                        double r0 = ToDouble(Value(r0_prefix.Replace("c_" + pg + "_", "c_" + ibc.ToString() + "_") + "sjzbc"));
                        double alpha = (r100 - r0) / (100 * r0);
                        this["c_" + ibc.ToString() + "_alphabc"] = ToDecimal(alpha);
                        double deltat0 = (r0 - Wendu.TValueToRValue(ToDouble(0), param, ConvertMethod.DIN90)) / 0.39083;
                        bool valid1 = false;
                        bool valid2 = false;
                        bool valid3 = false;
                        string dg = StrValue("m_" + ibc.ToString() + "_dj").ToString().Trim().ToUpper();
                        
                        if (dg == "AA")
                            valid1 = (Math.Abs(r0 - 100) <= 0.039);
                        if (dg == "A")
                            valid1 = (Math.Abs(r0 - 100) <= 0.059);
                        if (dg == "B")
                            valid1 = (Math.Abs(r0 - 100) <= 0.117);
                        if (dg == "C")
                            valid1 = (Math.Abs(r0 - 100) <= 0.234);

                        if (dg == "AA")
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.102) ;
                        if (dg == "A")
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.133) ;
                        if (dg == "B")
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.303) ;
                        if (dg == "C")
                            valid2 = (Math.Abs(r100 - 138.506) <= 0.607) ;

                        if (dg == "AA")
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 30 * 1e-6) <= 7.0);
                        if (dg == "A")
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 23 * 1e-6) <= 7.0);
                        if (dg == "B")
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 21 * 1e-6) <= 14.0);
                        if (dg == "C")
                            valid3 = (Math.Abs(alpha - 0.003851 + deltat0 * 21 * 1e-6) <= 32.0);

                        if (valid1 && valid2 && valid3)
                            this["c_" + ibc.ToString() + "_jl"] = "合格";
                        else
                        {
                            string fail = "";
                            if (!valid1)
                                fail = "0度超差";
                            if (!valid2)
                                fail = fail + ";100度超差";
                            if (!valid3)
                                fail = fail + ";α超差";

                            this["c_" + ibc.ToString() + "_jl"] = fail.Trim(new char[]{';'});
                        }
                    }
                }
            }
        }