'Choosing an transporter with enough battery ANYLOGIC

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.

Parameters transporter Transporter Fleet enter image description here



Solution 1:[1]

Try the following instead:

!((AMR)unit).NeedCharging

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Emile Zankoul