public MainWindow()
        {
            InitializeComponent();

            Interval = simulator.controller.Interval;
            Min = simulator.controller.Min;

            foreach (Rule rule in simulator.controller.rules)
                AddRule(rule);

            simulator = null;
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();

            Interval = simulator.controller.Interval;
            Min      = simulator.controller.Min;

            foreach (Rule rule in simulator.controller.rules)
            {
                AddRule(rule);
            }

            simulator = null;
        }
Beispiel #3
0
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                simulator = new BoilerSimulator(SetPoint, InitialPressure, Samples, Method);
                simulator.controller.rules.Clear();

                for (int i = 0; i < RulesListBox.Items.Count; i++)
                {
                    CheckBox checkbox = (CheckBox)RulesListBox.Items[i];

                    if (checkbox.IsChecked.Value)
                    {
                        simulator.controller.rules.Add((Rule)checkbox.Tag);
                    }
                }

                List <int>   indices = new List <int>();
                List <Point> Values  = new List <Point>();
                MainPECPEGraph.ClearLines();
                for (int i = 0; i < Iterations; i++)
                {
                    simulator.Next();
                    indices.Add(i);
                    Values.Add(new Point(i, simulator.Pressure));
                    MainPECPEGraph.DrawLine(simulator.controller.OutputRuleList.Last());
                }

                OutputGraphLineSeries.ItemsSource = Values;
                IterationComboBox.ItemsSource     = indices;
                //generate a history based on the points
                HistoryOutputRulesListBox.ItemsSource = GenerateHistory(simulator.controller.OutputRuleList);

                StartButton.Content = "Re-run Simulation";
            } catch (FormatException exception)
            {
                MessageBox.Show("The values you have given are invalid. Please recheck them\n");
                Console.Out.WriteLine(exception);
            }
        }
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                simulator = new BoilerSimulator(SetPoint, InitialPressure, Samples, Method);
                simulator.controller.rules.Clear();

                for (int i = 0; i < RulesListBox.Items.Count; i++)
                {
                    CheckBox checkbox = (CheckBox)RulesListBox.Items[i];

                    if (checkbox.IsChecked.Value)
                        simulator.controller.rules.Add((Rule)checkbox.Tag);
                }

                List<int> indices = new List<int>();
                List<Point> Values = new List<Point>();
                MainPECPEGraph.ClearLines();
                for (int i = 0; i < Iterations; i++)
                {
                    simulator.Next();
                    indices.Add(i);
                    Values.Add(new Point(i, simulator.Pressure));
                    MainPECPEGraph.DrawLine(simulator.controller.OutputRuleList.Last());
                }

                OutputGraphLineSeries.ItemsSource = Values;
                IterationComboBox.ItemsSource = indices;
                //generate a history based on the points
                HistoryOutputRulesListBox.ItemsSource = GenerateHistory(simulator.controller.OutputRuleList);

                StartButton.Content = "Re-run Simulation";
            } catch( FormatException exception )
            {
                MessageBox.Show("The values you have given are invalid. Please recheck them\n");
                Console.Out.WriteLine(exception);
            }
        }