I would like to model a larger number of employees (about 30) as a resource pool. Each employee is given parameters before the model starts, which the simulation end user can enter manually. Each employee has different working hours (shift work, different on each day of the week), different duration of the shift and different tasks assigned to them.
My first thought was to model each employee individually as a resource with their own shift schedule. That would be easiest, but I bet there is a nicer solution - anyone have any ideas?
If your workers have different settings such as different shift hours, they will not belong to the same ResourcePool.
You must build an agent that contains a ResourcePool (so that you can use it as a resource) with its another parameters such as capacity etc.
In my opinion, the most correct thing is to build a Population of them. Each item in the population is an amount of workers with identical parameters.
Related
In my model I only want to batch agent which are at the same location. So my source block generates the agents according to a database to a specific node (which is sometimes different for agents), now I want the agents that occur at the same node to batch in sizes of 2 and the one that are left over need to be batched alone.
How can I model this, I know that I can use the selectoutput (which says for example if location=node1 use this output etc) option, but do I than have to add for example manually 100 outputs if I've 100 different locations where the agents start or is there a more simple solution for this problem?
Added later:
Or is there another way to model my idea:
So I'm simulating an hospital environment, where logistic employees (in this case the transporter) based on predefined times collects the thrash on certain areas for example the databaserow I show in the picture below:
At 9:50, the thrash at thrash collection point at LAB_Office_2_H_T_N can be collected by the logistic employee.
So in my model I create this 2 agents (which are 2 containers, last column) based on this time and seize a transporter to collect this thrash. Since a logistic employee is able to collect 2 thrash in one time I want to batch it and let the logistic employee collect 2 thrash containers at once.
After that he transports it to the thrash dump area and is released.
The colors changed after the added information. You can use pickup and dropoff blocks instead. You can define your node requirements in the condition cell. You can use local variables like container and agent to code whatever you want. Or use "Quantity (if available)" option. There you can programmatically define how many units will be picked up by using your own function.
I'm simulating a manufacturing process. The stations need a variable number of ResourcePool "workers". Let's say there are 5 workers for 4 stations, and I want to simulate that those workers can work indifferently in any of the stations.
The problem is that they are not working in the closest station. Oppositely, even when a worker is next to the station, maybe the furthest worker goes until this station which needs the resource, and then the process starts. Obviously, this is inefficient and doesn't represent the reality.
I already have the workers defined, their shifts, their timetables, etc. I have tried to use the function getNeartestAgent() in 'Customize request choice', but it doesn't work. I also tried to calculate the distance of each agent with getDistance(), but I don't know how to manage it and I'm sure it must be a simpler solution even when I'm not working on GIS.
[31/08/22]
Recently I tried to develop a similar model, and I still have the same problem. The model consists of 3 stations which need 1 unit of ResourcePool. In this pool, there are 2 units. This units are agent type Operario. So, I need to choose the closest unit to the station. I tried several things, the following are just some...:
Service blocks -> Resource selection -> "Nearest to the agent". The agent is the material item, so the unit should go to the closest agent being treated in the station. However, it didn't work (units where to any station indeferently).
Service blocks -> Resource selection -> "Unit with top rating". The Unit rating field was 1/distanceTo(node1.getXYZ()). It didn't work either.
Stations (instead of Service blocks) -> Customize resource choice -> Resource choice condition. I can't stablish a boolean variable related to the unit position, as I can't compare among them.
Function. I can't compare units from ResourcePool, as they are detected as Agent and not as Operario.
ResourcePool. I tried to stablish the priority based on the distance to a certain node. But then I can't call these agents (Operario) from the station. It seems here I can only refer to material items, eventhough I write "unit.(...)".
Does anyone know how can I choose the closest resource to the station in which the task is performed? Should be through Customize resource choice -> Resource choice condition, but I don't know how!
when you use a service or seize block, in the advanced properties, there's an option called "Resource Selection"
You have to choose "Nearest to the agent"
If this doesn't work, it might mean that a resource that is close by and not selected, might be actually busy with something else... you have debug your model in order to be sure that it is not the case.
Is there any way to calculate the utilization of a given resource in a specific time frame? I have a machine that works h24, but during daytime hours its utilization is higher than during nighttime hours.
In the final statistics, using the function "machine.utilization()" I get a low result, which is influenced by the night hours. How can I split the two statistics?
Utilization is calculated as (work time)/(available time excluding maintenance). Which means that the measure described in your question can be achieved using 2 ways:
Make the machine 'unavailable' during the night, this way that time will be excluded in calculations
ResourcePool object has 2 properties on resource seize and on resource release which can be used to record specific instances of work time, sum it up and divide only by a period of (8hr * (num of days)) instead of total time from model start
For a little more detail and link to AnyLogic help please see the answer to another question here.
Update:
In ResourcePool's On seize and On release, AnyLogic provides a parameter called unit, which is the specific resource unit agent being processed. So getting actual use time per unit requires following:
2 collections of type LinkedHashMap that maps Agent -> Double. One collection to store start times (let's call it col_start and one to store total use times, let's call it col_worked)
On seize should contain this code: col_start.put(unit, time())
On release should contain:
double updated = col_worked.getOrDefault(unit, 0.0) + (time() - col_start.get(unit));
col_worked.put(unit, updated);
This way at any given point during model execution, col_worked will contain a mapping of resource unit Agent to the total sum of time it was utilised expressed as a double value in model time units.
In Anylogic 8.5.1, I am doing a simulation for library evacuation, I have set and agent with Option-list that contains different types of users: students, organizers, graduates, and others. Also, I have set 'custom distribution' parameter to set the distribution values for each user. Until now, I have run the model and every thing is working well.
What I want is:
1. to use 'pedFlowStatistics' line in particular places (I can do this);
2. want to count the users that pass this line (I do not know how to do it);
3. then draw a chart to highlight the different number of users that passes that particular line space (I do not know how to do it).
I need help in the above situation, thanks in advance.
I do not have a Java background.
It's not possible to count based on conditions with pedFlowStatistics... you can only count the total pedestrians using:
pedFlowStatistics.countPeds(); // counts total number of pedestrians
pedFlowStatistics.traffic(); //shows the number of pedestrians per hour
You can use these functions directly in your chart.
But since you want to count based on conditions (the type of user they are), you will need to be smart about this and depending on your model, you will have to count pedestrians in a different place... or maybe use 2 ped go to blocks and count in between... it depends on your layout and model.
I am currently working on a project to model outpatient appointment scheduling for a local hospital. The goal of this project is to model their current situation and then adjust different factors to reduce the wait time until the next available appointment. We are using AnyLogic to create the model. At this hospital the current system is as follows:
A patient calls and schedules an appointment with one of the hospitals 19 sub-specialties.
- appointment will either be a first time consultation lasting 1 hour or a follow up appointment lasting 15 minutes.
Patient waits 1 week-6 months until their appointment date (based on sub-specialty)
Patient is seen by a doctor and then exits the system
We have approached the problem in two ways, the first was to attach the schedule to the resource pool which consists of the doctors for a single sub specialty. This would allow the schedule to change as the number of doctors change. The second approach was to attach the schedule to the source which consists of the patients entering the system. This better controls the flow of individuals into the system.
We are having difficulties figuring out how to configure the model so that it accurately shows the result of adding more doctors while still allowing the flexibility we need in scheduling different length appointments in multiple sub-specialties.
If anyone has experience with AnyLogic Scheduling, has dealt with a similar problem, or has any advice on how to proceed, I would appreciate the input.
Thanks!
If I understand correctly, you want to change the number of resources you have according to a certain schedule...
In the schedule you need to you use integer type and then create your schedule based however you want. In the action you can use "value" as a variable that corresponds to the value of the current schedule value. The action in the schedule is activated everytime the schedule changes... so you can simply do resourcePool.set_capacity(value);
With this you have the flexibility to use different length appointments... You can use one different schedule for each sub-specialty