コード例 #1
0
        protected override void Context()
        {
            _randomGenerator = new RandomGenerator();
            sut               = new PKSimDistributedParameter().WithName("P");
            _minValue         = 5;
            _maxValue         = 10;
            sut.Info.MinValue = _minValue;
            sut.Info.MaxValue = _maxValue;

            _pathFactory      = new ObjectPathFactoryForSpecs();
            _minimumParameter = new PKSimParameter {
                Name = Constants.Distribution.MINIMUM
            }.WithFormula(new ExplicitFormula("0"));
            _maximumParameter = new PKSimParameter {
                Name = Constants.Distribution.MAXIMUM
            }.WithFormula(new ExplicitFormula("1"));
            _percentileParameter = new PKSimParameter {
                Name = Constants.Distribution.PERCENTILE
            }.WithFormula(new ExplicitFormula("0.5"));
            sut.Add(_minimumParameter);
            sut.Add(_maximumParameter);
            sut.Add(_percentileParameter);
            _distributedFormula = new UniformDistributionFormula();
            _distributedFormula.AddObjectPath(_pathFactory.CreateRelativeFormulaUsablePath(sut, _minimumParameter).WithAlias(Constants.Distribution.MINIMUM));
            _distributedFormula.AddObjectPath(_pathFactory.CreateRelativeFormulaUsablePath(sut, _maximumParameter).WithAlias(Constants.Distribution.MAXIMUM));
            sut.Formula = _distributedFormula;
        }
コード例 #2
0
ファイル: Converter341To351.cs プロジェクト: onwhenrdy/MoBi
        private void addEffectiveSurfaceAreaParameter(ISpatialStructure spatialStructure)
        {
            var organism = getOrganism(spatialStructure);

            if (organism == null)
            {
                return;
            }
            var lumen = organism.EntityAt <IContainer>("Lumen");

            if (lumen == null)
            {
                return;
            }

            var variabilityFactor = lumen.EntityAt <IParameter>(EFFECTIVE_SURFACE_AREA_VARIABILITY_FACTOR);
            var area = _dimensionFactory.Dimension("Area");

            foreach (var containerWithSurfaceArea in organism.GetAllChildren <IContainer>(c => c.ContainsName(EFFECTIVE_SURFACE_AREA_ENHANCEMENT_FACTOR)))
            {
                var effectiveSurfaceArea = _objectBaseFactory.Create <IParameter>()
                                           .WithName(EFFECTIVE_SURFACE_AREA)
                                           .WithDimension(area)
                                           .WithGroup("GI_ANATOMY_AREA")
                                           .WithDescription("Effective surface area of GI segment");

                var geometricSurfaceArea = containerWithSurfaceArea.EntityAt <IParameter>(GEOMETRIC_SURFACE_AREA);
                if (geometricSurfaceArea == null)
                {
                    continue;
                }

                var effectiveSurfaceAreaEnahncementFactor = containerWithSurfaceArea.EntityAt <IParameter>(EFFECTIVE_SURFACE_AREA_ENHANCEMENT_FACTOR);

                containerWithSurfaceArea.Add(effectiveSurfaceArea);

                var formula = spatialStructure.FormulaCache.FindByName("PARAM_EffectiveSurfaceArea") as ExplicitFormula;
                if (formula == null)
                {
                    formula = _formulaTask.CreateNewFormula <ExplicitFormula>(area).WithName("PARAM_EffectiveSurfaceArea");
                    formula.AddObjectPath(_objectPathFactory.CreateRelativeFormulaUsablePath(effectiveSurfaceArea, variabilityFactor).WithAlias("AeffVariabilityFactor"));
                    formula.AddObjectPath(_objectPathFactory.CreateRelativeFormulaUsablePath(effectiveSurfaceArea, geometricSurfaceArea).WithAlias("Ageom"));
                    formula.AddObjectPath(_objectPathFactory.CreateRelativeFormulaUsablePath(effectiveSurfaceArea, effectiveSurfaceAreaEnahncementFactor).WithAlias("AeffFactor"));
                    formula.FormulaString = "Ageom * AeffFactor * AeffVariabilityFactor";
                    spatialStructure.AddFormula(formula);
                }

                effectiveSurfaceArea.Formula = formula;
            }
        }
