Reputation: 41
I’m trying to make a Seize block to choose from different resource pools depending on the agent type that is passing through the block.
My first try was to create a dynamic reference of the Resource set parameter in a Seize block as the image shows:
image of dynamic value in Resource set
if(agent instanceof Pala || agent instanceof Torre){
Extensibles;
}else{
Camabajas3e;
}
where Extensibles and Camabajas3e are the resource pool names.
But I get the error: “Type mismatch: cannot convert from ResourcePool to ResourcePool[][].”
My second attempt was to include both resource pools in the list and instead use the parameter “Resource choice condition” with the following code:
agent.vehículo==unit.vehículo
were vehículo es a parameter inside each agent type in the flowchart and each resource type from the resource pool.
But I get the error: “vehículo connot be resolved or is not a field” but it is a parameter inside agents and resources.
What I’m doing wrong? How can I solve it?
Thank you.
Upvotes: 1
Views: 357
Reputation: 9431
use units of the same pool instead of (alternative) resource sents
and in the code write this:
(agent instanceof Pala || agent instanceof Torre) ? Extensibles : Camabajas3e
with your second option you can actually use what you did, but you need to tell anylogic what is your agent type..
agent.vehiculo==((ResourceType)unit).vehiculo
Upvotes: 1