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.
Related
I have a SERVICE block which i want to stop working for two hours when 10th agent enter the service.
So I used agent suspend and resume function for that. The image of implementation is given below.
MyDynamicEvent Properties section:
Now when i run the model and 10th agent enter the SERVICE, traceln("reparing") gets print on console but MyDynamicEvent does not work which means SERVICE block does not stop working and agents keep passing the SERVICE block. It suppose to stop for 2 hours when 10th agent enters the service.
You understand Dynamic Events wrong. In your code, you are creating the DE when the 10th agent enters, but you schedule it to start 2 hrs later. So it will trigger, but 2 hrs after the 10th agent arrived.
So the problem does not lie with the DE, but with the self.suspend(), imo
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.
Is there a way to have parallel services and/or delays to occur per agent and move on with the activity that takes the longest. For example if I have an agent that can be painted and serviced at the same time, each requiring a different resource pool with different processing times but the agent will move forward when the process that took the longest is over.
Use a Split block to split your agent into two for the two parallel tasks (Service blocks) and then use a Combine to combine them back again afterwards (with the Combine block outputting the original agent 1).
You can also use RestrictedAreaStart and RestrictedAreaEnd blocks (capacity 1) around the split/combine area to ensure that other agents can't 'jump in' whilst the longest parallel process is still running (but the shorter one has already finished).
Something like the below (with resource pools).
Probably easiest to dynamically setup delay duration and resources needed from within 1 Service element:
calculate the duration your agent will use in each case (painting = 5 mins, servicing = 10 mins) --> use the longer value as the service delay
Also, make the agent require 1 painter and 1 service-engineer as resources.
Only drawback: Your painter will stay for 10 mins as well.
Alternative approach would likely involve creating your own, purely agent-based setup with seizing& releasing
I'm doing a simulation of an industry in Anylogic. It consists of three equal production lines, they all have the same number of processes (in the case services) and each service has a Resource attached (aka. a Machine). The products that are produced in the three lines will only be joined together in the end (at the final stock before delivery).
However, my last process of each line can have an increase or decrease in resources (machines) when needed. For example, line 1 had a machine failure and stopped for some time and now instead of needing 4 machines to complete the order it will need 6.
In addition, if one of this machines placed in this process breaks (because of a failure), I need the service to keep working but with less resources. So, for example, I have 4 machines in the last process of line 1, one of these machines had a break down, I would like the other 3 to keep producing.
Which possible solution can be used for this? I tried to simulate this in the service itself but it doesn't work with less resources then specified.
From what I understood I think you need to model the three lines separately and use three different resourcePools for your machines. Doing this you will have control over the resource capacity on every line and can change them based on any events. If your question is about how to change capacity of one line when another line fails, I suggest using the "send to flowchart" option in resource failure and you can use flowchart blocks to change capacities and execute any other code necessary.
If your 3 lines are identical, you can create a custom flowchart block and pass the resourcePool as a parameter to the custom block.This way you don't have to replicate your logic three times.
In a distributed system, 5 processes, using zookeeper to coordinate.
I need these processes to run one by one in every round.
run order is dynamic, but is known for every round.
Any zookeeper recipe can do this? Thanks
for example:
round 1: 1 2 3 4 5
round 2: 3 2 4 1 5
Your problem is not fully defined:
In a situation when a given process fails to start do we have any kind of a timeout or does the system just halt?
Do the processes terminate between rounds, so that they are started by some external mechanism for every round?
Do we care about process termination status? If a process started but then failed in the middle of the execution, should the next process start?
In the simplest case, when we
accept halting
don't differentiate between a successful termination and a failure
assume that every process is somehow started for every round and knows its position in the current round
we could use the following approach (probably can be simplified):
For a given round either pre-setup or make the first process in the round create a path /round.
The first process
checks that getChildren('/round') returns an empty list
creates an ephemeral znode /round/exec_1
creates a permanent znode /round/start_1
Every other process number N
gets the list of /round's children
checks if /round/start_{N-1} exists
if yes, then checks /round/exec_{N-1} and waits for it to be deleted (using watcher)
if not, wait for it to appear (using watcher), then act as if the node was already there.
If the answers to the questions above are different, this protocol can be adjusted.
But the general idea here is to define how we indicate that a process is good to go: we register the fact that a previous process has started and then wait for it to terminate.