Пример #1
0
        public void CreateDefaultConfig_Frequency_A_B()
        {
            this.measName                    = "Default config done by application";
            this.measInfo                    = "Frequency measurment channel A-B";
            this.measType                    = eMeasType.freq_a_b;
            this.GraphLegendName             = EnumHelper.GetDescription(this.measType);
            this.YLegendName                 = "offset (ns)";
            this.XLegendName                 = "timestamp (s)";
            this.board                       = 0;
            this.memoryWrap                  = false;
            this.sleepAfterSingleMeasurement = 850; //ms
            this.sleepAfterSingleRead        = 5;   //ms
            this.loops                       = 0;
            this.stamp                       = DateTime.Now;
            this.numTag0                     = 1U;
            this.numTag1                     = 1U;
            this.enableChannel0              = true;
            this.enableChannel1              = true;
            this.doCalibration               = false;
            this.inputChannel0Signal         = GT668Class.GtiInputSel.GT_CHA_POS;
            this.inputChannel1Signal         = GT668Class.GtiInputSel.GT_CHB_POS;
            this.prescaleA                   = GT668Class.GtiPrescale.GT_DIV_1;
            this.prescaleB                   = GT668Class.GtiPrescale.GT_DIV_1;
            this.measSkipChannel0            = 2499; // 624
            this.measSkipChannel1            = 2499; // 624
            this.inputThresholdA             = 0.7;
            this.inputThresholdB             = 0.7;
            this.clockThreshold              = 0.7;
            this.inputThresholdModeA         = GT668Class.GtiThrMode.GT_THR_VOLTS;
            this.inputThresholdModeB         = GT668Class.GtiThrMode.GT_THR_VOLTS;
            this.clockThresholdMode          = GT668Class.GtiThrMode.GT_THR_VOLTS;
            this.inputCouplingA              = GT668Class.GtiCoupling.GT_CPL_DC;
            this.inputCouplingB              = GT668Class.GtiCoupling.GT_CPL_DC;
            this.referenceClock              = GT668Class.GtiRefClkSrc.GT_REF_EXTERNAL;
            this.clockFrequenz               = eClockFreq.Mhz10;
            this.inputImpendanceA            = GT668Class.GtiImpedance.GT_IMP_LO;
            this.inputImpendanceB            = GT668Class.GtiImpedance.GT_IMP_LO;
            this.showAllErrors               = false;
            this.showResults                 = true;
            this.restartMeasurementAfterLoop = false;
            this.userDefinedYOffset          = 0;

            this.ResultDefinitions.Clear();

            ResultDefinition rs = new ResultDefinition();

            rs.DataFormat  = "<datastamp>,<value>;";
            rs.Path        = $@"{Application.StartupPath}\Results\";
            rs.FilePattern = $@"AutogeneratedResultFile_<ticks>.dat";
            rs.Active      = true;
            rs.DataSource  = eDatasource.file;
            this.ResultDefinitions.Add(rs);

            rs             = new ResultDefinition();
            rs.DataFormat  = "<datastamp,format=F3> <value>";
            rs.Path        = $@"{Application.StartupPath}\Results\";
            rs.FilePattern = $@"AVARAutogeneratedResultFile_<ticks>.dat";
            rs.Active      = true;
            rs.DataSource  = eDatasource.AVARfile;

            this.ResultDefinitions.Add(rs);

            this.XMLName = $@"{Application.StartupPath}\Config\Phase_A_B_Autogenerated_{StaticMeasFunctions.GetActDateTimeCnt()}.xml";
        }
Пример #2
0
        public bool Deserialize(string FileName)
        {
            bool      ok;
            XmlReader reader;

            try
            {
                this.XMLName = FileName;
                XmlSerializer serializer = new XmlSerializer(typeof(MeasurementConfigClass));
                Stream        fs         = new FileStream(FileName, FileMode.Open);
                reader = new XmlTextReader(fs);
                var PF = (MeasurementConfigClass)serializer.Deserialize(reader);
                reader.Close();

                this.measName                    = PF.measName;
                this.measInfo                    = PF.measInfo;
                this.enableChannel0              = PF.enableChannel0;
                this.enableChannel1              = PF.enableChannel1;
                this.measGateChannel0            = PF.measGateChannel0;
                this.measGateChannel1            = PF.measGateChannel1;
                this.measSkipChannel0            = PF.measSkipChannel0;
                this.measSkipChannel1            = PF.measSkipChannel1;
                this.measType                    = PF.measType;
                this.memoryWrap                  = PF.memoryWrap;
                this.numTag0                     = PF.numTag0;
                this.numTag1                     = PF.numTag1;
                this.prescaleA                   = PF.prescaleA;
                this.prescaleB                   = PF.prescaleB;
                this.referenceClock              = PF.referenceClock;
                this.restartMeasurementAfterLoop = PF.restartMeasurementAfterLoop;
                this.showAllErrors               = PF.showAllErrors;
                this.showResults                 = PF.showResults;
                this.sleepAfterSingleMeasurement = PF.sleepAfterSingleMeasurement;
                this.sleepAfterSingleRead        = PF.sleepAfterSingleRead;
                this.userDefinedYOffset          = PF.userDefinedYOffset;
                this.YLegendName                 = PF.YLegendName;
                this.XLegendName                 = PF.XLegendName;
                this.GraphLegendName             = PF.GraphLegendName;
                this.ScaleYAxis                  = PF.ScaleYAxis;
                this.stamp             = PF.stamp;
                this.ResultDefinitions = new List <ResultDefinition>();
                for (int i = 0; i < PF.ResultDefinitions.Count; i++)
                {
                    var rd = new ResultDefinition();
                    rd.Path        = GetPath(PF.ResultDefinitions[i].Path);
                    rd.DataFormat  = PF.ResultDefinitions[i].DataFormat.Replace("%", "<").Replace("*", ">");
                    rd.Active      = PF.ResultDefinitions[i].Active;
                    rd.FilePattern = PF.ResultDefinitions[i].FilePattern;
                    rd.DataSource  = PF.ResultDefinitions[i].DataSource;
                    this.ResultDefinitions.Add(rd);
                }

                ok = true;
            }
            catch (Exception ex)
            {
                ok     = false;
                loadOK = ok;
                MessageBox.Show(ex.Message, "Konfiguration der Anwendung konnte nicht geladen werden.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(ok);
            }
            finally
            {
            }
            loadOK = ok;
            return(ok);
        }