LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How (automate) change fan set point and hold (while collecting data) for a certain time period, then change to new set point

Hi everyone,

I am really having a hard time trying to figure out how to get labview to do what I want (completely due to my ignorance of the program). I reallly would like to learn labview, but I am right on time and I am not sure where to start with the examples because I am not sure of all of the function names or where to start looking, basically.

 

I have a program set up where I manual set the fan speed (of a blower fan), and then over time data is collected off of multiple pressure transducers. I manually change the fan speed every 2 minutes or so, and the speeds go up and down at non-integer values

For example a series of fan speed changes I would make would be

10 -> 10.8 -> 10.3 -> 9 -> 9.8 -> 9.3 -> 8 -> 7 -> 6 -> 4 -> 2 -> 0 -> 2 -> 4 -> 6 -> etc... back to 10.

 

I generally run the same sequence of numbers so if I could just have an array that I write in excel or notepad and read in when I open labview, or an array I can store in labview and adjust as needed, that would be ideal. I have looked at the example of how to make an array with a for loop, but I don't know how to read values out of the array after it is made.

 

I know that there must is a way to make an array of values that a loop would read off each value at each iteration. I am not sure how to have the loop hold at each iteration for a set period of time while writing data to the file (i.e. not just holding everything and not collecting or writing data).

 

I have attached the labview code I currently use where I manually change the fan speed every few minutes. Can someone help me figure out how to pre-define the fan speeds and have labview automatically change the fan speed after a certain period of time?

 

Thanks!

Casey

 

PS please dont just me for how inefficeint my code is 🙂 Someone helped me do a few of the things so I can help explain the different parts of the code if you have questions.

0 Kudos
Message 1 of 11
(3,762 Views)

Casey,

 

I created a quick VI that shows one way you could automate the fan speed over time.

 

I have stored all of your example values in a numeric array that is read at program start.  I use the elapsed time express VI to increment the index of the array that will be used as the fan speed.  I provided some links to some of the items I used to make this VI.

 

Shift Registers

 

Elapsed Time

 

Case Structures

 

If you are just getting into LabVIEW and looking for some general information you can always look through some of our getting started material

 

https://learn.ni.com/learn/article/labview-tutorial

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 11
(3,692 Views)

Looks like I forgot to change my array default values.  If you enter values into the array It should go through them at the specified speed.  

 

You will need to figure out what you want to do when you get through all array values, but right now it defaults to 0 when it has gone through all of the fan speeds you have specified.

Matt J | National Instruments | CLA
0 Kudos
Message 3 of 11
(3,689 Views)

Shoot, it looks like you have a newer version of labview than I do. Is there a way I can open the 2014 version or can you repost a saved version that i can open with 2011 or 2012?

 

I am excited to get a look at this! I also appreciate the links to help me work through how to you implemented the automation!

0 Kudos
Message 4 of 11
(3,655 Views)

Thank you for converting the VI RavensFan.

 

Casey, after you take a look, if you have any questions about what is going on within the code or where to look for more information I would be glad to help.

Matt J | National Instruments | CLA
Message 6 of 11
(3,606 Views)

Uh oh. I accidently hit "accept as solution" when I was trying to hit reply. Hopefully you will still be willing to work with me on this code!

 

I think I am getting the basic idea of how your code works! I tried to drop the code you wrote into my current program (that actually runs the fan and collects the data from the pressure transducers, but there is a problem and the combined program does not run (even time doesn't progress).

 

My other question is if there is anyway I can store the values of hte array so I don't need to reinput them everytime I open the program. I generally have an array that is atleast 50 values long (I just showed a shorter example above). Is there anyway I can save the values from the array or have the array read out of a text file or something?

0 Kudos
Message 7 of 11
(3,583 Views)

Put your Elapsed Time calculation into the inner most while while loop that way it updates every time the innermost while loop iterates.  Right now, it will only update when your innermost loop stops and the outermost loop iterates again.

 

For saving the data in the array, you can right click on the array and use Save Values as Default.  But if you want to change it from time to time, or read values from a file, then you will need to use some File Read functions.  Read from Spreadsheet File is a good choice.  Search the forums and the LabVIEW help and you'll find many different examples of how to read and write to files.

 

PS:  Make sure all of your control and indicator terminals on the block diagram have labels and they are visible.  Hard to know what is the purpose of an indicator when it doesn't have a name.  You can make the label not visible on the front panel if you want to, but it should always be visible on the block diagram.

 

Your one True/False case structure is kind of pointless since it just outputs a false or true boolean constant.  You can replace that whole thing with a NOT function.  And since the values feeding the selector of that case structure is a Not Equal function, just change that to an Equals function would mean you can get rid of the entire case structure and not need a NOT function.  All you need is a single wire.

 

Be careful about comparing floating point values for equality.  A PC can't always represent certain values precisely due to its binary nature.  As a result two values that may look identical to you and me might be slightly different and not equal to the computer.

 

EDIT:  Also on your dial indicators, you can right click Visible Items >>  Digital Display.  Then you won't need to have a separate numeric indicator for displaying the value.

Message 8 of 11
(3,558 Views)

Hi Ravensfan!

 

Thank you so much for your helpful comments. Unfortunatly your message goes a bit over my head :-). Perhaps I am too novice for the message boards, but I hope you don't mind me asking some questions so I can increase my knoweldge of labview.

 

1. I tried to put the elapsed time inside of hte inner most loop, but still I couldnt get the file to change the fan speed. Perhaps I am putting it in the wrong place? (Sorry I haven't cleaned up the indicators in the attached files. THere are a few sections of the code implemented by another person and I am not sure what everything does yet - still testing each part of the code to identify it).

 

2. Which true-false structure are you refering to?

 

3. For comparing floaring point values, I think this is just the section of the code (if I understand correctly) that forces the prorgam to "hold" for 10 seconds after the fan speed is changed. Since the smallest changes we make in the fan speed at 0.1 (maybe 0.05?), do you still think this could be a problem? Oh, or perhaps you mean the computer might think the fan speed has changed when it actually has not?

 

 

0 Kudos
Message 9 of 11
(3,521 Views)

Try this.  I eliminated the inner most while loop.

 

Your program wouldn't change speed because you were getting trapped in the innermost while loop because it only ends when that one Stop button was pressed.

0 Kudos
Message 10 of 11
(3,513 Views)