0

I am trying to model a production infrastructure in anylogic which consists of several agents. One of it is a "steam network" (system dynamics) which starts with a flow from nowhere. The dynamic value of this flow is supposed to be the steam output of another agent. Unfortunately, I can't figure out how to link the flow to the steam production (dynamic variable) of my agent "machine".

I appreciate all your help.

Josie
  • 7
  • 4

2 Answers2

0

The flow object allows you to set the flow to be anything (it is a Java field) so you can easily link it to your agent's variable as below: enter image description here

The actual code depends on your model structure, i.e. how the steam agent is embedded relative to the myAgent feeding it with flow. In my example, "MyAgent" is simply embedded in the steam engine, but yours might vary. If that is the problem, check the Help's section Where am I and how do I get to...

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • Hi Benjamin, thank you for answering so quickly. I did insert myAgent.myVariable . In my model it's Gaskessel.DampfproduktionGaskessel with Gaskessel being the name of the agent where the dynamic variable DampfproduktionGaskessel "lives". However, I do get the errors: "Expression contains variable with undefined unit" & "Cannot make a static reference to the non-static field DampfproduktionGaskessel". Is it because DampfproduktionGaskessel is a dynamic variable? Am I missing something? – Josie Sep 06 '18 at 09:05
  • no, you need to understand model navigation, please check that link I posted. You need to understand how to navigate from the flow object to the variable of your agent. And that depends on your model structure (how are agents embedded). Nice German naming, btw ;-) – Benjamin Sep 06 '18 at 09:07
0

To clarify the model navigation, take this example model I made: enter image description here

It has 2 different agents embedded on main. "OtherAgent" has 1 variable v_DefiningFlowRate of type double, set to 12.

The second agent on Main "SysDynAgent" has a flow object that pulls the flow rate from "OtherAgent" by navigating to it correctly: enter image description here

this is what you need to adapt to in your model

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • note that your "OtherAgent" might be a population of agents. In that case, the code in the flow object would look like "get_Main().otherAgent.get(0).v_definingFlowRate" and you need to ensure you choose the right otherAgent (#0 here)! – Benjamin Sep 06 '18 at 09:15