Пример #1
0
 /// <summary>
 /// 显示输出CF点的列表窗体
 /// </summary>
 private void ShowOutPutValue(CFDisplay cfs)
 {
     this.Dispatcher.Invoke((Action)(() =>
     {
         OutPutView view = new OutPutView(cfs);
         view.Owner = this;
         view.Show();
     }));
 }
Пример #2
0
        /// <summary>
        /// 找出所有的可测支路及其测试方案
        /// </summary>
        public void generate()
        {
            Simulation sim   = Simulation.getInstance();
            CFDisplay  cfSrc = new CFDisplay();

            sim.srcType = SourceType.Source2;
            sim.OutPuts = cfSrc;
            List <LogicCircuit> cannotTest = new List <LogicCircuit>();

            foreach (LogicCircuit cirt in testBranch)
            {
                List <List <List <string> > > conditions = new List <List <List <string> > >();
                foreach (string coilName in cirt.OpenContacts)
                {
                    if (powCoils.ContainsKey(coilName))
                    {
                        conditions.Add(powCoils[coilName]);
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("缺少线圈信息。");
                    }
                }
                List <List <string> > cbs = new List <List <string> >();
                combine(conditions, 0, new List <string>(), cbs);
                bool success = false;
                foreach (List <string> pows in cbs)
                {
                    if (validate(sim, pows, cirt))
                    {
                        success = true;
                        break;
                    }
                }
                if (!success)
                {
                    cannotTest.Add(cirt);
                }
            }
            List <LogicCircuit> all = new List <LogicCircuit>(testBranch);

            all.RemoveAll(p => cannotTest.Contains(p));
            canTestBranch = all;
        }
Пример #3
0
 /// <summary>
 /// 按下启动或中止按钮所执行的操作
 /// </summary>
 /// <param name="obj"></param>
 private void SwitchState(string state)
 {
     if (manager.CurrentMode == Mode.Default)
     {
         manager.CurrentMode = modes[state];
         Messenger.Default.Send <IList <string> >(openPages, "SaveOpenPages");
         Itemvm graph = Itemvm.findItem(items, typeof(GraphGenerator));
         Task   task1 = new Task(() => { graph.Itemvms[0].DoubleClick(new Action <string>(appendLog)); Thread.Sleep(200); });
         Task   task  = task1;
         task1 = task1.ContinueWith(t => { graph.Itemvms[1].DoubleClick(new Action <string>(appendLog)); Thread.Sleep(200); });
         task1 = task1.ContinueWith(t => { graph.Itemvms[2].DoubleClick(new Action <string>(appendLog)); Thread.Sleep(200); });
         task1 = task1.ContinueWith(t => { graph.Itemvms[3].DoubleClick(new Action <string>(appendLog)); Thread.Sleep(200); });
         task1 = task1.ContinueWith(t =>
         {
             Messenger.Default.Send <Object>(null, "GraphCanNotClose");
             try
             {
                 CFDisplay output = manager.prepared();//初始化仿真器的输出源
                 Messenger.Default.Send <CFDisplay>(output, "ShowOutPutValue");
                 appendLog("CF接口输出源绑定成功。\r\n");
             }
             catch (Exception e)
             {
                 appendLog("CF接口输出源绑定失败。\r\n");
                 Console.WriteLine(e);
             }
         });
         task.Start();
     }
     else
     {
         Messenger.Default.Send <object>(openPages, "ExitWorkMode");
         manager.exit();
         manager.CurrentMode = Mode.Default;
     }
     appendLog("进入" + manager.CurrentMode + "模式.\r\n");
 }
Пример #4
0
        public CFDisplay prepared()
        {
            CFDisplay  cfSrc = null;
            Simulation sim   = Simulation.getInstance();

            sim.resetSimulation();
            switch (CurrentMode)
            {
            case Mode.Simulink:
            {
                cfSrc       = new CFDisplay();
                sim.OutPuts = cfSrc;
                sim.srcType = Result.SourceType.Source2;
                Simulation simcp = Simulation.getAnotherSimulation();
                simcp.OutPuts = cfSrc;
                simcp.srcType = Result.SourceType.Source1;
                break;
            }

            case Mode.AutoTest:
            {
                SequenceGenerator squence = new SequenceGenerator();
                squence.generate();
                squence.compressTestBranch();
                ResultTest test = new ResultTest(squence);
                test.testBranchPercent();
                break;
            }

            case Mode.ManualTest:
            {
                break;
            }
            }
            return(cfSrc);
        }
Пример #5
0
 public OutPutView(CFDisplay cfData)
 {
     InitializeComponent();
     this.DataContext = cfData;
     Messenger.Default.Register <object>(this, "ExitWorkMode", close);
 }