Example #1
0
        public SimulationRunResults RunSimulation(IModelCoreSimulation simulation, SimulationRunOptions simulationRunOptions)
        {
            try
            {
                _simulationRunOptions = simulationRunOptions;
                _canceled             = false;
                doIfNotCanceled(() => loadSimulation(simulation));
                doIfNotCanceled(() => FinalizeSimulation(_simModelSimulation));
                doIfNotCanceled(simulate);

                return(new SimulationRunResults(!_canceled, _simModelSimulation.SolverWarnings, getResults(simulation)));
            }
            finally
            {
                _simModelSimulation = null;
                RaiseTerminated(this, EventArgs.Empty);
            }
        }
Example #2
0
        private void loadSimulation(IModelCoreSimulation simulation)
        {
            var xml = CreateSimulationExport(simulation, _simulationRunOptions.SimModelExportMode);

            _simModelSimulation = CreateSimulation(xml);
        }
 /// <summary>
 ///    Performs any actions necessary to make the simulation run ready
 /// </summary>
 protected void FinalizeSimulation(SimModelNET.ISimulation simModelSimulation)
 {
     simModelSimulation.FinalizeSimulation();
 }