question

Sahil B3 avatar image
0 Likes"
Sahil B3 asked Jeanette F commented

Truck not moving on a map when used process flow

I am trying to model truck movement on a map using the process flow. The goal is to create points on the Map using table, form road connection between them, and move a truck from one point to other.

I followed a couple of examples and was able to define the process flow. However, the task executor fails and does not appear on the map.

This goes away if I manually place points into the map. Then the travel part of the process flow works.


Map_Test.fsm

Thanks in advance!

FlexSim 22.2.1
proces flowmap
map-test.fsm (4.7 MiB)
· 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 @Sahil B3, was Jason Lightfoot'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

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Kavika F commented

Don't create the taskexecuter in the GIS navigator. Just leave it in the model - your 'A' connection will assign the navigator

· 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.

Kavika F avatar image Kavika F ♦ commented ·

In addition to what Jason says, I don't think the GIS navigator functions properly with points made while the model's running. If you generate your points beforehand using a script or user command and then A-connect the Task Executer to a point, it should function correctly. Here's a rework of your code to generate points with code rather than process flow:

// Create a map object if one does not exist
Object map = model().find("MyMap_1");
if (!map) {
    map = createinstance(library().find("/GIS/Map"), model());
    map.name = "MyMap_1";
    map.setSize(30, 20, 2);
    map.setLocation(10, 0, 0);
    
    map.setProperty("Latitude", 40.54);
    map.setProperty("Longitude", -111.76);
    map.setProperty("Zoom", 11.87);
}
 
// The map should have asserted a GISNavigator when it was created
Object navigator = model().find("GISNavigator");
if (!navigator)
    return 0;

//reference an existing global table with all the cities and their latitude and longitude 
Table data = Table("Data_Points");

if (navigator.subnodes.length == data.numRows) {
  return 1;
}

// Delete any existing points
navigator.subnodes.clear();



for (int i = 1; i <= data.numRows; i++) {
  // Create the first point
  Object point1 = createinstance(library().find("/GIS/Point"), navigator);
  point1.name = data[i]["Origin"];
  point1.setProperty("Latitude", data[i]["Origin_Lat"]);
  point1.setProperty("Longitude", data[i]["Origin_Lon"]);

  // Create a second point
  Object point2 = createinstance(library().find("/GIS/Point"), navigator);
  point2.name = data[i]["Destination"];
  point2.setProperty("Latitude", data[i]["Destination_Lat"]);
  point2.setProperty("Longitude", data[i]["Destination_Lon"]);

  // Connect the points to create a route
  contextdragconnection(point1, point2, "A");

  // Get a reference to the newly created route
  treenode routeNode = getvarnode(point1, "routes").last;

  // Set its Update Type to Driving Roads and Update it
  routeNode.subnodes["updateType"].value = GIS_UPDATE_TYPE_DRIVING_ROADS;
  function_s(navigator, "updateRoute", routeNode);
}

//repaint the map to show new points
repaintall();
0 Likes 0 ·