Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi,
As the title suggests, I am looking for an alternative in Tjingworx as to how I can mimic the continous operation of a Thing? For eg., if I have a Windmill and I want to simulate to get the speed data from its edge sensors (one of the examples of Thingworx tutorials), then what are the possible ways in which it can be done. Of course, the Postman acting as a data generator is one way (as taught in the tutorial) but the problem with Postman is that even if I use Postman runner to generate data for more than once, it can only generate a finite number of iterations and it stops eventually once those iterations are done.
I wanted to know that is there any other way we can simulate this behavior in the TW which does not need the maximum number of iterations etc. to be performed and keeps on generating data continuously unless stopped? For eg: leaving it running for more than a couple of hours or more and being able to experience a simulated real-time continuous data generation?
Solved! Go to Solution.
Hi! Create a timer thing (a thing that implements the Timer template) and configure it to fire every x seconds/minutes/hours. Then subscribe to the timer in your own thing and run a script like:
me.speed = Math.random() * (200 - 100) + 100;
Which will give a random number between 100 and 200.
See also: Math.random() - JavaScript | MDN
Hi! Create a timer thing (a thing that implements the Timer template) and configure it to fire every x seconds/minutes/hours. Then subscribe to the timer in your own thing and run a script like:
me.speed = Math.random() * (200 - 100) + 100;
Which will give a random number between 100 and 200.
See also: Math.random() - JavaScript | MDN
Thanks!
Some tweaks were needed to adapt it according to my project but the basic idea works correctly.