Permalink
Browse files

Disable ID, there seems to be a bug.

Use window function to pick last temperature in the time interval.
  • Loading branch information...
1 parent 2a588e1 commit 2e35f823eb11cf197db198ec6c399620f69a3003 @drbrain committed Oct 18, 2011
Showing with 7 additions and 6 deletions.
  1. +3 −3 lib/indigo_control.rb
  2. +4 −3 temperature_graph.r
View
6 lib/indigo_control.rb
@@ -18,9 +18,9 @@ def initialize
@pid = PID.new get_set_point
# Ziegler-Nichols
- @pid.proportional_gain = 1.0 * 0.6
- @pid.integral_gain = 2 * @pid.proportional_gain / 60
- @pid.derivative_gain = 0.6 * @pid.integral_gain / 8
+ #@pid.proportional_gain = 1.0 * 0.6
+ #@pid.integral_gain = 2 * @pid.proportional_gain / 60
+ #@pid.derivative_gain = 0.6 * @pid.integral_gain / 8
end
def get_set_point
View
7 temperature_graph.r
@@ -30,11 +30,12 @@ WHERE ts > now() - interval '24 hours'
ORDER BY time")
desired <- query(con, "
-SELECT date_trunc('minute', ts) as time, max(temperature) as temp
+SELECT date_trunc('minute', ts) as time,
+ last_value(temperature) OVER
+ (PARTITION BY date_trunc('minute', ts)) as temp
FROM desired_temperatures
WHERE ts > now() - interval '24 hours'
-GROUP BY date_trunc('minute', ts)
-ORDER BY time")
+ORDER BY ts")
fire_on <- query(con, "
SELECT ts as time

0 comments on commit 2e35f82

Please sign in to comment.