Interactive.cs 26.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using MachineDll;
using System.Data;
namespace Interface
{
    public class Interactive : Form, IReceiveData
    {
        private bool _IsAllFinish;
        private readonly TheMachine theMachine;
        private int _SuccessCount;
        private int _FailureCount;
        private DataTable table1;
        private double _TestTime;
        private System.Timers.Timer timer1;
        private System.ComponentModel.IContainer components;
        private double fluidHeight;
        private double heatTemp;
        private double suggestHeatTemp;
        private double suggestHeight;
        private double washUpperLimit;
        private double conductance;
        private bool IsStatic;
        private bool m_ifHeat;
        private Queue objQ;
        public Interactive(bool ifHeat, double testTime, double SuggestHeight, double SuggestHeatTemp, 
            double WashUpperLimit, bool isStatic,string port)
        {
            m_ifHeat = ifHeat;
            _IsAllFinish = false;
            _TestTime = testTime;
            IsStatic = isStatic;
            suggestHeight=SuggestHeight;
            suggestHeatTemp = SuggestHeatTemp;
            washUpperLimit = WashUpperLimit;
            //可以异步调用界面的控件
            CheckForIllegalCrossThreadCalls = false;
            theMachine = GetMachineFromMe.GetMachine;
            SerialPortSetting.PortName = port;

            if (theMachine.StartConnection())
            {
                theMachine.AddClients(this);
                if (theMachine.StartReading())
                {
                    Init();
                }
            }
        }
        private double sum;
        private double MaxData;
        private double MinData;
        private double AverageData;
        private int count; //供测试用
        private int tempCompare = 0;//初始为0;1:大;2:小

        private void Init()
        {
            table1 = new DataTable();
            DataColumnCollection columns = table1.Columns;
            columns.Add("ColTestTime", typeof(System.DateTime));
            columns.Add("ColData", typeof(System.Double));
            sum = 0;
            MaxData = 0;
            MinData = 100;
            
            System.Threading.Thread.Sleep(3000);
            if (_IsStart)
            {
                //读取液位数据
                fluidHeight = GetFluidHeight();

                tempCompare = 0;
                //  液位判断:
                //《建议进水高度:v4开,p2开,其余关
                // 》建议进水高度:V5开,其余关
                //直至
                //=建议进水高度:下一步
                count = 16;
                JudgeHeight();

                //温度读取,加热判断:
                heatTemp = GetHeatTemp();
                //y:比较设定温度:》设定温度:V2,V3,P1开,其余关
                //                 《设定温度:V2,V3,P1开,TK开
                //                  直至
                //                 =设定温度:
                tempCompare = 0;
                if (m_ifHeat)
                {
                    count = 16;
                    JudgeHeatTemp();
                }
                    //n:》30:V2,v3,p1开,其余关
                    //   《=30:
                else
                {
                    count = 8;
                    JudgeAssignHeatTemp();
                }
                //过滤极限:
                //n:V2,v3,p1开,d读书,其余关
                //直至y:
                conductance = GetConductance();

                count = 8;
                JudgeWashUpperLimit();

                IsLast = true;
            }
        }

        private void GetData()
        {
            DataRow dr;
            dr = table1.NewRow();
            dr["ColTestTime"] = DateTime.Now;
            dr["ColData"] = ConductanceA;
            table1.Rows.Add(dr);
            sum = sum + ConductanceA;
            if (ConductanceA > MaxData)
            {
                MaxData = ConductanceA;
            }
            if (ConductanceA < MinData)
            {
                MinData = ConductanceA;
            }
            AverageData = sum / 30;
        }

        public bool IsStart
        {
            get
            {
                return _IsStart;
            }
        }
        public bool IsAllFinish
        {
            get
            {
                return _IsAllFinish;
            }
        }
        public bool IsFinish
        {
            get
            {
                return _IsFinish;
            }
        }
        public DataTable ReTable
        {
            get
            {
                return table1;
            }
        }
        public double ReAverageData
        {
            get
            {
                return AverageData;
            }
        }
        public double ReMaxData
        {
            get
            {
                return MaxData;
            }
        }
        public double ReMinData
        {
            get
            {
                return MinData;
            }
        }
        public void CloseRead()
        {
            theMachine.StopReading();
            theMachine.RemoveClients(this);
            theMachine.CloseConnection();
        }
        #region IReceiveData 成员

