cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

How to automate the data to mimic continous operation of a Thing?

tyadav
1-Newbie

How to automate the data to mimic continous operation of a Thing?

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?

1 ACCEPTED SOLUTION

Accepted Solutions
mlähde
3-Visitor
(To:tyadav)

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

View solution in original post

2 REPLIES 2
mlähde
3-Visitor
(To:tyadav)

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

tyadav
1-Newbie
(To:mlähde)

Thanks!

Some tweaks were needed to adapt it according to my project but the basic idea works correctly.

Top Tags