public void AddParameterRangeBasedOn(IdentificationParameter identificationParameter, IParameter parameter) { identificationParameter.Add(createParameter(Constants.Parameters.START_VALUE)); identificationParameter.Add(createParameter(Constants.Parameters.MIN_VALUE)); identificationParameter.Add(createParameter(Constants.Parameters.MAX_VALUE)); updateParameterRange(identificationParameter, parameter); }
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); }); }
protected override void Context() { _rangeImageCreator = A.Fake <IOptimizedParameterRangeImageCreator>(); sut = new ParameterIdentificationRunResultToRunResultDTOMapper(_rangeImageCreator); _parameterIdentification = new ParameterIdentification(); _runResult = A.Fake <ParameterIdentificationRunResult>().WithDescription("Desc"); _runResult.Index = 5; _optimizationRunResult = new OptimizationRunResult(); _runResult.BestResult = _optimizationRunResult; A.CallTo(() => _runResult.NumberOfEvaluations).Returns(10); A.CallTo(() => _runResult.TotalError).Returns(5); _identificationParameter1 = new IdentificationParameter().WithName("P1"); _identificationParameter1.Add(parameterNamed(1, Constants.Parameters.MIN_VALUE)); _identificationParameter1.Add(parameterNamed(2, Constants.Parameters.START_VALUE)); _identificationParameter1.Add(parameterNamed(3, Constants.Parameters.MAX_VALUE)); _identificationParameter2 = new IdentificationParameter().WithName("P2"); _identificationParameter2.Add(parameterNamed(4, Constants.Parameters.MIN_VALUE)); _identificationParameter2.Add(parameterNamed(5, Constants.Parameters.START_VALUE)); _identificationParameter2.Add(parameterNamed(6, Constants.Parameters.MAX_VALUE)); _identificationParameter3 = new IdentificationParameter().WithName("P3"); _identificationParameter3.Add(parameterNamed(7, Constants.Parameters.MIN_VALUE)); _identificationParameter3.Add(parameterNamed(8, Constants.Parameters.START_VALUE)); _identificationParameter3.Add(parameterNamed(9, Constants.Parameters.MAX_VALUE)); _identificationParameter3.IsFixed = true; _parameterIdentification.AddIdentificationParameter(_identificationParameter1); _parameterIdentification.AddIdentificationParameter(_identificationParameter2); _parameterIdentification.AddIdentificationParameter(_identificationParameter3); _optimizedParameterValue1 = new OptimizedParameterValue("P1", 2.5, 2.1); _optimizationRunResult.AddValue(_optimizedParameterValue1); _optimizedParameterValue2 = new OptimizedParameterValue("P2", 5.5, 5.2); _optimizationRunResult.AddValue(_optimizedParameterValue2); //does not exist in PI anymore _optimizationRunResult.AddValue(new OptimizedParameterValue("P DOES NOT EXIST", 50, 60)); A.CallTo(_rangeImageCreator).WithReturnType <Image>().Returns(ApplicationIcons.OK); }
protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _identificationParameterFactory = A.Fake <IIdentificationParameterFactory>(); _logger = A.Fake <IOSPSuiteLogger>(); _identificationParameterTask = A.Fake <IIdentificationParameterTask>(); sut = new IdentificationParameterMapper(_parameterMapper, _identificationParameterFactory, _identificationParameterTask, _logger); _identificationParameter = new IdentificationParameter { IsFixed = true, UseAsFactor = true, Scaling = Scalings.Linear }; _startValueParameter = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.START_VALUE); _identificationParameter.Add(_startValueParameter); _identificationParameter.Name = "PARAM"; _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P1"); _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P2"); _simulation = A.Fake <Simulation>().WithName("S"); _simulation.Model.Root = new Container { _parameter1, _parameter2 }; _identificationParameter.Scaling = Scalings.Linear; _parameterSelection1 = new ParameterSelection(_simulation, _parameter1.Name); _parameterSelection2 = new ParameterSelection(_simulation, _parameter2.Name); _identificationParameter.AddLinkedParameter(_parameterSelection1); _identificationParameter.AddLinkedParameter(_parameterSelection2); _snapshotStartValueParameter = new Parameter(); A.CallTo(() => _parameterMapper.MapToSnapshot(_startValueParameter)).Returns(_snapshotStartValueParameter); _project = new PKSimProject(); _project.AddBuildingBlock(_simulation); _snapshotContext = new SnapshotContext(_project, ProjectVersions.Current); _parameterIdentification = new ParameterIdentification(); _parameterIdentificationContext = new ParameterIdentificationContext(_parameterIdentification, _snapshotContext); return(_completed); }