blob: 0a143e709344415be6bd74644243b8e53806432d [file] [log] [blame]
James Feistce6a3f32019-03-12 11:20:16 -07001#pragma once
2
Patrick Venture7a98c192020-08-12 08:35:16 -07003#include "pid/zone_interface.hpp"
James Feistce6a3f32019-03-12 11:20:16 -07004
5#include <boost/asio/steady_timer.hpp>
6
Patrick Venturea0764872020-08-08 07:48:43 -07007namespace pid_control
8{
9
James Feistce6a3f32019-03-12 11:20:16 -070010/**
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 Venture7a98c192020-08-12 08:35:16 -070015 * @param[in] zone - ptr to the ZoneInterface implementation for this loop.
James Feistce6a3f32019-03-12 11:20:16 -070016 * @param[in] timer - boost timer used for async callback.
Hao Jiangb6a0b892021-02-21 18:00:45 -080017 * @param[in] isCanceling - bool ptr to indicate whether pidControlLoop is being
18 * canceled.
James Feistce6a3f32019-03-12 11:20:16 -070019 * @param[in] first - boolean to denote if initialization needs to be run.
Bonnie Lo0e8fc392022-10-05 10:20:55 +080020 * @param[in] cycleCnt - loop timer counter.
James Feistce6a3f32019-03-12 11:20:16 -070021 */
Johnathan Mantey5301aae2020-09-28 11:06:58 -070022void pidControlLoop(std::shared_ptr<ZoneInterface> zone,
23 std::shared_ptr<boost::asio::steady_timer> timer,
Hao Jiangb6a0b892021-02-21 18:00:45 -080024 const bool* isCanceling, bool first = true,
Bonnie Lo0e8fc392022-10-05 10:20:55 +080025 uint64_t cycleCnt = 0);
Patrick Venturea0764872020-08-08 07:48:43 -070026
27} // namespace pid_control