Exemplo n.º 1
0
        protected override void Context()
        {
            _simulation = BatchToolFactoryForSpecs.DefaultSimulation();
            var pv1 = new ParameterVariationSet {
                Name = "PV1"
            };

            pv1.ParameterValues.Add(new ParameterValue("A|B|C", 15, 0.2));
            pv1.ParameterValues.Add(new ParameterValue("A|B|C|D", 20, 0.6));
            _simulation.ParameterVariationSets.Add(pv1);

            _settings = new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            };
        }
Exemplo n.º 2
0
        private IPKSimMacroCommand updateParameters(PathCache <IParameter> allParameters, ParameterVariationSet parameterVariationSet)
        {
            var macroCommand = new PKSimMacroCommand();

            foreach (var parameterValue in parameterVariationSet.ParameterValues)
            {
                var parameterPath = parameterValue.ParameterPath;

                var parameter = allParameters[parameterPath];
                if (parameter == null)
                {
                    //try with adding the name of the simulation at first
                    parameterPath = $"{Simulation.Name}{ObjectPath.PATH_DELIMITER}{parameterPath}";
                    parameter     = allParameters[parameterPath];
                    if (parameter == null)
                    {
                        _logger.AddWarning($"Parameter with path '{parameterValue.ParameterPath}' not found!");
                        continue;
                    }
                }

                _logger.AddDebug($"Parameter '{parameterValue.ParameterPath}' value set from '{parameter.Value} to '{parameterValue.Value}'.");
                macroCommand.Add(new SetParameterValueCommand(parameter, parameterValue.Value));
            }

            return(macroCommand.Run(_executionContext));
        }