Exemple #1
0
        public static void AddFluidsPlant(this IServiceCollection service)
        {
            // Helper classes if they don't exist
            service.TryAddTransient <IPlantPartCellCreator, PlantPartCellCreator>();
            service.AddSingleton <FluidTransporter <Sucrose>, SucroseTransporter>();
            service.AddSingleton <ICarrierCollection <Sucrose>, SucroseCarrierCollection>();
            service.AddSingleton <FluidsPlantCycle>();

            // Part Factories
            service.AddTransient(p => CornCellTypeLocator.GetCornCellTypeLocator());

            // Construct the plant with stem and main root
            service.AddTransient(provider => new GenericShootSystem(CreateStem(provider)));
            service.AddTransient(provider => new GenericRootSystem(CreateRoot(provider)));
            service.AddSingleton <IPlant, FluidsPlant>();
        }
Exemple #2
0
        public void SetUp()
        {
            var cellFactory = new GenericCellFactory();

            var cellCreator = new HexagonCellCreator(cellFactory);

            var cellTypeLocator = CornCellTypeLocator.GetCornCellTypeLocator();

            var optionsService = PlantSimulatorOptionsHelper.CreateOptionsService();

            var cellGridCreator = new HexagonalCellGridFactory(cellCreator, cellTypeLocator, optionsService);

            creator = new PlantPartCellCreator(cellGridCreator);

            var internodeCells = creator.CreateCells(21, 17, new Vector3(0), 0f);

            Internode internode = new GenericInternode(internodeCells, 0);

            plant = internode.Cells;

            collisionDetection = new CellCollisionDetection(new GeometryHelper());
        }
 public void Setup()
 {
     environment = new SimulationEnvironment {
         LightPosition = new Vertex(0, 10000, 0), Temperature = 22
     };
     plant                         = TestPlant.CreatePlant();
     cellFactory                   = new GenericCellFactory();
     optionsService                = PlantSimulatorOptionsHelper.CreateOptionsService();
     divider                       = new GenericCellDivider(cellFactory);
     helper                        = new GeometryHelper();
     cellSizer                     = new GenericCellSizer(helper, new LoggerAdapter <GenericCellSizer>(new NullLogger <GenericCellSizer>()));
     cellCollisionDetection        = new CellCollisionDetection(helper);
     bodySystemSolver              = new GenericCellBodySystemSolver(cellCollisionDetection, cellSizer);
     cellGrower                    = new GenericCellGrower(plant, environment, bodySystemSolver, optionsService);
     descriptorService             = new PlantDescriptorService();
     cellCreator                   = new HexagonCellCreator(cellFactory);
     gridCreator                   = new HexagonalCellGridFactory(cellCreator, CornCellTypeLocator.GetCornCellTypeLocator(), optionsService);
     plantPartCellCreator          = new PlantPartCellCreator(gridCreator);
     internodePartFactory          = new GenericInternodePartFactory(optionsService, gridCreator);
     stemPartFactory               = new GenericStemPartFactory(optionsService, internodePartFactory);
     petiolePartFactory            = new GenericPetiolePartFactory(cellFactory, optionsService);
     nodePartFactory               = new GenericNodePartFactory(optionsService, cellFactory, stemPartFactory, petiolePartFactory);
     internodePlantPartDevelopment = new InternodePartDevelopment(optionsService, nodePartFactory, cellGrower, descriptorService, internodePartFactory);
     rootFactory                   = new GenericRootPartFactory(optionsService, plantPartCellCreator);
     rootPlantPartDevelopment      = new RootPartDevelopment(optionsService, nodePartFactory, rootFactory, cellGrower, descriptorService);
     developer                     = new PlantPartDeveloper(internodePlantPartDevelopment, rootPlantPartDevelopment);
     sucroseCarrierCollection      =
         new SucroseCarrierCollection(
             new LoggerAdapter <SucroseCarrierCollection>(new NullLogger <SucroseCarrierCollection>()));
     sucroseTransporter     = new SucroseTransporter(cellCollisionDetection, helper, sucroseCarrierCollection, new LoggerAdapter <FluidTransporter <Sucrose> >(new NullLogger <FluidTransporter <Sucrose> >()));
     plantGrower            = new GenericPlantGrower(bodySystemSolver, developer, sucroseTransporter);
     runner                 = new GenericPlantRunner(plant, environment, plantGrower, new FluidsPlantCycle(plant, optionsService, sucroseCarrierCollection, new LoggerAdapter <FluidsPlantCycle>(new NullLogger <FluidsPlantCycle>())));
     RangeExtensions.Random = new Random(optionsService.Options.Simulation.RandomSeed);
 }