0

EX:

I have a population people with agent type Person with a parameter wrist_size.

In the agent type Person I've created another population =watches, agent type =Watch.

Now I want to create a variable in the lower agent type that will be based on the parameter of the upper agent.

length of the watch should be equal to the wrist_size of the person

What should code should I put to the variable?

Many thanks.

Jeun Bee
  • 9
  • 3

1 Answers1

0

You can simply use people.wrist_size in the "initial value" field of Watch.length.

Each embedded population (here Watch within Person) gets a "link" up to their parent agent (here Person named people).

See https://anylogic.help/advanced/code/access.html#where-am-i-and-how-do-i-get-to for understanding model hierarchies.

Benjamin
  • 10,603
  • 3
  • 16
  • 28