'Why are parameters of an agent empty after creation and sending it to another agent?
In my Anylogic model I have agents (carriers) that receive orders and after some delay processes, should create a new truckOrder and send it to a truck agent. I have coded it in the exit block as you can see in the figure below. When running, I get a NullPointerException error within this exit block, because order.terminal and order.customer are empty.
This is how an order is created (within a customer agent) and send to the enter block of a carrier:
Order order = new Order(this, main.terminals(0));
Carrier carrier = randomFrom(main.carriers);
if (carrier != null)
carrier.receiveOrder.take(order);
Also when I do it differently, like below, it does not work. Does anybody know why?
Order order = new Order(this, main.terminals(1));
Carrier carrier = randomFrom(main.carriers);
if (carrier != null)
send(order, carrier.receiveOrder);
The NullPointerException error is placed within these rows of the Carrier.java tab:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


