LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data input constraints (using shift registers)

Solved!
Go to solution

Hello, nice to meet you.
I have a few questions about LabView programs.
I'll attach my vi.

I receive random number data using a shift register. I want to place constraints here.


1. “datav1” and “data v2” arrays can store three pieces of data each. If 10 pieces of data (5 pieces each) are filled in each array, we cannot input them even if we press the start button.
2. We can fill “data v1” with 5 pieces of data and then fill “data v2” array with 5 pieces of data.
3. If the first data in the “data v1” array is 0.43, the next data cannot be entered into the shift register unless it is within 0.33 and 0.53 (+-0.1).

 

I want to add these conditions.
Who can help me?

Thank you,

0 Kudos
Message 1 of 15
(489 Views)

if data_v1 and data_v2 can store three pieces of data, how can they have 5 pieces of data. 

 

This looks like homework, can you post the original question? 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 2 of 15
(459 Views)

Also:

 

  • What's the purpose of the "standard deviation and variance" on top of the loop.
  • The clear button seems to have the wrong mechanical action.
  • Where do you measure the array size?
  • You could do a "start=true AND "size<5" for the first case, for example.
  • You have twice as much code as needed because the top and bottom half always do exactly the same thing. Once is enough!
  • You need more logic to first fill array 1 with five points, then fill v2 with five, then stop accepting data.
  • Your loop cannot be stopped.
  • Use left-to-right wires, i.e. don't place indicators on the left.
  • You can use "use default if unwired" output tunnels to clear the array.
  • ...
0 Kudos
Message 3 of 15
(443 Views)

See if this can give you some ideas...

 

(Note that your teacher reads this forum too, so make sure you understand every single subtlety and put your own spin on it. It is a good learning experience to look at relatively clean and efficient code that avoids a lot of pointless duplications. For example why do you think you need two empty array constants to initialize the shift registers? One is enough!)

 

 

altenbach_0-1708188064575.png

 

Note that the "clear" case can probably be inside the outer FALSE case for simplicity. Personally, I would probably use an event structure, but I don't know it it was already introduced in your course.

 

0 Kudos
Message 4 of 15
(430 Views)

thank you!
You told me perfectly what I wanted.
I learned a lot from you.
The reason I added “standard deviation and variance” is to filter the data. (I don't know what function to use, but I put it in for now.)
For example, if the first data of data v1 is 0.43, I would like to be able to receive the next random number only if it is a random number within 0.33 and 0.53 (+-0.1) (adjust the value with the control). (Even if you press the add button, it does not enter the array)
Of course, for data v2, I want to input the next data based on the first data, like the method above.

0 Kudos
Message 5 of 15
(377 Views)

@hurang wrote:

For example, if the first data of data v1 is 0.43, I would like to be able to receive the next random number only if it is a random number within 0.33 and 0.53 (+-0.1) (adjust the value with the control). (Even if you press the add button, it does not enter the array)
Of course, for data v2, I want to input the next data based on the first data, like the method above.


 

Well, exactly defining the problem is 80% of the work. 😄

 

Should the very first point be the reference to decide if the new point is within range or should each new point be within range of the previous. For example if the first point is 0.43 and the second 0.50, what should be the allowed range be for the third (0.33-0.45 or 0.40-0.60), etc. In any case, all you need is keep the reference value in a scalar shift register and update as needed.

0 Kudos
Message 6 of 15
(331 Views)

Here is one possibility assuming the first value is the reference for all others.

 

altenbach_0-1708273980829.png

 

0 Kudos
Message 7 of 15
(321 Views)

Thank you so much!

you are the best.

Could you please attach the vi?

I'd like to try it out.

0 Kudos
Message 8 of 15
(299 Views)

Sorry, I am currently not near any computer. All the cases are the same as before and all additions are visible and easy to reproduce. Just a handful of simple primitives and a few wires. Try it.

0 Kudos
Message 9 of 15
(289 Views)

Sorry, there was an error in delivering the message.

Data v2 is based on the 6th value.

In other words, if we receive a total of 10 pieces of data, data v1 is based on the first value, and data v2 is based on the 6th value. 

Sorry for confusing you.

0 Kudos
Message 10 of 15
(277 Views)