James Feist | ce6a3f3 | 2019-03-12 11:20:16 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 7a98c19 | 2020-08-12 08:35:16 -0700 | [diff] [blame] | 3 | #include "pid/zone_interface.hpp" |
James Feist | ce6a3f3 | 2019-03-12 11:20:16 -0700 | [diff] [blame] | 4 | |
| 5 | #include <boost/asio/steady_timer.hpp> |
| 6 | |
Patrick Venture | a076487 | 2020-08-08 07:48:43 -0700 | [diff] [blame] | 7 | namespace pid_control |
| 8 | { |
| 9 | |
James Feist | ce6a3f3 | 2019-03-12 11:20:16 -0700 | [diff] [blame] | 10 | /** |
| 11 | * Main pid control loop for a given zone. |
| 12 | * This function calls itself indefinitely in an async loop to calculate |
| 13 | * fan outputs based on thermal inputs. |
| 14 | * |
Patrick Venture | 7a98c19 | 2020-08-12 08:35:16 -0700 | [diff] [blame] | 15 | * @param[in] zone - ptr to the ZoneInterface implementation for this loop. |
James Feist | ce6a3f3 | 2019-03-12 11:20:16 -0700 | [diff] [blame] | 16 | * @param[in] timer - boost timer used for async callback. |
Hao Jiang | b6a0b89 | 2021-02-21 18:00:45 -0800 | [diff] [blame] | 17 | * @param[in] isCanceling - bool ptr to indicate whether pidControlLoop is being |
| 18 | * canceled. |
James Feist | ce6a3f3 | 2019-03-12 11:20:16 -0700 | [diff] [blame] | 19 | * @param[in] first - boolean to denote if initialization needs to be run. |
Bonnie Lo | 0e8fc39 | 2022-10-05 10:20:55 +0800 | [diff] [blame] | 20 | * @param[in] cycleCnt - loop timer counter. |
James Feist | ce6a3f3 | 2019-03-12 11:20:16 -0700 | [diff] [blame] | 21 | */ |
Johnathan Mantey | 5301aae | 2020-09-28 11:06:58 -0700 | [diff] [blame] | 22 | void pidControlLoop(std::shared_ptr<ZoneInterface> zone, |
| 23 | std::shared_ptr<boost::asio::steady_timer> timer, |
Hao Jiang | b6a0b89 | 2021-02-21 18:00:45 -0800 | [diff] [blame] | 24 | const bool* isCanceling, bool first = true, |
Bonnie Lo | 0e8fc39 | 2022-10-05 10:20:55 +0800 | [diff] [blame] | 25 | uint64_t cycleCnt = 0); |
Patrick Venture | a076487 | 2020-08-08 07:48:43 -0700 | [diff] [blame] | 26 | |
| 27 | } // namespace pid_control |