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.

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.