Beispiel #1
0
        public override string Communicate(ParameterIdentification pid, int timeout = 300)
        {
            // check if the header needs to be set
            if (pid.Header != currentJ1850Header &&
                !string.IsNullOrEmpty(pid.Header))
            {
                string response = SendCommand(Protocols.Elm327.SetFrameHeader(pid.Header));
                if (!response.Contains(Protocols.Elm327.Responses.OK))
                {
                    Diagnostics.DiagnosticLogger.Log("Could not set frame header for PID" + System.Environment.NewLine + pid.ToString());
                    return(null);
                }
            }
            else if (string.IsNullOrEmpty(pid.Header))
            {
                string response = SendCommand(Protocols.Elm327.SetFrameHeader(Protocols.J1850.Headers.Default));
                if (!response.Contains(Protocols.Elm327.Responses.OK))
                {
                    Diagnostics.DiagnosticLogger.Log("Could not set default frame header for PID" + System.Environment.NewLine + pid.ToString());
                    return(null);
                }
            }

            return(pid.SimulatedResponse(this.Protocol));
        }
 private void randomizeStartValuesFor(ParameterIdentification parameterIdentification)
 {
     parameterIdentification.AllVariableIdentificationParameters.Each(x =>
     {
         x.StartValueParameter.Value = generatedRandomStartValueFor(x);
     });
 }
Beispiel #3
0
        protected override void Context()
        {
            _view                               = A.Fake <IParameterIdentificationSimulationSelectionView>();
            _treeNodeFactory                    = A.Fake <ITreeNodeFactory>();
            _applicationController              = A.Fake <IApplicationController>();
            _lazyLoadTask                       = A.Fake <ILazyLoadTask>();
            _treeNodeContextMenuFactory         = A.Fake <ITreeNodeContextMenuFactory>();
            _multipleTreeNodeContextMenuFactory = A.Fake <IMultipleTreeNodeContextMenuFactory>();
            _dialogCreator                      = A.Fake <IDialogCreator>();
            _parameterIdentificationTask        = A.Fake <IParameterIdentificationTask>();
            sut = new ParameterIdentificationSimulationSelectionPresenter(_view, _treeNodeFactory, _applicationController, _lazyLoadTask, _treeNodeContextMenuFactory,
                                                                          _multipleTreeNodeContextMenuFactory, _dialogCreator, _parameterIdentificationTask);

            _parameterIdentification = new ParameterIdentification();
            _simulation = A.Fake <ISimulation>().WithId("Id").WithName("S");
            _parameterIdentification.AddSimulation(_simulation);
            _outputMapping = new OutputMapping
            {
                OutputSelection = new SimulationQuantitySelection(_simulation, new QuantitySelection("PATH", QuantityType.Drug))
            };
            _parameterIdentification.AddOutputMapping(_outputMapping);

            _simulationNode = A.Fake <ITreeNode>();
            A.CallTo(() => _treeNodeFactory.CreateFor(_simulation)).Returns(_simulationNode);

            _simulationSelectionPresenter = A.Fake <ISelectionSimulationPresenter>();
            A.CallTo(() => _applicationController.Start <ISelectionSimulationPresenter>()).Returns(_simulationSelectionPresenter);

            sut.EditParameterIdentification(_parameterIdentification);
        }
Beispiel #4
0
 protected override void Context()
 {
     base.Context();
     _parameterIdentification = new ParameterIdentification();
     _parameterIdentification.Configuration.AlgorithmProperties = new OptimizationAlgorithmProperties("XX");
     _parameterIdentification.AddIdentificationParameter(DomainHelperForSpecs.IdentificationParameter());
 }
