LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview multithread test

Hi all

I want to build up a parallel test structure as screenshot,my purpose is:

1)scanning bar code check length and start test.

2)which item pass,scanning insert pass item continuous new test.

 

Actually,Which item pass and stuck with the code,please help me point out,thanks in advance!

0 Kudos
Message 1 of 9
(2,574 Views)

Hi all

I want to build up a parallel test structure as screenshot,my purpose is:

1)scanning bar code check length and start test.

2)which item pass,scanning insert pass item continuous new test.

 

Actually,Which item pass and stuck with the code,please help me point out,thanks in advance!

Download All
0 Kudos
Message 2 of 9
(2,573 Views)

Great so what have you done so far? You will have to write code that will read the bar code then do the rest of what you want to do. Draw it out and start making code that does what you have drawn.

Tim
GHSP
0 Kudos
Message 3 of 9
(2,550 Views)

Do not post multi post for the same question:

 

https://forums.ni.com/t5/LabVIEW/Labview-multithread-test/td-p/4054596

 

 

Tim
GHSP
0 Kudos
Message 4 of 9
(2,547 Views)

Thank for your reply,but excution this code has a bug,which item pass then stuck it,my desired as below:

1)when scanning first bar code check length and run CH1 event, continuous second bar code check length and run CH2 event,and third,forth....

2)whatever which item pass,then scanning bar code insert pass item insteasd of it,run test.

 

The code has bug as below:

1)which item pass then test instructure  stuck.

2)if scanning bar code test, rest of disapperance, which item pass.

 

someone could help me fix it any promptly is appreciated,thanks in advance.

0 Kudos
Message 5 of 9
(2,484 Views)

@Sam.Huang wrote:

someone could help me fix it any promptly is appreciated,thanks in advance.


You attach a folder full of files without even telling us the name of the toplevel. Why don't you use a project?

Your Vi is full of very dangerous constructs. For example you do read-modify-write of your listbox in many places in parallel without any protection from race conditions.

 

Warning to all: The VI is set to "run when opened" and immediately pops some other VIs. So be careful. Very annoying! I doubt anyone will try to fix this mess.

0 Kudos
Message 6 of 9
(2,480 Views)
Thank for your reply.first of all,post thread in here is want all can point out easy and available way to cover the issue,any suggestion is well. My purpose is :scanning first bar code start socket 1 run,scanning second bar code start socket 2 run,scanning third bar code start socket 3 run, until eighth socket 8 run, then finished first cycle. Inspect which socket random value is in range,then scanning bar code insert to pass item,maybe is socket 3 or socket 6 etc. The problem with my code is someone if pass,the code is stuck and input bar code the rest of disappearance. Someone could give me a voice or which structure can easy for the purpose,thanks for all!
0 Kudos
Message 7 of 9
(2,436 Views)

Personally, I would tear down the entire code and build from scratch with 10% of the code. Why is there so much duplication?

 

As I said, there are plenty of potential race condition due to a complete lack of understanding of Dataflow.

 

For example, in the code below you are reading the listbox items in three (actually many more!!! This is just the tip of the iceberg) different locations in parallel (A, B, C), creating A', B', C' which you write back to the listbox items. Whatever writes last wins, so instead of all three modifications, you end up with whatever writes last (either D, E, or F). You need to encapsulate the updating into a non-reentrant action engine, for example to protect the critical section..

 

altenbach_0-1590769529550.png

 

 

Why do you need all these local variables? Why is there so much duplication? You have 10 copies of large code sections that only differ by some integers. Why do you think you need to read the same value (SN length) from 10 identical local variables in parallel??? Wouldn't one (or zero!) be sufficient?

 

altenbach_1-1590769676926.png

 

You need to take a step back, do some simple tutorials about code architecture, program design, and dataflow. You'll end up with code that fits on half a screen, is maintainable and clear, scales for any number of tests (not just 10) and has no unnecessary duplicate code. How log does one "test" take?

0 Kudos
Message 8 of 9
(2,421 Views)

Thank for your point out,I have fixed stuck issue and integrated code concise,the last issue is which item pass how to insert another in the row and start new test as screenshot,Please give me a voice for the issue,thanks!

 

sageliuliu_0-1590809557223.png

 

0 Kudos
Message 9 of 9
(2,396 Views)