#include <Symbol.h>


#define PIDx(a) ((a) - 1)
typedef struct tagPIDPARAMETER
{
    double dbKc;
    double dbTi;
    double dbTd;
    double dbTs;

    double dbE0;
    double dbQ0;

    double dbKi;
    double dbKd;

    double dbA;
    double dbB;
    double dbC;

    double dbI;
    double dbJ;
}PIDPARAMETER, *LPPIDPARAMETER;

class CPIDControl
{
private:
    PIDPARAMETER m_PID;
public:
    PIDPARAMETER* GetParmater(){return(&m_PID);}
public:
    static void MakeAttrib(PIDPARAMETER* pPIDParameter);
    void MakeAttrib();
public:
    void SetAttrib(double dbKc, double dbTi, double dbTd, double dbTs);
    void SetEQ(double dbE0, double dbQ0);
public:
    double GetP1(int n, double* pdbE);//n=1,2,...n
    double GetP2(double dbEn, double dbE1 ,double dbQ1, double* pdbQn);

    double GetDeltaP1(double dbE, double dbE1, double dbE2);//n=1,2,...n
    double GetDeltaP2(double dbE, double dbE1, double dbE2);//n=1,2,...n
    double GetDeltaP3(double dbY, double dbY1, double dbY2, double dbR);//n=1,2,...n

public:
    CPIDControl();
    ~CPIDControl();
};
