protected override void Context()
        {
            base.Context();
            _compound = new Compound();
            var solDim = new Dimension(new BaseDimensionRepresentation(), "Solubility", "m");

            solDim.AddUnit(new Unit("cm", 0.01, 0));
            _refPhValue         = 7;
            _solValue           = 100;
            _gainPerChargeValue = 1000;
            A.CallTo(() => _formulaFactory.CreateTableFormula()).Returns(new TableFormula());
            var refPh         = DomainHelperForSpecs.ConstantParameterWithValue(_refPhValue).WithName(CoreConstants.Parameter.RefpH).WithDimension(DomainHelperForSpecs.NoDimension());
            var solubilty     = DomainHelperForSpecs.ConstantParameterWithValue(_solValue).WithName(CoreConstants.Parameter.SolubilityAtRefpH).WithDimension(solDim);
            var gainPerCharge = DomainHelperForSpecs.ConstantParameterWithValue(_gainPerChargeValue).WithName(CoreConstants.Parameter.SolubilityGainPerCharge).WithDimension(DomainHelperForSpecs.NoDimension());

            _solubility_pKa_pH_Factor         = new PKSimParameter().WithName(CoreConstants.Parameter.SOLUBILITY_P_KA__P_H_FACTOR);
            _solubility_pKa_pH_Factor.Formula = new ExplicitFormula("10 * (pH +1)");
            _solubility_pKa_pH_Factor.Formula.AddObjectPath(new FormulaUsablePath(new[] { ObjectPath.PARENT_CONTAINER, CoreConstants.Parameter.RefpH }).WithAlias("pH"));
            _compound.Add(refPh);
            _compound.Add(solubilty);
            _compound.Add(gainPerCharge);
            _compound.Add(_solubility_pKa_pH_Factor);
            _solubilityAlternative = new ParameterAlternative();
            _solubilityAlternative.Add(refPh);
            _solubilityAlternative.Add(solubilty);
            _solubilityAlternative.Add(gainPerCharge);

            var solubilityAlternativeGroup = new ParameterAlternativeGroup();

            solubilityAlternativeGroup.AddAlternative(_solubilityAlternative);

            _compound.AddParameterAlternativeGroup(solubilityAlternativeGroup);
        }
Beispiel #2
0
 protected override void Context()
 {
     _objectBaseFactory = A.Fake <IObjectBaseFactory>();
     _cloner            = A.Fake <ICloner>();
     _speciesRepository = A.Fake <ISpeciesRepository>();
     //necessary to create compound since default parameter willl be added to the group based on compound parameters
     _compound = new Compound();
     _compoundParameterGroup = new ParameterAlternativeGroup();
     _compound.AddParameterAlternativeGroup(_compoundParameterGroup);
     _userSettings = A.Fake <ICoreUserSettings>();
     sut           = new ParameterAlternativeFactory(_objectBaseFactory, _cloner, _speciesRepository, _userSettings);
 }
        protected override void Context()
        {
            base.Context();
            //A compound with 2 lipo alternatives and MolWeight Eff
            _compound = new CompoundFactoryForSpecs().Create();
            var lipoGroup = new ParameterAlternativeGroup().WithName(CoreConstants.Groups.COMPOUND_LIPOPHILICITY);

            _alternative1 = new ParameterAlternative().WithName("ALT1");
            _alternative1.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.LIPOPHILICITY));
            lipoGroup.AddAlternative(_alternative1);

            _alternative2 = new ParameterAlternative().WithName("ALT2");
            _alternative2.Add(DomainHelperForSpecs.ConstantParameterWithValue(2).WithName(CoreConstants.Parameters.LIPOPHILICITY));
            lipoGroup.AddAlternative(_alternative2);
            _compound.AddParameterAlternativeGroup(lipoGroup);
        }
        protected override void Context()
        {
            base.Context();
            _compound = new Compound();
            var solDim = new Dimension(new BaseDimensionRepresentation(), "Solubility", "m");

            solDim.AddUnit(new Unit("cm", 0.01, 0));
            _solubilityTableFormula = new TableFormula();
            var solubilityTable = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.SOLUBILITY_TABLE).WithDimension(solDim);

            solubilityTable.Formula = _solubilityTableFormula;
            _solubilityAlternative  = new ParameterAlternative {
                solubilityTable
            };

            var solubilityAlternativeGroup = new ParameterAlternativeGroup();

            solubilityAlternativeGroup.AddAlternative(_solubilityAlternative);

            _compound.AddParameterAlternativeGroup(solubilityAlternativeGroup);
        }
