/**
* @file ALGO_PID_ATY.h
*
* @param Project ALGO_Algorithm_ATY_LIB
*
* @author ATY
*
* @copyright
* - Copyright 2017 - 2023 MZ-ATY
* - This code follows:
* - MZ-ATY Various Contents Joint Statement -
*
* https://mengze.top/MZ-ATY_VCJS
* - CC 4.0 BY-NC-SA -
*
* https://creativecommons.org/licenses/by-nc-sa/4.0/
* - Your use will be deemed to have accepted the terms of this statement.
*
* @brief Familiar functions of CRC for all codes
*
* @version
* - 1_01_200318 > ATY
* -# Preliminary version, first Release
* - 1_02_200318 > ATY
* -# Add Conditional Compilation
* -# Add user port
* -Undone
**********************************************************************************
*/
#ifndef __ALGO_PID_ATY_H
#define __ALGO_PID_ATY_H
#include "INCLUDE_ATY.h"
/******************************* For user *************************************/
// #define __DEBUG_ALGO_PID_ATY
/******************************************************************************/
typedef struct PID{
double SetPoint; // Set point desired value
double Proportion; // Proportional const
double Integral; // Integral const
double Derivative; // Derivative const
double LastError; // Error[-1]
double PrevError; // Error[-2]
double SumError; // Sums of errors
}PID;
double PidCalc(PID* pidStruct, double nextPoint);
void PidInitZero(PID* pidStruct);
void PidClearZero(PID* pidStruct);
#ifdef __DEBUG_ALGO_PID_ATY
void Actuator(double rDelta);
void PidControl(void);
#endif /* __DEBUG_ALGO_PID_ATY */
#endif /* __ALGO_PID_ATY_H */
/******************************** End Of File *********************************/