components/PID/PID_v1.h

changeset 82
7d17e2cb31a8
parent 29
45647136ec95
equal deleted inserted replaced
81:72c715ac0444 82:7d17e2cb31a8
25 PID_DIRECT = 0, ///< PID direction normal. 25 PID_DIRECT = 0, ///< PID direction normal.
26 PID_REVERSE = 1, ///< PID direction reverse. 26 PID_REVERSE = 1, ///< PID direction reverse.
27 } PID_DIRECTION; 27 } PID_DIRECTION;
28 28
29 /** 29 /**
30 * @brief PID calculation mode.
31 */
32 typedef enum
33 {
34 PID_P_ON_M = 0, ///< PID on Measurement.
35 PID_P_ON_E = 1, ///< PID on Errors.
36 } PID_PON;
37
38
39
40 /**
41 * @brief Setup the PID controller and initialize. 30 * @brief Setup the PID controller and initialize.
42 * @param[in] Input The measured value. 31 * @param[in] Input The measured value.
43 * @param[in,out] Output The computed result. 32 * @param[in,out] Output The computed result.
44 * @param[in] Setpoint The setpoint to regulate to. 33 * @param[in] Setpoint The setpoint to regulate to.
45 * @param[in] Kp The Proportional value. 34 * @param[in] Kp The Proportional value.
46 * @param[in] Ki The Intergral value. 35 * @param[in] Ki The Intergral value.
47 * @param[in] Kd The Derivate value. 36 * @param[in] Kd The Derivate value.
48 * @param[in] POn 0 - PID on Measurement, 1 - PID on Error.
49 * @param[in] Direction Direct or Reverse action. 37 * @param[in] Direction Direct or Reverse action.
50 */ 38 */
51 void PID(double* Input, double* Output, double* Setpoint, double Kp, double Ki, double Kd, PID_PON POn, PID_DIRECTION Direction); 39 void PID(double* Input, double* Output, double* Setpoint, double Kp, double Ki, double Kd, PID_DIRECTION Direction);
52 40
53 /** 41 /**
54 * @brief sets PID to either Manual or Automatic. 42 * @brief sets PID to either Manual or Automatic.
55 * @param Mode Manual (0) or Automatic (1). 43 * @param Mode Manual (0) or Automatic (1).
56 */ 44 */
76 * @brief While most users will set the tunings once in the constructor, this function gives 64 * @brief While most users will set the tunings once in the constructor, this function gives
77 * the user the option of changing tunings during runtime for Adaptive control. 65 * the user the option of changing tunings during runtime for Adaptive control.
78 * @param[in] Kp The Proportional value. 66 * @param[in] Kp The Proportional value.
79 * @param[in] Ki The Intergral value. 67 * @param[in] Ki The Intergral value.
80 * @param[in] Kd The Derivate value. 68 * @param[in] Kd The Derivate value.
81 * @param[in] POn 0 - PID on Measurement, 1 - PID on Error.
82 */ 69 */
83 void PID_SetTunings(double Kp, double Ki, double Kd, PID_PON POn); 70 void PID_SetTunings(double Kp, double Ki, double Kd);
84 71
85 /** 72 /**
86 * @brief The PID will either be connected to a DIRECT acting process (+Output leads 73 * @brief The PID will either be connected to a DIRECT acting process (+Output leads
87 * to +Input) or a REVERSE acting process(+Output leads to -Input.) we need to 74 * to +Input) or a REVERSE acting process(+Output leads to -Input.) we need to
88 * know which one, because otherwise we may increase the output when we should 75 * know which one, because otherwise we may increase the output when we should

mercurial