LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PARALLEL PROCESS

I NEED TO GENERATE RANDOM NUMBERS AT A DETERMINED FREQUENCY 
WITHIN THE CONFIGURED TIME.
FOR EXAMPLE MY CONFIGURED TIME IS 30 SECONDS AND
I WANT TO GENERATE RANDOM NUMBERS EVERY 400 mS,
AND THESE RANDOM NUMBERS PUT INSIDE AN ARRAY
0 Kudos
Message 1 of 7
(1,328 Views)

I suggest you to take some online course, you can find these here (pay special attention to shift registers, and timing):

(from Hooovahh copypaste)

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required

Message 2 of 7
(1,301 Views)

Hi m,

 

most of the things in your VI doesn't make any sense - and seem unrelated to your problem…

 

FOR EXAMPLE MY CONFIGURED TIME IS 30 SECONDS AND I WANT TO GENERATE RANDOM NUMBERS EVERY 400 mS, AND THESE  RANDOM NUMBERS PUT INSIDE AN ARRAY 

No need to shout - or is your keyboard broken?

 

All you need is a Quotient&Remainder function, a FOR loop with a wait and the Random function inside. LabVIEW does the rest by autoindexing!

FOR i:= 0 to "configured time" QR delay
  rnd()
  wait(delay)
NEXT
Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 3 of 7
(1,286 Views)

Ask your classmates how they handled this Homework Assignment.  But don't, of course, "copy" their paper ...

0 Kudos
Message 4 of 7
(1,238 Views)

As a first step, please explain to me why the thread is named "PARALLEL PROCESS". Where is the parallel part?

 

As a second step, try sprinkle a little bit more thought into whatever you are wiring. For example, look at the two locations (A, B) in the image. There is no logic to your logic!

 

What do you think would happen if you remove the "select" (A), the "OR" (B), and the three boolean diagram constants and just wire across? Nothing would change! Both constructs just return the boolean input unchanged. Right?

 

BooleanRube.png

 

 

Just plain silly!

 

 

ALSO:

  • You only need to set the slide max property once outside the loop, not with every iteration, especially since the control is only read once.
  • You can get rid of the "ELAPSED TIME" indicator and just show the digital display of the slide (right-click...visible items...digital display).
  • Your "SETTING TIME" control has the wrong representation. If you want to limit it to integers, you can do that using the "data entry ..." option.
  • Your loop does not need to spin millions of times per second, so add a reasonable wait.

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 5 of 7
(1,236 Views)

My apologies -- I didn't notice you attached some code until I read Altenbach's post.  So here are some hints:

  • Think more about What you want to do, less about how to do it.
  • For example, "Generate Random numbers at a certain frequency".  You know how to generate one RN -- what does "at a certain frequency" suggest?  More exactly, what does "every 400 msec" suggest?
  • Suppose I said I wanted to do something for 30 seconds at 2.5Hz.  How many of these things do I need to do?
  • Do these questions suggest very simple code ideas to you?

 

Bob Schor

0 Kudos
Message 6 of 7
(1,227 Views)

You also need to properly define what you mean by a "random number".

 

  • A random number in the interval 0..1?
  • A random integer in a certain range (e.g. dice (1..6), lotto number, etc).
  • A random number with a gaussian probability distribution?

What should the user see during the run? e.g.

 

  • An array that grows by one element every 400ms? (less efficient)
  • A full sized array containing NaN where elements are replaced with random numbers in order (more memory efficient)
  • Just the current random number and the final array only at the end? (more efficient)

...


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 7
(1,226 Views)