Search code examples
anylogic

AnyLogic, error in a batch block agent class cannot be cast to New_agent class


Good day!

I have a model with Source-> Wait-> Batch blocks. The agents are generated by the cyclic event. For one event the random number of agents may be generated, but all of them marked as the same group and have the same creation time. In a batch block I would like to join the agent with the same creation timestamp. For this purpose I used the wait block, where I calculate the cumulative size of all agents with the same timestamp and set the batchSize. The agents belongs to the class Modality. However, after Running I get the followiwng error:

class priority.New_modality cannot be cast to class priority.Modality (priority.New_modality and priority.Modality are in unnamed module of loader 'app')

What is the reason?

Thank you :)

[![Modality and New Modality

wait batch block


Solution

  • Likely, you are trying to push New_modality agents through a flow chart block that expects modality agents.

    Check the flow chart block downstream of the batch block and make sure it is set to await New_modality agents (it is in the advanced properties)