I am working on the simulation modelling of “import container transportation from seaport to dryport”.
I have created following agents:
- Kandla_port
- Dryport
- Railyard
- Train
- Containers
- order
- Import containers are received by the Kandla port. There are two types of containers (1) twentyFootContainers (2) fortyFootContainers.
- Here, 1 twentyFootContainer = 1 TEU & 1 fortyFootContainer = 2 TEUs.
- This containers are generated at Kandla port using two separate events according to arrival rate.
- Now, the condition is that if number of TEUs > (0.5*capacity), the kandla port sends the train request to the railyard. Here, capacity is the maximum carrying capacity of train in TEUs that is 90 in our case.
- So kandla port will send the request to Railyard as soon as number TEUs crosses value of 45. To send the request I have created one function that checks the trainRequest condition after each container arrival.
- I checked the BUILD MODEL feature. There is no error.
- I am facing the issue during the simulation run. As soon as the number of TEUs reaches the value greater than 45 (i.e, 46 or 47), the simulation is sending the following error.
Error:
Exception during discrete event execution: root.kandla: Trying to send message to 'null' destination agent java.lang.RuntimeException: root.kandla: Trying to send message to 'null' destination agent at com.anylogic.engine.Engine.error(Unknown Source) at com.anylogic.engine.Agent.error(Unknown Source) at com.anylogic.engine.Utilities.error(Unknown Source) at com.anylogic.engine.AgentExtensionImpl.error(Unknown Source) at com.anylogic.engine.ie.send(Unknown Source) at com.anylogic.engine.Agent.send(Unknown Source) at import_containers.Kandla.requestTrainIfNeeded(Kandla.java:749) at import_containers.Kandla.executeActionOf(Kandla.java:726) at com.anylogic.engine.EventTimeout.execute(Unknown Source) at com.anylogic.engine.Engine.n(Unknown Source) at com.anylogic.engine.Engine.je(Unknown Source) at com.anylogic.engine.Engine$i.run(Unknown Source)
I have used following java codes:
Event 1 – TwentyFootContainers
int containerId = containerIdCounter++; // Assign a unique ID to each container Container container = new Container(true, weight, containerId); // Initialize a 20-foot container twentyFootContainerCount++; totalTeusArrived++; if (Math.random() < roadModePercentage) { teusByRoad++; } else { teusByRailPending++; requestTrainIfNeeded(); // Call the function to check if a train is needed }
Event 2 – FortyFootContainers
int containerId = containerIdCounter++; // Assign a unique ID to each container Container container = new Container(false, weight, containerId); // Initialize a 40-foot container fortyFootContainerCount++; totalTeusArrived += 2; if (Math.random() < roadModePercentage) { teusByRoad += 2; } else { teusByRailPending += 2; requestTrainIfNeeded(); // Call the function to check if a train is needed }
Function – requestTrainIfNeeded
`if (!trainRequested && teusByRailPending > capacity * 0.4) {
Order order = new Order(this, teusByRailPending);
send(order, railyard);
trainRequested = true;
} `
Nevil Gandhi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.