alan-turing-institute / CROP

CROP is a Research Observation Platform
MIT License
25 stars 4 forks source link

Warnings #118

Open meljsingh opened 3 years ago

meljsingh commented 3 years ago

This issue lists all the warnings which could be of use to GU.

  1. Data sources

Locations: Weather: Energy: R&D area: 2 sensors R&D-1 and R&D-2 Propagation: 1 sensor Front of farm: 1 sensor -Column 1 Middle of farm: Column 16 - 3 sensors Back of farm: 1 sensor - Column 29 Fridge: 1 sensor

  1. Relative Humidity

Data analysis shows that when RH outside surpasses 70%, there will likely be increased internal humidity due to ventilation. This is particularly problematic in summer, where ventilation is required to keep temperatures down. In winter, ventilation is mostly required to lower humidity, therefore, the threshold for warning should be when RH_ext> RH_int.

Therefore the two warnings are:

A. Source: iweather.RelativeHumidity If iweather.RelativeHumidity>70%, issue:

Warning Recommendation
High external humidity Check dehumidifiers are working
Reduce extraction fan power
entopia commented 3 years ago

List of warnings and how to calculate them

Four warning zones

Propagation

Calculation source: zensie_data variable (x): Propagation_T/RH > temperature Calc: average of x in past 24 hours If *x_av24*<23 degC,: warning_message: "Temperature is low in propagation, add heater"

Farm

There are more zones of interest here Load all the data for sensors: Zone: Front of farm - hourly average value from sensor Farm_T/RH_1B2 Zone: Middle of farm - hourly average value from sensors Farm_T/RH 16B1, 16B2 and 16B4 Zone: Back of farm - hourly average value from sensor Farm_T/RH_2

variables are Temperature (T_i), Relative Humidity (RH_i) and Vapour Pressure Deficit (VPD_i)

SVP <- 610.7*10^(7.5*T_i/(237+T_i ))
VPD_i<- SVP* (1-RH_i )

Calculation source: zensie_data variable (x): Calc: average of x in past 24 hours if (sum(*x*>25)>10) warning_message: very warm conditions - conditions ideal for peashoots, garlic chive and broccoli if T_i average over 24 hour <19 warning_message: cold conditions, check space heating

Calculation source: zensie_data variable RH_is (x): Calc: average of x in past 24 hours if (sum(*x*>80)>10) warning_message: very humid conditions check dehumidifier performance if RH_i median over last 24 hours is >80 warning_message: very humid conditions check dehumidifier performance

Calculation source: zensie_data variable RH_is (x): Calc: average of x in past 24 hours if (sum(*x*>80)>10) warning_message: very humid conditions check dehumidifier performance if RH_i median over last 24 hours is >80 warning_message: very humid conditions check dehumidifier performance

Calculation source: zensie_data variable (x): _T/RH > temperature Calculate hourly average x_hourly If there are more than 20 hours missing warning_message: "Missing data in farm zone - check sensor battery"

Energy

Using energy data table (so it's in BST)

Using this function


constructLights <- function(tobj){
# lights typically come on at 4pm. So a farm cycle starts at 4pm. This algorithm identifies the likely time that the lights came on in the farm.
tobj is your energy object, and EnergyCP is the energy for sensor.nunber ==17
tobj$FarmDateNew <- as.Date(tobj$FarmTime - 16*60*60)
tobjmean <- (tobj %>% group_by(FarmDateNew) %>% dplyr::summarise(meanE=mean(EnergyCP)))
tobj$Lights <- rep(0, length(tobj$FarmDateNew))

identify rows where energyCP

for(ii in 1:length(tobj$Lights)){ if(tobj$EnergyCP[ii] > 0.9*tobjmean[which(tobjmean$FarmDateNew==tobj$FarmDateNew[ii]),2]){ if(tobj$EnergyCP[ii] >15){ tobj$Lights[ii] <- 1 } } } for(tt in 2:(length(tobj$Lights)-1)){ if((tobj$Lights[tt]==0)&(tobj$Lights[tt+1]==1)){

current off, next one on

  ldif2 <- tobj$EnergyCP[tt+1] - tobj$EnergyCP[tt]
  ldif1 <- tobj$EnergyCP[tt] - tobj$EnergyCP[tt-1]
  if(0.6*ldif2<ldif1){
    tobj$Lights[tt] <- 1
  }
}

} return(tobj$Lights) }


From this we want to return an analysis for the past 24 hours:
- Time the lights came on (Based on difference between hours) 
- Number of hours the lights were on ```sum(Lights==1)```

- [ ] Ventilation

Take EnergyCP (sensor=17)
Estimate energy use for fans using the estimated time lights are on (object lights from above)

```r 
tobj$FanApproxCP  <- tobj$EnergyCP - tobj$Lights *14
tobj$FanApproxCC  <- tobj$EnergyCC (at Clapham Common, sensor=16)

Weather

If RH outside is greater than RH inside, we want to warn on reducing extraction fan

Calculation: sumRH_out = sum of RH outside in past 24 hours (using hourly data) sumRH_in = sum of RH for the average value in farm (average col 16, col 1, and col 29) FanApprox = average tobj$FanApproxCP + tobj$FanApproxCC in past 24 hours

if sumRH_out> 1.1 * sumRH_in & FanApprox >20
issue_warning = "It it is more humid outside than inside, consider reducing ventilation"
if sumRH_out< 1.1 * sumRH_in  & sumRH_in > 75*24 & FanApprox <20
issue_warning = "RH is high inside and not so high outside, consider increasing ventilation"

Calculation: sumTemp_out = sum of RH outside in past 24 hours (using hourly data) sumTemp_in = sum of RH for the average value in farm (average col 16, col 1, and col 29) FanApprox = average tobj$FanApproxCP + tobj$FanApproxCC in past 24 hours

if sumTemp_out< 1.1 * sumTemp_in & & sumTemp_in >23*24 & FanApprox <20
issue_warning = "It it is cooler outside than inside, consider increasing ventilation"
if sumTemp_out< 1.1 * sumTemp_in & & sumTemp_in >23*24 & FanApprox >40
issue_warning = "It it is warmer outside than inside, consider decreasing ventilation"
meljsingh commented 3 years ago

And finally, maybe we can automate this: IMG_7695