LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Power supply freezes after running vi second time

Solved!
Go to solution

Hello,
I am just starting my adventures in brave new world of LabView and I run into a problem with my first serious vi which is controling CPX400DP power supply and DPO4104 oscyloscope.

 

What my vi should be doing:

First it sets current levels of both channels of power supply (e.g. 5V on first, 0V on second) and size of the jump (e.g. 0.5V). Then vi should change both current levels by size of the jump and repeat till the current levels of both channels would be reverse to the start value (in this case, 0V on first channel, 5V on second). Also before every current change the vi would save to file mean of measurements out of the waveform from oscyloscope.

 

What my vi is doing:

At first run it seems that it's doing everything in order (new text file with resonable numbers is created). However, when I try to run the vi a second time my power supply freezes short after few current changes. I can stop the execution of the vi in LabView (it does take a while though) but to successfully run the vi again I must reset my power supply (turn it off and on).

I tried to go around this problem by modyfing the vi in a way that it would do what I want multiple times during running the vi only once but unfortunately that didn't work.

 

If anyone would have any suggestions about what I am doing wrong or how to help fix this problem feel free to share I don't bite... much Smiley Wink But seriously, I'm stuck with this problem for over a week and I'll be glad for any tips Smiley Happy

 

Thanks!

Waldek.

 

PS Sorry if I am not clear somewhere but I'm not used to talk about programing in English Smiley Embarassed
PSS In attachments are my main vi and two sub vis.

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

Waldek,

 

Welcome to the Forum and to LabVIEW.

 

I do not see anything which immediately jumps out as the cause of your freeze. How long do you wait between runs? Does it make a difference if you wait longer? My question is because I wonder if the power supply can respond as fast as the program is trying to send commands.

 

Some general suggestions: 1. Move the things which never change outside the loop. The current limits may be in that category.

2. Do you need a wait between the initial settings and the for loop? The current changer.vi could run the first time a few milliseconds after the code before the for loop.

3. What is the purpose of the feedback node on the error wire? As connected the effect is to delay any errors by one iteration of the loop. So if an error occurs, the loop will run one more time before the error causes it to stop.

4. You can wire the error cluster directly to the case select terminal and the OR gates wired to loop termination terminals. You do not need to Unbundle the Status boolean.

 

Lynn

Message 2 of 9
(2,884 Views)

Thanks Lynn, good to be here.

 

I didn't wait long between runs but I always checked the created text file after the first run so I didn't run it immediately. Maybe you're onto something but earlier I had smaller program that would only do the first part of my current vi (change current levels from 5V - 0V to 0V - 5V) and there where no problems when I run it even multiple times in short period of time. This would suggest that the power supply can keep up with the commands and I had to make an error elsewhere... Anyway, I will check if waiting a bit longer changes anything on Monday (I don't have devices at home) and post the results.

 

1. Good idea, I will modify the vi.

2. Well, theoretically to get mesurments I need I don't have to wait at all (I think). I did put the wait inside the for loop so I could see changes of current levels on the front panel of the power supply. Otherwise it would run so fast that it wouldn't be possible to recognise changes on the front panel. Hmm... wait between initial settings and the for loop... I don't think I need a wait there. So I guess I should move the wait to the case loop, correct?

3. I actually don't remember putting the feedback node anywhere so I had to somehow make it by mistake ^^;

4. Yeah, in the 2013 version I have in home I can do that but the work station I use at the University has 2010 version which doesn't have this option implemented yet ^^

 

Thanks again Lynn for so fast response! Smiley Happy 

0 Kudos
Message 3 of 9
(2,861 Views)

Instruments which communicate via VISA (especially power supplies) often take tens to hundreds of milliseconds to respond to a command. The software will only take nanoseconds or microseconds unless the Reads actaully wait for the instrument.  I do not have the power supply or scope subVIs so I cannot tell what they do.

 

It is possible that the feedback node was inserted automatically by LV. One of the settings under Options does that.  It never gets it the way I want so I always turn that off.

 

I do not recall when boolean inputs began accepting error wires. It could have been after LV 2010.

 

Lynn

0 Kudos
Message 4 of 9
(2,843 Views)

You can try inserting ;*OPC? after every setup command to turn it into a query.  The power supply will return a "1" when the operation has completed.  That way you automatically avoid sending commands too quickly because the VISA read will just sit there witing for the "1" and since the "1" is only sent after the command has completed... well there you go.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 9
(2,813 Views)

Thanks for a suggestion Bill but could you elaborate a bit on "try inserting ;*OPC? after every setup command"? I understand what that would do, concept wise, but as a new user I don't know how to do that in LabView. And Good Uncle Google doesn't say anything about " ;*OPC? " and insist on talking about OPC servers instead.Smiley Embarassed

0 Kudos
Message 6 of 9
(2,797 Views)
Solution
Accepted by Revan-Ghost

@Revan-Ghost wrote:

Thanks for a suggestion Bill but could you elaborate a bit on "try inserting ;*OPC? after every setup command"? I understand what that would do, concept wise, but as a new user I don't know how to do that in LabView. And Good Uncle Google doesn't say anything about " ;*OPC? " and insist on talking about OPC servers instead.Smiley Embarassed


I'm sorry - I was looking at the manual and failed to realize that the missing subVIs from your code were actually drivers for your power supply, so you may not be able to implement this (unless the drivers themselves have the "Operation Complete" capability - hopefully the drivers came with documentation).  Else, you may be stuck having to hardcode waits after each command.

 

If you wrote your own drivers, this is how you would send the command to set output 1 to 1 Volt:

 

V1 1;*OPC?

 

The V1 1 sets your voltage to 1 Volt.  To tack on another command, you use the semicolon.  The *OPC? command forces it to return send a "1."  SInce the commands are acted upon sequentially, the power supply can't send the "1" until it is done processing the command to set it to 1 Volt.  After that command is complete, the "1" is sent, you read the 1 out of the buffer and move on.  This avoids issues where you pile on too many commands at once.  I checked the manual and it supports this feature.

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 9
(2,776 Views)

So I did fix the problem the other day.

 

Lynn was right, my power supply couldn't respond as fast as the program was trying to send commands. And I used the tip from Bill and put two "Wait for Operation Complete" subvi's in current_changer.vi from device drivers and now my program runs without a hitch! Thanks for the help everyone! Smiley Very Happy

Message 8 of 9
(2,716 Views)

Glad you got it working.

 

Lesson learned: Before trying to automate or computerize a process, be sure you understand how the apparatus works. (Of course you probably cannot push the buttons on the instrument fast enough to get it confused.)

 

Lynn

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