文件说明
客户在使用ST FOC4.3库文件控制电机过程中,当使用了STM32F30x芯片时,如果使用的是ICS(Isolated Current Sensor)采样电流信号时会遇到无法编译通过报错问题,本文用以说明如何修正这个问题。
文件预览
- /**
- ******************************************************************************
- * @file SystemNDriveParams.h
- * @author STMicroelectronics - System Lab - MC Team
- * [url=home.php?mod=space&uid=252314]@version[/url] 4.3.0
- * [url=home.php?mod=space&uid=311857]@date[/url] 22-Sep-2016 15:29
- * [url=home.php?mod=space&uid=159083]@brief[/url] This file contains System & Drive constant initialization
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * [url=http://www.st.com/software_license_agreement_liberty_v2]http://www.st.com/software_license_agreement_liberty_v2[/url]
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __SYSTEMNDRIVE_PARAMS_H
- #define __SYSTEMNDRIVE_PARAMS_H
- #include "Parameters conversion.h"
- #ifdef SINGLEDRIVE
- #define MAX_TWAIT 0 /* Dummy value for single drive */
- #define FREQ_RATIO 1 /* Dummy value for single drive */
- #define FREQ_RELATION HIGHEST_FREQ /* Dummy value for single drive */
- #endif
- #ifdef DUALDRIVE
- #include "Parameters conversion motor 2.h"
- /**
- * [url=home.php?mod=space&uid=159083]@brief[/url] PI / PID Speed loop parameters Motor 2
- */
- PIParams_t PISpeedParamsM2 =
- {
- .hDefKpGain = (int16_t)PID_SPEED_KP_DEFAULT2, /*!< Default Kp gain, used to initialize Kp gain
- software variable*/
- .hDefKiGain = (int16_t)PID_SPEED_KI_DEFAULT2, /*!< Default Ki gain, used to initialize Ki gain
- software variable*/
- .hKpDivisor = (uint16_t)SP_KPDIV2, /*!< Kp gain divisor, used in conjuction with
- Kp gain allows obtaining fractional values.
- If FULL_MISRA_C_COMPLIANCY is not defined
- the divisor is implemented through
- algebrical right shifts to speed up PI
- execution. Only in this case this parameter
- specifies the number of right shifts to be
- executed */
- .hKiDivisor = (uint16_t)SP_KIDIV2, /*!< Ki gain divisor, used in conjuction with
- Ki gain allows obtaining fractional values.
- If FULL_MISRA_C_COMPLIANCY is not defined
- the divisor is implemented through
- algebrical right shifts to speed up PI
- execution. Only in this case this parameter
- specifies the number of right shifts to be
- executed */
- .wDefMaxIntegralTerm = (int32_t)IQMAX2 * (int32_t)SP_KIDIV2,/*!< Upper limit used to saturate the integral
- term given by Ki / Ki divisor * integral of
- process variable error */
- .wDefMinIntegralTerm = -(int32_t)IQMAX2 * (int32_t)SP_KIDIV2,/*!< Lower limit used to saturate the integral
- term given by Ki / Ki divisor * integral of
- process variable error */
- .hDefMaxOutput = (int16_t)IQMAX2, /*!< Upper limit used to saturate the PI output
- */
- .hDefMinOutput = -(int16_t)IQMAX2, /*!< Lower limit used to saturate the PI output
- */
- .hKpDivisorPOW2 = (uint16_t)SP_KPDIV_LOG2, /*!< Kp gain divisor expressed as power of 2.
- E.g. if gain divisor is 512 the value
- must be 9 because 2^9 = 512 */
- .hKiDivisorPOW2 =( uint16_t)SP_KIDIV_LOG2 /*!< Ki gain divisor expressed as power of 2.
- E.g. if gain divisor is 512 the value
- must be 9 because 2^9 = 512 */
- };
- /**
- * @brief PI / PID Iq loop parameter Motor 2
- */
- PIParams_t PIIqParamsM2 =
- {
- .hDefKpGain = (int16_t)PID_TORQUE_KP_DEFAULT2, /*!< Default Kp gain, used to initialize Kp gain
- software variable*/
- .hDefKiGain = (int16_t)PID_TORQUE_KI_DEFAULT2, /*!< Default Ki gain, used to initialize Ki gain
- software variable*/
- .hKpDivisor = (uint16_t)TF_KPDIV2, /*!< Kp gain divisor, used in conjuction with
- Kp gain allows obtaining fractional values.
- If FULL_MISRA_C_COMPLIANCY is not defined
- the divisor is implemented through
- algebrical right shifts to speed up PI
- execution. Only in this case this parameter
- specifies the number of right shifts to be
- executed */
- .hKiDivisor = (uint16_t)TF_KIDIV2, /*!< Ki gain divisor, used in conjuction with
- Ki gain allows obtaining fractional values.
- If FULL_MISRA_C_COMPLIANCY is not defined
- the divisor is implemented through
- algebrical right shifts to speed up PI
- execution. Only in this case this parameter
- specifies the number of right shifts to be
- executed */
- .wDefMaxIntegralTerm = (int32_t)S16_MAX * TF_KIDIV2, /*!< Upper limit used to saturate the integral
- term given by Ki / Ki divisor * integral of
- process variable error */
- .wDefMinIntegralTerm = (int32_t)S16_MIN * TF_KIDIV2, /*!< Lower limit used to saturate the integral
- term given by Ki / Ki divisor * integral of
- process variable error */
- .hDefMaxOutput = S16_MAX, /*!< Upper limit used to saturate the PI output
- */
- .hDefMinOutput = -S16_MAX, /*!< Lower limit used to saturate the PI output
- */
- .hKpDivisorPOW2 = (uint16_t)TF_KPDIV_LOG2, /*!< Kp gain divisor expressed as power of 2.
- E.g. if gain divisor is 512 the value
- must be 9 because 2^9 = 512 */
- .hKiDivisorPOW2 = (uint16_t)TF_KIDIV_LOG2 /*!< Ki gain divisor expressed as power of 2.
- E.g. if gain divisor is 512 the value
- must be 9 because 2^9 = 512 */
- };
- /**
- * @brief PI / PID Id loop parameter Motor 2
- */
- PIParams_t PIIdParamsM2 =
- {
- .hDefKpGain = (int16_t)PID_FLUX_KP_DEFAULT2, /*!< Default Kp gain, used to initialize Kp gain
- software variable*/
- .hDefKiGain = (int16_t)PID_FLUX_KI_DEFAULT2, /*!< Default Ki gain, used to initialize Ki gain
- software variable*/
- .hKpDivisor = (uint16_t)TF_KPDIV2, /*!< Kp gain divisor, used in conjuction with
- Kp gain allows obtaining fractional values.
- If FULL_MISRA_C_COMPLIANCY is not defined
- the divisor is implemented through
- algebrical right shifts to speed up PI
- execution. Only in this case this parameter
- specifies the number of right shifts to be
- executed */
- .hKiDivisor = (uint16_t)TF_KIDIV2, /*!< Ki gain divisor, used in conjuction with
- Ki gain allows obtaining fractional values.
- If FULL_MISRA_C_COMPLIANCY is not defined
- the divisor is implemented through
- algebrical right shifts to speed up PI
- execution. Only in this case this parameter
- specifies the number of right shifts to be
- executed */
- .wDefMaxIntegralTerm = (int32_t)S16_MAX * TF_KIDIV2, /*!< Upper limit used to saturate the integral
- term given by Ki / Ki divisor * integral of
- process variable error */
- .wDefMinIntegralTerm = (int32_t)S16_MIN * TF_KIDIV2, /*!< Lower limit used to saturate the integral
- term given by Ki / Ki divisor * integral of
- process variable error */
- .hDefMaxOutput = S16_MAX, /*!< Upper limit used to saturate the PI output
- */
- .hDefMinOutput = -S16_MAX, /*!< Lower limit used to saturate the PI output
- */
- .hKpDivisorPOW2 = (uint16_t)TF_KPDIV_LOG2, /*!< Kp gain divisor expressed as power of 2.
- E.g. if gain divisor is 512 the value
-
下载:
玩板看这里:
https://bbs.eeworld.com.cn/elecplay.html
EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!