question

Tomi Kosunen avatar image
0 Likes"
Tomi Kosunen asked Jeanette F commented

Create GIS points with script

Hi

I am asked to build a model about courier service. As input data, the model gets orders, which are retrieval and delivery coordinates (Lon, Lat) in the city map. There are number of couriers driving in the system. The new order is allocated to a courier with some decision logic. Probably the courier's current location and the driving time to the retrieval location are used in the decision. I'm using Gis Map to make the model.

I have some difficulties with the model:

My first idea was to create new Point (retrieval and destination) into the Map at specific location every time, the courier gets new order. I'm not able to get the model running. The points are created, but I get an exception when the traveller is starting its travel. See model MapGrid_createLive.fsm

My second idea was to move existing point to a new location. I'm able to move existing point to a new location, but the routing path does not update. Am I missing some update command? Now I rund repaintall() and updatelocations commands. See model MapGrid_move.fsmNote also, that if the Point3 is moved "manually" just before the second Travel command, the path is updated correctly.

My third (and probably the best) option was to create grid of Points (1 km x 1 km) that covers the whole city. The grid would be something like 30 x 30 Points (900 Points). There muts be connection (path) from every Point to every point. I tried to make the grid by script. Making the Points was succeed, but connecting from all Points to all Points was running over night and it was still running in the next morning. Why it takes so long time? See model MapGrid_createGrid.fsmNote: in this example there are only 50 Points. The script running time grows exponentially as the number grows.

FlexSim 23.0.1
scriptgis map
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Tomi Kosunen, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Matthew Gillespie commented

I got your second approach to work. You were missing the "calculateRoutePath" function which updates the drawn and travellled path between the two points. I essentially just copied the eventfunction code from the GIS Point library object in the main tree.

1678963508167.png

This does however still not update the routing table of the GIS navigator (which is also why this does not help to create new points during the model run). If you only use this for direct point to point travel it should be fine. However when the task executer travels through other points to get to its destination this will likely result in wrong routing at some point.

mapgrid-move_fm.fsm


1678963508167.png (140.4 KiB)
mapgrid-move-fm.fsm (1003.2 KiB)
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Tomi Kosunen avatar image Tomi Kosunen commented ·

Thx @Felix Möhlmann . I edited your model a bit and this is actually quite good and light solution. The traveller is always running from point 1 to point 2 and the location of those points are just changing. I'm going to need a pair of Points for every task executer. I think, that I can manage with the point-to-point travels as I can handle the travel chains in other way. The difficult part will be to select the closest task executer: none of the task executers have the path to the destination so I have to create path for every possible task executer, calculate the travel time and select the closest. That will probably be time consuming task.

mapgrid-move-fm_1.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Tomi Kosunen commented ·
I don't know how much input data and what exact form it has. Maybe you could try to group the coordinates together so you can pre-calculate a cache of (estimated) route costs between these groups instead of checking the exact cost for each path every time.

Or you use a straight line approximation to eliminate most courier drivers first and only do a detailed check for drivers within a certain distance interval.

0 Likes 0 ·
Tomi Kosunen avatar image Tomi Kosunen Felix Möhlmann commented ·

It seems, that moving the point and calculate the path "live" on the simulation goes wrong. I assume that the path calculation is done in server somewhere and it is too slow for the simulation. Task executer starts moving on the path that is not yet calculated. Any ideas, how to make the path calculation faster (Option 3).

BTW: is the server down? The paths are not updated at all. Looking at https://maps.flexsim.com/route/v1/driving/ gives error: Web server is down

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.