protected override void Context()
        {
            base.Context();
            _rootContainer = CreateContainer(null, "Sim", ContainerType.Simulation);
            var organism = CreateContainer(_rootContainer, "Organism");
            var liver    = CreateContainer(organism, "Liver");
            var plasma   = CreateContainer(liver, "Plasma", ContainerType.Compartment);

            _moleculeAmount = new MoleculeAmount().WithName("ABC").WithParentContainer(plasma);
        }
        public void TestSerializationMoleculeAmountWithFixedValue()
        {
            MoleculeAmount x1 = CreateObject <MoleculeAmount>().WithName("Monica").WithDimension(DimensionLength);

            x1.Persistable  = true;
            x1.Value        = 2.3;
            x1.ScaleDivisor = 0.345;

            IMoleculeAmount x2 = SerializeAndDeserialize(x1);

            AssertForSpecs.AreEqualMoleculeAmount(x2, x1);
        }
        public void TestSerializationQuantityAndContainerWithConstantFormula()
        {
            MoleculeAmount x1 = CreateObject <MoleculeAmount>().WithName("Monica").WithDimension(DimensionLength);

            x1.IsFixedValue = false;
            x1.Persistable  = false;
            x1.Formula      = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4);
            x1.Mode         = ContainerMode.Logical;
            Parameter p1 = CreateObject <Parameter>().WithName("Quentin").WithDimension(DimensionLength);

            x1.Add(p1);

            IQuantityAndContainer x2 = SerializeAndDeserialize(x1);

            AssertForSpecs.AreEqualQuantityAndContainer(x2, x1);
        }
Beispiel #4
0
        protected override void Context()
        {
            base.Context();
            var organsim    = new Container().WithName(Constants.ORGANISM);
            var kidney      = new Container().WithName(CoreConstants.Organ.KIDNEY).WithParentContainer(organsim);
            var urine       = new Container().WithName(CoreConstants.Compartment.URINE).WithParentContainer(kidney);
            var lumen       = new Container().WithName(CoreConstants.Organ.LUMEN).WithParentContainer(organsim);
            var feces       = new Container().WithName(CoreConstants.Compartment.FECES).WithParentContainer(lumen);
            var gallBladder = new Container().WithName(CoreConstants.Organ.GALLBLADDER).WithParentContainer(organsim);

            _moleculeUrine = new MoleculeAmount().WithName("DRUG")
                             .WithParentContainer(urine);
            _moleculeUrine.Persistable = false;

            _moleculeFeces = new MoleculeAmount().WithName("DRUG")
                             .WithParentContainer(feces);
            _moleculeFeces.Persistable = false;

            _moleculeGallBladder = new MoleculeAmount().WithName("DRUG")
                                   .WithParentContainer(gallBladder);
            _moleculeGallBladder.Persistable = false;

            _urineConcentrationObserver             = new Observer().WithName(CoreConstants.Observer.CONCENTRATION_IN_CONTAINER);
            _urineConcentrationObserver.Persistable = true;
            _moleculeUrine.Add(_urineConcentrationObserver);

            _fecesConcentrationObserver             = new Observer().WithName(CoreConstants.Observer.CONCENTRATION_IN_CONTAINER);
            _fecesConcentrationObserver.Persistable = true;
            _moleculeFeces.Add(_fecesConcentrationObserver);


            var compound = new Compound().WithName("DRUG");

            _individualSimulation = new IndividualSimulation();
            _individualSimulation.AddUsedBuildingBlock(new UsedBuildingBlock("Id", PKSimBuildingBlockType.Compound)
            {
                BuildingBlock = compound
            });
            _individualSimulation.Model = new OSPSuite.Core.Domain.Model {
                Root = new Container {
                    organsim
                }
            };
        }
