public static void RemoveMachineOut(DataGrid TableGridWPF, List <Machine> machines) { MachineTable provider = (MachineTable)TableGridWPF.SelectedItem; Machine newP = machines.Find(p => p.id.ToString().CompareTo(provider.ID) == 0); RemoveMachine(newP); }
public void AddMachine(Machine machine) { lock (_lock) { MachineTable.AddMachine(machine.MachineId, machine); } }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public void SetLayout() { titleView.Frame = new CoreGraphics.CGRect(0, 0, UIScreen.MainScreen.Bounds.Width - 100, 30); pingImageView.Frame = new CoreGraphics.CGRect(-6, 0, 5, 5); machinesTitleLabel.Frame = new CoreGraphics.CGRect(5, 0, UIScreen.MainScreen.Bounds.Width - 105, 30); MachineTable.ReloadData(); }
public AccountingModule(MachineTable machineTable, UtilizationTable utilizationTable, RunConfiguration configuration) { ClearInformation(); _machineTable = machineTable; this._utilizationTable = utilizationTable; MeasureHolder = new MeasureValueHolder(configuration); }
private void WrapperWPF_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (WrapperWPF.SelectedItem != null) { MachineTable cbi = (MachineTable)WrapperWPF.SelectedItem; TransferInfo.wrapperId = cbi.ID; Save(); } }
private void ConveyorWPF_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ConveyorWPF.SelectedItem != null) { MachineTable cbi = (MachineTable)ConveyorWPF.SelectedItem; TransferInfo.conveyorId = cbi.ID; Save(); } }
public void EndSimulation() { lock (_lock) { foreach (var machine in MachineTable.GetAllMachines()) { machine.StopMachine(); } //MachineTable.GetMachineById(0).StopMachine(); Started = false; } }
public void PowerOnHost() { lock (_lock) { if (ReadyMachineTable.GetHostsCount() != 0) { Machine machine = ReadyMachineTable.GetAllMachines().First(); ReadyMachineTable.RemoveMachine(machine.MachineId); MachineTable.AddMachine(machine.MachineId, machine); DataHolder.SetUtilization(machine.MachineId, UtilizationStates.UnderUtilization); machine.StartMachine(); } } }
public void StartSimulation() { lock (_lock) { //NetworkSwitch.Started = true; foreach (var machine in MachineTable.GetAllMachines().Skip(1).Where(x => x.MachineId < int.MaxValue)) { DataHolder.SetUtilization(machine.MachineId, UtilizationStates.Normal); machine.StartMachine(); } MachineTable.GetMachineById(0).StartMachine(); if (ContainerTypes == ContainersType.D) { MachineTable.GetMachineById(int.MaxValue).StartMachine(); } } }
void ReleaseDesignerOutlets() { if (MachinesTitle != null) { MachinesTitle.Dispose(); MachinesTitle = null; } if (MachineTable != null) { MachineTable.Dispose(); MachineTable = null; } if (SettingsButton != null) { SettingsButton.Dispose(); SettingsButton = null; } }
public SimulationController(RunConfiguration configuration) { CurrentConfiguration = configuration; MachineTableObject = new MachineTable(); UtilizationTable = new UtilizationTable(); AccountingModuleObject = new AccountingModule(MachineTableObject, UtilizationTable, CurrentConfiguration); _networkSwitchObject = new NetworkSwitch(MachineTableObject, AccountingModuleObject, configuration.NetworkDealy); MachineControllerObject = new MachineController(UtilizationTable, MachineTableObject, CurrentConfiguration.ContainersType); _masterFactory = new MasterFactory(_networkSwitchObject, MachineControllerObject, UtilizationTable, CurrentConfiguration.Strategy, CurrentConfiguration.PushAuctionType, CurrentConfiguration.PullAuctionType, CurrentConfiguration.SchedulingAlgorithm, CurrentConfiguration.TestedHosts); var h = new Load(Global.DataCenterHostConfiguration); _hostFactory = new HostFactory(h, _networkSwitchObject, CurrentConfiguration.LoadPrediction, CurrentConfiguration.Strategy, CurrentConfiguration.ContainersType, configuration.SimulationSize); _registryFactory = new RegistryFactory(_networkSwitchObject, configuration.SimulationSize); _containerFactory = new ContainerFactory(CurrentConfiguration.ContainersType, configuration.SimulationSize, configuration.LoadPrediction); }
//public int GetMachinesCount() //{ // lock (_lock) // { // return MachineTable.GetMachinesCount(); // } //} public void PowerOffHost(int machineId) { lock (_lock) { var machine = MachineTable.GetMachineById(machineId); if ((machine as HostMachine).GetContainersCount() != 0) { //return false; throw new NotImplementedException(); } else { machine.StopMachine(); //PoweredOffMachinesTable.AddMachine(machine.MachineId, machine); MachineTable.RemoveMachine(machineId); DataHolder.RemoveUtilization(machineId); ReadyMachineTable.AddMachine(machineId, machine); //Console.WriteLine($"( ) Power off Host #{machineId}"); //return true; } } }
public MachineController(UtilizationTable holder, MachineTable machineTable, ContainersType containerTypes) { MachineTable = machineTable; ReadyMachineTable = new MachineTable(); PoweredOffMachinesTable = new MachineTable(); ContainerTypes = containerTypes; DataHolder = holder; Task t = new Task(async() => { while (Started) { var currentTotal = MachineTable.GetHostsCount(); var mcount = Convert.ToInt32(currentTotal * 0.05); var rcount = ReadyMachineTable.GetHostsCount(); if (!StartingMachine) { if (mcount > rcount && PoweredOffMachinesTable.GetHostsCount() > 0) { await WakeIdleHost(); } else if (mcount < rcount) { await PowerOffExtraMachines(); } } //else //{ //} await Task.Delay(Global.Second); } }); t.Start(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------- public void UpdateViewValues() { MachineTable.ReloadData(); UIApplication.SharedApplication.ApplicationIconBadgeNumber = DataManager.problemsCount; }