예제 #1
0
        public MainWindowViewModel()
        {
            // Отображение графика
            systemGraph = new SystemGraph();
            heatGraph   = new HeatGraph();


            // ПИД регулятор
            PidRegulator.PidParameters pidSettings;
            pidSettings.Kr   = 1.0f;
            pidSettings.Kp   = 0.005f;
            pidSettings.Ki   = 1.5f;
            pidSettings.Kd   = 0.0f; // Эти две...
            pidSettings.Km   = 1.0f; // ...лучше не трогать
            pidSettings.Umax = 500;  // Максимальный выход ПИД
            pidSettings.Umin = 1;    // Минимальный выход ПИД
            pidRegulator     = new PidRegulator(pidSettings);



            // Тепловая система
            thermalSystem = new ThermalSystem()
            {
                TargetTemperature = 200, // Температура к которой мы стремимся
            };
            thermalSystem.control += new ThermalSystem.ThermalSystemControlHandler(ThermalSystemСontrol);

            // Тик тепловой системы
            thermalSystemTimer          = new DispatcherTimer();
            thermalSystemTimer.Interval = TimeSpan.FromMilliseconds(20);
            thermalSystemTimer.Tick    += delegate(object sender, EventArgs e){
                thermalSystem.Integrate();
            };
            thermalSystemTimer.Start();
        }
예제 #2
0
        public MainWindowViewModel()
        {
            Graph = new TaskGraph(true);
            Graph2 = new SystemGraph(true);

            //Add Layout Algorithm Types
            layoutAlgorithmTypes.Add("BoundedFR");
            layoutAlgorithmTypes.Add("Circular");
            layoutAlgorithmTypes.Add("CompoundFDP");
            layoutAlgorithmTypes.Add("EfficientSugiyama");
            layoutAlgorithmTypes.Add("FR");
            layoutAlgorithmTypes.Add("ISOM");
            layoutAlgorithmTypes.Add("KK");
            layoutAlgorithmTypes.Add("LinLog");
            layoutAlgorithmTypes.Add("Tree");

            //Pick a default Layout Algorithm Type
            LayoutAlgorithmType = "Tree";
        }
예제 #3
0
 public bool CheckSystemGraph(SystemGraph graph)
 {
     List<SystemVertex> list = new List<SystemVertex>();
     list.Add(graph.Vertices.First());
     int i = 0;
     while (i < list.Count)
     {
         foreach (var vertex in graph.Vertices)
         {
             if (!list.Contains(vertex) && (graph.ContainsEdge(list[i], vertex) || graph.ContainsEdge(vertex, list[i])))
             {
                 list.Add(vertex);
             }
         }
         i++;
     }
     if (i != graph.Vertices.Count())
     {
         return false;
     }
     return true;
 }
예제 #4
0
        private void LoadGraph_OnClick2(object sender, RoutedEventArgs e)
        {
            FileDialog dialog = new OpenFileDialog();
            dialog.DefaultExt = ".xml";
            dialog.Filter = "XML Documents (.xml)|*.xml";
            bool? result = dialog.ShowDialog();
            if (result != true)
            {
                return;
            }
            string path = dialog.FileName;
            SystemGraph graph = new SystemGraph(true);
            XmlDocument document = new XmlDocument();
            document.LoadXml(File.ReadAllText(path));
            XmlNodeList vertices = document.GetElementsByTagName("vertice");
            XmlNodeList edges = document.GetElementsByTagName("edge");
            foreach (XmlNode node in vertices)
            {
                SystemVertex vertex = new SystemVertex(node.Attributes[0].Value, node.Attributes[1].Value);
                graph.AddVertex(vertex);
            }

            foreach (XmlNode node in edges)
            {
                var source = graph.Vertices.First(x => x.ID == node.Attributes[1].Value);
                var target = graph.Vertices.First(x => x.ID == node.Attributes[2].Value);
                SystemEdge edge = new SystemEdge(node.Attributes[0].Value, source, target);
                SystemEdge outEdge;
                graph.TryGetEdge(source, target, out outEdge);
                if (outEdge == null)
                {
                    graph.AddEdge(edge);
                    edge = new SystemEdge(node.Attributes[0].Value, target, source);
                    graph.AddEdge(edge);
                }

            }

            vm.Graph2 = graph;
        }
예제 #5
0
 public void ReLayoutGraph2()
 {
     graph2 = new SystemGraph(true);
     NotifyPropertyChanged("Graph2");
 }