I am simulating a job-shop scheduling problem where an order is processed by multiple machines located across different manufacturers. Each manufacturer
and machine
is represented as an agent in separate populations. Part of the simulation is the transport of an order agent from a manufacturing agent to the relevant machine agent according to the production plan.
As part of another part of my program, I need to predict the times when the order is generated by the source block when each order should enter and exit the relevant machine agent.
I am running into an issue where the time when the order agent exits the exitToTransport block in the manufacturer, agent does not match with the time that the order agent enters the enterMachine block for the machine agent.
This issue seems to only appear after the order has undergone 2-3 of these transports. Additionally, there are no blocks that the order agent enters or leaves between the exitToTransport and enterMachine blocks. Is there a way to eliminate this gap between the exit and enter times? Thank you for your time.
Related
I am trying to simulate manufacturing process by using statechart. And i have created agents for particular machines by statecharts and connecting those agents according to manufacturing process with help of resource pool, seize block and release block
My agent is passing through the resource pool and seize block. And I am expecting to run the model one after another seize blocks. However, when I run the model my all three statcharts are active at a same time, which I do not want. can anybody suggest me a possible way to avoid simultaneous process?
I'm assuming your manufacturing processes don't take 0 time. You're missing Delay blocks, causing all your blocks to execute at the same, instantaneous moment.
On a side note, what you're showing us isn't a statechart, but a flowchart.
Suppose I have the following supply chain model see model model1
Agents are communicating with each other through a defined network and send messages to each other through ports. for example, demand is generated for customers through their ports and send as "orders" upstream to facilities. Upstream facilities send "shipments" to downstream facilities
and stats are collected at each node.
The model seems to work for 2 echelons but when one facility is connected to two facilities downstream as desired I get the following error "Agent can't be in several flowcharts at the time. At least two flowchart blocks are in conflict" see error. Based on the description it seems the agent "shipment" is sent to two facilities at the same time.
My question is how could I avoid this conflict?
more information about each node:
Agents' "orders" enter through each node's port and are capture as Enter. take(msg), follow a flowchart, and exit as Agent "shipment" to each destination. Each agent "order" has a double amount and port destination. see facility node
any suggestions please?
You must make sure that you do not send agents into a flowchart that is already in another flow chart, correct. This is bad model design.
One way to debug and find the root issue: before sending any message agent, check currentBlock()!=null and traceln the agent and the block. Also pause the model.
You can then see where you want to (re)send that agent that is already in some other flowchart block.
You probably send message agents out that are still somewhere else.
PS: For messages, you probably do not want to use flow charts at all but normal message passing. This avoids these pains here as you can easily send the same message to several agents. Check how message passing is done in the example agent models
I have Agent B / Agent A / Agent A type of agents in a queue waiting for a service (delay). But I need that when it's time to change from Agent A to Agent B, ocurrs a machine set up. How do you usually handle this situation?
I tried, with no success, making variables and checking conditions On enter in the delay. I'm new to AnyLogic, so any help would be amazing.
The Downtime block allows to model changeovers for Service blocks. Read the help and explore all the tutorials and example models that use it to learn how it works.
I am creating a conveyor system, where the source produces 3 agents every 325 seconds. I would like each agent to convey to different specific areas but am having problems evenly distributing them using the SelectOutput5 block.
I am new to the software and have limited knowledge of Java. Is there a custom distribution function that forces the first agent to exit from port 1, second exit port 2 and third exit port 3? I would like the function to be capped at 3 and return back to exiting from port 1 when the 4th agent enters, port 2 for 5th agent, etc...
Try a variable to track last exit and a function to get the next exit.The image below shows an example.
Assume there are 2 processes with tickets A:75 and B:25. Now if lottery results in ticket number = 66, that means we run A.
This is okay for non-preemptive kernels because A will run until A is complete and then will not participate in the lottery.
But if Kernel is preemptive and A is selected,then wouldn't we need to decrease the tickets A has.
I'm not sure that I understand the concern that you're raising in your question, but I'll try to address your points. I assume that the system has 1 core and that each process has 1 thread.
Non-preemptive: If 66 is chosen, then A will run until it voluntarily yields to the scheduler. Once the scheduler has control, it will randomly choose another ticket and run the associated process. Thus, A could immediately run again or B could run.
Preemptive: If 66 is chosen, then A will run until it either voluntarily yields to the scheduler or it is preempted (e.g. by a timer interrupt) and the scheduler is given control. Just like in the non-preemptive version, the scheduler will randomly choose another ticket and run the associated process, so in this case A has a 75/100 = 75% chance of running and B has a 25/100 = 25% chance of running.
I assume that what you're asking is how do you revoke A's tickets while it is running so that it is not chosen by a scheduler on another core to run at the same time (i.e. how does lottery scheduling work on a multicore system?). When the scheduler chooses a ticket, it can simply mark the process's other tickets as invalid or manipulate the ticket data structure in the appropriate way so that the process cannot be chosen by a scheduler. The process's ticket should be chosen and the other tickets should be marked invalid at the same time (i.e. the two operations should look like one operation that is atomic) and before the scheduler performs a context switch to the process. The tickets should be marked valid again immediately after the scheduler regains control from that process.
The idea remains the same when processes can have more than 1 thread. It just comes down to the scheduler implementation to determine how to distribute the tickets among the process's threads and which ones to take away when one of the threads is chosen.