Beispiel #5
0
 protected override void Context()
 {
     base.Context();
     _runResult.BestResult = new OptimizationRunResult();
     _runResult.BestResult.AddValue(new OptimizedParameterValue("Does not exist", 1, 1));
     _parameterIdentification = new ParameterIdentification();
 }
        protected void FindMissingOutputPaths(ParameterIdentification parameterIdentification, ISimulation oldSimulation, ISimulation newSimulation)
        {
            var outputMappings = parameterIdentification.AllOutputMappingsFor(oldSimulation);

            outputMappings.Where(outputMapping => !simulationHasEquivalentPath(outputMapping.OutputPath, newSimulation)).ToList().Each(outputPath =>
                                                                                                                                       ActionForSimulationDoesNotHaveOutputPath(parameterIdentification, newSimulation, outputPath));
        }
        protected override void Context()
        {
            _optimizationAlgorithm1 = A.Fake <IOptimizationAlgorithm>();
            _optimizationAlgorithm2 = A.Fake <IOptimizationAlgorithm>();
            A.CallTo(() => _optimizationAlgorithm2.Name).Returns(Constants.OptimizationAlgorithm.DEFAULT);
            _identificationAlgorithm1  = A.Fake <OptimizationAlgorithmProperties>();
            _identificationAlgorithm2  = A.Fake <OptimizationAlgorithmProperties>();
            _algorithmPropertiesMapper = A.Fake <IOptimizationAlgorithmToOptimizationAlgorithmPropertiesMapper>();
            _parameterIdentificationConfigurationDTOMapper = A.Fake <IParameterIdentificationConfigurationToParameterIdentificationConfigurationDTOMapper>();
            _optimizationAlgorithmRepository = A.Fake <IOptimizationAlgorithmRepository>();
            _parameterIdentificationAlgorithmOptionsPresenter = A.Fake <IExtendedPropertiesPresenter>();
            _view = A.Fake <IParameterIdentificationConfigurationView>();
            _parameterIdentification = new ParameterIdentification();
            _noOptionsPresenter      = A.Fake <IStandardParameterIdentificationRunModePresenter>();
            _multipleParameterIdentificationRunModePresenter   = A.Fake <IMultipleParameterIdentificationRunModePresenter>();
            _categorialParameterIdentificationRunModePresenter = A.Fake <ICategorialParameterIdentificationRunModePresenter>();
            ConfigureCategorialParameterIdentificationRunModePresenter();
            sut = new ParameterIdentificationConfigurationPresenter(_view, _parameterIdentificationAlgorithmOptionsPresenter, _optimizationAlgorithmRepository, _parameterIdentificationConfigurationDTOMapper, _algorithmPropertiesMapper,
                                                                    _noOptionsPresenter, _multipleParameterIdentificationRunModePresenter, _categorialParameterIdentificationRunModePresenter);
            A.CallTo(() => _algorithmPropertiesMapper.MapFrom(_optimizationAlgorithm1)).Returns(_identificationAlgorithm1);
            A.CallTo(() => _algorithmPropertiesMapper.MapFrom(_optimizationAlgorithm2)).Returns(_identificationAlgorithm2);

            A.CallTo(() => _noOptionsPresenter.CanEdit(A <ParameterIdentification> .That.Matches(x => x.Configuration.RunMode.IsAnImplementationOf <StandardParameterIdentificationRunMode>()))).Returns(true);
            A.CallTo(() => _categorialParameterIdentificationRunModePresenter.CanEdit(A <ParameterIdentification> .That.Matches(x => x.Configuration.RunMode.IsAnImplementationOf <CategorialParameterIdentificationRunMode>()))).Returns(true);
            A.CallTo(() => _multipleParameterIdentificationRunModePresenter.CanEdit(A <ParameterIdentification> .That.Matches(x => x.Configuration.RunMode.IsAnImplementationOf <MultipleParameterIdentificationRunMode>()))).Returns(true);
        }
