public static void GenerateProcesses(ScheduleClass Temp)
        {
            int i;
            Process CPU;
            Process Eql;
            Process IO;
            Random rand = new Random();
            for (i = 0; i <= 15; i++)
            {
                CPU = new Process();
                Eql = new Process();
                IO = new Process();

                CPU.Name = "CPU" + i.ToString();
                Eql.Name = "Equal" + i.ToString();
                IO.Name = "IO" + i.ToString();

                CPU.CurrentPriority = CPU.StartingPriority = i;
                Eql.CurrentPriority = Eql.StartingPriority = i;
                IO.CurrentPriority = IO.StartingPriority = i;

                CPU.TimeNeededInCPU = rand.Next(5, 8);
                CPU.TimeNeededInIO = rand.Next(3,4);

                Eql.TimeNeededInCPU = rand.Next(3,5);
                Eql.TimeNeededInIO = rand.Next(3,5);

                IO.TimeNeededInCPU = rand.Next(3,4);
                IO.TimeNeededInIO = rand.Next(5,8);

                CPU.TotalCyclesNeeded = rand.Next(4,6);
                IO.TotalCyclesNeeded = rand.Next(4, 6);
                Eql.TotalCyclesNeeded = rand.Next(4,6);

                Temp.InsertProcesses(CPU, Eql, IO);
            }

            Temp.SortLists();
        }
Example #2
0
        private Dictionary <uint, List <string> > GenerateControlledObjectForEachController(ScheduleClass sch)
        {
            var controlledObjectsForEachController = new Dictionary <uint, List <string> >();

            foreach (var controlledObject in sch.ControlledObjects)
            {
                var  tmp = controlledObject.Split('.')[0];
                uint controller;
                if (uint.TryParse(tmp, out controller))
                {
                    var obj = controlledObject.Split('.')[1];
                    if (controlledObjectsForEachController.ContainsKey(controller))
                    {
                        controlledObjectsForEachController[controller].Add(obj);
                    }
                    else
                    {
                        controlledObjectsForEachController.Add(controller, new List <string> {
                            obj
                        });
                    }
                }
            }
            return(controlledObjectsForEachController);
        }
Example #3
0
 private void cbx_ScheduleTime_SelectedIndexChanged(object sender, EventArgs e)
 {
     SelectedScheduleClass = ScheduleQuery.GetScheduleClass(cbx_ScheduleTime.Text);
     UpdateSchedules(1);
 }