LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with my project please!

Hello everyone,

I'm currently trying to put together my labview project for school and I could really do with some help I'm struggling how to do a few small things that maybe some more experienced people might be able to help me with. I'm trying to make a basic temp control system but I'm having trouble trying to get it to do certain things in the criteria.

1. I have to try and get the max and min of the humidity and temp values and don't know if I can even do it with my current build?

2. Should I do an array for the average, max, min, and history for the unit and if so how do I wire it up as I couldn't do it when I tried to add the arrays?

3. Is my current build for controlling the temp ok or is there a better way to control the system as i just need to create a random input for temp and humidity?

If there is any more info you need to help me feel free to ask, trying to learn how this works so please be kind I'm very new to this and my lecture wont respond to emails😞

greenfingers_0-1639761902237.png

 

.

0 Kudos
Message 1 of 6
(2,072 Views)
  1. You needn't have separate digital indicators for your values.  Right-click on a slide indicator and select Visiblr Items → Digital Display
  2. You're using a Power of X function and feeding it "e" as x.  Just use the "exp" function.
  3. For your averaging, I suggest:
    1. Drop a feedback node.
    2. Right-click and Change Direction
    3. Wire both inputs to the value you want to average
    4. Drop a Max & Min function
    5. Wire one input to the the value you want to average, and the other to the output of the feedback node.
    6. Create indicators for the outputs of the Max & Min function

Note: This does a total min/max for all samples.

See the highlighted bit of code in the attachment.

"If you weren't supposed to push it, it wouldn't be a button."
Message 2 of 6
(2,056 Views)

You can use either a shift register or a feedback node along with the Build Array primitive to create your history array.

 

For the max/min stuff, there are some VI's that accept single points at a time and give you some info. For example, the Mean Pt by Pt:

BertMcMahan_0-1639769995402.png

 

I'd recommend a shift register to build your history. I prefer them to feedback nodes, but they both work fine. Right click the border of your While loop and select "Add shift register".

 

shiftreg.png

 

Sorry your prof isn't returning emails 😞

Message 3 of 6
(2,046 Views)

In addition to what has been said:

 

  • There is a +1 and a -1 primitive.
  • I strongly recommend not to use expanded shift registers to keep a running average. It is also not initialized so there is no telling what's in it on the second run. You are also processing the value from the previous iterations. It is probably safer to process the value from the current iteration. You can use "mean ptbypt" to eliminate most of your code or you could have an array with 6 elements in a simple shift regsiter where you always replace the oldest with the newest.
  • You have a glaring race condition because the "Heater on" value property node will be read way before it is set in the case structure. Place the "heater on" value in a shift register and manipulate it according to conditions. No need for value property nodes. Don't bury terminals inside case structures!
  • Again, to get the running max and min, you can use max&min ptbypt. No need for explicit code.
  • I would not add a random number between 0 and 1, because that's always positive. I would use gaussian nose (Box Muller) or at least subtract 0.5 for the dice.
Message 4 of 6
(2,043 Views)

Also, if attaching code, make sure that all controls contain typical default values so we don't have to guess what they should be.

 

I also would recommend to implement some sanity check e.g. to ensure that setpoint high>setpoint low to avoid surprises. (not shown)

 

Never call a VI "Untitled 1.vi"! That's just plain lazy! So many others do that too and my browser turned it into "Untitled 1 (12).vi", with the danger that I look at the wrong VI.

 

To get you started, here's a quick draft how you could handle the temperature and heater (adding humidity would be trivial, but try to avoid all your duplicate code!)

 

 

altenbach_0-1639773602688.png

 

Message 5 of 6
(2,032 Views)

Sorry about the untitled VI still very new to this and also thanks for the help I greatly appreciate it. Going to get stuck into all the info you guys gave me and see how I get on. Thanks again!!🙂

0 Kudos
Message 6 of 6
(2,018 Views)