LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView General Help- Very Easy for a Pro

Good Afternoon, 

I am having a little trouble with my project for university and have sort of hit a wall. What I am designing is a "smart" (in the loosest sense of the word) green house. It has 2 separate states for DAY and NIGHT controlled via a LDR and Thermistor. I'm using the LDR's readings to decide when to switch from day to night. However this same LDR will be under our artificial lights. Therefore we have a parameter called "Day to night switch level" which is the point at which the software decided to stop cranking up the light intensity but to instead decide its night time. The system then sets the bulb to zero and settles down for the night..... until the LDR detects a the same "Day to night switch level" at which point the bulb will come back on. However i'm having real difficulty programming this sort of thing.

Currently all that happens is that the system flicks between night and day. 

Can anybody help me out? Happy to undo a lot of what I have already done in order to make this happen well. 

Kind Regards

Ed

0 Kudos
Message 1 of 2
(2,056 Views)

Hi Ed,

 

However i'm having real difficulty programming this sort of thing.

Usually I suggest to use a statemachine for your task: there are atleast the states "day" and "night"…

 

Currently all that happens is that the system flicks between night and day.

This might happen when you switch an actuator without applying a hysteresis: when you control a temperature at 50°C then the heater will switch on as soon as you fall below 50°C and will switch off as soon as 50C is reached. That might happen very fast. Usually you apply a hysteresis at such control loops like switch off at/above 51°C and switch on below 49°C…

 

On your VI:

Ever heard of the InRangeAndCoerce function? This will cleanup your blockdiagram by 50% size!

See here: check.png.png

Also try to stay away from ExpressVIs and DDT wires:

check.png

- Convert to "default" datatypes asap after the DAQAssistent. (Or get rid of that DAQAssi asap.)

- Don't use a hidden chart just for averaging: Use PtByPt-Mean instead!

- NEVER hide the label of controls/indicators in the block diagram!

- NEVER delete the label of controls/indicators!

- Avoid duplicated code, like in that case structure…

- You don't need that inner while loop: either use a FeedbackNode or move the shift register to the outer loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 2
(2,041 Views)