 Shalins
		
			Shalins
		
		
		
		
		
		
		
		
	
			11-27-2012 04:07 PM
Hi friends,
I'm working on a program that displays random numbers based on the user's input (i.e. how many random numbers do you want to display in the output).
For example: if the user input is 4, then 4 random numbers will be displayed.
It should also indicate the number of iterations and the time taken for it to display the random numbers.
I'm having trouble with the underlined part above.... I have attached my VI.
Solved! Go to Solution.
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			11-27-2012 04:17 PM
Shalins wrote:It should also indicate the number of iterations and the time taken for it to display the random numbers..
This is nearly impossible to answer, because the display update is asynchronous.
I don't understand your VI. Why doesn't it have a toplevel while loop? (are you using "continuous run mode"???). Then you are running three independent code fragments in parallel. I don't see why. Displaying the ms timer value will give you a random U32 without any useful information. Also the wait for FP activity makes no sense. Can you enlighten us with your thought process. I don't get it.
11-27-2012 04:26 PM
@altenbach wrote:
I don't understand your VI. Why doesn't it have a toplevel while loop? (are you using "continuous run mode"???).
I have being specified to use a FOR loop, but i really need some way to display time taken in generating the amount of random numbers....
11-27-2012 04:30 PM
altenbach wrote:
Also the wait for FP activity makes no sense.
I didn't know what to use, I just thought may be I needed something to indicate the FP activity.
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			11-27-2012 04:32 PM - edited 11-27-2012 04:35 PM
OK, now you want the time to generate the random numbers. Earlier you wanted to measure the time to display the random numbers. that is very different.
Generating a few random numbers will be way too fast to measure. Maybe if you would generate a few millions and then divide by the total number, you could get a reasonable average.
Timing a code fragment is typically done using a three frame flat sequence. Put the code in the center and a tick count in each of the other two frames. The difference between the tick counts will give you the time of the central frame in milliseconds.
(For better resolution on Windows, you can substitute the "high resolution relative seconds" (found in C:\Program Files (x86)\National Instruments\LabVIEW 2012\vi.lib\Utility), depending on LabVIEW version).
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			11-27-2012 04:36 PM - edited 11-27-2012 04:43 PM
@Shalins wrote:
@altenbach wrote:
Also the wait for FP activity makes no sense.
I didn't know what to use, I just thought may be I needed something to indicate the FP activity.
What does this have to do with benchmarking? Also your 1500ms wait makes no sense at all.
Note that you can prompt for a number. That's better than to prmpt for a string and convert it to a number later.
11-27-2012 04:49 PM
ok i got it, thanks
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			11-27-2012 04:52 PM
Here's a very quick example.....
11-27-2012 05:24 PM
how come your able to do a DBL connection between the user input and N (the count terminal) doesn't it need a conversion??
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			11-27-2012 05:43 PM
@Shalins wrote:
how come your able to do a DBL connection between the user input and N (the count terminal) doesn't it need a conversion??
Everybody is able to do that, even you did it in your original attachment. 😄
Notice the little red dot? This is a coercion dot, indicating that LabVIEW internally converted to a suitable datatype. (See also this old discussion)