AB modeling in anylogic (statechart) - simulation

I have a problem where the state of one agent depends on the states of its components. Like I have a machine which consists of 10 different components. each one has its own state chart( the states could be; Operating,failed, under manitenance...etc). So the machine will fail if at least one component fails and it will be up if all of them is operating. What I did is to create the 10 agents and create thier statecharts( please note that each component has different failure rate, repair time..etc that is why i seperate them) and i created one agent for the machine with its statechart(that is dependent on the 10 statecharts), I am stuck here, I could not find way to get the state of the machine based on its components' states.
It should be AB modeling
Thanks alot

Related

msg can't reach the stat chart for multiple deliveries

I'm trying to change the existing model in Anylogic (product delivery) and trying to move trucks to various locations. in manufacturing processes I add batch and hold to put 5 orders in the truck, but after I can't communicate with truck state chart and can't make it read the trigger (msg). I tried various methods but couldn't make it work. I'm new in anylogic and your help will be appreciated.
the first thing you should do is go to the truck agent, to the connections object, and verify if your message is being sent
Also to understand better how messages work, i suggest you watch the following video which is part of the course available at noorjax.teachable.com
https://www.youtube.com/watch?v=Fe2U8IAhlHM

Considering differences in the same materials - Stations

I am trying to simulate a manufacturing assembly process, where material items are processed following an unique line. In the quality control stations, when a failure is detected, the object is sent to the repair area (by a truckpallet) and, when it is repaired, the same resource takes it and puts it at the start of the line. Until this point, I already programmed it.
The problem is the following: when it is a repaired object, is has to follow the same conveyor but with no stops in the stations. The object must enter a station and leave it, with no delays (as the works related with the stations have already been made).
I thought the best would be to consider the difference (repaired vs. not repaired) in the Agent, but then I can't work with it in the Main agent... I have also tried alternative solutions, for example defining variables in each station 1 and consider that in the stations delays and in the following station:
triangular( 109.1*delay_bec, delaytime_bec*delay_bec, 307.6*delay_bec)
Actions - in finished process:
if(delay_bec==0){
delay_headers=0;
delay_bec=1;}
But nothing worked... Any help?
I thought the best would be to consider the difference (repaired vs. not repaired) in the Agent, but then I can't work with it in the Main agent...
This is actually the correct approach. You need to create a custom agent type, give in a boolean variable isRepaired (or similar) and then in the delay you can dynamically adjust the duration using that characteristic:
agent.isRepaired ? 0. : 100
This will delay normal agents by 100 time units and repaired agents not at all.
Obviously, you must make sure that the agents flowing through the flow blocks are of your custom agent type (see the help how to do that)

How can I make this logic run through 3 types of agents?

1
2
As pic1 shows, in my logic, I've got 2 types of agents, so I set 3 sources. However, when I run the model, It couldn't through the queue and next steps, I think it's because of the setting of agent type. Do you know how can I set that agent type that can make 3 different agents go through this logic?
if a block in your process is handling several types of agents, it can definitely do it without issues, you don't need to touch the advanced settings, but if you did, change the agent type to Agent.
This Agent selection in the agent type is done automatically in AnyLogic, and that's why you should never touch the advanced section if you don't know what you are doing.
If it still doesn't work, it means that your error is different and not due to the different agent types, in which case you will need to specify the error you are experiencing

How to compare conditions of an agent with all connected agents in statechart

I am working on my thesis associated with modeling farmers' behaviors in a river basin. I am having 6
agents that contain different populations of farmers. These farmers have been located on the GIS map as the environment (main) in anylogic. I also defined the connection between populations of 6 agents by coding on the main startup and using "Link to Agent". Now, I'd like to define agents' behaviors through statecharts. But I have some difficulties. I have to compare the income of each farmer to the income of all connected farmers. How can I do that? What I have tried to define condition transition and write (for example if the income of each farmer is less than the income of all connected farmers in its network then do specific action):
IncomeT<ALL_CONNECTED.IncomeT
but it didn't work. Got any suggestions?
Thanks.
not quite clear who is your agent for which you are designing your state chart. Is it some entity (say Area) which contains a population of farmers? If yes, then why would you connect/link one Area to another? If you agent is a famer (which is not how you described it, but seems logical) then you would just store (and update) "minimum population income" in some variable and compare individual income with that stored value.
Alternatively you can use min() function. More on that: https://help.anylogic.com/index.jsp?topic=%2Fcom.anylogic.help%2Fhtml%2Fdata%2Fcollections-statistics-api.html

Anylogic wearhouse - how to combine two agents to create one final agent

Good afternoon to everyone,
I have a problem with the software AnyLogic. I have to do a program that is able to combine two agents (two different semifinished) to create one final agent (final product). The problem is that the two semifinished have different production time, so I need a function that is able to accept one agent (the first semifinished), than to wait for the second agent and at the end to generate one final agent from the previous two agents (semifinished). How it's possible to do this? I have already tried with the function "Combine" without any success.
You need to use the "Assember" object from the process library. Speciy how many agents of type A and B you need (1 each in your case). The assember will create a new agent type (you need to specify it) from the 2 incoming agents once it has got 1 of each.
Also check the help on the Assembler, you can do lots of fine-tuning with it.
cheers