public async Task Run(SensitivityAnalysis sensitivityAnalysis) { if (!_entityValidationTask.Validate(sensitivityAnalysis)) { return; } try { if (IsRunning) { throw new OSPSuiteException(Error.CannotStartTwoConcurrentSensitivityAnalyses); } using (_sensitivityAnalysisEngine = _sensitivityAnalysisEngineFactory.Create()) { var begin = SystemTime.UtcNow(); await _sensitivityAnalysisEngine.StartAsync(sensitivityAnalysis); var end = SystemTime.UtcNow(); var timeSpent = end - begin; _dialogCreator.MessageBoxInfo(Captions.SensitivityAnalysis.SensitivityAnalysisFinished(timeSpent.ToDisplay())); } } catch (OperationCanceledException) { _dialogCreator.MessageBoxInfo(Captions.SensitivityAnalysis.SensitivityAnalysisCanceled); } finally { _executionContext.ProjectChanged(); _sensitivityAnalysisEngine = null; } }
public async Task Run(ParameterIdentification parameterIdentification) { if (!_entityValidationTask.Validate(parameterIdentification)) { return; } try { if (IsRunning) { throw new OSPSuiteException(Error.CannotStartTwoConcurrentParameterIdentifications); } using (_parameterIdentificationEngine = _parameterIdentificationEngineFactory.Create()) { var begin = SystemTime.UtcNow(); await _parameterIdentificationEngine.StartAsync(parameterIdentification); var end = SystemTime.UtcNow(); var timeSpent = end - begin; _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationFinished(timeSpent.ToDisplay())); } } catch (OperationCanceledException) { _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationCanceled); } finally { _executionContext.ProjectChanged(); _parameterIdentificationEngine = null; } }
public async Task Run(ParameterIdentification parameterIdentification) { if (!_entityValidationTask.Validate(parameterIdentification)) { return; } try { using (var parameterIdentificationEngine = _parameterIdentificationEngineFactory.Create()) { _parameterIdentificationEngines.Add(parameterIdentification, parameterIdentificationEngine); var begin = SystemTime.UtcNow(); await parameterIdentificationEngine.StartAsync(parameterIdentification); var end = SystemTime.UtcNow(); var timeSpent = end - begin; _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationFinished(parameterIdentification.Name, timeSpent.ToDisplay())); } } catch (OperationCanceledException) { _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationCanceled(parameterIdentification.Name)); } finally { _executionContext.ProjectChanged(); _parameterIdentificationEngines.Remove(parameterIdentification); } }
public void RunSimulation(Simulation simulation, bool defineSettings = false) { _defineSettings = defineSettings; _lazyLoadTask.Load(simulation); if (!_entityValidationTask.Validate(simulation)) { return; } this.Visit(simulation); }
public Task RunSimulation(Simulation simulation, SimulationRunOptions simulationRunOptions = null) { _simulationRunOptions = simulationRunOptions ?? new SimulationRunOptions(); _lazyLoadTask.Load(simulation); if (_simulationRunOptions.Validate && !_entityValidationTask.Validate(simulation)) { return(_simulationDidNotRun); } switch (simulation) { case IndividualSimulation individualSimulation: return(runSimulation(individualSimulation, _simulationPersistableUpdater.UpdatePersistableFromSettings)); case PopulationSimulation populationSimulation: return(runSimulation(populationSimulation, _simulationPersistableUpdater.UpdatePersistableFromSettings)); } return(_simulationDidNotRun); }