Charting the results of an experiment - anylogic

I am very new to ANYLOGIC. I am trying to use a chart to display the number of operating turbines from the Wind Turbine Tutorial.
I have followed the procedure in the Anylogic in 3 Days book and have the following error:
"Operating cannot be resolved or is not a field" in the statistics field.
I am using the condition item.inState(turbines.Operating). This should count all the agents in the population "turbines" that are in the state Operating.
My state chart for the Agent Turbine has 4 states and Operating is one of them.
Is there another way of getting this information or am I doing something wrong?

turbines is a population, so a state is not a part of the population, but a part of either one individual of the population, or the class of the population
so you would need to do
item.inState(Turbine.Operating)
where Turbine is the Agent Type

Related

Mean statistics about agents in Anylogic

I'm working on a family practitioner model, my goal is to model the population of a city and all of the family practitioners in that given city by taking into account the distribution of the treatment time and the arrival schedule of patients etc... So far i've managed to create an agent that contains a bloc diagram to model the whole process
With a source and a delay bloc to generate patients according to a fixed schedule, a service bloc and two sinks.
Now i've put a population of this agent "process" in the main and i've simulated the model for 3 months.
Lets say i've started with a population of 10 process which represents the number of practitioners. My goal now to to collect some Mean statistics, like the Mean number of treated patients (treated patients goes to the sink "Served") of the 10 practitioners, the Mean waiting time of patients at the service bloc, the mean utilization ratio of the resource of the service bloc...
I want to also know if is it possible to limit the total number of Patients (or to at least count them), for exemple, instead of simulating the model for 3 months, i wanna limit the total number of patients that goes to the 10 process to 10k and i want to know how much time does it take to serve all of them. (is it possible with this architecture of the model or do i have to make major changes)
Thank you

Duplicate a model #Anylogic

I'm working on a family practitioner model, my goal is to model the population of a city and all of the family practitioners in that given city by taking into account the distribution of the treatment time and the arrival schedule of patients etc... I've started with a basic model with two practitioners and a small population.
Basic Model
Now if im going to model all of the 10k practitioners by duplicating the same blocks its gonna be like undoable, the other solution is to add more units in the resourcepool which does not model the real situation because basicly every family practitioner have his own queue and increasing the resourcepool is like modelling 'n' family practitioner in the same clinic with the same shared queue of patients. Is there any other solution? (first time using anylogic so im basicly a newbie)
thanks
You need to change your model architecture fundamentally. Practitioners become a custom agent type, you create a population of them and provide a flow chart in that agent type. Then, you can have 10k of them each with their own flow chart.
Strongly recommend you do all the tutorials in the help first to get a better understanding of the capabilities of AnyLogic. Having some blocks on Main is really just 0.1% of what the tool is capable of :)

How can I create a finite calling population model?

I am trying to simulate a finite calling population model in AnyLogic. My population consists of 10 agents and I want them to come back to the Source node after they have been served.
I thought about making conditioning with the SelectOutput node but the Source node does not have any input. The best thing that I came up with is to just limit the number of customers arrivals to 10. However, in this case, the model stops running after 10 arrivals which is not an appropriate result.
What can I do to be able to simulate such a type of model in AnyLogic?
EDIT: I thought that making agents come back to the Source node could be a solution to building the finite calling population model. The main purpose of my question is to understand how can I build such type of model in AnyLogic. Here is the description of the concept of the model.
You cannot send them back to a Source element, as it only acts to create agents.
However, you can send them back to blocks that come after the source as below:
Here, all agents created by the Source block will infinitely loop through the Queue and Delay blocks.

Gathering statistics on a resourcePool

I want to get some statistics on some of the resources I have in AnyLogic. For instance, I have a forklift agent and a resourcePool of forklift and I want to get the hourly utilization and the total distance traveled by all forklifts in the pool. I know I can click on the resourcePool icon and see the utilization, but I want to get that with the traveled distance updated and saved every hour.
Sorry I'm new to this and took me few months of learning to get my model straight
Thank you
First, you must create an agent type for your resources. With that in place, you can record anything anytime using datasets or default AnyLogic logging capability.
See some example models using resource pools with custom agent types such as "Lead acid battery production" and many more.
PS: Recording distance travelled is done automatically if you apply default logging but it is a bit more involved if you want to do it manually.

Gathering statistics on agent population

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.
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.