AnyLogic : An agent was not able to leave the port root.moveToOkParts1.out - simulation

Logic follow and the problem is described in the image below:
Note:
when I remove the "moveTo" block model did not through any error. But i want to see agent move toward the service station on 2D animation so I have to use "moveTo" block, which is throwing error.
Kindly help.
Thank you.

you can do this as the condition in the selectoutput block:
servicePaint.queueSize()+moveToOkParts1.size()<2
This because it's always possible for you to have multiple agents in your moveTo block that your selectOutput is not accounting for that will overflow the queue of your service

Related

Limit the number of Pedestrian in service 'queue'?

I have a simple model which has two Pedestrian Service blocks after one another. Is there a way to limit the queue for a service so it has a 'knock-back effect' on the queue/path area before?
I assume you can add a wait block before every ped-service that frees an agent if the ped-service queue is below a certain length. But, that seems a little messy (maybe a limitation of the pedestrian library) - would be keen to hear what best practices are from the experts (cough Ben & Felipe) :)
You can add a simple wait or queue block before the service block and only let them exit the queue if the pedestrians in the service blocks are below a threshold.
You need to implement the release logic in the on enter for the queue
as well as for the exit at the service block
But, in order to make your snake path act as a queue you will need to add walls around it, else as per your example the pedestrians will group around the end of the path in a bunch. You will also need to set your pedestrain width to just more than half your path width to ensure they don't bunch inside the path

why doesn't rackstore see the path to reach the palletrack?

I don't know why the resources don't follow the path in order to arrive the pallet rack. I thought it was because of the path (maybe not linked) but with a moveto block the problem disappears.What's the reason?
All the paths are bidirectional.
The problem that you have is the issue of teleportation... you move your boxes teleporting them from one node to the next by using the agent location parameter of the rackstore... This has the effect that the agents do not belong to the network as you expect.
instead you need to use a moveTo block instead as you see in the following image
Notice that I removed the agent location from the rackStore and also in the moveTo block i use JumpTo option instead of moveTo so you maintain the teleportation as you did...
Anyways, teleporting is not very good

the dowtime block with a schedule

I want to model the tour of the oss in the hospital rooms for the delivery of lunch/dinner or various assistance.
Well, I used a 'downtime' block controlled by a schedule. But at runtime this block does nothing
U know why?
Tnk U
Miriana
you define what downtime block to use in your resourcePool block... If you don't tell anylogic why to use the downtime block, then it won't use it.

In AnyLogic, is there a way to easily specify the offset of a resource when attached to an agent?

I think the title of the question is clear enough. I could try to add some code changing the coordinates of the resource every time it is attached. But this is a manual and indirect way. Is there a direct way to do it from within the block's properties? Thank you.
I asked what block it was just to clarify the question, it's the same answer for both of them, which is to use a variable in your resource agent called offset, then the x of your resource will be equal to that variable offset.
On the seize block, in the on seize action you can do ((Resource)unit).offset=theOffsetYouWant;
I think that solves your problem

Road Traffic Library - MoveTo block - while loop?

I want to implement a connected autonomous vehicle fleet in AnyLogic. Because of this, a vehicle agent has the ability to change its route. My understanding is that using the standard "MoveTo" block lets you move the vehicle agent only once by telling it what road to move the agent to.
For example:
Any vehicle following the above block can be created on any road that is specified in road4Source, then move to another road specified in moveToRoad2 block and then will be destroyed/deleted/discarded when it reaches the endOfRoute block.
However, since the vehicle can choose the route for itself, I only know the Origin and the Destination of the vehicle and not sure what route it will take. So, the number of MoveTo blocks should ideally be dynamic.
Considering this, is it possible to reuse MoveTo blocks (consider it a kind of a while loop) so that that the vehicle remains in the MoveTo block until it reaches the Destination (a particular road in my case)?
Something like this:
So that in the Road argument of moveToRoad2, I can put something like(could be wrong just for illustration):
car.getRoad() == car.destination ? endOfRoute : car.getRoad()
where car.getRoad() would return the road that the vehicle wants to go to and if it is equal to the destination of the car then it would go the endOfRoute block.
EDIT 1
I understand now that if there are two connections to the same port, AnyLogic will throw an error:
Out port can't be connected with more than one In Port.
So is there any other way to achieve what I want to do here?
First, this is the configuration you want:
Then you need to generate a collection of roads that the car will take... This collection is generated in the carSource... or you can update it as you progress in the "loop".
the car agent must have a variable that will start with 0 and will increment +1 every time it exits carMoveTo...
So the new road that the car will take is:
collection.get(car.variable)
And on exit of carMoveTo:
car.variable++;
In the selectOutput the condition for true would be:
agent.variable==collection.size()
I hope this helps...
Nevertheless, if you have too much traffic, you will see big problems in your model because the car doesn't necessarily recognize traffic after the destination in the carMoveTo so you may have crushes... or maybe not... depends on different factors.