03-22-2019 09:20 AM
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
03-22-2019 10:43 AM - edited 03-22-2019 10:46 AM
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:
Also try to stay away from ExpressVIs and DDT wires:
- 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…