I want to send the message in an Anylogic model from each agent to others which the message has two parameters. when another agent received the message in the "communication", check the first parameter. if it passes a condition, we use a second parameter in a way and if not, we use it in another way. for example: X, Y, and Z are the parameters of the agents.
I send a message in a transition.
and received it in "connection-link to agent"
I want to have this condition:
if sender.X > receiver.X receiver.Z=receiver.Z + sender.Y;
if sender.X < receiver.X receiver.Z=receiver.Z - sender.Y;
so I should send X and Y Simultaneously from an agent to another. but I can not send a message in a transition as: sendToAllConnected(X,Y);
could you help me?
I use this code ( "op" is a agent parameter):
if(msg.op<this.op)
this.op=this.op+msg;
if (msg.op<this.op)
this.op=this.op-msg;
and this code:
if (sender.op<this.op)
this.op=this.op+msg;
if (sender.op<this.op)
this.op=this.op-msg;
but I have an error that op cannot be resolved or is not a field.
Send a reference to the sender object. Don't try to send the X and Y values. Once you send the sender object, then the receiving object can reason with that message object (a reference to the sender) and get the applicable values of x and y.