Merge branch 'blinka' of https://github.com/jbruce12000/kiln-controller into blinka
This commit is contained in:
commit
0485ed961a
@ -12,12 +12,13 @@ Turns a Raspberry Pi into an inexpensive, web-enabled kiln controller.
|
|||||||
* no limit to runtime - fire for days if you want
|
* no limit to runtime - fire for days if you want
|
||||||
* view status from multiple devices at once - computer, tablet etc
|
* view status from multiple devices at once - computer, tablet etc
|
||||||
* real-time firing cost estimate
|
* real-time firing cost estimate
|
||||||
* NIST-linearized conversion for accurate K type thermocouple readings
|
* real-time heating rate displayed in degrees per hour
|
||||||
* supports PID parameters you tune to your kiln
|
* supports PID parameters you tune to your kiln
|
||||||
* monitors temperature in kiln after schedule has ended
|
* monitors temperature in kiln after schedule has ended
|
||||||
* api for starting and stopping at any point in a schedule
|
* api for starting and stopping at any point in a schedule
|
||||||
* accurate simulation
|
* accurate simulation
|
||||||
* support for shifting schedule when kiln cannot heat quickly enough
|
* support for shifting schedule when kiln cannot heat quickly enough
|
||||||
|
* support for skipping first part of profile to match current kiln temperature
|
||||||
* prevents integral wind-up when temperatures not near the set point
|
* prevents integral wind-up when temperatures not near the set point
|
||||||
* automatic restarts if there is a power outage or other event
|
* automatic restarts if there is a power outage or other event
|
||||||
* support for a watcher to page you via slack if you kiln is out of whack
|
* support for a watcher to page you via slack if you kiln is out of whack
|
||||||
|
|||||||
23
lib/oven.py
23
lib/oven.py
@ -327,6 +327,8 @@ class Oven(threading.Thread):
|
|||||||
self.totaltime = 0
|
self.totaltime = 0
|
||||||
self.target = 0
|
self.target = 0
|
||||||
self.heat = 0
|
self.heat = 0
|
||||||
|
self.heat_rate = 0
|
||||||
|
self.heat_rate_temps = []
|
||||||
self.pid = PID(ki=config.pid_ki, kd=config.pid_kd, kp=config.pid_kp)
|
self.pid = PID(ki=config.pid_ki, kd=config.pid_kd, kp=config.pid_kp)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -339,6 +341,24 @@ class Oven(threading.Thread):
|
|||||||
startat = 0
|
startat = 0
|
||||||
return startat
|
return startat
|
||||||
|
|
||||||
|
def set_heat_rate(self,runtime,temp):
|
||||||
|
'''heat rate is the heating rate in degrees/hour
|
||||||
|
'''
|
||||||
|
# arbitrary number of samples
|
||||||
|
# the time this covers changes based on a few things
|
||||||
|
numtemps = 60
|
||||||
|
self.heat_rate_temps.append((runtime,temp))
|
||||||
|
|
||||||
|
# drop old temps off the list
|
||||||
|
if len(self.heat_rate_temps) > numtemps:
|
||||||
|
self.heat_rate_temps = self.heat_rate_temps[-1*numtemps:]
|
||||||
|
time2 = self.heat_rate_temps[-1][0]
|
||||||
|
time1 = self.heat_rate_temps[0][0]
|
||||||
|
temp2 = self.heat_rate_temps[-1][1]
|
||||||
|
temp1 = self.heat_rate_temps[0][1]
|
||||||
|
if time2 > time1:
|
||||||
|
self.heat_rate = ((temp2 - temp1) / (time2 - time1))*3600
|
||||||
|
|
||||||
def run_profile(self, profile, startat=0, allow_seek=True):
|
def run_profile(self, profile, startat=0, allow_seek=True):
|
||||||
log.debug('run_profile run on thread' + threading.current_thread().name)
|
log.debug('run_profile run on thread' + threading.current_thread().name)
|
||||||
runtime = startat * 60
|
runtime = startat * 60
|
||||||
@ -426,6 +446,8 @@ class Oven(threading.Thread):
|
|||||||
temp = 0
|
temp = 0
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self.set_heat_rate(self.runtime,temp)
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
'cost': self.cost,
|
'cost': self.cost,
|
||||||
'runtime': self.runtime,
|
'runtime': self.runtime,
|
||||||
@ -433,6 +455,7 @@ class Oven(threading.Thread):
|
|||||||
'target': self.target,
|
'target': self.target,
|
||||||
'state': self.state,
|
'state': self.state,
|
||||||
'heat': self.heat,
|
'heat': self.heat,
|
||||||
|
'heat_rate': self.heat_rate,
|
||||||
'totaltime': self.totaltime,
|
'totaltime': self.totaltime,
|
||||||
'kwh_rate': config.kwh_rate,
|
'kwh_rate': config.kwh_rate,
|
||||||
'currency_type': config.currency_type,
|
'currency_type': config.currency_type,
|
||||||
|
|||||||
@ -575,6 +575,10 @@ $(document).ready(function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#act_temp').html(parseInt(x.temperature));
|
$('#act_temp').html(parseInt(x.temperature));
|
||||||
|
heat_rate = parseInt(x.heat_rate)
|
||||||
|
if (heat_rate > 9999) { heat_rate = 9999; }
|
||||||
|
if (heat_rate < -9999) { heat_rate = -9999; }
|
||||||
|
$('#heat_rate').html(heat_rate);
|
||||||
$('#heat').html('<div class="bar" style="height:'+x.pidstats.out*70+'%;"></div>')
|
$('#heat').html('<div class="bar" style="height:'+x.pidstats.out*70+'%;"></div>')
|
||||||
if (x.cool > 0.5) { $('#cool').addClass("ds-led-cool-active"); } else { $('#cool').removeClass("ds-led-cool-active"); }
|
if (x.cool > 0.5) { $('#cool').addClass("ds-led-cool-active"); } else { $('#cool').removeClass("ds-led-cool-active"); }
|
||||||
if (x.air > 0.5) { $('#air').addClass("ds-led-air-active"); } else { $('#air').removeClass("ds-led-air-active"); }
|
if (x.air > 0.5) { $('#air').addClass("ds-led-air-active"); } else { $('#air').removeClass("ds-led-air-active"); }
|
||||||
@ -608,6 +612,7 @@ $(document).ready(function()
|
|||||||
|
|
||||||
$('#act_temp_scale').html('º'+temp_scale_display);
|
$('#act_temp_scale').html('º'+temp_scale_display);
|
||||||
$('#target_temp_scale').html('º'+temp_scale_display);
|
$('#target_temp_scale').html('º'+temp_scale_display);
|
||||||
|
$('#heat_rate_temp_scale').html('º'+temp_scale_display);
|
||||||
|
|
||||||
switch(time_scale_profile){
|
switch(time_scale_profile){
|
||||||
case "s":
|
case "s":
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
<div class="ds-title-panel">
|
<div class="ds-title-panel">
|
||||||
<div class="ds-title">Sensor Temp</div>
|
<div class="ds-title">Sensor Temp</div>
|
||||||
<div class="ds-title">Target Temp</div>
|
<div class="ds-title">Target Temp</div>
|
||||||
|
<div class="ds-title">Heat Rate</div>
|
||||||
<div class="ds-title">Cost</div>
|
<div class="ds-title">Cost</div>
|
||||||
<div class="ds-title ds-state pull-right" style="border-left: 1px solid #ccc;">Status</div>
|
<div class="ds-title ds-state pull-right" style="border-left: 1px solid #ccc;">Status</div>
|
||||||
</div>
|
</div>
|
||||||
@ -36,6 +37,7 @@
|
|||||||
<div class="ds-panel">
|
<div class="ds-panel">
|
||||||
<div class="display ds-num"><span id="act_temp">25</span><span class="ds-unit" id="act_temp_scale" >°C</span></div>
|
<div class="display ds-num"><span id="act_temp">25</span><span class="ds-unit" id="act_temp_scale" >°C</span></div>
|
||||||
<div class="display ds-num ds-target"><span id="target_temp">---</span><span class="ds-unit" id="target_temp_scale">°C</span></div>
|
<div class="display ds-num ds-target"><span id="target_temp">---</span><span class="ds-unit" id="target_temp_scale">°C</span></div>
|
||||||
|
<div class="display ds-num ds-heat-rate"><span id="heat_rate">---</span><span class="ds-unit" id="heat_rate_temp_scale">°C</span></div>
|
||||||
<div class="display ds-num ds-cost"><span id="cost">0.00</span><span class="ds-unit" id="cost"></span></div>
|
<div class="display ds-num ds-cost"><span id="cost">0.00</span><span class="ds-unit" id="cost"></span></div>
|
||||||
<div class="display ds-num ds-text" id="state"></div>
|
<div class="display ds-num ds-text" id="state"></div>
|
||||||
<div class="display pull-right ds-state" style="padding-right:0"><span class="ds-led" id="heat">\</span><span class="ds-led" id="cool">l</span><span class="ds-led" id="air">[</span><span class="ds-led" id="hazard">I</span><span class="ds-led" id="door">♨</span></div>
|
<div class="display pull-right ds-state" style="padding-right:0"><span class="ds-led" id="heat">\</span><span class="ds-led" id="cool">l</span><span class="ds-led" id="air">[</span><span class="ds-led" id="hazard">I</span><span class="ds-led" id="door">♨</span></div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user