示例#1
0
        /// <summary>
        /// Measure the AC output
        /// </summary>
        /// <param name="ckt">Circuit</param>
        /// <returns></returns>
        public override double Measure(Circuit ckt)
        {
            // Initialize
            Frequencies.Clear();
            Results.Clear();

            // Simulate
            Analysis.OnExportSimulationData += StoreResult;
            ckt.Simulate(Analysis);
            Analysis.OnExportSimulationData -= StoreResult;

            // Return result
            return(extractparam(this));
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var s = new Stopwatch();

            s.Start();
            var wc = new WordCloudGen(1000, 600);

            if (resultPictureBox.Image != null)
            {
                resultPictureBox.Image.Dispose();
            }
            Words.Clear();
            Frequencies.Clear();

            List <string> AllWords       = new List <string>();
            List <int>    AllFrequencies = new List <int>();
            var           file_words     = File.ReadAllText(@"D:\c#\图云词频计算\words.txt");
            var           words          = file_words.Split('\n');

            foreach (var word in words)
            {
                if (AllWords.Contains(word))
                {
                    //如果已经存在就+1
                    AllFrequencies[AllWords.IndexOf(word)]++;
                }
                else
                {
                    bool result = false;
                    for (int j = 0; j < word.Length; j++)
                    {
                        if (Char.IsNumber(word, j))
                        {
                            result = true;
                        }
                    }
                    if (!result)
                    {
                        //如果不存在 且不为数字就添加
                        AllWords.Add(word);
                        AllFrequencies.Add(1);
                    }
                }
            }
            int index = 0;

            foreach (var temp in AllFrequencies)
            {
                if (temp > 200)
                {
                    Words.Add(AllWords[index]);
                    Frequencies.Add(temp);
                }
                index++;
            }

            Image i = wc.Draw(Words, Frequencies);

            s.Stop();
            elapsedLabel.Text      = s.Elapsed.TotalMilliseconds.ToString();
            resultPictureBox.Image = i;
        }