/// <summary>Gets the next job to run</summary> public Simulation NextSimulationToRun(bool doFullFactorial = true) { if (Parent is ISimulationGenerator || hasRun) { return(null); } hasRun = true; Simulation simulationToRun; if (this.Parent == null) { simulationToRun = this; } else { Simulations simulationEngine = Apsim.Parent(this, typeof(Simulations)) as Simulations; simulationToRun = Apsim.Clone(this) as Simulation; // We are breaking.NET naming rules with our manager scripts.All our manager scripts are class // Script in the Models namespace.This is OK until we do a clone(binary serialise/deserialise). // When this happens, the serialisation engine seems to choose the first assembly it can find // that has the 'right' code.It seems that if the script c# is close to an existing assembly then // it chooses that assembly. In the attached .apsimx, it chooses the wrong temporary assembly for // SowingRule2. It chooses SowingRule assembly even though the script for the 2 manager files is // different. I'm not sure how to fix this yet. A brute force way is to recompile all manager // scripts after cloning. // https://github.com/APSIMInitiative/ApsimX/issues/2603 simulationEngine.MakeSubsAndLoad(simulationToRun); } return(simulationToRun); }