/// <summary>
        /// 根据服务获取数据,封装各统计项,并初始化,默认为0.0
        /// </summary>
        public void InitializeStastisticList(double[] dataArray)
        {
            Statsitic maxDeviation;
            Statsitic responseTime;
            Statsitic frequency;
            Statsitic delayTime;
            Statsitic upTime;
            Statsitic peakTime;

            maxDeviation = new Statsitic("超调量");       //默认值为0
            items.Add(maxDeviation);
            responseTime = new Statsitic("调节时间");
            items.Add(responseTime);
            frequency = new Statsitic("振荡次数");
            items.Add(frequency);
            delayTime = new Statsitic("延迟时间");
            items.Add(delayTime);
            upTime = new Statsitic("上升时间");
            items.Add(upTime);
            peakTime = new Statsitic("峰值时间");
            items.Add(peakTime);


            if (dataArray != null)
            {
                for (int i = 0; i < dataArray.Length; i++)
                {
                    items[i].Val = dataArray[i];
                }
            }
        }
示例#2
0
        //?*服务*/、加载窗体时调用此方法获取统计值并返回,**顺序一定:超调量", "调节时间", "振荡次数", "延迟时间","上升时间","峰值时间………………………………………………
        public List <Statsitic> getSimuStastisticsFromService(string reqStr)
        {
            List <Statsitic> list = new List <Statsitic>();
            Statsitic        sta;

            double[] arr  = { 20, 5, 10, 44, 33, 22 };//获取的值
            string[] type = { "超调量", "调节时间", "振荡次数", "延迟时间", "上升时间", "峰值时间" };
            for (int i = 0; i < arr.Length; i++)
            {
                sta = new Statsitic(type[i], arr[i]);
                list.Add(sta);
            }
            return(list);
        }
        //?*服务*/、加载窗体时调用此方法获取四个统计值并返回,**顺序一定:最大、最小、平均值、方差………………………………………………
        public List <Statsitic> getStatsticsFromService(string reqStr)
        {
            int j = 0;
            List <Statsitic> list = new List <Statsitic>();
            Statsitic        sta;
            String           results = service.HttpGet(staURL + reqStr);

            string[] arrSta = results.Split('-');
            while (j + 1 < arrSta.Length)
            {
                sta = new Statsitic(arrSta[j], Math.Round(System.Convert.ToDouble(arrSta[j + 1]), 3));
                list.Add(sta);
                j = j + 2;
            }
            return(list);
        }