private void InternalStart() { // Get a base scripting host with built in libraries ScriptingHost = BaseLibraries.MakeBaseScriptingHost(Args.StartingSeed); // Expose Simulation functions ScriptingHost.DefineCustomFunction(nameof(Clock), GetClock); ScriptingHost.DefineCustomFunction(nameof(EventCount), GetCurrentEventCount); // Initialize state variables foreach (StateVariable stateVariable in Graph.StateVariables) { ScriptingHost.Create(stateVariable); } // Initialize clock Clock = Schedule.MinTime; // Initialize event count EventCount = new int[Graph.Verticies.Count]; CurrentVertex = null; CurrentEdge = null; // Insert starting event Schedule.Insert(Graph.StartingVertex, Schedule.DefaultDelay, Schedule.DefaultPriority, EvaluateParameters(Args.StartParameterExpressions)); }
public static ScriptingHost MakeValidationScriptingHost() { ScriptingHost scriptingHost = BaseLibraries.MakeBaseScriptingHost(); scriptingHost.DefineCustomFunction(nameof(Simulation.Clock), (args) => new VariableValue(0.0)); scriptingHost.DefineCustomFunction(nameof(Simulation.EventCount), (args) => new VariableValue(0)); return(scriptingHost); }