        private Byte[] _ReceiveValue;
        public void NewReceiveData(int receivedCount, Byte[] receiveValue)
        {
            _IsStart = true;
            if (receivedCount == 1)
            {
                timer1 = new System.Timers.Timer();
                timer1.Elapsed += new System.Timers.ElapsedEventHandler(theout);
                timer1.Interval = (int)_TestTime * 1000;
                timer1.Start();
            }
            _ReceiveValue = receiveValue;
            NewGetData();
        }

        private void NewGetData()
        {
            DataRow dr;
            dr = table1.NewRow();
            dr["ColTestTime"] = DateTime.Now;
            double tempData=ChangeData();
            dr["ColData"] = tempData;
            table1.Rows.Add(dr);
            sum = sum + tempData;
            if (tempData > MaxData)
            {
                MaxData = tempData;
            }
            if (tempData < MinData)
            {
                MinData = tempData;
            }
            AverageData = sum / 30;
        }
        private double ChangeData()
        {
            double returnValue = 0;
            string temp = Convert.ToChar(_ReceiveValue[0]).ToString();
            for (int i = 1; i < _ReceiveValue.Length;i++ )
            {
                if (Convert.ToChar(_ReceiveValue[i]).ToString() == "+")
                {
                    break;
                }
                temp = temp + Convert.ToChar(_ReceiveValue[i]);
            }
            double.TryParse(temp, returnValue);
            return returnValue;
        }
        private int ConductanceA;
        private int TemperatureB;
        private int PressureC;
        private int ProportionD;
        private bool IsLast=false;
        private bool _IsStart = false;
        private bool _IsFinish = false;
        private int LastStep = 0;
        public void ReceiveData(int receivedCount, BuffType receiveDtype, int _FirstBuff, int _SecondBuff)
        {
            _IsStart = true;
            switch (receiveDtype)
            {
                case BuffType.ConductanceA:
                    ConductanceA = CalculateFrequency(_FirstBuff, _SecondBuff);
                    if (IsFinish)
                    {
                        GetData();
                    }
                    _SuccessCount++;
                    break;
                case BuffType.TemperatureB:
                    TemperatureB = CalculateFrequency(_FirstBuff, _SecondBuff);
                    _SuccessCount++;
                    break;
                case BuffType.PressureC:
                    PressureC = CalculateFrequency(_FirstBuff, _SecondBuff);
                    _SuccessCount++;
                    break;
                case BuffType.ProportionD:
                    ProportionD = CalculateFrequency(_FirstBuff, _SecondBuff);
                    _SuccessCount++;
                    break;
                case BuffType.InvalidData:
                    _FailureCount++;
                    break;
            }
            //完成一个读数流程 且到最后一步还没有完成操作时
            if (_SuccessCount % 4 == 0 && IsLast && !_IsFinish)
            {
                if (LastStep == 0)
                {
                    CreateOperationQuery();
                    LastStep = LastStep + 1;
                }
                GetOperation(objQ.Pop().ToString());
                if (objQ.IsNull)
                {
                    _IsFinish = true;
                    timer1 = new System.Timers.Timer();
                    timer1.Elapsed += new System.Timers.ElapsedEventHandler(theout);
                    timer1.Interval = (int)_TestTime * 1000;
                    timer1.Start();
                }
            }
        }

        private int CalculateFrequency(int _FirstBuff, int _SecondBuff)
        {
            return _SecondBuff * 256 + _FirstBuff;
        }

        #endregion
        /// <summary>
        /// 通过外界读取液位数据
        /// </summary>
        /// <returns></returns>
        public double GetFluidHeight()
        {
            return (double)PressureC;
        }
        /// <summary>
        /// 加热温度
        /// </summary>
        /// <returns></returns>
        public double GetHeatTemp()
        {
            return (double)TemperatureB;
        }
        /// <summary>
        /// 电导
        /// </summary>
        /// <returns></returns>
        public double GetConductance()
        {
            return (double)ConductanceA;
        }