Beispiel #8
0
        protected override void Context()
        {
            _executionContext        = A.Fake <IOSPSuiteExecutionContext>();
            _eventPublisher          = A.Fake <IEventPublisher>();
            _project                 = A.Fake <IProject>();
            _parameterIdentification = new ParameterIdentification();
            _applicationController   = A.Fake <IApplicationController>();
            _renameObjectPresenter   = A.Fake <IRenameObjectPresenter>();

            A.CallTo(() => _applicationController.Start <IRenameObjectPresenter>()).Returns(_renameObjectPresenter);
            A.CallTo(() => _executionContext.Project).Returns(_project);
            A.CallTo(() => _renameObjectPresenter.NewNameFrom(_parameterIdentification, A <IEnumerable <string> > ._, A <string> ._)).Returns("newName");

            A.CallTo(() => _project.AllParameterIdentifications).Returns(new[]
            {
                new ParameterIdentification {
                    Name = "name1"
                },
                new ParameterIdentification {
                    Name = "name2"
                }
            });

            sut = new RenameParameterIdentificationUICommand(_executionContext, _eventPublisher, _applicationController);
            sut.For(_parameterIdentification);
        }
Beispiel #9
0
        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;
            }
        }
 protected override void Context()
 {
     base.Context();
     _parameterIdentification = A.Fake <ParameterIdentification>();
     sut.EditParameterIdentification(_parameterIdentification);
     _errorHistory.AddRange(new[] { 10f, 11f, 12f });
 }
        public void Export(ParameterIdentification parameterIdentification, string fileName)
        {
            var serializer = _serializerRepository.SerializerFor(parameterIdentification);
            var element    = serializer.Serialize(parameterIdentification, new ParameterIdentificationExportSerializationContext());

            XmlHelper.SaveXmlElementToFile(element, fileName);
        }
        protected override void Context()
        {
            _runResultDTOMapper = A.Fake <IParameterIdentificationRunResultToRunResultDTOMapper>();
            _view = A.Fake <IMultipleParameterIdentificationResultsView>();
            _transferOptimizedParametersToSimulationTask = A.Fake <ITransferOptimizedParametersToSimulationsTask>();
            _commandCollector = A.Fake <ICommandCollector>();

            sut = new MultipleParameterIdentificationResultsPresenter(_view, _runResultDTOMapper, _transferOptimizedParametersToSimulationTask);
            sut.InitializeWith(_commandCollector);


            _parameterIdentification = new ParameterIdentification();
            _runResult1 = A.Fake <ParameterIdentificationRunResult>();
            _runResult2 = A.Fake <ParameterIdentificationRunResult>();
            _parameterIdentification.AddResult(_runResult1);
            _parameterIdentification.AddResult(_runResult2);

            _dto1 = new ParameterIdentificationRunResultDTO(_runResult1);
            _dto2 = new ParameterIdentificationRunResultDTO(_runResult2);

            A.CallTo(() => _runResultDTOMapper.MapFrom(_parameterIdentification, _runResult1)).Returns(_dto1);
            A.CallTo(() => _runResultDTOMapper.MapFrom(_parameterIdentification, _runResult2)).Returns(_dto2);

            A.CallTo(() => _view.BindTo(A <IEnumerable <ParameterIdentificationRunResultDTO> > ._))
            .Invokes(x => _allParameterIdentificationRunResultDTO = x.GetArgument <IEnumerable <ParameterIdentificationRunResultDTO> >(0).ToList());
        }
Beispiel #13
0
        public ISimulationAnalysis CreateAnalysisFor(ParameterIdentification parameterIdentification, ParameterIdentificationAnalysisType parameterIdentificationAnalysisType)
        {
            switch (parameterIdentificationAnalysisType)
            {
            case ParameterIdentificationAnalysisType.TimeProfile:
                return(createTimeProfileAnalysisFor(parameterIdentification));

            case ParameterIdentificationAnalysisType.ResidualsVsTime:
                return(createResidualVsTimeAnalysisFor(parameterIdentification));

            case ParameterIdentificationAnalysisType.ResidualHistogram:
                return(createHistogramAnalysisFor(parameterIdentification));

            case ParameterIdentificationAnalysisType.PredictedVsObserved:
                return(createPredictedVsObservedAnalysisFor(parameterIdentification));

            case ParameterIdentificationAnalysisType.CorrelationMatrix:
                return(createCorrelationAnalysisFor(parameterIdentification));

            case ParameterIdentificationAnalysisType.CovarianceMatrix:
                return(createCovarianceAnalysisFor(parameterIdentification));

            case ParameterIdentificationAnalysisType.TimeProfileConfidenceInterval:
                return(createTimeProfileConfidenceInterval(parameterIdentification));

            case ParameterIdentificationAnalysisType.TimeProfilePredictionInterval:
                return(createTimeProfilePredictionInterval(parameterIdentification));

            case ParameterIdentificationAnalysisType.TimeProfileVPCInterval:
                return(createTimeProfileVPCInterval(parameterIdentification));

            default:
                throw new ArgumentOutOfRangeException(nameof(parameterIdentificationAnalysisType), parameterIdentificationAnalysisType, null);
            }
        }
