Hello,
I am trying to copy an agent through the Split block in AnyLogic. The problem is that the COPY does not have the same characteristics as the ORIGINAL; it create a copy of the agent with 'blank' characteristics.
My Patient agent has only one parameter: "p" [original value 0]. I made this simple model to illustrate my problem. In DELAY1 block , I change the parameter p = 1.
The Split should create a copy of Patient which has the parameter p ==1. The code 'this.add_patients()' creates a Patient, but without 'p'.
Any help would be greatly appreciated.
Hi Alex,
The AnyLogic help for the Split block says this: For each incoming agent ("original") creates one or several other agents and outputs them via outCopy port. A new agent created may have a meaning of a copy, a sibling, etc. and can be of arbitrary type. It is your responsibility to set the properties of the new agents (maybe to copy some properties of the original). The number of new agents can be changed dynamically.
So, to make it a "copy", you have to manually copy the agent. In your example, once the agent is created, you can assign the p value from the original agent to the new agent. Alternatively, you can use the version of add_patients that takes in a parameter list. So, for your example you could use "this.add_patients(original.p)".
Hope this helps,
Kurt