Esempio n. 1
0
        private string ParamFlagsDescription(ParamDesc pd)
        {
            var flg = pd.wParamFlags;
            var res = new List <string>();

            if (0 != (flg & ParamDesc.ParamFlags.PARAMFLG_FIN))
            {
                res.Add("in");
            }
            if (0 != (flg & ParamDesc.ParamFlags.PARAMFLG_FOUT))
            {
                res.Add("out");
            }
            if (0 != (flg & ParamDesc.ParamFlags.PARAMFLG_FRETVAL))
            {
                res.Add("retval");
            }
            if (0 != (flg & ParamDesc.ParamFlags.PARAMFLG_FOPT))
            {
                res.Add("optional");
            }
            if (0 != (flg & ParamDesc.ParamFlags.PARAMFLG_FLCID))
            {
                res.Add("lcid");
            }
            if (0 != (flg & ParamDesc.ParamFlags.PARAMFLG_FHASDEFAULT) && pd.varDefaultValue != null)
            {
                res.Add("defaultvalue(" + ITypeInfoXtra.QuoteString(pd.varDefaultValue) + ")");
            }
            return("[" + string.Join(", ", res.ToArray()) + "]");
        }
Esempio n. 2
0
        private void LoadConfig()
        {
            config = new Config();
            config.LoadIniFileInCurDir("default.cfg");
            //默认参数
            //传感器参数
            sensorParamTable.Add("传感器量程最小值", new ParamDesc(config.感器参数.感器量程最小值, "0.000", "Mpa", -1000.000f, 1000.000f, 0.001));
            sensorParamTable.Add("传感器量程最大值", new ParamDesc(config.感器参数.感器量程最大值, "0.000", "Mpa", -1000.000f, 1000.000f, 0.001));
            sensorParamTable.Add("传感器输出电压最小值", new ParamDesc(config.感器参数.感器输出电压最小值, "0.00", "V", 0.00, 12.00, 0.01));
            sensorParamTable.Add("传感器输出电压最大值", new ParamDesc(config.感器参数.感器输出电压最大值, "0.00", "V", 0.01, 12.00, 0.01));
            sensorParamTable.Add("传感器精度", new ParamDesc(config.感器参数.感器精度, "0.00", "%", 0.001, 10.000, 0.001));
            sensorParamTable.Add("传感器供电电压", new ParamDesc(config.感器参数.感器供电电压, "0.00", "V", 0.01, 24.00, 0.01));

            //测试参数
            testParamTable.Add("老化周期数", new ParamDesc(config.测试参数.老化周期数, "", "次", 1, 10000, 1));
            testParamTable.Add("充气(高压)压力", new ParamDesc(config.测试参数.充气高压压力, "0.000", "Mpa", -1000.000f, 1000.000f, 0.001));
            testParamTable.Add("充气(高压)时间", new ParamDesc(config.测试参数.充气高压时间, "", "秒", 1, 200, 1));
            testParamTable.Add("排气(静置)时间", new ParamDesc(config.测试参数.排气静置时间, "", "秒", 1, 200, 1));
            testParamTable.Add("测量周期步进", new ParamDesc(config.测试参数.测量周期步进, "", "周期", 0, 10000, 1));
            testParamTable.Add("上电时间", new ParamDesc(config.测试参数.电时间, "", "毫秒", 10, 10000, 1));
            testParamTable.Add("气压稳定时间", new ParamDesc(config.测试参数.气压稳定时间, "", "毫秒", 10, 10000, 1));
            testParamTable.Add("老化方式", new ParamDesc(config.测试参数.老化方式, "恒压老化|动态老化", "-", 0, 0, 0));

            pressureParamDesc = testParamTable["充气(高压)压力"];
            if (pressureParamDesc == null)
            {
                MessageBox.Show("程序故障!");
                Application.Exit();
            }

            //传感器编号
            string s = config.设备参数.设备标签.Trim();

            string[] ss = s.Split(' ');
            int      i  = 0;

            for (; i < ss.Count(); i++)
            {
                channelNumbers[i] = ss[i];
            }
            for (; i < 50; i++)
            {
                channelNumbers[i] = "NoSet";
            }

            //使能
            s  = config.设备参数.禁用的通道.Trim();
            ss = s.Split(',');
            for (int slot = 0; slot < 10; slot++)
            {
                for (int ch = 0; ch < 5; ch++)
                {
                    channelEnableTable[slot, ch] = true;
                    for (i = 0; i < ss.Count(); i++)
                    {
                        try
                        {
                            if (int.Parse(ss[i]) == (slot * 5 + ch))
                            {
                                channelEnableTable[slot, ch] = false;
                            }
                        }
                        catch { }
                    }
                }
            }
        }