Esempio n. 1
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
            if (originalSimulation != null)
            {
                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);
        }
Esempio n. 2
0
 private void addPopulationBuildingBlockToSimulation(PopulationSimulationImport populationSimulationImport, Population population)
 {
     _simulationBuildingBlockUpdater.UpdateUsedBuildingBlockInSimulationFromTemplate(populationSimulationImport.PopulationSimulation, population, PKSimBuildingBlockType.SimulationSubject);
 }