/// <summary> /// Creates StorageAgents based on current Model and add them to the SimulationContext /// </summary> private void CreateStorageAgents() { var materials = _ganttContext.GptblMaterial; var stockpostings = _ganttContext.GptblStockquantityposting; foreach (var material in materials) { var initialStock = stockpostings.Single(x => x.MaterialId.Equals(material.MaterialId)); var stockDefintion = new FCentralStockDefinition( stockId: Int32.Parse(material.MaterialId), materialName: material.Name, initialQuantity: initialStock.Quantity.Value, unit: material.QuantityUnitId, price: material.ValueProduction.Value, materialType: material.Info1, deliveryPeriod: long.Parse(material.Info2) ); _simulation.SimulationContext.Tell(message: Directory.Instruction.Central .CreateStorageAgents .Create(message: stockDefintion, target: ActorPaths.StorageDirectory.Ref) , sender: ActorPaths.StorageDirectory.Ref); System.Diagnostics.Debug.WriteLine($"Creating Stock for: {material.Name}"); } }
public void CreateStorageAgents(FCentralStockDefinition stock) { var storage = Agent.Context.ActorOf(props: Storage.Props(actorPaths: Agent.ActorPaths , time: Agent.CurrentTime , debug: Agent.DebugThis , principal: Agent.Context.Self) , name: ("Storage(" + stock.StockId + " " + stock.MaterialName + ")").ToActorName()); StorageManager.AddOrCreateRelation(storage, stock.StockId.ToString()); Agent.Send(instruction: BasicInstruction.Initialize.Create(target: storage, message: StorageAgent.Behaviour.Factory.Central(stockDefinition: stock, simType: SimulationType))); }
public CentralStockManager(FCentralStockDefinition stockDefinition) { _stockDefinition = stockDefinition; _quantity = stockDefinition.InitialQuantity; }
public static IBehaviour Central(FCentralStockDefinition stockDefinition, SimulationType simType) { return(new Central(stockDefinition, simType)); }
public Central(FCentralStockDefinition stockDefinition, SimulationType simType) : base(simulationType: simType) { _stockManager = new CentralStockManager(stockDefinition); }
public static CreateStorageAgents Create(FCentralStockDefinition message, IActorRef target) { return(new CreateStorageAgents(message: message, target: target)); }