I have a flow chart like below.
my current tmE_SystemA measured time in the system for a customer, regardless of their arrival stream. However, I also would like to know the time for a customer in the system for each arrival stream.
I tried to add 3 more Time Measure End before the current tmE_SystemA and each measure for one tmS_A. But it will gives me error when customer from other streams reach to the new Time Measure End (e.g. when customer from customerArrival_A2 reached tmE_A1 it will show error, saying that this agent not pass through corresponding Time Measure Start.)
So how can I properly measure the time for each arrival stream?
Instead of timeMeasureStart and timeMeasureEnd blocks, you can just add variables inside your Customer agent called startTime, endTime and cycleTime of type double.
Then, at endService, you can type agent.cycleTime=agent.endTime-agent.startTime;. You will have the time in system for each agent.
Related
I am building a model in Anylogic where customers order containers at terminals with a starting hourly rate (which differs per hour), which I load from database to a schedule and then let the customers order at every terminal with the rate of the schedule. When they have ordered, a truck will bring the container from terminal to customer.
However, I want to give each possible route for the trucks (directly or via a hub that is open at night) some costs (depends on time of day and travel time). Depending on these costs, the agents choose which route to take and (as the hub route is partly done at night) at what time to travel. The choices are:
Travel directly (arrive at the terminal at day time)
Travel via hub (arrive at the terminal at night time)
Thus, I want to let the hourly arrival rate schedule change based on the choices agents make after calculations. Does anybody know how to let the arrival rate schedule (different per hour) change depending on agent choices (based on route costs)?
Based on your answers, you don't really need to change the hourly order rate schedule, rather you need to choose when to deliver the containers to the customers. For this, place the arrived orders in a queue and process them with FIFO principle (or LIFO, whichever priority you assign them).
But if you insist on having different hourly order rates, you can use the following approach. So, if you want to distribute 10 arrivals during an hour, you can use exponential(10) as the interarrival distribution. Please see the screenshot below. I update the variable trucks1 dynamically during the simulation to have different number of arrivals for different hours.
I have the following problem which I am unable to solve:
I have a situation where a security point (added as delay) holds every half an hour a 15 min break. After the break, the security guards increase their speed till the queue is shorter than 10pp.
I wanted to model this as follows: a state chart with delay.set_capacity(0) after 30 minutes and delay.set_capacity(1) again after the 15 min break. For the increased speed after the break, I added an additional state with condition: queue.size()>10 and now I want to set the action such that the delay function changes the delay time from exponential (1/10) to exponential (1/5) as long as queue.size()>10.
Anyone experience with which function in the action box to use? Or would you suggest a different function?
Since you are using, or at least want to use a statechart I would suggest the following design, where you have composite states inside the working state to indicate if the security agent is working fast or normal and a message transition to let it move from one state to the next.
It is advised to use a message transition and trigger it as needed instead of a conditional state which gets chected for every change inside the agent since this can be a computational expensive exercise.
I assume you already implemented the correct capacity settings for the different on enter actions for working and breaking
Now you simply need to send the message every time an agent enters the queue and every time it exits the delay block, and of course, see the delay time based on the state of the statechart.
Aee screenshot below.
I have a model where the queue's capacity limit is 2. I also set up a "SelectOutput"-block before the queue, as customers who can't enter the queue are lost. So now I want to find out the mean rate at which customers are lost? How can I do that?
Many thanks!
Create a variable leftLastMin of type int.
In the "on exit (false)" code of the SelectOutput, write leftLastMin ++
Now, create a recurring event that triggers every minute. Here, you can easily do something with the number left last minute (traceln, store into dataset or statistics object...).
Also, reset your counter leftLastMin=0 so it is ready for the next minute.
I'm running a similation where i would lige to know the total amount of time agents spends in a delay block. I can access the data when running single simulations in the Dataset log under flowchart_stats_time_in_state_log
https://imgur.com/R5DG51a
However i would like to to write the data from block 5 (spraying) to an output in order to store the data when running multiple simulations.
https://imgur.com/MwPBvO8
Im guessing that the value reffence should look something like the expression below. It is not working however so i would aprreciate it alot if anybody could help me out or suggest an alternate solution for getting the data.
flowchart_stats_time_in_state_log.total_seconds.spraying;
Btw. Time measures dose not work for this situation since i need to know the total amount of time spend in a block after a 12 hour shift. with time measures i do not get the data from the agents that are still in the block when the simulation ends.
Based on the goal of summing all processing times, you could solve it mathematically. Set the output equal to block.statsUtilization.mean() * capacity * time() calculated on simulation end.
For example, if you have a capacity of 1 and a run length of 100 minutes, then if you had a utilization of 50%; that means you had an agent in the block for 50 minutes. Utilization = time busy / total time. Because of this relationship, we can calculate how long agents were actually in the block.
Another alternative would be to have a variable to track time in block, incrementing when the agents leave. At end of the run, you would need to call a function to iterate over the agents still in the block to add their time. AnyLogic allows you to pretty easily loop over queues, delays, or anything that holds agents:
for( MyAgent agent : delayBlockName ){
variable += time() - agent.enterBlockTime;
}
To implement this solution, you would need to create your own agent (name it something better than MyAgent) with a variable for when the agent enters the block. You would then need to then mark the time each agent enters the block.
I want to use Google Measurement Protocol to record offline events, i.e. take data from an EPOS system and track them in Google Analytics. This would be a batch process once a day. How do I tell Google what the date of the event is? If the console app went offline for a few days I wouldn't want three days worth of events to be associated with one day.
Your best best currently is to use the Queue Time Measurement Protocol Parameter.
v=1&tid=UA-123456-1&cid=5555&t=pageview&dp=%2FpageA&qt=343
Queue Time is used to collect offline / latent hits. The value represents the time delta (in milliseconds) between when the hit being reported occurred and the time the hit was sent. The value must be greater than or equal to 0. Values greater than four hours may lead to hits not being processed.