Example #1
0
        public void initData()
        {
            var list = UserControlBase.dataManage.deviceInfoElem.connector.moduleList;

            foreach (var elem in list)
            {
                if (elem.moduleID == "HSC_FUNC")
                {
                    var moduleList = UserControlBase.dataManage.modules.list;
                    foreach (var elemModule in moduleList)
                    {
                        if (elemModule.moduleID == elem.moduleID)
                        {
                            foreach (var innerElem in elemModule.connectModules.list)
                            {
                                xml.HSCData hscData = new xml.HSCData();

                                DataRow drData;
                                drData = dtData.NewRow();

                                hscData.used            = false;
                                drData[columnUsedIndex] = hscData.used;


                                hscData.name           = innerElem.parameterName;
                                drData[columnVarIndex] = hscData.name;

                                hscData.address            = hscData.name;
                                drData[columnAddressIndex] = hscData.address;

                                hscData.type = (int)TYPE.NOTUSED;
                                if (typeDescDic.ContainsKey(hscData.type))
                                {
                                    drData[columnTypeIndex] = typeDescDic[hscData.type];
                                }
                                else
                                {
                                    drData[columnTypeIndex] = "";
                                }

                                hscData.note            = "";
                                drData[columnNoteIndex] = hscData.note; //

                                dtData.Rows.Add(drData);
                                UserControlBase.dataManage.hscList.Add(hscData);
                            }
                        }
                    }
                    this.dataGridView1.DataSource = dtData;
                }
            }
        }
Example #2
0
        public string getHscVarInitValue(HSCData hsc, int axis)
        {
            int timeBase = 0;

            if (hsc.timeWindow == 0)
            {
                timeBase = 100;
            }
            else if (hsc.timeWindow == 1)
            {
                timeBase = 1000;
            }
            else if (hsc.timeWindow == 2)
            {
                timeBase = 0;
            }

            string initValue = string.Format("( axis_no := {0}, preset_val := {1}, threshold0 := {2}, threshold1 := {3}, time_base := {4} )",
                                             axis, hsc.preset, hsc.thresholdS0, hsc.thresholdS1, timeBase);

            return(initValue);
        }