3 Replies Latest reply on Nov 13, 2017 4:26 PM by pchung RSS
    tyadav Newbie

    How to simulate position tracking in Thingworx?

    Hi,

     

    I have been a doing a project in Thingworx and I need to simulate the position tracking for my things. For eg: If I have a car as a Thing, and it has two modes moving and stopped. I need to simulate the changing latitude and longitude for the car when it is in 'moving' state and store the generated coordinates so that they can be later displayed on the Google map widget in the mashup. Similarly, if the car is stopped then it should display the location where it was last stopped. I have the following questions:

     

    1. How do I achieve this? As in, should I create and use a service or a subscription (with speed values as the trigger)?

    2. What sort of code snippet will be required for such a functionality?

    3. Should I employ the Google api?

     

    Thanks!

      • Re: How to simulate position tracking in Thingworx?
        pchung Collaborator

        at one point in time i created something that was a simulator for this.

        Basically I created:

        1. a geofence

        2. 'cars'

        3. a Timer

        4. each time the timer finished, i would increment lat/long randomly by like .001 or something

         

        then based on some other rules i would either turn them on or off and keep them within the geofence

          • Re: How to simulate position tracking in Thingworx?
            tyadav Newbie

            Hey Pai,

             

            Thanks for your reply and I was thinking along the same lines but how did you make sure that the cars were reasonable moving in the coordinates of a particular road or something like that while you were incrementing the lat/long?As in, it didn't show the car moving in a jungle or a water body? I understand that while simulating we always take rough estimate but the water and jungle thing etc. could affect the data.

             

            Also for eg: if my output variable for location is me.Location and the datatype is location then what exactly should be the syntax to provide this variable with the values of Lat/long so that it shows up on map and datatables in the correct format?

             

            Thanks!