        /// <summary>
        /// 《建议进水高度:v4开,p2开,其余关
        /// </summary>
        public void CreatFluidGreaterSuggestQuery()
        {
            objQ = new Queue();
            objQ.Push(
                /// 打开V4阀
                    "theMachine.GetControllor.OpenP11()");
            objQ.Push(
                /// 打开P2泵
                    "theMachine.GetControllor.OpenP15()");
            objQ.Push(
                /// P10口置0,关闭V5阀
                    "theMachine.GetControllor.CloseP10()");
            objQ.Push(
                /// 关闭V3,2阀
                    "theMachine.GetControllor.CloseP12()");
            objQ.Push(
                /// 关闭V1阀
                    "theMachine.GetControllor.CloseP13()");
            objQ.Push(
                /// 关闭P1泵
                    "theMachine.GetControllor.CloseP14()");
            objQ.Push(
                /// 关闭P1.6口
                    "theMachine.GetControllor.CloseP16()");
            objQ.Push(
                /// 关闭P1.7口
                    "theMachine.GetControllor.CloseP17()");           
        }
        /// <summary>
        /// 》建议进水高度:V5开,其余关
        /// </summary>
        public void CreatFluidSmallerSuggestQuery()
        {
            objQ = new Queue();
            objQ.Push(
                    /// P10口置1,打开V5阀
                    "theMachine.GetControllor.OpenP10()");
            objQ.Push(
                    /// 关闭V4阀
                    "theMachine.GetControllor.CloseP11()");
            objQ.Push(
                    /// 关闭V3,2阀
                    "theMachine.GetControllor.CloseP12()");
            objQ.Push(
                    /// 关闭V1阀
                    "theMachine.GetControllor.CloseP13()");
            objQ.Push(
                    /// 关闭P1泵
                    "theMachine.GetControllor.CloseP14()");
            objQ.Push(
                    /// 关闭P2泵
                    "theMachine.GetControllor.CloseP15()");
            objQ.Push(
                    /// 关闭P1.6口
                    "theMachine.GetControllor.CloseP16()");
            objQ.Push(
                    /// 关闭P1.7口
                    "theMachine.GetControllor.CloseP17()");
        }
        /// <summary>
        /// 》设定温度:V2,V3,P1开,其余关  
        /// </summary>
        public void CreatHeatTempGreaterSuggestQuery()
        {
            objQ = new Queue();
            objQ.Push(
                    /// 打开V3,2阀
                    "theMachine.GetControllor.OpenP12()");
            objQ.Push(
                    /// 打开P1泵
                    "theMachine.GetControllor.OpenP14()");
            objQ.Push(
                    /// P10口置0,关闭V5阀
                    "theMachine.GetControllor.CloseP10()");
            objQ.Push(
                    /// 关闭V4阀
                    "theMachine.GetControllor.CloseP11()");
            objQ.Push(
                    /// 关闭V1阀
                    "theMachine.GetControllor.CloseP13()");
            objQ.Push(
                    /// 关闭P2泵
                    "theMachine.GetControllor.CloseP15()");
            objQ.Push(
                    /// 关闭P1.6口
                    "theMachine.GetControllor.CloseP16()");
            objQ.Push(
                    /// 关闭P1.7口
                    "theMachine.GetControllor.CloseP17()");
        }
        /// <summary>
        /// 《设定温度:V2,V3,P1开,TK开 
        /// </summary>
        public void CreatHeatTempSmallerSuggestQuery()
        {
            objQ = new Queue();
            objQ.Push(
                    /// 打开V3,2阀
                    "theMachine.GetControllor.OpenP12()");
            objQ.Push(
                    /// 打开P1泵
                    "theMachine.GetControllor.OpenP14()");
            objQ.Push(
                    /// P10口置0,关闭V5阀
                    "theMachine.GetControllor.CloseP10()");
            objQ.Push(
                    /// 关闭V4阀
                    "theMachine.GetControllor.CloseP11()");
            objQ.Push(
                    /// 关闭V1阀
                    "theMachine.GetControllor.CloseP13()");
            objQ.Push(
                    /// 关闭P2泵
                    "theMachine.GetControllor.CloseP15()");
            objQ.Push(
                    /// 关闭P1.6口
                    "theMachine.GetControllor.CloseP16()");
            objQ.Push(
                    /// 关闭P1.7口
                    "theMachine.GetControllor.CloseP17()");
        }
        /// <summary>
        /// V2,v3,p1开,d读书,其余关
        /// </summary>
        public void CreatWashUpperLimitGreaterConductanceQuery()
        {
            objQ = new Queue();
            objQ.Push(
                    /// 打开V3,2阀
                    "theMachine.GetControllor.OpenP12()");
            objQ.Push(
                    /// 打开P1泵
                    "theMachine.GetControllor.OpenP14()");
            objQ.Push(
                    /// P10口置0,关闭V5阀
                    "theMachine.GetControllor.CloseP10()");
            objQ.Push(
                    /// 关闭V4阀
                    "theMachine.GetControllor.CloseP11()");
            objQ.Push(
                    /// 关闭V1阀
                    "theMachine.GetControllor.CloseP13()");
            objQ.Push(
                    /// 关闭P2泵
                    "theMachine.GetControllor.CloseP15()");
            objQ.Push(
                    /// 关闭P1.6口
                    "theMachine.GetControllor.CloseP16()");
            objQ.Push(
                    /// 关闭P1.7口
                    "theMachine.GetControllor.CloseP17()");
        }
        /// <summary>
        /// 动态:v2,v3,p1开,d读数,其余关
        /// </summary>
        public double DynamicOperation()
        {
            IsLast = true;
            /// 打开V3,2阀
            theMachine.GetControllor.OpenP12();
            /// 打开P1泵
            theMachine.GetControllor.OpenP14();
            /// P10口置0,关闭V5阀
            theMachine.GetControllor.CloseP10();
            /// 关闭V4阀
            theMachine.GetControllor.CloseP11();
            /// 关闭V1阀
            theMachine.GetControllor.CloseP13();
            /// 关闭P2泵
            theMachine.GetControllor.CloseP15();
            /// 关闭P1.6口
            theMachine.GetControllor.CloseP16();
            /// 关闭P1.7口
            theMachine.GetControllor.CloseP17();
            return (double)ConductanceA;
            //动态:v2,v3,p1开,d读数,其余关
        }
        /// <summary>
        /// 静态:P1,V1开,d读数,其余关
        /// </summary>
        public double StaticOperation()
        {
            IsLast = true;
            /// 打开V1阀
            theMachine.GetControllor.OpenP13();
            /// 打开P1泵
            theMachine.GetControllor.OpenP14();

            /// P10口置0,关闭V5阀
            theMachine.GetControllor.CloseP10();
            /// 关闭V4阀
            theMachine.GetControllor.CloseP11();
            /// 关闭V3,2阀
            theMachine.GetControllor.CloseP12();
            /// 关闭P2泵
            theMachine.GetControllor.CloseP15();
            /// 关闭P1.6口
            theMachine.GetControllor.CloseP16();
            /// 关闭P1.7口
            theMachine.GetControllor.CloseP17();

            return (double)ConductanceA;

            //静态:P1,V1开,d读数,其余关
        }

