void buildMark() { M = Matrix <double> .Build.Dense(petriNet.Places, 1); Buffers.ForEach(b => b.clearConnected()); //machines and buffers for (int m = 0; m < Machines; m++) { M[firstMachineAddress + m, 0] = 1; M[firstMachineAddress + Machines + m, 0] = Buffers.First(i => i.Number == m + 1).Capacity; Buffers.First(b => b.Number == m + 1).Address = firstMachineAddress + Machines + m; } //inputs int place = 0; foreach (var process in Processes) { var output = getCorrespondingOutput(process.Number); M[place, 0] = Inputs.First(i => i.Number == process.Number).Value; Inputs.First(i => i.Number == process.Number).Address = place; Inputs.First(i => i.Number == process.Number).CorrespondingOutput = output; place += process.Operations.Count * 3 + 2; foreach (var o in process.Operations) { Buffers.First(i => i.Number == o.MachineNumber).Connect(process, o.Number); } } }
private void Init(List <sortAlgorithm> sort) { Buffers.ForEach(b => b.clerarActive()); buildPetriNet(); buildMark(); timer = new TimerController(Machines); transitionController = new TransistionController(petriNet, Buffers, Processes, Machines, firstMachineAddress, sort); t = 0; PreparedTransitions = transitionController.getPreparedTransitions(t, timer, M); stopped = false; machinesPercentage = printMachinesPercentage(); }