Truck not moving on a map when used process flow

Truck not moving on a map when used process flow

sahil_b3
Not applicable
22 Views
3 Replies
Message 1 of 4

Truck not moving on a map when used process flow

sahil_b3
Not applicable

[ FlexSim 22.2.1 ]

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!

0 Likes
Accepted solutions (1)
23 Views
3 Replies
Replies (3)
Message 2 of 4

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

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

Message 3 of 4

kavika_faleumu
Autodesk
Autodesk

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["Origin"];
  point1.setProperty("Latitude", data["Origin_Lat"]);
  point1.setProperty("Longitude", data["Origin_Lon"]);

  // Create a second point
  Object point2 = createinstance(library().find("/GIS/Point"), navigator);
  point2.name = data["Destination"];
  point2.setProperty("Latitude", data["Destination_Lat"]);
  point2.setProperty("Longitude", data["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
Message 4 of 4

Jeanette_Fullmer
Community Manager
Community Manager

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