        public void CreateOperationQuery()
        {
            objQ = new Queue();
            if (IsStatic)
            {
                objQ.Push(/// 打开V1阀
                    "theMachine.GetControllor.OpenP13()");
            }
            else
            {
                objQ.Push(/// 打开V3,2阀
                    "theMachine.GetControllor.OpenP12()");
            }
            objQ.Push(/// 打开P1泵
                    "theMachine.GetControllor.OpenP14()");
            objQ.Push(/// P10口置0,关闭V5阀
                    "theMachine.GetControllor.CloseP10()");
            objQ.Push(/// 关闭V4阀
                    "theMachine.GetControllor.CloseP11()");
            if (IsStatic)
            {
                objQ.Push(/// 关闭V3,2阀
                    "theMachine.GetControllor.CloseP12()");
            }
            else
            {
                objQ.Push(/// 关闭V1阀
                    "theMachine.GetControllor.CloseP13()");
            }
            objQ.Push(                    /// 关闭P2泵
                    "theMachine.GetControllor.CloseP15()");
            objQ.Push(
                /// 关闭P1.6口
                    "theMachine.GetControllor.CloseP16()");
            objQ.Push(
                /// 关闭P1.7口
                    "theMachine.GetControllor.CloseP17()");
        }

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.SuspendLayout();
            // 
            // Interactive
            // 
            this.Name = "Interactive";
            this.ResumeLayout(false);

        }