Beispiel #14
0
        private T createChartAnalysisFor <T>(ParameterIdentification parameterIdentification) where T : CurveChart, ISimulationAnalysis
        {
            var chart = _chartFactory.Create <T>();

            AddSimulationAnalysisTo(parameterIdentification, chart);
            return(chart);
        }
Beispiel #15
0
        private string getExportDirectory(ParameterIdentification parameterIdentification)
        {
            var path = _dialogCreator.AskForFolder(Captions.ParameterIdentification.SelectDirectoryForParameterIdentificationExport, Constants.DirectoryKey.SIM_MODEL_XML);

            if (string.IsNullOrEmpty(path))
            {
                return(path);
            }

            var newDirectoryName = parameterIdentification.Name;

            path = Path.Combine(path, newDirectoryName);

            if (!DirectoryHelper.DirectoryExists(path))
            {
                return(DirectoryHelper.CreateDirectory(path));
            }

            if (_dialogCreator.MessageBoxYesNo(Captions.DoYouWantToDeleteDirectory(newDirectoryName), Captions.Delete, Captions.Cancel) == ViewResult.No)
            {
                return(string.Empty);
            }

            DirectoryHelper.DeleteDirectory(path, true);
            return(DirectoryHelper.CreateDirectory(path));
        }
Beispiel #16
0
 protected override void Context()
 {
     base.Context();
     _simulation = A.Fake <ISimulation>();
     _parameterIdentification = A.Fake <ParameterIdentification>();
     A.CallTo(() => _parameterIdentification.UsesSimulation(_simulation)).Returns(true);
 }
        protected void FindMissingObservedData(ParameterIdentification parameterIdentification, ISimulation oldSimulation, ISimulation newSimulation)
        {
            var mappingUsingSimulation = parameterIdentification.AllOutputMappingsFor(oldSimulation);

            mappingUsingSimulation.Where(mapping => !newSimulation.UsesObservedData(mapping.WeightedObservedData.ObservedData)).ToList().Each(mapping =>
                                                                                                                                              ActionForSimulationDoesNotUseObservedData(parameterIdentification, newSimulation, mapping));
        }
