0

In a hybrid DES-ABM model I've been building in Anylogic 8, I'm struggling with sending messages. In main, there are several clinics, and within these clinics the process modeling library is used to model within clinic processes. Once the patient-agent reaches a 'seize' block, a doctor-agent is seized.

Now, what I am trying to do is, once that doctor-agent is seized, a message needs to be sent from that 'seize' block to the doctor-agent that lives in the clinic.

I've consulted the Anylogic Help manual, and I have inserted these code snippets at the 'seize' block, in the 'On entry' field:-

agent.send("Start", Clinic.doctor)

send("Start", Clinic.doctor)

Error: Description: Cannot make a static reference to the non-static field

agent.send("Start", doctor)

send("Start", doctor)

Error: Description: The method send(Object, Agent) in the type Agent is not applicable for the arguments (String, Clinic._doctor_Population).

How would I do this?

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
mivandev
  • 321
  • 2
  • 14

1 Answers1

0

You need to send the message in the "onSeize" code section of the seize block. There, type:

send("Start", unit)

The keyword "unit" will send it to the doctor that has been seized. Read more about those keywords and where to find them here:

http://www.benjamin-schumann.com/blog/2016/2/4/the-magic-lightbulb-and-how-it-can-help-your-anylogic-modelling

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • Thank you, and very helpful blogpost! This seems to work, although nothing happens in the statecharts of the doctors; they do not transition to other states, it seems. However, using a traceln() on the statechart of the doctor, it does seem that they do actually receive the message. Do you have any suggestions? – mivandev Nov 24 '17 at 13:19
  • Well you need a transition that actually responds to the "Start" message *and* the doctor needs to be in a state where that transition is available. Do you believe both of those to be true? – Stuart Rossiter Nov 25 '17 at 10:49
  • Hi @StuartRossiter, I believe those things are true. The doctor agent has statechart in which he should transition when he receives "Start". As background info: I am trynig to recreate the model structure used in this article: http://ieomsociety.org/ieom_2016/pdfs/554.pdf – mivandev Nov 28 '17 at 09:38