LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

issues making a program for vacuum chamber bakeout control

I tried to move the local variables outside of the loop and cut down on them.  I implemented the NOT functions and cut down the DAQ and sample clock subVIs for the thermocouple loops using a constant for the channels and predetermined tasks instead of DAQ assistants.  I don't understand how I would put all of the analog functions into one loop because the pressure one is different than the thermocouple ones or even to put the three thermos into one loop, they need to turn on and off independently.  I don't know how to make it more streamlined since the pressure and temperature checks need to be the way I have them, there has to be that hysterises between two values not just greater or less than one value.  That's why I have the case structures they way they are.  I didn't know how else to make the program follow that specific path of checks.  I still don't think the local variables and the indicators are right.  That's why I had the indicators of the variables not wired to anything, I didn't know where to wire them to, since they needed to be related to the variables but you said to use them instead of the variables in some places. I didn't know how to have the indicators reference the same thing since I tried to copy the indicator but it just makes a new one, not a copy referenced to the original indicator.  That's why I thought that if they weren't wired to anything and just had the local variables reference the same indicator then it sould update, but that didn't seem right either.


My reasoning behind the case structures (I realize there is probably a better way to do this, I just don't know how):

Pressure=0 then master off (which controls the three heaters/thermocouples), if not =0 then go to Master bypass (which will be able to control the heaters even if the pressure=0 or >2x10^-6 and even if the temps for the three are >150 C). 

Master bypass on/off, if on then all thermocouples should be on, if off then go to next check. 

Any thermos on?  If yes then check pressure >2x10^-6 (yes turn off; if no go to next check); if no then check p<1x10^-6 (if yes then go to next; if no then turn off).

Check to see if thermo is on for each of the three thermocouples.  If on then check if temp >150 C (yes, turn off; if no, leave on);  if off check t<120 C (yes, turn on; no; turn off). The temp checks need to happen for each of the three.

Thanks for the help!

Error -200983 occurred at Property Node DAQmx Read (arg 1) in bakeout control.vi

Possible reason(s):

Measurements: You only can get the specified property while the task is reserved, committed or while the task is running.

Reserve, commit or start the task prior to getting the property.

Property: AvailSampPerChan

Task Name: _unnamedTask<2>

Error -200983 occurred at Property Node DAQmx Read (arg 1) in bakeout control.vi
Possible reason(s):

Measurements: You only can get the specified property while the task is reserved, committed or while the task is running.

Reserve, commit or start the task prior to getting the property.

Property: AvailSampPerChan

Task Name: _unnamedTask<1>
0 Kudos
Message 21 of 31
(1,490 Views)
Hi modi,

wow, what a big vi...

-You still have problems to understand why not to use locals! Why do you wire a value to a terminal AND a local (several times)??? The terminal is ok, no need to wire to the local too! (This is called Rube-GoldsteinSmiley Very Happy)
-You have problems to understand dataflow: all those smaller DAQ while loops will run forever, when the wrong boolean value is feed in...
-You should take equal structures outside of case structures... The only difference in all those single DAQ cases is the temp comparison value! So just select the correct value and delete the case structure (as done once in attachment)!
-Do you need to create and delete DAQ tasks in every iteration? Probably it would be easier to create them once at start and clear them at end of vi...

Oohh, made some changes and put a lot of comments in the vi. But a lot has to be changed here!



Message Edited by GerdW on 07-18-2008 07:01 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 22 of 31
(1,483 Views)
Did you read ANYTHING of what I wrote in this replySmiley MadAs I said, you have MAJOR architecture problems,  It doesn't look like you've changed anything in your code.  You are stuck on the reserved resource.  And that is because you have a continuous clock use at the top, and also trying to use the clock in several other points of the code.  That is actually the least of your problems.  Once you fix that, you'll see you will have major problems in your code with endless while loops and while loops blocking the execution of each other.
 
Please go back and reread my post.  Start small getting just one of the controls to work properly,  Then build on the code from there.  Don't just do a cut and paste operation like you are doing now.  Look at the example for producer/consumer with Data.  That is what you need.  One while loop doing all the data acquisition feeding the data to another while loop to log the data.  And a separate while loop that is a state machine do handle the logic of each of the controls.
 
In your DAQ tasks, you can set them up to read multiple channels.
0 Kudos
Message 23 of 31
(1,478 Views)
I reworked your program to give it the architecture I was talking about.  See attached.  (Your code I put in a diagram disable structure since I didn't want to delete extra indicators and controls.)  You will see the code now fits in about 1 screen and with a tremendous reduction in duplicate code.
 
One of the things I did was create a subVI I called hysteresis.  This does the control logic of turning off the heater above 150, turning it on below 120, and leaving it in its current state in between.
 
I can't guarantee this all works as I have no way to debug it without actual hardware, but I think I coded in all of your intentions for this program.
Download All
0 Kudos
Message 24 of 31
(1,445 Views)
Wow, thanks, that looks great.  I am now trying to debug.  I get this error: Error -200524 occurred at DAQmx Write (Digital 1D Bool NChan 1Samp 1Line).vi:1

Possible reason(s):

Measurements: Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.

When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same number of channels as the data written.

Number of Channels in Task: 1
Number of Channels in Data: 3

This happens at the DAQmx Clear Task.vi at the end of the logic loop. 


0 Kudos
Message 25 of 31
(1,401 Views)
and then this:

Error -200488 occurred at Property Node DAQmx Timing (arg 1) in DAQmx Timing (Sample Clock).vi:1->bakeout control.vi


Possible reason(s):

Measurements: Specified virtual channel cannot be added to the task, because it does not exist.

You cannot specify a physical channel.  Instead, create a virtual channel using the DAQ Assistant or DAQmx Create Virtual Channel, and then add the virtual channel to the task.

Channel Name: Dev1/Ai0

Task Name: Dev1/Ai0:3
0 Kudos
Message 26 of 31
(1,400 Views)
Also, I need to have a master bypass where I can keep all three thermos on even if the pressure hysteresis says to turn off, and I need the pressure hysteresis for if heaters are on to turn off if p>2*10^-6 and if heaters are off and p<1*10^-6 then turn on.  I don't see where I would put that in. Thanks!
0 Kudos
Message 27 of 31
(1,398 Views)

Okay.  I added the bypass.

As for the other errors, that is one of the problems with trying to code something without hardware, you can't determine what combination of things may or may not work.  For the analog inputs, I added a Create Task in front of the sample clock.  I hope that fixes that error message.  For the digital ouput, look at the various settings for # of channels, # of lines, # of samples.  Look at the DAQmx examples as well to determine the format of data to be able to write out 3 booleans at once.  I created had created a 1-D array of 3 boolean values.  Since the error says, Error -200524 occurred at DAQmx Write (Digital 1D Bool NChan 1Samp 1Line)., the secret may be to make it for N lines, in which case we need a 2-D array.  I'm not sure whether it would it would be a 1x3 or a 3x1, but you can try it and experiment.

0 Kudos
Message 28 of 31
(1,381 Views)
Hey, thanks again.  It seems to be running without an error, but the temps don't come up in the array on the front panel.  Also, is there a way to slow down the graph of the pressure?  It really only needs to plot a point every 6 seconds or less (I have used 0.1 samples per second on the pressure recorder program I made first, that seemed to be ok, it didn't like anything less).  I fixed the bypass so that it will output the +5V for the digital write when the bypass switch is flipped. 
Download All
0 Kudos
Message 29 of 31
(1,358 Views)

I did make a mistake on the wiring to the digital outputs.  I took the array from before the bypass logic rather than after.  It looks like you fixed that.

I don't understand what you mean by "but the temps don't come up in the array on the front panel".  What is showing up in that array?  If that lower logic loop is spinning, and values are begin passed through the queue, there has to be data showing up in that array.  However there is the possibility that I have that 40 x 3 array defined backwards and it should be 3 x 40, or transposing may need to happen.

Also, "is there a way to slow down the graph of the pressure?  It really only needs to plot a point every 6 seconds or less (I have used 0.1 samples per second on the pressure recorder program I made first, that seemed to be ok, it didn't like anything less)"

In your original VI, you had a sample rate of 0.01 for pressure which would be 1 reading every 100 seconds.  And 0.1 for temperature which would be a reading every 10 seconds.  How fast are the data points coming in now?  Isn't it 1 every 10 seconds?

0 Kudos
Message 30 of 31
(1,349 Views)