Exemple #1
0
		public static Model NoRedundancyCircularModel()
		{
			// create 3 stations
			var dispenser = new ParticulateDispenser();
			var stations = new Station[]
			{
				new ContainerLoader(),
				dispenser,
				new PalletisationStation()
			};

			dispenser.SetStoredAmount(IngredientType.BlueParticulate, 50u);
			dispenser.SetStoredAmount(IngredientType.RedParticulate, 50u);
			dispenser.SetStoredAmount(IngredientType.YellowParticulate, 50u);

			// connect them to a circle
			for (var i = 0; i < stations.Length; ++i)
			{
				var next = stations[(i + 1) % stations.Length];
				stations[i].Outputs.Add(next);
				next.Inputs.Add(stations[i]);
			}

			var model = new Model(stations, new FastObserverController(stations));

			var recipe = new Recipe(ingredients: new[]
			{
				new Ingredient(IngredientType.BlueParticulate, 12),
				new Ingredient(IngredientType.RedParticulate, 4),
				new Ingredient(IngredientType.YellowParticulate, 5)
			}, amount: 3);
			model.ScheduleProduction(recipe);

			return model;
		}
        private Station CreateStation(char type, string name)
        {
            Station station;

            switch (type)
            {
            case 'P':
                station = new ContainerLoader();
                break;

            case 'C':
                station = new PalletisationStation();
                break;

            case 'D':
                station = new ParticulateDispenser();
                foreach (IngredientType ingredient in Enum.GetValues(typeof(IngredientType)))
                {
                    (station as ParticulateDispenser).SetStoredAmount(ingredient, Model.InitialIngredientAmount);
                }
                break;

            default:
                throw new InvalidDataException($"invalid type: {type}");
            }

            _stations.Add(station);
            if (name != null)
            {
                _namedStations.Add(name, station);
            }

            return(station);
        }
Exemple #3
0
        public static Model NoRedundancyCircularModel()
        {
            // create 3 stations
            var dispenser = new ParticulateDispenser();
            var stations  = new Station[]
            {
                new ContainerLoader(),
                dispenser,
                new PalletisationStation()
            };

            dispenser.SetStoredAmount(IngredientType.BlueParticulate, 50u);
            dispenser.SetStoredAmount(IngredientType.RedParticulate, 50u);
            dispenser.SetStoredAmount(IngredientType.YellowParticulate, 50u);

            // connect them to a circle
            for (var i = 0; i < stations.Length; ++i)
            {
                var next = stations[(i + 1) % stations.Length];
                stations[i].Outputs.Add(next);
                next.Inputs.Add(stations[i]);
            }

            var model = new Model(stations, new FastObserverController(stations));

            var recipe = new Recipe(ingredients: new[]
            {
                new Ingredient(IngredientType.BlueParticulate, 12),
                new Ingredient(IngredientType.RedParticulate, 4),
                new Ingredient(IngredientType.YellowParticulate, 5)
            }, amount: 3);

            model.ScheduleProduction(recipe);

            return(model);
        }
		private Station CreateStation(char type, string name)
		{
			Station station;
			switch (type)
			{
				case 'P':
					station = new ContainerLoader();
					break;
				case 'C':
					station = new PalletisationStation();
					break;
				case 'D':
					station = new ParticulateDispenser();
					foreach (IngredientType ingredient in Enum.GetValues(typeof(IngredientType)))
					{
						(station as ParticulateDispenser).SetStoredAmount(ingredient, Model.InitialIngredientAmount);
					}
					break;
				default:
					throw new InvalidDataException($"invalid type: {type}");
			}

			_stations.Add(station);
			if (name != null)
				_namedStations.Add(name, station);

			return station;
		}