コード例 #3
0
        protected override void Context()
        {
            var organism = new Container().WithName("Organism");

            _objectPathFactory = new ObjectPathFactory(new AliasCreator());
            _fuParameter       = new Parameter().WithName("fu").WithValue(0.5);

            organism.Add(_fuParameter);
            var liver       = new Container().WithName("Liver").WithParentContainer(organism);
            var liverVolume = new Parameter().WithName("Volume").WithValue(10).WithParentContainer(liver);
            var f_vas_liver = new Parameter().WithName("f_vas").WithValue(0.1);

            liver.Add(f_vas_liver);

            var kidney       = new Container().WithName("Kidney").WithParentContainer(organism);
            var kidneyVolume = new Parameter().WithName("Volume").WithValue(20).WithParentContainer(kidney);

            kidney.Add(new Parameter().WithName("f_vas").WithValue(0.2));

            sut               = new SumFormula();
            sut.Criteria      = Create.Criteria(x => x.With("Volume"));
            sut.Variable      = "V";
            sut.FormulaString = "fu * V_#i * f_vas_#i";
            sut.AddObjectPath(_objectPathFactory.CreateRelativeFormulaUsablePath(liverVolume, f_vas_liver).WithAlias("f_vas_#i"));
            sut.AddObjectPath(_objectPathFactory.CreateAbsoluteFormulaUsablePath(_fuParameter).WithAlias("fu"));

            sut.Dimension = new Dimension(new BaseDimensionRepresentation(), "dim1", "unit1");

            _allFormulaUsable = organism.GetAllChildren <IFormulaUsable>().ToEntityDescriptorMapList();

            _objectBaseFactory = A.Fake <IObjectBaseFactory>();
            A.CallTo(() => _objectBaseFactory.Create <ExplicitFormula>()).Returns(new ExplicitFormula());
        }
コード例 #4
0
 protected override void Context()
 {
     sut            = new PKSimDistributedParameter();
     _pathFactory   = new ObjectPathFactoryForSpecs();
     _meanParameter = new PKSimParameter {
         Name = Constants.Distribution.MEAN
     }.WithFormula(new ExplicitFormula("10"));
     _stdParameter = new PKSimParameter {
         Name = Constants.Distribution.DEVIATION
     }.WithFormula(new ExplicitFormula("10"));
     _percentileParameter = new PKSimParameter {
         Name = Constants.Distribution.PERCENTILE
     }.WithFormula(new ExplicitFormula("0.5"));
     sut.Add(_meanParameter);
     sut.Add(_stdParameter);
     sut.Add(_percentileParameter);
     sut.Formula = new NormalDistributionFormula();
     sut.Formula.AddObjectPath(_pathFactory.CreateRelativeFormulaUsablePath(sut, _meanParameter));
     sut.Formula.AddObjectPath(_pathFactory.CreateRelativeFormulaUsablePath(sut, _stdParameter));
 }
コード例 #5
0
        private void addObjectPathToDistributionFormula(IDistributionFormula distribution,
                                                        IDistributedParameter distributedParameter,
                                                        IParameter usedParameter,
                                                        string alias)
        {
            var usedParameterPath = _objectPathFactory.CreateRelativeFormulaUsablePath(distributedParameter, usedParameter);

            usedParameterPath.Alias     = alias;
            usedParameterPath.Dimension = usedParameter.Dimension;

            distribution.AddObjectPath(usedParameterPath);
        }
コード例 #6
0
        private IFormulaUsablePath createRelativePathBase(IFormulaUsable formulaUsable, IEntity refObject)
        {
            if (refObject == null)
            {
                return(null);
            }

            if (formulaUsable.IsAtMolecule() && formulaUsable.RootContainer.Equals(formulaUsable.ParentContainer))
            {
                return(CreateFormulaUsablePathFrom(new[] { formulaUsable.ParentContainer.Name, formulaUsable.Name }, formulaUsable));
            }

            return(_objectPathFactory.CreateRelativeFormulaUsablePath(refObject, formulaUsable));
        }