Beispiel #5
0
        protected override void Context()
        {
            _entityPathResolver           = new EntityPathResolverForSpecs();
            _representationInfoRepository = new RepresentationInfoRepositoryForSpecs();
            sut = new PKSimPathToPathElementsMapper(_representationInfoRepository, _entityPathResolver);

            _organism                = new Organism();
            _venousBlood             = new Organ().WithName(CoreConstants.Organ.VenousBlood).WithParentContainer(_organism);
            _liver                   = new Organ().WithName(CoreConstants.Organ.Liver).WithParentContainer(_organism);
            _kidney                  = new Organ().WithName(CoreConstants.Organ.Kidney).WithParentContainer(_organism);
            _liverInt                = new Compartment().WithName(CoreConstants.Compartment.Interstitial).WithParentContainer(_liver);
            _liverCell               = new Compartment().WithName(CoreConstants.Compartment.Intracellular).WithParentContainer(_liver);
            _kidneyUrine             = new Compartment().WithName(CoreConstants.Compartment.URINE).WithParentContainer(_kidney);
            _gallBladder             = new Organ().WithName(CoreConstants.Organ.Gallbladder).WithParentContainer(_organism);
            _lumen                   = new Organ().WithName(CoreConstants.Organ.Lumen).WithParentContainer(_organism);
            _peripheralVenousBlood   = new Container().WithName(CoreConstants.Organ.PeripheralVenousBlood).WithParentContainer(_organism);
            _smallIntestine          = new Organ().WithName(CoreConstants.Organ.SmallIntestine).WithParentContainer(_organism);
            _mucosa                  = new Compartment().WithName(CoreConstants.Compartment.Mucosa).WithParentContainer(_smallIntestine);
            _mucosa_duo              = new Compartment().WithName(CoreConstants.Compartment.Duodenum).WithParentContainer(_mucosa);
            _mucosa_duo_interstitial = new Compartment().WithName(CoreConstants.Compartment.Interstitial).WithParentContainer(_mucosa_duo);

            _events     = new Container().WithName(Constants.EVENTS);
            _eventGroup = new EventGroup().WithName("E1").WithParentContainer(_events);
            _plasma     = new Compartment().WithName(CoreConstants.Compartment.Plasma).WithParentContainer(_venousBlood);
            _drugContainerVenousBlood           = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_venousBlood);
            _drugContainerPeripheralVenousBlood = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_peripheralVenousBlood);
            _drugContainerGallBladder           = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_gallBladder);
            _drugContainerInLumen     = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_lumen);
            _drugContainerInLiverCell = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_liverCell);
            _drug = new MoleculeAmount().WithName(_drugName).WithParentContainer(_plasma);

            _drugUrineKidney = new MoleculeAmount().WithName(_drugName).WithParentContainer(_kidneyUrine);
            _applications    = new Container().WithName(Constants.APPLICATIONS);
            _application1    = new EventGroup().WithName("App").WithParentContainer(_applications).WithContainerType(ContainerType.EventGroup);
            _formulation     = new Container().WithName("F1").WithParentContainer(_application1);

            _neighborhoods = new Container().WithName(Constants.NEIGHBORHOODS);
            _liverCellToLiverIntNeighborhood = new Neighborhood {
                FirstNeighbor = _liverInt, SecondNeighbor = _liverCell
            }.WithParentContainer(_neighborhoods);
            _concentrationDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            _fractionDimension      = DomainHelperForSpecs.FractionDimensionForSpecs();
        }