        public void theout(object source, System.Timers.ElapsedEventArgs e)
        {
            CloseRead();
            timer1.Stop();
            _IsAllFinish = true;
        }

        private void GetOperation(string type)
        {
            System.Threading.Thread.Sleep(2900);
            switch (type)
            {
                case "theMachine.GetControllor.OpenP10()":
                    theMachine.GetControllor.OpenP10();
                    break;
                case "theMachine.GetControllor.CloseP10()":
                    theMachine.GetControllor.CloseP10();
                    break;
                case "theMachine.GetControllor.OpenP11()":
                    theMachine.GetControllor.OpenP11();
                    break;
                case "theMachine.GetControllor.CloseP11()":
                    theMachine.GetControllor.CloseP11();
                    break;
                case "theMachine.GetControllor.OpenP12()":
                    theMachine.GetControllor.OpenP12();
                    break;
                case "theMachine.GetControllor.CloseP12()":
                    theMachine.GetControllor.CloseP12();
                    break;
                case "theMachine.GetControllor.OpenP13()":
                    theMachine.GetControllor.OpenP13();
                    break;
                case "theMachine.GetControllor.CloseP13()":
                    theMachine.GetControllor.CloseP13();
                    break;
                case "theMachine.GetControllor.OpenP14()":
                    theMachine.GetControllor.OpenP14();
                    break;
                case "theMachine.GetControllor.CloseP14()":
                    theMachine.GetControllor.CloseP14();
                    break;
                case "theMachine.GetControllor.OpenP15()":
                    theMachine.GetControllor.OpenP15();
                    break;
                case "theMachine.GetControllor.CloseP15()":
                    theMachine.GetControllor.CloseP15();
                    break;
                case "theMachine.GetControllor.OpenP16()":
                    theMachine.GetControllor.OpenP16();
                    break;
                case "theMachine.GetControllor.CloseP16()":
                    theMachine.GetControllor.CloseP16();
                    break;
                case "theMachine.GetControllor.OpenP17()":
                    theMachine.GetControllor.OpenP17();
                    break;
                case "theMachine.GetControllor.CloseP17()":
                    theMachine.GetControllor.CloseP17();
                    break;
                default:
                    break;
            }
        }

        #region judge

