12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- /**
- * @file spdflxwkn.c
- * @author xu, haifeng(xuhf58@midea.com)
- * @brief
- * @version 0.1
- * @date 2024-01-17
- *
- * @copyright Copyright (c) 2024
- *
- */
- #include "spdflxwkn.h"
- /******************************
- *
- * Variable Define and Initial
- *
- ******************************/
- SPDFW_CTRL_COEFIN spdflx_stCtrlCoefIn = {0};
- SPDFW_CTRL_COEF spdflx_stCtrlCoef = SPDFW_CTRL_COEF_DEFAULT;
- SPDFW_CTRL_IN spdflx_stCtrlIn = {0};
- SPDFW_CTRL_OUT spdflx_stCtrlOut = SPDFW_CTRL_OUT_DEFAULT;
- /******************************
- *
- * Function Statement
- *
- ******************************/
- void spdflx_voInit(void);
- void spdflx_voCoef(SPDFW_CTRL_COEFIN *in, SPDFW_CTRL_COEF *out);
- void spdflx_voCtrl(SPDFW_CTRL_IN *in, SPDFW_CTRL_COEF *coef, SPDFW_CTRL_OUT *out);
- /**
- * @brief Spd FluxWeak Module Init
- *
- * @param void
- * @return void
- */
- void spdflx_voInit(void)
- {
- spdflx_stCtrlOut.swIdRefPu = 0;
- spdflx_stCtrlOut.swIqLimPu = spdflx_stCtrlCoef.swIpeakMaxPu;
- }
- /**
- * @brief Spd FluxWeak Coefficient Init
- *
- * @param SPDFW_CTRL_COEFIN
- * @param SPDFW_CTRL_COEF
- * @return void
- */
- void spdflx_voCoef(SPDFW_CTRL_COEFIN *in, SPDFW_CTRL_COEF *out)
- {
- out->swFlxStartSpeedPu = in->swRSpeedPu >>1;
- out->swFlxStopSpeedPu = in->swRSpeedPu;
- out->swIdMinPu = in->swIdMinPu;
- out->swIpeakMaxPu = in->swIpeakMaxPu;
- out->slFlxKPu = ((SLONG) out->swIdMinPu<<15) /( out->swFlxStopSpeedPu - out->swFlxStartSpeedPu);
- }
- /**
- * @brief Spd FluxWeak Coefficient Calculate
- *
- * @param SPDFW_CTRL_IN
- * @param SPDFW_CTRL_COEF
- * @param SPDFW_CTRL_OUT
- * @return void
- */
- void spdflx_voCtrl(SPDFW_CTRL_IN *in, SPDFW_CTRL_COEF *coef, SPDFW_CTRL_OUT *out)
- {
- if(in->swSpdFbkLpfAbsPu < coef->swFlxStartSpeedPu)
- {
- out->swIdRefPu = 0;
- }
- else if(in->swSpdFbkLpfAbsPu < coef->swFlxStopSpeedPu)
- {
- out->swIdRefPu = (SWORD)(coef->slFlxKPu * ((SLONG)in->swSpdFbkLpfAbsPu - (SLONG)coef->swFlxStartSpeedPu) >>15);
- }
- else
- {
- out->swIdRefPu = coef->swIdMinPu;
- }
-
- out->swIqLimPu = mth_slSqrt(((SLONG)coef-> swIpeakMaxPu * (SLONG)coef-> swIpeakMaxPu) - ((SLONG)out->swIdRefPu * (SLONG)out->swIdRefPu));
- }
|