Beispiel #6
0
        protected override void Context()
        {
            base.Context();
            var root = new Container().WithName("Root").WithId("Root");

            sut.Root  = root;
            _molecule = new MoleculeAmount().WithName("Molecule");
            var globalMoleculeContainer = new Container().WithName("toto").WithContainerType(ContainerType.Molecule);

            _parameterUnderMolecule         = new Parameter().WithName("Param").WithFormula(new ConstantFormula(400));
            _parameterUnderAnotherContainer = new Parameter().WithName("Param").WithFormula(new ConstantFormula(400));
            globalMoleculeContainer.Add(_parameterUnderMolecule);

            sut.Root.Add(_molecule);
            sut.Root.Add(globalMoleculeContainer);
            var anotherContainer = new Container().WithName("anotherContainer");

            sut.Root.Add(anotherContainer);
            anotherContainer.Add(_parameterUnderAnotherContainer);

            _aParameterWithoutParent = new Parameter().WithName("_aParameterWithoutParent").WithFormula(new ConstantFormula(400));
        }
        protected override void Context()
        {
            _organism            = new Container().WithName(Constants.ORGANISM);
            _liver               = new Container().WithName("Liver");
            _kidney              = new Container().WithName("Kidney");
            _liverIntracellular  = new Container().WithName(INTRACELLULAR);
            _kidneyIntracellular = new Container().WithName(INTRACELLULAR);
            _liverRelExp         = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName("Relative expression (normalized)");
            _volumeLiver         = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.VOLUME);

            _volumeLiver.Formula            = new ExplicitFormula("1+2");
            _volumeOrganism                 = DomainHelperForSpecs.ConstantParameterWithValue(20).WithName(Constants.Parameters.VOLUME);
            _volumeLiverCell                = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(Constants.Parameters.VOLUME);
            _liverIntracellularSubContainer = new Container().WithName("Intracellular Sub Container");
            _volumeKidneyCell               = DomainHelperForSpecs.ConstantParameterWithValue(3).WithName(Constants.Parameters.VOLUME);
            _gfr                     = DomainHelperForSpecs.NormalDistributedParameter(3).WithName("GFR");
            _volumeKidney            = DomainHelperForSpecs.ConstantParameterWithValue(14).WithName(Constants.Parameters.VOLUME);
            _height                  = DomainHelperForSpecs.ConstantParameterWithValue(175).WithName("Height");
            _weight                  = DomainHelperForSpecs.ConstantParameterWithValue(75).WithName("Weight");
            _paramWithRHS            = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName("RHSParam");
            _paramWithRHS.RHSFormula = new ExplicitFormula();

            _clearance = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName("CL");

            _organism.AddChildren(_liver, _kidney, _height, _weight, _volumeOrganism, _paramWithRHS);
            _liver.AddChildren(_liverIntracellular, _volumeLiver);
            _liverIntracellular.AddChildren(_volumeLiverCell, _liverIntracellularSubContainer, _liverRelExp);
            _liverIntracellularSubContainer.Add(_clearance);

            _kidney.AddChildren(_kidneyIntracellular, _volumeKidney);
            _kidneyIntracellular.AddChildren(_volumeKidneyCell, _gfr);

            _liverIntracellularMoleculeAmount = new MoleculeAmount().WithName("Drug");
            _liverIntracellular.Add(_liverIntracellularMoleculeAmount);

            _simulation            = A.Fake <ISimulation>();
            _simulation.Model.Root = _organism;
        }
Beispiel #8
0
        protected override void Context()
        {
            base.Context();
            var root = new Container().WithName("Root").WithId("Root");

            sut.Root = root;
            _quantityWithMolWeight = new MoleculeAmount().WithName("Molecule");
            var quantityWithMolWeightContainer = new Container().WithName(_quantityWithMolWeight.Name).WithContainerType(ContainerType.Molecule);

            quantityWithMolWeightContainer.Add(new Parameter().WithName(Constants.Parameters.MOL_WEIGHT).WithFormula(new ConstantFormula(400)));
            _parameterUnderMoleculeWithMolWeight = new Parameter().WithName("Concentration");
            quantityWithMolWeightContainer.Add(_parameterUnderMoleculeWithMolWeight);

            _quantityWithoutMolWeight = new MoleculeAmount().WithName("Molecule2");
            var quantityWithoutMolWeightContainer = new Container().WithName(_quantityWithoutMolWeight.Name);

            _parameterUnderMoleculeWithoutMolWeight = new Parameter().WithName("Concentration");

            quantityWithoutMolWeightContainer.Add(_parameterUnderMoleculeWithoutMolWeight);

            sut.Root.Add(quantityWithMolWeightContainer);
            sut.Root.Add(quantityWithoutMolWeightContainer);
        }
Beispiel #9
0
 protected override void Context()
 {
     sut = new MoleculeAmount {
         Name = "TOTO"
     };
 }