From 4fddeeb4a8024531f46cd3100e479ff79531dcc1 Mon Sep 17 00:00:00 2001 From: jbruce12000 Date: Tue, 21 Nov 2023 09:53:09 -0500 Subject: [PATCH] add throttling of elements below a specific temp if outside the pid control window --- config.py | 10 ++++++++++ lib/oven.py | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/config.py b/config.py index 3a7dd90..33e133d 100644 --- a/config.py +++ b/config.py @@ -228,3 +228,13 @@ automatic_restart_state_file = os.path.abspath(os.path.join(os.path.dirname( __f kiln_profiles_directory = os.path.abspath(os.path.join(os.path.dirname( __file__ ),"storage", "profiles")) #kiln_profiles_directory = os.path.abspath(os.path.join(os.path.dirname( __file__ ),'..','kiln-profiles','pottery')) + +######################################################################## +# low temperature throttling of elements +# kiln elements have lots of power and tend to drastically overshoot +# at low temperatures. When under the set point and outside the PID +# control window and below throttle_below_temp, only throttle_percent +# of the elements are used max. +# To prevent throttling, set throttle_percent to 100. +throttle_below_temp = 300 +throttle_percent = 20 diff --git a/lib/oven.py b/lib/oven.py index 245c662..028fd5c 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -793,6 +793,10 @@ class PID(): elif error > (1 * config.pid_control_window): log.info("kiln outside pid control window, max heating") output = 1 + if config.throttle_below_temp and config.throttle_percent: + if ispoint <= config.throttle_below_temp: + output = config.throttle_percent/100 + log.info("max heating throttled at %d percent below %d degrees to prevent overshoot" % (config.throttle_percent,config.throttle_below_temp)) else: icomp = (error * timeDelta * (1/self.ki)) self.iterm += (error * timeDelta * (1/self.ki))