Difference between revisions of "NASA weight filter"

From HiveTool
Jump to: navigation, search
(Disadvantages)
 
Line 9: Line 9:
  
 
==Disadvantages==
 
==Disadvantages==
In the spring and summer this understates the weight of the hive. In the fall and winter, it can overstate the weight of the hive.  
+
#In the spring and summer this understates the weight of the hive. In the fall and winter, it can overstate the weight of the hive.  
May filter out swarms.
+
#May filter out swarms.
 
 
 
 
  
 
==Code==
 
==Code==

Latest revision as of 03:40, 30 November 2014

Purpose

Eliminate weight changes caused by the beekeeper so the data only reflects weight changes made by the bees.

Theory of operation

This weight filter works by calculating the change in weight (delta weight) between consecutive readings. The delta weight is divided by the time between the readings. If the weight change exceeds a threshold per unit time, it is assumed the bees could not change the weight of the hive that quickly and the weight change must be a manipulation change (a super, feeder, feed, etc. was added or removed) and it is not counted.

Advantages

Removes large changes so the detail can be seen.

Disadvantages

  1. In the spring and summer this understates the weight of the hive. In the fall and winter, it can overstate the weight of the hive.
  2. May filter out swarms.

Code

    if ( $last_weight ) {                                       # then have looped at least once and can calculate deltas
        $delta_weight = $weight - $last_weight;                 # calculate dw
        $delta_time = ($time - $last_time)/3600;                # calculate dt
        
        if ($delta_time) {                                      # don't divide by zero (if two records have the same time)
            $dwdt = $delta_weight/$delta_time; }                # calcualte dw/dt
        
                                                                # Begin NASA manipulation change filter
        if ( ($weight_filter eq "NASA") 
          && (abs $dwdt > $max_dwdt_lbs_per_hour)               # if the change in weight exceeds the threshold
          && ($start_zero_weight == 0)                          # and the data is not starting off with zeros
          && ($quality != 6) )                                  # and this record is not flagged as a swarm (Quality 6)
           {                                                    # then don't count the change as daily change,
           $manipulation_change +=  $delta_weight;              # count it as manipulation change
           }
        else
           {
           $daily_change += $delta_weight;                      # otherwise, count it as part of the daily change
           }
        }
        else {                                                  #first time through
             $daily_change = $weight;
             $first_graph_date = $row[0];
             $last_wx_rain = $row[10];
             $delta_rain = 0;
        }
        $last_weight = $weight;
        $weight = $daily_change; 
                                                                 # end NASA filter
        $last_temperature = $temperature;
        $last_time = $time;