Beispiel #18
0
 private void updateResidualOutputsPaths(ParameterIdentification identification, string oldName, string newName)
 {
     if (identification.HasResults)
     {
         identification.Results.SelectMany(result => result.BestResult.AllOutputResiduals).Each(residual => updateOutputResidualPath(residual, oldName, newName));
     }
 }
        protected override void Context()
        {
            _cloneManager               = A.Fake <ICloneManagerForModel>();
            _simulationFactory          = A.Fake <ICoreSimulationFactory>();
            _parameterIdentificationRun = A.Fake <IParameterIdentificationRun>();
            _coreUserSettings           = A.Fake <ICoreUserSettings>();
            _descriptionCreator         = A.Fake <ICategorialParameterIdentificationDescriptionCreator>();
            _container = A.Fake <Utility.Container.IContainer>();
            A.CallTo(() => _container.Resolve <ICoreSimulationFactory>()).Returns(_simulationFactory);
            _coreUserSettings.MaximumNumberOfCoresToUse = 1;
            sut = new CategorialParameterIdentificationRunInitializer(_cloneManager, _parameterIdentificationRun, _container, _descriptionCreator, _coreUserSettings);

            _parameterIdentification = new ParameterIdentification();
            _parameterIdentification.Configuration.RunMode = new CategorialParameterIdentificationRunMode();

            _simulation       = A.Fake <ISimulation>();
            _clonedSimulation = A.Fake <ISimulation>();

            A.CallTo(() => _simulationFactory.CreateWithCalculationMethodsFrom(_simulation, A <IEnumerable <CalculationMethodWithCompoundName> > ._)).Returns(_clonedSimulation);
            A.CallTo(() => _cloneManager.Clone(_parameterIdentification)).ReturnsLazily(() =>
            {
                var pi = new ParameterIdentification();
                pi.AddSimulation(_simulation);
                var identificationParameter = new IdentificationParameter();
                identificationParameter.AddLinkedParameter(new ParameterSelection(_simulation, A.Fake <QuantitySelection>()));
                pi.AddIdentificationParameter(identificationParameter);
                pi.AddOutputMapping(new OutputMapping
                {
                    OutputSelection = new SimulationQuantitySelection(_simulation, A.Fake <QuantitySelection>())
                });
                pi.Configuration.RunMode = new CategorialParameterIdentificationRunMode();
                return(pi);
            });
        }
        protected override void Context()
        {
            _view       = A.Fake <IParameterIdentificationParametersFeedbackView>();
            _exportTask = A.Fake <IParameterIdentificationExportTask>();
            sut         = new ParameterIdentificationParametersFeedbackPresenter(_view, _exportTask);

            _paramterIdentification           = new ParameterIdentification();
            _identificationParameter1         = createIdentificationParameter("P1", 10, 0, 20);
            _identificationParameter2         = createIdentificationParameter("P2", 20, 5, 40);
            _identificationParameter3         = createIdentificationParameter("P3", 20, 5, 40);
            _identificationParameter3.IsFixed = true;

            _paramterIdentification.AddIdentificationParameter(_identificationParameter1);
            _paramterIdentification.AddIdentificationParameter(_identificationParameter2);
            _paramterIdentification.AddIdentificationParameter(_identificationParameter3);

            A.CallTo(() => _view.BindTo(A <IEnumerable <ParameterFeedbackDTO> > ._, A <IEnumerable <IRunPropertyDTO> > ._))
            .Invokes(x =>
            {
                _allParameterFeedbackDTO = x.GetArgument <IEnumerable <ParameterFeedbackDTO> >(0).ToList();
                _allPropertiesDTO        = x.GetArgument <IEnumerable <IRunPropertyDTO> >(1).ToList();
            });

            sut.EditParameterIdentification(_paramterIdentification);
        }
Beispiel #21
0
 public void EditParameterIdentification(ParameterIdentification parameterIdentification)
 {
     _parameterIdentification = parameterIdentification;
     _simulationParametersPresenter.EditParameterAnalysable(parameterIdentification);
     _identificationParametersPresenter.EditParameterIdentification(parameterIdentification);
     _linkedParametersPresenter.EditParameterIdentification(parameterIdentification);
 }
        protected override void Context()
        {
            _view = A.Fake <IParameterIdentificationChartFeedbackView>();
            _chartDisplayPresenter           = A.Fake <IChartDisplayPresenter>();
            _dimensionFactory                = A.Fake <IDimensionFactory>();
            _predictedVsObservedChartService = A.Fake <IPredictedVsObservedChartService>();
            _displayUnitRetriever            = A.Fake <IDisplayUnitRetriever>();
            _parameterIdentification         = A.Fake <ParameterIdentification>();
            _observationColumns              = new List <DataColumn>();
            _curveList     = new List <Curve>();
            _baseGrid      = DomainHelperForSpecs.ObservedData().BaseGrid;
            _outputMapping = new OutputMapping();

            sut = new ParameterIdentificationPredictedVsObservedFeedbackPresenter(_view, _chartDisplayPresenter, _dimensionFactory, _displayUnitRetriever, _predictedVsObservedChartService);

            A.CallTo(() => _parameterIdentification.AllOutputMappings).Returns(new[] { _outputMapping });
            A.CallTo(() => _parameterIdentification.AllObservationColumnsFor(A <string> ._)).Returns(_observationColumns);
            _observationColumns.Add(new DataColumn());
            _observationColumns.Add(new DataColumn());

            A.CallTo(() => _predictedVsObservedChartService.AddCurvesFor(_observationColumns, A <DataColumn> ._, A <ParameterIdentificationPredictedVsObservedChart> ._, A <Action <DataColumn, Curve> > ._)).Invokes(x =>
            {
                var action = x.Arguments.Get <Action <DataColumn, Curve> >(3);
                _observationColumns.Each(observation =>
                {
                    var curve = new Curve {
                        Name = "Best"
                    };

                    action(new DataColumn(ShortGuid.NewGuid(), A.Fake <IDimension>(), _baseGrid), curve);
                    _curveList.Add(curve);
                });
                _chart = x.GetArgument <ParameterIdentificationPredictedVsObservedChart>(2);
            });
        }
