From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

HelloI'm using CVI, my test programm test one UUT well, now i wanna start the test but with 2 or 3 UUTs.I don't know how to do it?

Hello Tommy,

In the begining of the test, the three panels appears and the user put the serial number and the test start.

I create 3 threads to test 3 UUTs.

Always the test start by running thread 1,then 2 then 3.

I wana know what happen when thread 2 (for example) ends the panel of serial appear but what happen when two handle ends at the same time, how can i manage it?

Thanks a lot

0 Kudos
Message 11 of 33
(2,288 Views)

Hi xmouth,

 

I'm still having a bit of trouble understanding the specific problem you are looking to solve. One of the panels should necessarily appear before the other one, correct? As in, one of them will be displayed on top of the other?

 

You've mentioned that you are looking to test three units at one time. But, how many total units are you looking to test during the program's execution? Is it just three devices, or is it on the order of tens, hundreds, thousands, etc.? Can you have the user input all of the serial numbers when the program initially runs, or can you load the serial numbers in with a text or spreadsheet file?

Tom D.
Staff Software Engineer
NI
0 Kudos
Message 12 of 33
(2,268 Views)

Hello Tommy,

I wanna test three UUTs using the same PC with three tester.  As in, one of them will be displayed on top of the other.

I put the serial number when the program initially runs.

How can i procedure?

Thanks a lot

 

0 Kudos
Message 13 of 33
(2,255 Views)

Hi xmouth,

 

There seems to be a lot of back and forth on this post. I want to make sure that we are understanding your actual question.

 

At this point we understand that you want to test 3 UUTs in parallel. Beyond that, I don't understand what your concern/ question is. It seems that you may have some concerns about when the threads end, but at this this point I am not sure.

 

What exact functionality do you need help implementing? Can you share your code? Can you send more screenshots so we can better understand what you mean by "displayed on top of the other"?

 

Answering the questions above should help the forums better understand your application so we can help you succesfully test your 3 UUTs!

Briana P.
Licensing
Sr SW Engineering Manager | NI R&D
ni.com/support
0 Kudos
Message 14 of 33
(2,207 Views)

Hello Tommy,

I solve the problem of popup by creating new panel like popup.

When i start test, three panesl appers (like popup) where the user puts the serial number for each UUT.

The problem is that the three thread that i creat to manage three UUTs at the same time ; starts and ends at time.

When the user puts the serial of one UUT the test doesn't start until he puts the serial of the 2others UUTs.

I hope that you undestand me .

 

Thanks.

 

0 Kudos
Message 15 of 33
(2,197 Views)

Hi xmouth,

 

I think I have a better understanding now--so, you are looking to be able to begin a test in one thread, while the other threads wait for the user to enter a serial number in order to begin the test? And you would like to be able to run a test in one thread even if the tests in the other threads have not started yet?

 

You mentioned that you are performing some temperature and voltage calibration on an electronic card. Are you using NI-DAQmx, or another specific API to interface with the card? Also, are you using CVI's built-in User Interface Library (as shown in the bottom left corner of the CVI development environment) to retrieve the serial number? If I were coding the application, I would write a callback function to retrieve the serial number (a separate callback function for the OK button in each panel--one panel per thread), and pass the serial number along to the next function which begins the test. However, I'd like to have a clearer idea of what the test itself entails, as I may be overlooking some details. As Briana mentioned above, feel free to post any relevant sections of your code if you are willing to share it, so that we or other community members can offer suggestions.

 

Also, I was wondering whether you are interfacing this application with NI TestStand at all, or whether it is entirely developed in LabWindows/CVI?

 

Finally, I would recommend taking a look at the 'MultiPanel.cws' example project in the CVI Example Finder (Help -> Find Examples...). You can find it by going to the 'Search' tab and searching for the keyword 'multithreading'. I believe this example implements functionality similar to what you are trying to achieve, and it may provide some helpful insight.

Tom D.
Staff Software Engineer
NI
0 Kudos
Message 16 of 33
(2,178 Views)

Hello Tommy,

I'm sorry for the waste time.

I put that code in my startFunction:

 

CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE, test1ThreadFunction, NULL, &functionId1);
CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE, test2ThreadFunction, NULL, &functionId2);
CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, functionId1, 0);
CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, functionId1, 0 );

 

 

When i run the program, the two panels appears where i'll put the serial number for each DUT.

When i put the serial for the first DUT the test doesn't start until i put the second one, and when i put the second serial the test start with the two UUTs.

This is the problem.

What should i do ?

 

Thanks a lot.

0 Kudos
Message 17 of 33
(2,140 Views)

Hi xmouth,

 

No worries! I would like to help you successfully implement your application however I can.

 

I noticed that you are passing the same variable (functionId1) to both calls to CmtWaitForThreadPoolFunctionCompletion. I'm guessing that's why the same test is beginning with both UUTs.

 

It seems to me that by sequentially calling CmtWaitForThreadPoolFunctionCompletion, you are necessarily going to be waiting for each test to finish before executing any further code. In the documentation for that function (linked below), there is a recommendation to use CmtScheduleThreadPoolFunctionAdv. Have you looked into using this function at all? You should be able to use it to specify a callback function which is called when the thread function finishes executing. This way, you can have several tests running in parallel on different threads.

 

CmtWaitForThreadPoolFunctionCompletion: http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/libref/cvicmtwaitforthreadpoolfunctioncomplet...

Tom D.
Staff Software Engineer
NI
0 Kudos
Message 18 of 33
(2,124 Views)

Hello Tommy,

You said that i should put a callback function when the thread finished, i don't understand you well.

The three thread that i use have to be executed contiously without stopping, and i have to make the threads runs in parallel mode.

How can i procedure?

What about the thread function that you tell me about?

Thanks a lot!

0 Kudos
Message 19 of 33
(2,052 Views)

Hi xmouth,

 

When you call CmtWaitForThreadPoolCompletion, you are telling your computer to suspend execution of the code until the thread that you specify finishes executing its function--which, in this case, is your test. So, for example, if you call this function to wait on thread #1 to finish its function, you will not be able to begin a new test or perform any processing with thread #2 until the wait is over.

 

As an alternative, you can use CmtScheduleThreadPoolFunctionAdv to specify a callback function which will be called when a thread finishes executing its function. In your case, you could write a callback function that begins a new test on a specified thread. So, for example, when thread #1 finishes executing its test, your program will automatically jump to the callback function you wrote, in which you tell thread #1 to begin running a new test. This way, you will be able to have all three threads running in parallel, and automatically start new tests when the old tests end.

 

I would recommend reading over the documentation for CmtScheduleThreadPoolFunctionAdv, since it seems to offer the capability to do what you are trying to do. I have linked to the documentation below.

 

CmtScheduleThreadPoolFunctionAdv: http://zone.ni.com/reference/en-XX/help/370051P-01/cvi/libref/cvicmtschedulethreadpoolfunctionadv/

Tom D.
Staff Software Engineer
NI
0 Kudos
Message 20 of 33
(2,036 Views)