0
votes

In AnyLogic Simulation software, I have an agent that has some parameters. I just want that whenever this agent passes from a specific process, say delay, its parameter value to be changed to another value. Moreover, if I have 100 individuals (all same type of agents) passing from this process, I will change the first 40 of these individuals' parameter values to 1, and the last 60's values to 2. Is this possible? Do I need to write codes to these boxes: attached

1

1 Answers

1
votes

Yes, you have to write some code on one of these boxes.

Create an integer variable named v_countand set the initial value to 0. If you want agent's parameters to be changed as soon as they enter the block write this code "On enter" box, else if you want them to be changed when they leave the block write it "On at exit":

if(v_count < 40)
    agent.parameter = value1;
else
    agent.parameter = value2;

v_count++;

//reset the count to 0 when 100 agents have passed through this block
if(v_count == 100)
    v_count = 0;