Choosing an transporter with enough battery ANYLOGIC - simulation

In my model I've created an automobile robots(AMR) which transports orders. The Automobile robots is a transporter fleet, which is agent type AMR. This agent type has a parameter which is a boolean for needCharging (see figure 1), during my simulation at a certain point a robot needs to charge and the needCharging parameters changes to true.
In my model I want when I seize a transporter that he only chooses a transporter in the fleet where NeedCharging==false. So I coded it in the transporter choice condition as !unit.NeedCharging. (see figure 2 and 3 which showing the fleet and seize), but somehow he does not link the unit to a transporter in the seize block, how can I fix this that he only seizes transporters which does not have the parameter needcharging states as true.

Try the following instead:
!((AMR)unit).NeedCharging

Related

How i can deal with transporter and do logic in flow chart as like resources?

[model] https://i.stack.imgur.com/7A51i.jpg
I tried to put my transporters in queue and delay in its path (during unloading), after the transporter unload the cargo and goes back to the resource (which load the transporter). i tried to model it as a resource as shown but, i got an error (type : cast) as my agent consider to be a material item type ( can't cast the delay to transporter's agent type). what is the problem, and what i can do to achieve that with transporters instead of considering it a resource type.

Refer to transporter in flowchart blocks 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

Lift assigned to specific agent type Anylogic

I've a question, in my model I've multiple lift areas with 2 lifts, but only 1 lift is assigned for good transport (so agent type=AGV ) may use this lifts and the other lift is assigned for persons (agent type= person).
Is there a way to make the agents know which lift they should take and not take the lift which is not assigned for this specific goods transport.
Thanks
you can use this:
agent instanceof AGV
or
agent instanceof Person
You can put an selectOutput block to check this and send the agent to an intermediate point near the lift so it takes it, but if the AGV is a transporter that is acting as a resource, then you need to have the transporter as a variable in your agent so you can use as your condition
agent.transporter instanceof AGV

AnyLogic if condition selectOutput

I'm modelling a manufacturing line in anylogic. Two agents are being processed and transported via the same conveyor. Both Agents need to spend diffent delay times in a service station. Because of that i added two parallel services and now i want to sort the agents arriving on the conveyor to their corrosponding service stations.
flowchart
Agent1 needs to go to service and Agent2 to serviceT.
I assigned parameters to both Agents, Agent1 has the boolean parameter "S" set to true and Agent2 the same parameter set to false.
To sort the Agents in the selectOutput block i typed in the if condition agent.S == true as seen in the next screenshot.
selectOutput
Anylogic prompts following error: "Unresolved compilation problem: S cannot be resolved or is not a field"
What can i do about this?
Thank you!
I would like to answer this question in two parts:
Instead of using a selectOutput to model different delay times for the SAME station, it would be more reasonable to have only ONE service representing that ONE station. To model different times, set the delay time equal to agent.S where S is the delay time for each agent.
Regardless of whether you choose what I suggested or what you are already using, you will still get the same error. The reason for this error is most likely that you haven't specified the agent type going through the select output properly. In fact, if you look at the image of the select output properties you shared, under the "Advanced" tab, the agent type is set as the default type Agent. Make sure to replace that by the agent type that contains the parameter S.

A question about seizing more than one ressource in Anylogic

I'm working on a supply chain project with AnyLogic. In my model which is similar to product delivery example in AnyLogic examples, there are two agents which are Retailer and Fulfillment center. Both have their own vehicles. What I'm trying to do is to share vehicles so retailers and Fulfillment centers use the vehicles of each others. What I did is to create two Ressource Pool in each agent. So in the seize block as it shown below in picture, I added two ressource sets . In each statechart of each vehicle as it shown below and after delievering products, I informed my vehicle to go back to his initial location and in this case it can be Retailer or Fulfillment center. However after simulation, I got an error message in console that tells me that my agent which is the vehicle is trying to move to unknown source
If you put 2 ResourcePools into 2 agents, you have 4 pools in total. But you only want 1 shared pool, right?
Only add 1 ResourcePool to Main and use that from both agent's Seize elements. You will not be able to select the pool in the usual dropdown list (as there is no pool in either agent) but you can easily use the dynamic code to specify it. Note that the code below assumes both agents are embedded in Main: