Netlogo simulation how to add gas-station? - netlogo

I have a smart city simulation project using Netlogo and I need to add a "Turtle Shapes" gas station in the tools but I dont know how can I put it in the street be cause I want the cars that I have in simulation to pass throw and take gasoline my question is how can I add the gas station and calculate the total consomation of gasoline by cars and thanks.
The next image shows the simulation but without gas-station!!

Wow really cool project! Basically you can see the gas station as a particular kind of patch, then if a car touch this patch his energy goes up to maximum. The answer now is: how the car knows where is the gas station? You can do something like that: everyone that pass near the gas station leave a scent of knowledge of where the gas station is and if for example a car is half empty fuel then it starts follow the scent where is more strong and arrives at the gas station. I do this for my ant colony in order to make return them to the nest from every point of the map and it works just fine. Here's my project on github, I just upload it for you

Related

How to simulate a pickup process happening in the parking lot in AnyLogic?

I am modeling a warehouse yard where trucks arrive, get loaded/offloaded and leave the site. The complexity arises when modeling the drop trailers. Those vehicles consist of two parts: tractor and trailer. Tractor and trailer enter the yard as one entity and move to the parking lot. There, the tractor drops the trailer (turquoise colored rectangles in the picture below) and then then leaves the yard. After some time another tractor (pink colored in the picture below) comes to pick up one of those trailers. When there is no free space in the parking lot, model throws an error, because I use carMoveTo block to send it to the parkingLot. Therefore it requires additional space to move the tractor. How can I avoid this issue? In fact, I do not want that pink tractor to seize a free parking lot, but to pick up one of those trailers. I tried suppressing the error by using "on the way not found" option in the carMoveTo block, but I need to get a close-to-reality animation of the yard.
I would not advise mixing the road traffic library blocks with the Process Modelling Library (PML) Blocks, unless you really need to.
You can get near-perfect animation by making use of a network-type model and just the PML blocks. You will start by replacing your Car Move To block with just a MoveTo block
You can check the WholeSale Warehouse example in AnyLogic.
There they make use of a network diagram and PML blocks to simulation all the relative parking movements of trucks and trailers.
You can do something similar by creating the correct network and node points that indicate how a truck must move when it is parking a trailer and when it is picking up a trailer.
If this solution is not scalable and you cant draw lines, you can always simply just specify the X,Y, Z coordinates.
You might then need multiple MoveTo blocks for the entire movement or you can create some sort of loop where you give a truck a list of locations to move to, the truck will go through the loop and simply execute moving to the next location in the list, until it is done and then continue with the flow chart

Car failed to change the route error in anyLogic

I am Simulating the road traffic model in anyLogic. I am making a cross road network of four roads using one intersection and two car source. I have used select Output5 twice as seen in screenshot below.
Here road on East side is named as RoadE, road on West side is named as roadW, road on North side is named as roadN and road on South side is named as roadS.
Logic:-
Every time i am trying to run the model, it is throwing same exception as :
Why this agent is not able to choose right lane?
Make sure that the road segment (where the car comes from) is long enough. If it is too short, some cars might not have enough space and time to switch into the required lane.
Just make your bottom road a little longer and it will work.
Just see on lines consists from points on crossroad: right way does not conntected with left road. Car cant ride left from right way, and because it try to cange lane.
Do it herself (select crossroad, and then double click on rectangle on the end of way).
Offcorse, if your cars can ride left from right way)

Netlogo - agent travels along the link

I am modelling another project concerning the warehouse operations. In this particular instance, I have to visualize the warehouse layout of the storage space. I plan to define a number of links as routes where the agents (forklift truck) can travel along with in the warehouse.
For each link, there is a distance associated with. It’s not the link length as the distance but a distance attributes user defined. If I set a forklift truck driving speed, how do I reflect it accurately in the model with the use of command like fd (or forward) and jump. How do I specify the unit of measure in jump or fd in association with the distance defined in the link to ensure the forklift truck is moving in a correct distance per tick given the speed and distance.
A simple demo would be highly appreciated! Great thanks!

AnyLogic: How to calculate pedestrian traveled distance?

Is there any specific way (except writing functions myself) to calculate traveled distance of a ped object in pedestrian library, something like getDistanceDriven() method in Road Traffic Library?
there is only one way I can think of beyond coding it yourself: use the "Log model execution" functionality. Just click on the database on the project view and tick the box:
.
Then run your model and it will record the distance travelled for each agent in the dbase view "agent_movement_stats_log". Note that you can turn off any of the other logs you don't need...

How should i make infinte ground ?

I'm trying to make a simplified version of crazy taxi . For the first step i need to make an infinite ground . I'VE searched online but couldn't find any examples .
Can i find any example of how to do this ?
https://www.youtube.com/watch?v=rhTPxrJICVg&list=PLLH3mUGkfFCXQcNBz_FZDpqJfQlupTznd
N3K makes an infinite runner in Subway Surfers style, meaning ground coming from the back and going towards the camera.
The above link is to his tutorial series.
This is a very broad question I try to give a very simplified answer to get you going.
To create endless road you need some sort of procedural function that generates corners for your track. If you do not need to backtrack you can cook something up yourself like (in X distance turn X degrees to the right). If you do need to backtrack you need something like perlin/simplex noise that always generates the same value based on 1 or more other values. You could use total distance to get the curve in the road.
You simply keep generating the world on the fly and unload pieces of the world you don't need any more. If the player can alter the world like destroying street furniture or leaving skitmarks you need to implement a chunk system. When you backtrack and generate a cerain part of the world with your procedural function you can have permanent changes the player made in that specific part by saving and loading to the chunk. Much like Minecraft does it actually.