Beispiel #5
0
        protected override void Context()
        {
            base.Context();
            _compound = new Compound();
            var fuGroup = new ParameterAlternativeGroup().WithName(CoreConstants.Groups.COMPOUND_FRACTION_UNBOUND);

            _fuAlternative = new ParameterAlternative().WithName("MyFu");
            _fuAlternative.Add(DomainHelperForSpecs.ConstantParameterWithValue(0.2).WithName(CoreConstants.Parameter.FractionUnbound));
            _fuAlternative.IsDefault = true;
            fuGroup.AddAlternative(_fuAlternative);
            _compound.AddParameterAlternativeGroup(fuGroup);
            _template = new SystemicProcess();
            _p1       = DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.Parameter.FRATION_UNBOUND_EXPERIMENT);
            _p2       = DomainHelperForSpecs.ConstantParameterWithValue(0.9).WithName("toto");
            _template.Add(_p1);
            _template.Add(_p2);
            _clone = new SystemicProcess();
            _clone.Add(DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.Parameter.FRATION_UNBOUND_EXPERIMENT));

            A.CallTo(() => _executionContext.Clone(_template)).Returns(_clone);
        }
        protected override void Context()
        {
            base.Context();
            var solDim = new Dimension(new BaseDimensionRepresentation(), "Solubility", "m");

            solDim.AddUnit(new Unit("cm", 0.01, 0));
            _refPhValue         = 7;
            _solValue           = 100;
            _gainPerChargeValue = 1000;
            A.CallTo(_formulaFactory).WithReturnType <TableFormula>().Returns(new TableFormula());
            var solubilityTable = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.SOLUBILITY_TABLE).WithDimension(solDim);
            var refPh           = DomainHelperForSpecs.ConstantParameterWithValue(_refPhValue).WithName(CoreConstants.Parameters.REFERENCE_PH).WithDimension(DomainHelperForSpecs.NoDimension());
            var solubilty       = DomainHelperForSpecs.ConstantParameterWithValue(_solValue).WithName(CoreConstants.Parameters.SOLUBILITY_AT_REFERENCE_PH).WithDimension(solDim);
            var gainPerCharge   = DomainHelperForSpecs.ConstantParameterWithValue(_gainPerChargeValue).WithName(CoreConstants.Parameters.SOLUBILITY_GAIN_PER_CHARGE).WithDimension(DomainHelperForSpecs.NoDimension());

            _solubility_pKa_pH_Factor         = new PKSimParameter().WithName(CoreConstants.Parameters.SOLUBILITY_P_KA__P_H_FACTOR);
            _solubility_pKa_pH_Factor.Formula = new ExplicitFormula("10 * (pH +1)");
            _solubility_pKa_pH_Factor.Formula.AddObjectPath(new FormulaUsablePath(new[] { ObjectPath.PARENT_CONTAINER, CoreConstants.Parameters.REFERENCE_PH }).WithAlias("pH"));

            _compoundForCalculation = new Compound {
                refPh, solubilty, gainPerCharge, _solubility_pKa_pH_Factor
            };
            _solubilityAlternative = new ParameterAlternative {
                refPh, solubilty, gainPerCharge, solubilityTable
            };

            var solubilityAlternativeGroup = new ParameterAlternativeGroup();

            solubilityAlternativeGroup.AddAlternative(_solubilityAlternative);


            _originalRefPh       = DomainHelperForSpecs.ConstantParameterWithValue(_refPhValue).WithName(CoreConstants.Parameters.REFERENCE_PH).WithDimension(DomainHelperForSpecs.NoDimension());
            _originalRefPh.Value = 4;
            _compound            = new Compound {
                _originalRefPh
            };
            _compound.AddParameterAlternativeGroup(solubilityAlternativeGroup);

            A.CallTo(() => _executionContext.Clone(_compound)).Returns(_compoundForCalculation);
        }