// Start is called before the first frame update void Start() { n = Model.GetInstance().GetNumCells(0); iterations = BacteriaFactory.GetIterations(); CellDoneHandler.Setup(n); StartCoroutine(Load()); ExportHandler.init(); }
private static String CreateDirPath() { BacteriaFactory b = BacteriaFactory.GetInstance(); Model m = Model.GetInstance(); String enviroMode = m.environment.IsDynamic() ? "Dynamic": "Static"; String death = b.GetLifeRegulator() is LifeRegulator ? "Death" : "Immortal"; return(Application.dataPath + "/Exports/" + b.GetRegulatorType().ToString() + "_" + death + "_" + m.GetNumCells(0) + "_" + enviroMode + "_" + BacteriaFactory.GetIterations() + "_" + timeStamp + "/"); }
public void OnEndSimClick() //called when the user clicks the end sim button to open the stat page { endSimButton.gameObject.SetActive(false); endSimScreen.gameObject.SetActive(true); prevTimeScaleFactor = model.GetTimeScaleFactor(); model.SetTimeScaleFactor(0); //Update the texts for the end screen numOfCells.text = "Number of Bacteria: " + model.GetCells().Count; numOfIterations.text = "Number of Iterations: " + BacteriaFactory.GetIterations(); timeElapsed.text = "Time elapsed: " + FormatTimeString(); }
//Calculates the average ligand consentration for each time step private float[] CalculateAverageLigandC() { if (allCells.Count == 0) { return(null); } float[] averageLigandC = new float[BacteriaFactory.GetIterations()]; for (int i = 0; i < averageLigandC.Length; i++) //for each iteration { float averageC = 0; for (int j = 0; j < cells[i + 1].Count; j++) //for the cells present in that iteration { averageC += (float)((ForwardInternals)cells[i + 1][j].GetInternals()).GetInternalStates()[i + 1].l; } averageLigandC[i] = (cells[i + 1].Count != 0 ? averageC / cells[i + 1].Count : 0); } return(averageLigandC); }
public void Run() { Model model = Model.GetInstance(); for (int k = 0; k < runs; k++) //simulates m different runs only showing the last one but exporting the data for the rest { if (k != 0) { //reset data if not the first run (since that is already setup elsewhere in the code) model.SetupCells(n, iterations); model.CreateCells(n); } for (simulatedStep = 1; simulatedStep <= iterations; simulatedStep++) //Simulate the cells one timestep at a time { model.SimulateTimeStep(simulatedStep); } model.ExportData(n, BacteriaFactory.GetIterations()); } model.GetAverageLigandC(); }