LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing 2 results to set next operation

Greetings!
 
After running 2 separate random number generators (A & B) to a limit, say the first one to 100, I want to decriment only the random number generator that got to the limit first and run the 2 random number generators again (and again). Of course I have to alternate between decrimenting A & B depending on the results. I thought that comparing the difference in timing between the two random number generators might achieve this.
 
What are my other options?
 
Thank you for your help!
 
Newbie 2
 
 
0 Kudos
Message 1 of 5
(3,017 Views)

Could you explain?

  • What is the meaning of "running to a limit"? Are you adding random numbers and testing if the sum reaches a limit?
  • What you mean by decrementing? e.g.:
    • starting to subtract random numbers and then start incrementing again when it reaches zero?
    • starting over at zero?
  • Why would there be different timings? What determines the timing? If you would just run the in he same loop, they would be synchronous.

Please clarify! 🙂

I don't see how timing would help. Just use a loop with two shift registers and some comparison logic.

 

0 Kudos
Message 2 of 5
(3,013 Views)
Greetings,
 
I am using two random number generators to simulate the output of two machines, "A" & "B". These two machines hypothetically measure the variation in a part in a production setting. The random number generator is initially multiplied by 10. A limit of 100 (set by the machine operator) is the total amount of variation that is exceptable before a machining process need to be tuned to reduce the variation.
 
When machine "A" or "B" reaches the operator set limit (say 100), the machine that hits the limit first, has the initial random number multiplier (10) reduced or decrimented by 1 to 9 automatically within the .vi and maybe reduced by 1 again to 8. The test is repeated until the limit is reached again. The only machine that has its random number multiplier reduced is the first  one to reach the operator set limit.
 
I only have a few weeks experience w/ Lab View so my knowledge with the software is limited.
 
Thanks for your help, I hope this clears up the issue(s).
 
Newbie 2
 
0 Kudos
Message 3 of 5
(3,005 Views)

Also,

Currently both random number generators are running in the while loop to reached their limits.

 

Newbie 2

0 Kudos
Message 4 of 5
(3,004 Views)

Hi newbie 2,

Thanks for contacting National Instruments.  I have been reading over your past two posts and I agree with altenbach in that using shift registers with some comparison logic will be the easiest way and most effective.  However, if you really do want to use some kind of timing, you could implement the "Get Date/Time In Seconds" function and get the value from this function each time one of the machines reaches the limit.  Using this, you could compare the values you get for each function when it reaches the limit and then whichever one has a value that is "less" than the other should be the one that you can decrement.  I hope some of this helps and if you have any further questions, please feel free to reply back and we can go from there.  Thanks and good luck with your application!

Regards

Noah R
Applications Engineering
National Instruments
0 Kudos
Message 5 of 5
(2,974 Views)