Exemplo n.º 1
0
        public void ExportForCluster(PopulationSimulation populationSimulation, string populationFolder, string fileDescription = null)
        {
            if (string.IsNullOrEmpty(populationFolder))
            {
                return;
            }

            _lazyLoadTask.Load(populationSimulation);

            if (settingsRequired(populationSimulation))
            {
                var outputSelections = _simulationSettingsRetriever.SettingsFor(populationSimulation);
                if (outputSelections == null)
                {
                    return;
                }

                populationSimulation.OutputSelections.UpdatePropertiesFrom(outputSelections, _cloner);
            }

            var existingFiles = Directory.GetFiles(populationFolder);

            if (existingFiles.Any())
            {
                if (_dialogCreator.MessageBoxYesNo(PKSimConstants.UI.DeleteFilesIn(populationFolder)).Equals(ViewResult.No))
                {
                    return;
                }

                existingFiles.Each(FileHelper.DeleteFile);
            }

            var fileName          = populationSimulation.Name;
            var modelFileFullPath = Path.Combine(populationFolder, $"{fileName}.pkml");
            var agingFileFullPath = Path.Combine(populationFolder, $"{fileName}{CoreConstants.Population.TABLE_PARAMETER_EXPORT}.csv");

            //Model
            _mobiExportTask.ExportSimulationToPkmlFile(populationSimulation, modelFileFullPath);

            var comments = _populationExportTask.CreateProjectMetaInfoFrom(fileDescription);

            //all values
            var dataTable = _populationExportTask.CreatePopulationDataFor(populationSimulation);

            dataTable.ExportToCSV(Path.Combine(populationFolder, $"{fileName}.csv"), comments: comments);

            //all aging data
            var agingData = populationSimulation.AgingData.ToDataTable();

            if (agingData.Rows.Count > 0)
            {
                agingData.ExportToCSV(agingFileFullPath, comments: comments);
            }
        }
 protected override void PerformExecute()
 {
     _moBiExportTask.ExportSimulationToPkmlFile(Subject);
 }