Beispiel #23
0
        protected override void Context()
        {
            _mapper = A.Fake <ICategorialParameterIdentificationToCalculationMethodPermutationMapper>();
            _runInitializerFactory   = A.Fake <IParameterIdentificationRunInitializerFactory>();
            _parameterIdentification = new ParameterIdentification();
            _parameterIdentification.Configuration.RunMode = new CategorialParameterIdentificationRunMode();
            _aCombination       = new List <CalculationMethodWithCompoundName>();
            _anotherCombination = new List <CalculationMethodWithCompoundName>();

            _calculationMethodCombinations = new List <CalculationMethodCombination> {
                new CalculationMethodCombination(_aCombination), new CalculationMethodCombination(_anotherCombination)
            };

            _aCombination.Add(new CalculationMethodWithCompoundName(new CalculationMethod {
                Category = "category1", DisplayName = "method1"
            }, "compound1"));
            _aCombination.Add(new CalculationMethodWithCompoundName(new CalculationMethod {
                Category = "category2", DisplayName = "method2"
            }, "compound1"));

            _anotherCombination.Add(new CalculationMethodWithCompoundName(new CalculationMethod {
                Category = "category1", DisplayName = "method3"
            }, "compound1"));
            _anotherCombination.Add(new CalculationMethodWithCompoundName(new CalculationMethod {
                Category = "category2", DisplayName = "method4"
            }, "compound1"));

            sut = new CategorialParameterIdentificationRunFactory(_runInitializerFactory, _mapper);


            A.CallTo(() => _mapper.MapFrom(A <ParameterIdentification> ._)).Returns(_calculationMethodCombinations);
        }
Beispiel #24
0
        public IReadOnlyList <IParameterIdentificationRun> CreateFor(ParameterIdentification parameterIdentification, CancellationToken cancellationToken)
        {
            var runInitializer = _runInitializerFactory.Create <StandardParameterIdentificationRunInitializer>();

            runInitializer.Initialize(parameterIdentification, runIndex: 0);
            return(new[] { runInitializer.Run });
        }