        /// <summary>
        /// 液位判断:《建议进水高度:v4开,p2开,其余关// 》建议进水高度:V5开,其余关 //直至=建议进水高度:下一步
        /// </summary>
        private void JudgeHeight()
        {
            #region 供测试使用
            if (count == 16)
            {
                CreatFluidGreaterSuggestQuery();
            }
            if (count > 8)
            {
                GetOperation(objQ.Pop().ToString());
                count = count - 1;
                JudgeHeight();
            }
            if (count == 8)
            {
                CreatFluidSmallerSuggestQuery();
            }
            if (count > 0 && count <= 8)
            {
                GetOperation(objQ.Pop().ToString());
                count = count - 1;
                JudgeHeight();
            }
            if (count == 0)
            {
                return;
            }
            #endregion
            //if (fluidHeight > suggestHeight)
            //{
            //    if (tempCompare != 1)//如果是第一比较或是上一次是小于
            //    {
            //        CreatFluidGreaterSuggestQuery();
            //    }
            //    GetOperation(objQ.Pop().ToString());
            //    fluidHeight = GetFluidHeight();
            //    tempCompare = 1;
            //    JudgeHeight();
            //}
            //if (fluidHeight < suggestHeight)
            //{
            //    if (tempCompare != 2)//如果是第一比较或是上一次是大于
            //    {
            //        CreatFluidSmallerSuggestQuery();
            //    }
            //    //GetOperation(objQ.Pop().ToString());
            //    fluidHeight = GetFluidHeight();
            //    tempCompare = 2;
            //    JudgeHeight();
            //}
            //if (fluidHeight == suggestHeight)
            //{
            //    return;
            //}
        }
        /// <summary>
        /// 比较设定温度:》设定温度:V2,V3,P1开,其余关  《设定温度:V2,V3,P1开,TK开     直至=设定温度:下一步
        /// </summary>
        private void JudgeHeatTemp()
        {
            #region 供测试使用
            if (count == 16)
            {
                CreatHeatTempGreaterSuggestQuery();
            }
            if (count > 8)
            {
                GetOperation(objQ.Pop().ToString());
                count = count - 1;
                JudgeHeatTemp();
            }
            if (count == 8)
            {
                CreatHeatTempSmallerSuggestQuery();
            }
            if (count > 0 && count <= 8)
            {
                GetOperation(objQ.Pop().ToString());
                count = count - 1;
                JudgeHeatTemp();
            }
            if (count == 0)
            {
                return;
            }
            #endregion
            //if (heatTemp > suggestHeatTemp)
            //{
            //    if (tempCompare != 1)//如果是第一比较或是上一次是小于
            //    {
            //        CreatHeatTempGreaterSuggestQuery();
            //    }
            //    GetOperation(objQ.Pop().ToString());
            //    heatTemp = GetHeatTemp();
            //    tempCompare = 1;
            //    JudgeHeatTemp();
            //}
            //if (heatTemp < suggestHeatTemp)
            //{
            //    if (tempCompare != 2)//如果是第一比较或是上一次是大于
            //    {
            //        CreatHeatTempSmallerSuggestQuery();
            //    }
            //    GetOperation(objQ.Pop().ToString());
            //    heatTemp = GetHeatTemp();
            //    tempCompare = 2;
            //    JudgeHeatTemp();
            //}
            //if (heatTemp == suggestHeatTemp)
            //{
            //    return;
            //}
        }
        /// <summary>
        /// 》30:V2,v3,p1开,其余关   《=30::下一步
        /// </summary>
        private void JudgeAssignHeatTemp()
        {
            #region 供测试使用
            if (count == 8)
            {
                CreatHeatTempGreaterSuggestQuery();
            }
            if (count > 0 && count <= 8)
            {
                GetOperation(objQ.Pop().ToString());
                count = count - 1;
                JudgeAssignHeatTemp();
            }
            if (count == 0)
            {
                return;
            }
            #endregion

            //if (heatTemp > 30)
            //{
            //    if (tempCompare != 1)//如果是第一比较
            //    {
            //        CreatHeatTempGreaterSuggestQuery();
            //    }
            //    GetOperation(objQ.Pop().ToString());
            //    tempCompare = 1;
            //    heatTemp = GetHeatTemp();
            //    JudgeAssignHeatTemp();
            //}
            //else
            //{
            //    return;
            //}
        }
        /// <summary>
        /// 过滤极限:
        /// n:V2,v3,p1开,d读书,其余关
        /// 直至y:
        /// </summary>
        private void JudgeWashUpperLimit()
        {
            #region 供测试使用
            if (count == 8)
            {
                CreatWashUpperLimitGreaterConductanceQuery();
            }
            if (count > 0 && count <= 8)
            {
                GetOperation(objQ.Pop().ToString());
                count = count - 1;
                JudgeWashUpperLimit();
            }
            if (count == 0)
            {
                return;
            }
            #endregion

            //if (conductance < washUpperLimit)
            //{
            //    if (tempCompare != 1)//如果是第一比较
            //    {
            //        CreatWashUpperLimitGreaterConductanceQuery();
            //    }
            //    GetOperation(objQ.Pop().ToString());
            //    tempCompare = 1; 
            //    conductance = GetConductance();
            //    JudgeWashUpperLimit();
            //}
            //else
            //{
            //    return;
            //}
        }

        #endregion
    }
}