예제 #1
0
 public SimulationProperties()
 {
     ModelProperties         = new ModelProperties();
     _compoundPropertiesList = new List <CompoundProperties>();
     EventProperties         = new EventProperties();
     InteractionProperties   = new InteractionProperties();
     AllowAging = false;
     Origin     = Origins.PKSim;
 }
예제 #2
0
        /// <summary>
        ///    Returns a clone of the current simulation properties
        /// </summary>
        public virtual SimulationProperties Clone(ICloneManager cloneManager)
        {
            var clone = new SimulationProperties
            {
                ModelProperties       = ModelProperties.Clone(cloneManager),
                EventProperties       = EventProperties.Clone(cloneManager),
                InteractionProperties = InteractionProperties.Clone(cloneManager),
                AllowAging            = AllowAging,
                Origin = Origin
            };

            _compoundPropertiesList.Each(cp => clone.AddCompoundProperties(cp.Clone(cloneManager)));
            return(clone);
        }
예제 #3
0
        public Simulation CreateFrom(ISimulationSubject simulationSubject, IReadOnlyList <Compound> compounds, ModelProperties modelProperties, Simulation originalSimulation = null)
        {
            var simulation = createSimulation(simulationSubject.GetType());

            //update the used building block in the simulation
            originalSimulation?.UsedBuildingBlocks.Each(simulation.AddUsedBuildingBlock);

            _simulationBuildingBlockUpdater.UpdateUsedBuildingBlockInSimulationFromTemplate(simulation, simulationSubject, PKSimBuildingBlockType.SimulationSubject);
            _simulationBuildingBlockUpdater.UpdateMultipleUsedBuildingBlockInSimulationFromTemplate(simulation, compounds, PKSimBuildingBlockType.Compound);

            //set basic properties
            if (originalSimulation != null)
            {
                simulation.UpdateFromOriginalSimulation(originalSimulation);
                simulation.Properties = originalSimulation.Properties;
            }

            //last but not least, update model properties to match new definition (this should be done last as UpdateFromOriginalSimulation resets the model properties)
            simulation.ModelProperties = modelProperties;
            updateCompoundProperties(simulation);

            return(simulation);
        }
예제 #4
0
        private void addModelStructureTo(IContainer container, OriginData originData, ModelProperties modelProperties, IFormulaCache formulaCache)
        {
            _parameterContainerTask.AddModelParametersTo(container, originData, modelProperties, formulaCache);

            foreach (var subContainer in _modelContainerQuery.SubContainersFor(originData.SpeciesPopulation, modelProperties.ModelConfiguration, container))
            {
                container.Add(subContainer);
                addModelStructureTo(subContainer, originData, modelProperties, formulaCache);
            }
        }
예제 #5
0
 private void addNeighborhood(INeighborhoodBuilder neighborhood, ISpatialStructure spatialStructure, OriginData originData, ModelProperties modelProperties, IFormulaCache formulaCache)
 {
     spatialStructure.AddNeighborhood(neighborhood);
     _parameterContainerTask.AddModelParametersTo(neighborhood, originData, modelProperties, formulaCache);
     _parameterContainerTask.AddModelParametersTo(neighborhood.MoleculeProperties, originData, modelProperties, formulaCache);
 }
예제 #6
0
        private void addNeighborhoods(ISpatialStructure spatialStructure, Organism organism, Individual individual, ModelProperties modelProperties, IFormulaCache formulaCache)
        {
            var neighborhoodList = _modelNeighborhoodQuery.NeighborhoodsFor(individual.Neighborhoods, modelProperties).ToList();

            foreach (var neighborhood in neighborhoodList)
            {
                addNeighborhood(neighborhood, spatialStructure, individual.OriginData, modelProperties, formulaCache);
            }

            _neighborhoodFinalizer.SetNeighborsIn(organism, neighborhoodList);
        }