1
votes

I have some issues with gathering statistics on the population level in a model I've been working with. In the model I have an agent type Company and RawMaterial. Within Company a process flow exists, where on some blocks costs are assigned to a variable in Company upon entry of RawMaterial (e.g. cost = gamma(3, 125, 0);)

To calculate the Company-level cumulative costs I use a Statistics object with cost in the value field of this object. So far so good it seems.

However, when I want to sum the cumulative costs of all Company agents into one value I run into trouble. Ideally, I want the cumulative costs for each Company agent to be plotted in Main. I've looked at the Help file (section "Functions to collect statistics on agent population") with no success.

1

1 Answers

1
votes

what about doing this in main? (you can even put this function in your time plot)

sum( companies, c->c.cost );

This function calculates the sum of the costs of all company agents (as long as you have a population of agents called companies in main, and not only an agent type)

If you don't have companies as a population of agents, you have to create it, otherwise it's very difficult to calculate anything. How to create it depends on your model.