LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Random Sample not updated

Solved!
Go to solution

Then you should be using the wire that comes out of function A!  Not the original k wire.  So if you need a second random number generator, then put it in.

0 Kudos
Message 11 of 21
(1,264 Views)

@Hamdi30 wrote:

Given you example, I need k to be updated to k-prime for function B before the loop repeats, and using the same random number generator. Hope this makes clear what I am looking for. Thanks. 


No, it makes no sense!

 

Why does it have to be the same? if you need more than 1 random numbers, you can place multiple generators.

 

Still, from your formula they cannot be independent, but just time (or k-) shifted, so you need to maintain the correlations and keep a history of at least the last 5 points.

 

Do you have a web link that describes the algorithm you are trying to implement? What's the purpose of all this? What does it all mean? Just having some random numbers dancing incoherently is not really informative or interesting.

0 Kudos
Message 12 of 21
(1,253 Views)

Again, I need both functions using “one” random number generator (rng). And the result of function A should be used as input to function B. This can be done easily.

 

The hard part is the following. Given there is a while loop iterates every period of time. 

In one iteration (name it k), I need function A uses the generated number of the rng. Then after 5 k or five iterations, function B uses the generated number of the rng. In other words, I need each function (inside the while loop) works only and every specific number of while-loop’s iterations. For example, if function A uses the generated number x at iteration number k and performs the calculations, the output of it will be used by function B but after 5 iterations. Please note that after 5 iterations, the x value should be updated ( given that a new random number generated in each iteration from the “same source” not a different rng. 

0 Kudos
Message 13 of 21
(1,250 Views)

And that is what you use shift registers for!  Or even feedback nodes.  The values you put into either can be returned 1 to N iterations later.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

0 Kudos
Message 14 of 21
(1,248 Views)

Currently I don’t have access to my laptop and using my cellphone to reply to your comments. I don’t need two random number generators because I am using a “ similar” vi that mimics my original vi. The origin one has one source of input comes from a device called opal-rt through a communication network uses dnp3 protocol which is mostly not supported by many labview basic licenses. That’s why I simplified what I need in a “similar” vi and a diagram.

The one random number is really a mimic to what I have in the real vi.   Hope now makes sense. 

0 Kudos
Message 15 of 21
(1,245 Views)

Again, please give us a web link that describes the algorithm. Does it have a name?

 

Maybe something like this? (You can initialize the array with anything you want but discard the first five values later)

 

Meaninglessprocessing.png

 

0 Kudos
Message 16 of 21
(1,241 Views)

Altenbach,

 

Do you need a wire from the random number into the element of the right hand side in the IPE?

Message 17 of 21
(1,234 Views)

@RavensFan wrote:

Do you need a wire from the random number into the element of the right hand side in the IPE?


Yes. 😄

 

(I corrected it...)

Message 18 of 21
(1,232 Views)

I think I am getting very close. The algorithm is not on the web—I am developing it for my PhD. I will definitely share it not only with you but also with the world once I complete it. Now, could you please share your last vi, please. I think you are right I need to understand the shift register very well. Thank you again. 


@altenbach wrote:

Again, please give us a web link that describes the algorithm. Does it have a name?

 

Maybe something like this? (You can initialize the array with anything you want but discard the first five values later)


 

0 Kudos
Message 19 of 21
(1,228 Views)
Solution
Accepted by Hamdi30

Here's a version that initializes with zeroes instead (probably preferred). Modify as needed.

Make sure you completely understand every single part of it!

 

Meaninglessprocessing2.png

0 Kudos
Message 20 of 21
(1,219 Views)