How to model breakdowns of transporters (in a transporter fleet)? - anylogic

I want to model breakdowns of a Transporter (using the TransporterFleet). When breaking down, the transporter should stop its movements, and go on moving when repaired.
I found the function "Agent.stop()" to stop the movement.
Are you aware of a function like "goOn() / resumeMovement()"... ?
Is there another best practise, how to model breakdowns of transporters?
Thanks and happy homeofficing!

I found a partial answer:
To stop (breakdown) a transporter temporarily it is possible to set the maximum speed to 0. After the breakdown the original maximum speed can be set again.
Transporter.setMaximumSpeed(double speed, SpeedUnits units)
Warning: This can cause internal Anylogic Errors when using version < 8.5.2

Related

Simulation stuck while producing the agents in AnyLogic

I have 100 cubic meter tank and I have 133,333 bottles to fill. When tank get fill I am using
source.injact(133,333)
My first issue was a lack of memory, which I resolved, and now agents are being produced; however, once the source began producing, the simulation stuck and run very slow. How can I solve this issue?
if you have 100,000 agents and if all of them are using the fluid library, there's a chance that things will be very slow.
That's all i can say with the information provided.
I wouldn't use the fluid library inside a bottle agent... I would model that differently (if you are doing that, which i don't know if you are)
It can also be that your computer is slow

Bulk conveyors are rounding batch sizes and losing material... What causes this and how do you fix it?

In my model I have bulk conveyors filling tanks throughout the model, and delays which are stopped upon the tanks becoming full with a delay.stopDelayForAll() command. However, occasionally the tanks fill up to 999.999 / 1000 and never completely fill due to some amount being rounded and lost on the bulk conveyor (as shown in the console warning in the picture), so my agents in the delay blocks get stuck and never leave the delay. When this happens, the conveyor shows that it is still moving and still has some material (on the order of anywhere from 1E-6 to 1E-3 kilograms), but this material never actually flows to the tank.
I have a variable (type double) called d_conveyorThroughputTPH representing the throughput in tons per hour, and in the conveyor I had the tons/sec input set to d_conveyorThroughputTPH/3600 - I initially thought the machine precision of this division was causing the rounding error, but even after changing that conveyor parameter to roundToDecimal(d_conveyorThroughputTPH/3600, 3), the issue still persists.
My conveyor lengths are 'Defined by conveyor belt shape' and the speeds are 500fpm.
Does anybody know what may be the cause of this issue, or how to solve it?
Thanks
The fluid library has some tolerance levels that apply that can cause this problem
https://anylogic.help/library-reference-guides/fluid-library/index.html#handling-numeric-errors
The biggest issue with this, is that in a model, this might happen with such an extremely low probability that it's easy to get confused
It's not super easy to find a solution.

Is there a way to record when (and how often) Transporters get within a certain distance of each other?

I have an AnyLogic simulation model using trucks and forklifts as agents (Transporter type), and among other things would like to identify each time one of them becomes within a certain distance of another one (example within 5 meters). I will record this count as a variable within the main space of the model. I am using path-guided navigation.
I have seen a method "agentsInRange" which will probably be able to do the trick, but am not sure where to call this from. I assume I should be able to use the AL functionality of "Min distance to obstacle" (TransporterFleet) and "Collision detection timeout" (TransporterControl)?
Thanks in advance!
Since there don't seem to be pre-built functions for this, afaik, the easiest way is to:
add an int variable to your transporter agent type counter
add an event to your transporter type checkCollision that triggers every second or so
in the event, loop across the entire population of transporters and count the number that are closer than X meters (use distanceTo(otherTransporter) and write your own custom code)
add that number to counter
Note that this might be very inefficient computationally as it is quite brute-force. But might be good enough :)

Energy Consumption in Anylogic

I would like to analyse the electrical energy consumed by a furnace in a conveyor system. Is there a method or specific function to do this using Anylogic?
I've found little material surrounding this, so pointing in the right direction would be great.
Simple answer: There is no build-in functionality. But you can easily do this yourself.
If you want very high accuracy, you should check system dynamics (but this slows your model quite a bit).
If you want a simple approach, I can think of this:
create a variable elecConsumptionPerMin in your furnace agent
create an event consumeElec in your furnace that cyclically (every minute) adds to the total furnace consumption (another variable)
on model startup, ideally set myFurnace.consumeElec.suspend()
when the furnace starts producing, call ´myFurnace.consumeElec.resume()` to start consuming enegery
Obviously, you can refine this to the nth degree and you might also want to experiment with state charts. But this is the simple approach

AnyLogic: How to set pedestrian comfortable speed beyond the range

I got the problem of the pedestrian library. I would like to use the pedestrian library to simulate the behavior of the vehicle, therefore, I would like to set the comfortable speed of the agent to be, say 70km/h. However, there is an error saying the speed has to be within [0mps, 10mps]. Is there any way to set whatever speed I want?
Thank you,
Jiannan
First why don't you use the road traffic library? But you must have your reasons.
You can't change the maximum speed value, but what you can do, which is not a very elegant solution, but a solution nonetheless, is to change the time scale of your model. There is no direct option for that, so you basically have to create your own clock that runs your way.
So for instance, if you want your car to move at 20mps, you choose 10 mps as the comfortable speed and you have the transformation customTime(time())=0.5*time(), where custom time is your own function.
So every time 1 second passes in the simulation, in your custom clock only 0.5 seconds will pass... You just have to take care of the statistics you are collecting so they fit your time scale.
Also, you will have to change everything according to your clock in your model, because Anylogic will continue showing you things in normal seconds.
Hope that helps :)