kopia lustrzana https://github.com/jbruce12000/kiln-controller
Removed changes not needed for PR
rodzic
3a097e5098
commit
c43770ace5
|
@ -1,49 +0,0 @@
|
|||
from lib.oven import Profile
|
||||
import os
|
||||
import json
|
||||
|
||||
def get_profile():
|
||||
profile_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'storage', 'profiles', "test-fast.json"))
|
||||
print(profile_path)
|
||||
with open(profile_path) as infile:
|
||||
profile_json = json.dumps(json.load(infile))
|
||||
profile = Profile(profile_json)
|
||||
|
||||
return profile
|
||||
|
||||
|
||||
def test_get_target_temperature():
|
||||
profile = get_profile()
|
||||
|
||||
temperature = profile.get_target_temperature(3000)
|
||||
assert int(temperature) == 178
|
||||
|
||||
temperature = profile.get_target_temperature(6004)
|
||||
assert temperature == 801.0
|
||||
|
||||
|
||||
def test_shift_remaining_segments():
|
||||
profile = get_profile()
|
||||
|
||||
now = 6000
|
||||
shift_seconds = 100
|
||||
profile.shift_remaining_segments(now, shift_seconds)
|
||||
|
||||
assert profile.data[0][0] == 0
|
||||
assert profile.data[1][0] == 3600
|
||||
assert profile.data[2][0] == 10900
|
||||
assert profile.data[3][0] == 14500
|
||||
assert profile.data[4][0] == 16500
|
||||
assert profile.data[5][0] == 19500
|
||||
|
||||
|
||||
def test_get_next_point():
|
||||
profile = get_profile()
|
||||
|
||||
now = 6000
|
||||
segment = profile.get_next_point(now)
|
||||
assert segment == 2
|
||||
|
||||
now = 14405
|
||||
segment = profile.get_next_point(now)
|
||||
assert segment == 4
|
|
@ -149,7 +149,7 @@ kiln_must_catch_up = True
|
|||
# or 100% off because the kiln is too hot. No integral builds up
|
||||
# outside the window. The bigger you make the window, the more
|
||||
# integral you will accumulate. This should be a positive integer.
|
||||
pid_control_window = 50 #degrees
|
||||
pid_control_window = 5 #degrees
|
||||
|
||||
# thermocouple offset
|
||||
# If you put your thermocouple in ice water and it reads 36F, you can
|
||||
|
@ -205,7 +205,7 @@ ignore_tc_too_many_errors = False
|
|||
# cleaned up (deleted) by the OS on boot.
|
||||
# The state file is written to disk every sensor_time_wait seconds (2s by default)
|
||||
# and is written in the same directory as config.py.
|
||||
automatic_restarts = False
|
||||
automatic_restarts = True
|
||||
automatic_restart_window = 15 # max minutes since power outage
|
||||
automatic_restart_state_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ),'state.json'))
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ class Oven(threading.Thread):
|
|||
self.cost = 0
|
||||
self.state = "IDLE"
|
||||
self.profile = None
|
||||
self.start_time = datetime.datetime.now()
|
||||
self.start_time = 0
|
||||
self.runtime = 0
|
||||
self.totaltime = 0
|
||||
self.target = 0
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import threading,logging,json,time,datetime
|
||||
|
||||
import config
|
||||
from oven import Oven
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue