diff --git a/config.py.EXAMPLE b/config.py.EXAMPLE index 60a5130..304a12f 100644 --- a/config.py.EXAMPLE +++ b/config.py.EXAMPLE @@ -1,13 +1,33 @@ import logging +#Logging log_level = logging.INFO log_format = '%(asctime)s %(levelname)s %(name)s: %(message)s' +#Server +listening_ip = "0.0.0.0" +listening_port = 8080 + +#GPIOs gpio_heat = 11 gpio_cool = 10 -gpio_air = 9 +gpio_air = 9 gpio_door = 18 - gpio_sensor_cs = 27 gpio_sensor_clock = 22 gpio_sensor_data = 17 + +#PID parameters +pid_ki = 0.1 #Integration +pid_kd = 0.4 #Derivative +pid_kp = 0.5 #Proportional + +#Simulation parameters +sim_t_env = 25.0 #deg C +sim_c_heat = 100.0 #J/K heat capacity of heat element +sim_c_oven = 2000.0 #J/K heat capacity of oven +sim_p_heat = 3500.0 #W heating power of oven +sim_R_o_nocool = 1.0 #K/W thermal resistance oven -> environment +sim_R_o_cool = 0.05 #K/W " with cooling +sim_R_ho_noair = 0.1 #K/W thermal resistance heat element -> oven +sim_R_ho_air = 0.05 #K/W " with internal air circulation diff --git a/oven.py b/oven.py index 49d4e01..0989e5c 100644 --- a/oven.py +++ b/oven.py @@ -54,7 +54,7 @@ class Oven (threading.Thread): self.set_heat(False) self.set_cool(False) self.set_air(False) - self.pid = PID(ki=0.1,kd=0.5,kp=0.4) + self.pid = PID(ki=config.pid_ki,kd=config.pid_kd,kp=config.pid_kp) def run_profile(self, profile): log.info("Running profile %s"%profile.name) @@ -182,14 +182,14 @@ class TempSensorSimulate(TempSensor): self.sleep_time = sleep_time def run(self): - t_env = 25.0 #deg C - c_heat = 100.0 #J/K heat capacity of heat element - c_oven = 2000.0 #J/K heat capacity of oven - p_heat = 3500.0 #W heating power of oven - R_o_nocool = 1.0 #K/W thermal resistance oven -> environment - R_o_cool = 0.05 #K/W thermal resistance oven -> environment - R_ho_noair = 0.1 #K/W thermal resistance heat element -> oven - R_ho_air = 0.05 #K/W + t_env = config.sim_t_env + c_heat = config.sim_c_heat + c_oven = config.sim_c_oven + p_heat = config.sim_p_heat + R_o_nocool = config.sim_R_o_nocool + R_o_cool = config.sim_R_o_cool + R_ho_noair = config.sim_R_ho_noair + R_ho_air = config.sim_R_ho_air t = t_env #deg C temp in oven t_h = t #deg C temp of heat element diff --git a/picoreflowd.py b/picoreflowd.py index 3cf9590..c1672c8 100644 --- a/picoreflowd.py +++ b/picoreflowd.py @@ -153,8 +153,8 @@ def save_profile(profile, force=False): return True def main(): - ip = "0.0.0.0" - port = 8080 + ip = config.listening_ip + port = config.listening_port log.info("listening to %s:%d"%(ip,port)) server = WSGIServer((ip,port), app,