Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9234741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:51:39+00:00 2026-06-18T06:51:39+00:00

I have looked here: Example code Description NetLogo project with vector map data I

  • 0

I have looked here: Example code Description

NetLogo project with vector map data

I am using vector map where is roads. Then i draw links where road is. In image where starting point is, that is capital city (Riga) of Latvia. To left side is city Ventspils, witch is about 200 kilometers from Riga. to top is Latvia/Estonia border and also about 200 km. To bottom is about 100 km.

What i want is calculate where i need to place electricity charging station for cars. With average green car can drive 50 kilometers with full battery. So. I know that to Ventspils is about 200 km. We need 4 charging stations on that road.

Idea No 1 is just after every 50 kilometrs to all directions from starting point place charging station. (tree symbols on picture). At this moment charging stations (trees) i am placing at random location:

to setup-stacijas
  set-default-shape boats "tree"
  create-boats num-boats [
    set speed 0 ; min-speed + random-float (max-speed - min-speed)
    let l one-of links
    set size 18
    set-next-stacija-link l [end1] of l
  ]
end 

to set-next-stacija-link [l n] ;; boat proc
  set cur-link l
  move-to n
  ifelse n = [end1] of l [set to-node [end2] of l] [set to-node [end1] of l]
  face to-node
end

Questions:

How i can calculate distance xx kilometers to all directions?

Vector map with links and random charging stations

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:51:40+00:00Added an answer on June 18, 2026 at 6:51 am

    An AGENT (a patch or a turtle) can use the DISTANCE primitive along with the MOD operator to find other AGENTS that are multiples of 50 “miles” away.

    I assume that 1 patch = 1 mile in our simulation.
    I assume that the “links” are connected to turtles of breed “node”.
    I assume that START is a variable that contains a “node”.

    ;; get all nodes that are multiples of 50 miles from start
    let stations no-turtles
    ask start [ set stations nodes with [ (floor distance myself) MOD 50 = 0 ]
    

    This isn’t perfect for many reasons.

    • It assumes all links are 1 unit or less long.
    • Roads that run across or along the arc at 50 miles will ALL be included, so they will ALL have stations.
    • Other odd stuff I haven’t thought off.

    Some other iterative methods suggest themselves:

    1. Setting “travelers” on the roads to “drop” charging stations every 50 (or so) miles.

      • At intersections, traveler splits into new travelers to travel each branch
      • when traveler meets a traveler, if the total distance from each traveler to its last “station” is more than 50 miles, a station is created. In any case, both travelers die.
      • when a traveler finds an existing station, it dies.

      In this way, stations will be placed all along all roads.

    2. Fill the patches with stations, in a hex-grid, 25 or something miles in radius. Let them migrate.

      • Make the stations not on roads move toward the nearest road.
      • One all stations have found a road, make stations move away from stations < 50 miles away, moving along roads (break tie by moving away from center of map).
      • stations that hit the edge will “fall off” (die)
      • so, stations will space themselves out, and extra staions will fall off the edges of map.

      This might actually work.

    3. Overfil with stations, then destroy until there is only just enough

      • Create a station on every mile of road.
      • pick one station
      • ## ask all other stations in 49 mile radius to die – mark it
      • pick one of the stations 50 miles away.
      • repeat from ## unil all stations are marked.

      That one probably is not optimal.

    4. Simulate cars on your roads–create stations where they die.

      • Put cars randomly on your roads (starting from cities). Cars can travel about 50 miles before needing recharge (dying)
      • there are no stations
      • simulate cars driving randomly on the roads.
      • when a car hits a station it recharges fully
      • if a car runs out of charge, it dies, and the counter for that patch/node/location is increased
      • repeat
      • when the counter in a patch exceeds some value, put a station there.
      • when a station is created, the counters for all patches in a 50 mile radius are reduced–to 0 nearest the station, and by 0 furthest, in a gradular fashion.

      Eventually, stations will pop-up where they are needed. This one will be fun to watch.

    ~~James

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked at several questions here about using Java to drive a telnet
I have looked here and from what I understand the following regex simply means
I have looked around here and the Internet in general but it seems this
I have looked on here and tried every answer available, but it is still
I have looked at the documentation here: http://docs.python.org/dev/library/xml.etree.elementtree.html#xml.etree.ElementTree.SubElement The parent and tag argument seems
I seem to have looked through many solution on here and the web and
Composer is a PHP package manager. I have looked through the documentation here: http://getcomposer.org/
I have looked at many questions here (and many more websites) and some provided
I have some code for drawing polygons edges that is supposed to draw, for
So, here is the scenario: I have Neo4J server running locally with some data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.