Refer to transporter in flowchart blocks ANYLOGIC - anylogic

In my model sometimes my transporter (agent type=AMR) needs to charge his battery, this is executed by creating a new order in the source block and let them seize the specific transporter to a certain location where this transporter gets charged. This charging is happening in a delay block, so when for example my transporter with the charging order leaves this block I want my transporter parameter of the battery level been set to 100 I already tried a few option such as (AMR)unit).Batterylevel=100, but in the delay block I'm only able to links some actions on exit on the order and not the transporter, but I want to change the transporter parameters in the on exit block but how do I code this?. (see figures below for perhaps a better understanding)

Instead of trying to do this in the delay block, I recommend you do that in the release block since no model time would have passed between the two blocks, so the model logic would not be impacted.
In the on enter field of the release block use:
((AMR)unit).Batterylevel=100

Related

How to remove agents from population at a similar "Rate" that a Source block is creating agents

I am creating a model where I require agents from a population to be removed at a certain rate after a certain moment in time. This rate should be similar and have the same variability as a "Rate" in a source block. My current method runs, but I would like to know whether this method is accurate and if there exists a more elegant solution.
To begin the removal, I set up a Timeout Event that creates a Dynamic Event.
create_dynamicEvent(exponential(rate));
My dynamic event then removes the agent by sending it through an enter block to a sink block, and sets up another instance of itself.
enter_sink.take(population.get(0));
create_dynamicEvent(exponential(rate));
Thank you for your help
I would also use Dynamic Events. You may want to create the DE in the Source block, though, i.e. each created agent already "schedules" its destruction. May be more appropriate, but it depends on the real system.
Apart from that: all good

Anylogic count and store values at data base Table with agent

Anylogic How to count agent enter and leave the charging block with time constraint. I am wondering how to compute the total agent present at charging station .
enter image description here
Example
Add an int variable next to the charge2 block called counterIn.
In the charge2 block's "on enter" code, write counterIn++.
Do the same for exiting and you have your counters.
PS: You may want to clarify/improve your future questions, this one is quite hard to understand. Some tips: https://www.benjamin-schumann.com/blog/2021/4/1/how-to-win-at-anylogic-on-stackoverflow

Trasporters are jammed at a specific location in AnyLogic

I hope you are having a great day.
Recently, I tried to build an AnyLogic model with free-space transporters, but I encountered an unexpected situation as shown below.
I thought that there is no logical reason why all the transporters are jammed in a specific position. Is there any solution or possible reason for this situation? I have attached my model for your information.
Thank you for reading this question.
The problem with the traffic jam appears to be due to the fact that there are two few attractors available for the transporters to place the items and then they get stuck waiting for an attractor to become available...
When running your model as-is I get a jam in the stage one area
And in the logic blocks, I can see that the transports are stuck in the "Move By Transporter" block.
If I assume the attractors are set to 4 for a reason I would suggest the following logic - similar to what is described here
You create a list of all the attractors available. See the neat trick in AnyLogic where if you select a bunch of objects and then right-click on them you can automatically create a collection.
You can call it something like attractorsAvailabeStage1
And create a new map to store the WIP agents that will be occupying the attractors
And have a function that will provide the available attractors.
Change the move by transporter option to move to an attractor
And also return the attractor as available once it gets moved from its location
Now you only need to prevent mew agents from entering the area if there is no more attractors left or agents on their way to the attractors
I tested it and it works great for stage 1 you need to do it for all the stages.
On second thought....
seeing that you do have resource pools and service blocks. You can achieve the same logic I described by having resources first size the locations, then go to the transport block, and then be delayed
You first seize the space in the stage, then you move to the space, then you delay it.... then you wait, then seize the space in stage 2, then move there, then release stage 1.
I would go for the latter option

PedWait block in Anylogic assistance

i am new in using Anylogic , and i see in the PedWait block , Delay end on free function call , what does that mean and what is the difference between choosing it and the on delay time expiry ?
Thank you
the free function call is used in case you want to use something different than a time delay to allow the pedestrian to continue to the next block.
For example, a pedestrian can wait until a resource is available... since you don't know if the resource is going to be available in an exact amount of time, you can't use a time delay, so you use a free function call.
And when the resource becomes available, you can free the pedestrian by doing pedWait.free(ped)

Considering differences in the same materials - Stations

I am trying to simulate a manufacturing assembly process, where material items are processed following an unique line. In the quality control stations, when a failure is detected, the object is sent to the repair area (by a truckpallet) and, when it is repaired, the same resource takes it and puts it at the start of the line. Until this point, I already programmed it.
The problem is the following: when it is a repaired object, is has to follow the same conveyor but with no stops in the stations. The object must enter a station and leave it, with no delays (as the works related with the stations have already been made).
I thought the best would be to consider the difference (repaired vs. not repaired) in the Agent, but then I can't work with it in the Main agent... I have also tried alternative solutions, for example defining variables in each station 1 and consider that in the stations delays and in the following station:
triangular( 109.1*delay_bec, delaytime_bec*delay_bec, 307.6*delay_bec)
Actions - in finished process:
if(delay_bec==0){
delay_headers=0;
delay_bec=1;}
But nothing worked... Any help?
I thought the best would be to consider the difference (repaired vs. not repaired) in the Agent, but then I can't work with it in the Main agent...
This is actually the correct approach. You need to create a custom agent type, give in a boolean variable isRepaired (or similar) and then in the delay you can dynamically adjust the duration using that characteristic:
agent.isRepaired ? 0. : 100
This will delay normal agents by 100 time units and repaired agents not at all.
Obviously, you must make sure that the agents flowing through the flow blocks are of your custom agent type (see the help how to do that)