Beispiel #25
0
        protected override void Context()
        {
            _parameterTask           = A.Fake <ISetParameterTask>();
            _dialogCreator           = A.Fake <IDialogCreator>();
            _parameterIdentification = new ParameterIdentification();
            _runResult = new ParameterIdentificationRunResult();

            _runResult.BestResult.AddValue(new OptimizedParameterValue("P1", 10, 20));
            _runResult.BestResult.AddValue(new OptimizedParameterValue("P2", 4, 5));

            _identificationParameter1 = new IdentificationParameter {
                Name = "P1"
            };
            _identificationParameter2 = new IdentificationParameter {
                Name = "P2", UseAsFactor = true
            };
            _identificationParameter3 = new IdentificationParameter {
                Name = "P3", IsFixed = true,
            };
            _identificationParameter3.Add(DomainHelperForSpecs.ConstantParameterWithValue(25).WithName(Constants.Parameters.START_VALUE));

            _linkedParameter1 = A.Fake <ParameterSelection>();
            A.CallTo(() => _linkedParameter1.Parameter).Returns(DomainHelperForSpecs.ConstantParameterWithValue(2));

            _linkedParameter2 = A.Fake <ParameterSelection>();
            A.CallTo(() => _linkedParameter2.Parameter).Returns(DomainHelperForSpecs.ConstantParameterWithValue(3));
            A.CallTo(() => _linkedParameter2.Dimension).Returns(Constants.Dimension.NO_DIMENSION);

            _linkedParameter3 = A.Fake <ParameterSelection>();
            A.CallTo(() => _linkedParameter3.Parameter).Returns(DomainHelperForSpecs.ConstantParameterWithValue(4));
            A.CallTo(() => _linkedParameter3.Dimension).Returns(Constants.Dimension.NO_DIMENSION);

            _linkedParameter4 = A.Fake <ParameterSelection>();
            A.CallTo(() => _linkedParameter4.Parameter).Returns(DomainHelperForSpecs.ConstantParameterWithValue(5));
            A.CallTo(() => _linkedParameter4.Dimension).Returns(Constants.Dimension.NO_DIMENSION);


            _identificationParameter1.AddLinkedParameter(_linkedParameter1);
            _identificationParameter2.AddLinkedParameter(_linkedParameter2);
            _identificationParameter2.AddLinkedParameter(_linkedParameter3);
            _identificationParameter3.AddLinkedParameter(_linkedParameter4);

            _parameterIdentification.AddIdentificationParameter(_identificationParameter1);
            _parameterIdentification.AddIdentificationParameter(_identificationParameter2);
            _parameterIdentification.AddIdentificationParameter(_identificationParameter3);

            _context = A.Fake <IOSPSuiteExecutionContext>();
            sut      = new TestTransferOptimizedParametersToSimulationsTask(_parameterTask, _dialogCreator, _context);

            _allValueOriginCommands = new List <ICommand>();

            A.CallTo(() => _parameterTask.SetParameterValue(A <IParameter> ._, A <double> ._, A <ISimulation> ._)).ReturnsLazily(x => A.Fake <IOSPSuiteCommmand <IOSPSuiteExecutionContext> >());

            A.CallTo(() => _parameterTask.UpdateParameterValueOrigin(A <IParameter> ._, A <ValueOrigin> ._, A <ISimulation> ._)).ReturnsLazily(x =>
            {
                var command = A.Fake <IOSPSuiteCommmand <IOSPSuiteExecutionContext> >();
                _allValueOriginCommands.Add(command);
                return(command);
            });
        }
Beispiel #26
0
 protected override void Context()
 {
     sut = new CategorialParameterIdentificationToCalculationMethodPermutationMapper();
     _parameterIdentification = new ParameterIdentification();
     _runMode = new CategorialParameterIdentificationRunMode();
     _parameterIdentification.Configuration.RunMode = _runMode;
 }
 protected override void Context()
 {
     base.Context();
     _relatedObject      = A.Fake <ParameterIdentification>().WithId("XX");
     _relatedItem.Origin = Origins.PKSim;
     A.CallTo(() => _relatedItemSerializer.Deserialize(_relatedItem)).Returns(_relatedObject);
 }
Beispiel #28
0
        private Task export(ParameterIdentification parameterIdentification, string templatePath, string exportFileExtension)
        {
            var exportDirectory = getExportDirectory(parameterIdentification);

            exportFor(parameterIdentification, exportDirectory, templatePath, exportFileExtension);
            return(exportParameterIdentificationContent(parameterIdentification, exportDirectory));
        }
Beispiel #29
0
 protected override void Context()
 {
     base.Context();
     _newOptions = A.Fake <MultipleParameterIdentificationRunMode>();
     _parameterIdentification = new ParameterIdentification();
     _parameterIdentification.Configuration.RunMode = _newOptions;
 }
Beispiel #30
0
 public void Initialize(ParameterIdentification parameterIdentification, int runIndex, CalculationMethodCombination calculationMethodCombination, bool isSingleCategory)
 {
     Initialize(parameterIdentification, runIndex);
     _calculationMethodCombination = calculationMethodCombination;
     _isSingleCategory             = isSingleCategory;
     _runMode = parameterIdentification.Configuration.RunMode.DowncastTo <CategorialParameterIdentificationRunMode>();
 }