LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use while loops to implement a simple climate control.

Hi,

 

I am currently a 4’th year computer systems engineering student in South Africa doing a primitive climate control project in LabVIEW 8.0. Although my knowledge and skill level of LabVIEW is far from that of an expert, I really enjoy working with it. The project consists of a motor driving some fan blades, a resistor heater and an analog temperature sensor. The basic functionality entails that a user specifies a desired temperature and then the program will heat if the current temperature is lower than desired or cool if the current temperature is above the desired temperature.

 

What I want to add is an acceptable temperature difference so that the fan and heater do not switch constantly as the threshold temperature is reached. Rather leave the current temperature to linger between the maximum (current + acceptable difference) or minimum (current – acceptable difference) allowed temperature before heating or cooling it to the desired temperature once again.

 

I have attached 2 VI’s:

 

Final Assignment: I tried to achieve the sensible climate control by making use of a formula node. As soon as I substituted the if statements in the formula node with while statements, the VI did not respond. It did not give any errors, it just didn’t respond.

 

Final Assignment2: I tried the same but by making use of while loop structures. The while where my Input DAQ is works fine, but none of the other while loops work.

 

Please advise me on possible solutions for my problem/project.

 

Thank you in advance.

 

D. Weppenaar

Download All
0 Kudos
Message 1 of 5
(3,424 Views)

1. Your VI does not respond because your formula node is trapped in an infinite loop and cannot exit if you're out of the deadband. Replace the words "while" with "if" (or similar) and you might be getting somewhere. 😉 Sorry, I don't have DAQ installed, but what determines the loop rate?

2. You have a dataflow issue. Only the inner loop on the left will run. All other loops must wait because they depend on data from the first loop. data is only available at an output tunnel of a loop once the loop finishes and a loop cannot start until all input tunnels contain data. Also the first loop can never stop, because the stop button is outside the loop and will never get read once the inner loop starts. The stop button needs to be in the innermost loop.

Most likely, all code segments should run synchronized, so delete all the inner loops. They serve no purpose. All yon need is the big outer loop as in the first code.

There are many ways to directly observe what is going on. For example you could run the VI in execution highlighting mode while watching the diagram.

Clearly, you need to become more familiar with LabVIEW basics. Maybe do a tutorial? Right now you might think that dataflow is a hindrance while in fact it is one of the most powerful advantages of dataflow programming. You simply need to be familiar with its logic. 🙂

 

 

 

0 Kudos
Message 2 of 5
(3,406 Views)
Ah that makes sense. Thank you. I suspected something like this. Still getting used to LabVIEW while loops as I am more familiar with C# programming. I'll try and brush up on my LabVIEW skills as soon as possible. Although with this being test week I dont know how soon that will be. Than you once again, your suggestions were very helpful.
0 Kudos
Message 3 of 5
(3,387 Views)
 

Hi D. Weppenaar,

If you are interested in brushing up on your LabVIEW skills, I would recommend taking a look at our online LabVIEW tutorials. 

In addition, we do offer instructor led courses that you may be interested in taking.  Please take a look at this link if you are interested in the instructor led class on LabVIEW.

Best of luck on your application, and have a great day!!

 
Regards,
Ching P.
DAQ and Academic Hardware R&D
National Instruments
0 Kudos
Message 4 of 5
(3,372 Views)
Thank you cphuong,
 
I downloaded both the introductory presentations and will look at them shortly, I have also informed fellow students that might be struggling with LabVIEW basics of these presentations.
 
Thank you once again.
 
Regards,
D. Weppenaar
0 Kudos
Message 5 of 5
(3,348 Views)