This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

28069instaspin-foc方案识别PMSM参数问题

Other Parts Discussed in Thread: MOTORWARE

大家好

        我用motor ware的lab2B来对伺服电机进行电机识别,我的电机是(额定电流2A,额定频率200HZ,220V输入)。

        现在识别的情况是:ROVERL和RS识别电机不转,RAMP_UP电机转动,FLUX和LS的识别电机又停止了,增加和减少USER_MOTOR_IND_EST_CURRENT时FLUX和LS识别电机都不转,增加USER_MOTOR_FLUX_EST_FREQ_Hz到40HZ,电机速度很快然后过流停止。

我在user.h头文件这样设的:


//! \file solutions/instaspin_motion/boards/hvkit_rev1p1/f28x/f2806xM/src/user.h
//! \brief Contains the public interface for user initialization data for the CTRL, DRV, and EST modules
//!
//! (C) Copyright 2012, Texas Instruments, Inc.


// **************************************************************************
// the includes

// modules
#include "sw/modules/types/src/types.h"
#include "sw/modules/motor/src/motor.h"
#include "sw/modules/est/src/32b/est.h"
#include "sw/modules/est/src/est_states.h"
#include "sw/modules/est/src/est_Flux_states.h"
#include "sw/modules/est/src/est_Ls_states.h"
#include "sw/modules/est/src/est_Rs_states.h"
#include "sw/modules/ctrl/src/32b/ctrl_obj.h"


// platforms
#include "sw/modules/fast/src/32b/userParams.h"

//!
//!
//! \defgroup USER USER
//!
//@{


#ifdef __cplusplus
extern "C" {
#endif

// **************************************************************************
// the defines


//! \brief CURRENTS AND VOLTAGES
// **************************************************************************
//! \brief Defines the full scale frequency for IQ variable, Hz
//! \brief All frequencies are converted into (pu) based on the ratio to this value
//! \brief this value MUST be larger than the maximum speed that you are expecting from the motor      
#define USER_IQ_FULL_SCALE_FREQ_Hz (60.0) // 800 Example with buffer for 8-pole 6 KRPM motor to be run to 10 KRPM with field weakening; Hz =(RPM * Poles) / 120                    

//! \brief Defines full scale value for the IQ30 variable of Voltage inside the system
//! \brief All voltages are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST be larger than the maximum value of any voltage calculated inside the control system otherwise the value can saturate and roll-over, causing an inaccurate value
//! \brief WARNING: this value is OFTEN greater than the maximum measured ADC value, especially with high Bemf motors operating at higher than rated speeds
//! \brief WARNING: if you know the value of your Bemf constant, and you know you are operating at a multiple speed due to field weakening, be sure to set this value higher than the expected Bemf voltage
//! \brief It is recommended to start with a value ~3x greater than the USER_ADC_FULL_SCALE_VOLTAGE_V and increase to 4-5x if scenarios where a Bemf calculation may exceed these limits
//! \brief This value is also used to calculate the minimum flux value: USER_IQ_FULL_SCALE_VOLTAGE_V/USER_EST_FREQ_Hz/0.7
#define USER_IQ_FULL_SCALE_VOLTAGE_V (450.0) // 450.0 Example for hvkit_rev1p1 typical usage

//! \brief Defines the maximum voltage at the input to the AD converter
//! \brief The value that will be represtented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the voltage sensing and scaling to the ADC input
#define USER_ADC_FULL_SCALE_VOLTAGE_V (409.6) // 409.6 hvkit_rev1p1 voltage scaling

//! \brief Defines the voltage scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_VOLTAGE_SF ((float_t)((USER_ADC_FULL_SCALE_VOLTAGE_V)/(USER_IQ_FULL_SCALE_VOLTAGE_V)))

//! \brief Defines the full scale current for the IQ variables, A
//! \brief All currents are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST be larger than the maximum current readings that you are expecting from the motor or the reading will roll over to 0, creating a control issue
#define USER_IQ_FULL_SCALE_CURRENT_A (1.3) // 10.0 Example for hvkit_rev1p1 typical usage  因为我的驱动板ADC运放改了,所以这里相应该小了,不知是否对参数识别有影响

//! \brief Defines the maximum current at the AD converter
//! \brief The value that will be represtented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the current sensing and scaling to the ADC input
#define USER_ADC_FULL_SCALE_CURRENT_A (2.5) // 19.89 hvkit_rev1p1 current scaling

//! \brief Defines the current scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_CURRENT_SF ((float_t)((USER_ADC_FULL_SCALE_CURRENT_A)/(USER_IQ_FULL_SCALE_CURRENT_A)))

//! \brief Defines the number of current sensors used
//! \brief Defined by the hardware capability present
//! \brief May be (2) or (3)
#define USER_NUM_CURRENT_SENSORS (3) // 3 Preferred setting for best performance across full speed range, allows for 100% duty cycle

//! \brief Defines the number of voltage (phase) sensors
//! \brief Must be (3)
#define USER_NUM_VOLTAGE_SENSORS (3) // 3 Required

//! \brief ADC current offsets for A, B, and C phases
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define I_A_offset (0.9488496184)
#define I_B_offset (0.9545648098)
#define I_C_offset (0.951295227)

//! \brief ADC voltage offsets for A, B, and C phases
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define V_A_offset (0.3461723328)
#define V_B_offset (0.3190022707)
#define V_C_offset (0.340960145)


//! \brief CLOCKS & TIMERS
// **************************************************************************
//! \brief Defines the system clock frequency, MHz
#define USER_SYSTEM_FREQ_MHz (90.0)

//! \brief Defines the Pulse Width Modulation (PWM) frequency, kHz
//! \brief PWM frequency can be set directly here up to 30 KHz safely (60 KHz MAX in some cases)
//! \brief For higher PWM frequencies (60 KHz+ typical for low inductance, high current ripple motors) it is recommended to use the ePWM hardware
//! \brief and adjustable ADC SOC to decimate the ADC conversion done interrupt to the control system, or to use the software Que example.
//! \brief Otherwise you risk missing interrupts and disrupting the timing of the control state machine
#define USER_PWM_FREQ_kHz (15.0) //30.0 Example, 8.0 - 30.0 KHz typical; 45-80 KHz may be required for very low inductance, high speed motors

//! \brief Defines the maximum Voltage.; vector (Vs) magnitude allowed. This value sets the maximum magnitude for the output of the
//! \brief Id and Iq PI current controllers. The Id and Iq current controller outputs are Vd and Vq.
//! \brief The relationship between Vs, Vd, and Vq is: Vs = sqrt(Vd^2 + Vq^2). In this FOC controller, the
//! \brief Vd value is set equal to USER_MAX_VS_MAG*USER_VD_MAG_FACTOR. Vq = sqrt(USER_MAX_VS_MAG^2 - Vd^2).
//! \brief Set USER_MAX_VS_MAG = 1.0 for a pure sinewave with a peak at SQRT(3)/2 = 86.6% duty cycle. No current reconstruction is needed for this scenario.
//! \brief Set USER_MAX_VS_MAG = 2/SQRT(3) = 1.1547 for a pure sinewave with a peak at 100% duty cycle. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief Set USER_MAX_VS_MAG = 4/3 = 1.3333 to create a trapezoidal voltage waveform. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief For space vector over-modulation, see lab 10 for details on system requirements that will allow the SVM generator to go all the way to trapezoidal.
#define USER_MAX_VS_MAG_PU (1.0) // Set to 1.0 if a current reconstruction technique is not used. Look at the module svgen_current in lab10a-x for more info.


//! \brief Defines the Pulse Width Modulation (PWM) period, usec
//! \brief Compile time calculation
#define USER_PWM_PERIOD_usec (1000.0/USER_PWM_FREQ_kHz)

//! \brief Defines the Interrupt Service Routine (ISR) frequency, Hz
//!
#define USER_ISR_FREQ_Hz ((float_t)USER_PWM_FREQ_kHz * 1000.0 / (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)

//! \brief Defines the Interrupt Service Routine (ISR) period, usec
//!
#define USER_ISR_PERIOD_usec (USER_PWM_PERIOD_usec * (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)


//! \brief DECIMATION
// **************************************************************************
//! \brief Defines the number of pwm clock ticks per isr clock tick
//! Note: Valid values are 1, 2 or 3 only
#define USER_NUM_PWM_TICKS_PER_ISR_TICK (1)

//! \brief Defines the number of isr ticks (hardware) per controller clock tick (software)
//! \brief Controller clock tick (CTRL) is the main clock used for all timing in the software
//! \brief Typically the PWM Frequency triggers (can be decimated by the ePWM hardware for less overhead) an ADC SOC
//! \brief ADC SOC triggers an ADC Conversion Done
//! \brief ADC Conversion Done triggers ISR
//! \brief This relates the hardware ISR rate to the software controller rate
//! \brief Typcially want to consider some form of decimation (ePWM hardware, CURRENT or EST) over 16KHz ISR to insure interrupt completes and leaves time for background tasks
#define USER_NUM_ISR_TICKS_PER_CTRL_TICK (1) // 2 Example, oontroller clock rate (CTRL) runs at PWM / 2; ex 30 KHz PWM, 15 KHz control

//! \brief Defines the number of controller clock ticks per current controller clock tick
//! \brief Relationship of controller clock rate to current controller (FOC) rate
#define USER_NUM_CTRL_TICKS_PER_CURRENT_TICK (1) // 1 Typical, Forward FOC current controller (Iq/Id/IPARK/SVPWM) runs at same rate as CTRL.

//! \brief Defines the number of controller clock ticks per estimator clock tick
//! \brief Relationship of controller clock rate to estimator (FAST) rate
//! \brief Depends on needed dynamic performance, FAST provides very good results as low as 1 KHz while more dynamic or high speed applicatons may require up to 15 KHz
#define USER_NUM_CTRL_TICKS_PER_EST_TICK (1) // 1 Typical, FAST estimator runs at same rate as CTRL;

//! \brief Defines the number of controller clock ticks per speed controller clock tick
//! \brief Relationship of controller clock rate to speed loop rate
#define USER_NUM_CTRL_TICKS_PER_SPEED_TICK (15) // 15 Typical to match PWM, ex: 15KHz PWM, controller, and current loop, 1KHz speed loop

//! \brief Defines the number of controller clock ticks per trajectory clock tick
//! \brief Relationship of controller clock rate to trajectory loop rate
//! \brief Typically the same as the speed rate
#define USER_NUM_CTRL_TICKS_PER_TRAJ_TICK (15) // 15 Typical to match PWM, ex: 10KHz controller & current loop, 1KHz speed loop, 1 KHz Trajectory

//! \brief Defines the controller frequency, Hz
//! \brief Compile time calculation
#define USER_CTRL_FREQ_Hz (uint_least32_t)(USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)

//! \brief Defines the estimator frequency, Hz
//! \brief Compile time calculation
#define USER_EST_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_EST_TICK)

//! \brief Defines the trajectory frequency, Hz
//! \brief Compile time calculation
#define USER_TRAJ_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_TRAJ_TICK)

//! \brief Defines the controller execution period, usec
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_usec (USER_ISR_PERIOD_usec * USER_NUM_ISR_TICKS_PER_CTRL_TICK)

//! \brief Defines the controller execution period, sec
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_sec ((float_t)USER_CTRL_PERIOD_usec/(float_t)1000000.0)


//! \brief LIMITS
// **************************************************************************
//! \brief Defines the maximum negative current to be applied in Id reference
//! \brief Used in field weakening only, this is a safety setting (e.g. to protect against demagnetizaton)
//! \brief User must also be aware that overall current magnitude [sqrt(Id^2 + Iq^2)] should be kept below any machine design specifications
#define USER_MAX_NEGATIVE_ID_REF_CURRENT_A (-2.0) // -2.0 Example, adjust to meet safety needs of your motor

//! \brief Defines the low speed limit for the flux integrator, pu
//! \brief This is the speed range (CW/CCW) at which the ForceAngle object is active, but only if Enabled
//! \brief Outside of this speed - or if Disabled - the ForcAngle will NEVER be active and the angle is provided by FAST only
#define USER_ZEROSPEEDLIMIT (0.002) // 可改 0.002 pu, 1-5 Hz typical; Hz = USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz

//! \brief Defines the force angle frequency, Hz
//! \brief Frequency of stator vector rotation used by the ForceAngle object
//! \brief Can be positive or negative
#define USER_FORCE_ANGLE_FREQ_Hz (1.0) // 1.0 Typical force angle start-up speed

//! \brief Defines the maximum current slope for Id trajectory during EPL mode
//! \brief For Induction motors only, controls how fast Id input can change under EPL control
#define USER_MAX_CURRENT_SLOPE_EPL (0.3*USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // 0.3*RES_EST_CURRENT / IQ_FULL_SCALE_CURRENT / TRAJ_FREQ Typical to produce 1-sec rampup/down

//! \brief Defines the starting maximum acceleration AND deceleration for the speed profiles, Hz/s
//! \brief Updated in run-time through user functions
//! \brief Inverter, motor, inertia, and load will limit actual acceleration capability
#define USER_MAX_ACCEL_Hzps (20.0) // 20.0 Default

//! \brief Defines maximum acceleration for the estimation speed profiles, rad/sec^2
//! \brief Only used during Motor ID (commission)
#define USER_MAX_ACCEL_EST_Hzps (2.0) // 2.0 Default, don't change

//! \brief Defines the maximum current slope for Id trajectory during estimation
#define USER_MAX_CURRENT_SLOPE (USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz Default, don't change

//! \brief Defines the fraction of IdRated to use during rated flux estimation
//!
#define USER_IDRATED_FRACTION_FOR_RATED_FLUX (0.5) // 0.5 Default, don't change

//! \brief Defines the fraction of IdRated to use during inductance estimation
//!
#define USER_IDRATED_FRACTION_FOR_L_IDENT (0.5) // 0.5 Default, don't change

//! \brief Defines the IdRated delta to use during estimation
//!
#define USER_IDRATED_DELTA (0.0001)// (0.00002) // 0.0001 Default, don't change

//! \brief Defines the fraction of SpeedMax to use during inductance estimation
//!
#define USER_SPEEDMAX_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change

//! \brief Defines flux fraction to use during inductance identification
//!
#define USER_FLUX_FRACTION (1.0) // 1.0 Default, don't change

//! \brief Defines the EPL (Efficient Partial Load) gain for computing Id reference
//! \brief Induction motors only
#define USER_EPL_GAIN (1.0) // 1.0 Default, don't change

//! \brief Defines the R/L estimation frequency, Hz
#define USER_R_OVER_L_EST_FREQ_Hz (100) // 100 Default, don't change


//! \brief POLES
// **************************************************************************
//! \brief Defines the analog voltage filter pole location, Hz
//! \brief Must match the hardware filter for Vph
#define USER_VOLTAGE_FILTER_POLE_Hz (372.5) // 372.5, value for hvkit_rev1p1 hardware

//! \brief Defines the analog voltage filter pole location, rad/s
//! \brief Compile time calcuation from Hz to rad/s
#define USER_VOLTAGE_FILTER_POLE_rps (2.0 * MATH_PI * USER_VOLTAGE_FILTER_POLE_Hz)

//! \brief Defines the software pole location for the voltage and current offset estimation, rad/s
//! \brief Should not be changed from default of (20.0)
#define USER_OFFSET_POLE_rps (20.0) // 20.0 Default, do not change

//! \brief Defines the software pole location for the flux estimation, rad/s
//! \brief Should not be changed from default of (100.0)
#define USER_FLUX_POLE_rps (100.0) // 100.0 Default, do not change

//! \brief Defines the software pole location for the direction filter, rad/s
#define USER_DIRECTION_POLE_rps (6.0) // 6.0 Default, do not change

//! \brief Defines the software pole location for the speed control filter, rad/s
#define USER_SPEED_POLE_rps (100.0) // 100.0 Default, do not change

//! \brief Defines the software pole location for the DC bus filter, rad/s
#define USER_DCBUS_POLE_rps (100.0) // 100.0 Default, do not change

//! \brief Defines the convergence factor for the estimator
//! \brief Do not change from default for FAST
#define USER_EST_KAPPAQ (1.5) // 1.5 Default, do not change

// **************************************************************************
// end the defines


//! \brief USER MOTOR & ID SETTINGS
// **************************************************************************

//! \brief Define each motor with a unique name and ID number
// BLDC & SMPM motors
#define Estun_EMJ_04APB22 101
#define Anaheim_BLY172S 102
#define MY_MOTOR 103

// IPM motors
// If user provides separate Ls-d, Ls-q
// else treat as SPM with user or identified average Ls
#define Belt_Drive_Washer_IPM 201

// ACIM motors
#define Marathon_5K33GN2A 301

//! \brief Uncomment the motor which shold be included at compile
//! \brief These motor ID settings and motor parameters are then available to be used by the control system
//! \brief Once your ideal settings and parameters are identified update the motor section here so it is available in the binary code
//#define USER_MOTOR Estun_EMJ_04APB22
//#define USER_MOTOR Anaheim_BLY172S
//#define USER_MOTOR MY_MOTOR
//#define USER_MOTOR Belt_Drive_Washer_IPM
#define USER_MOTOR Estun_EMJ_04APB22


#if (USER_MOTOR == Estun_EMJ_04APB22) // Name must match the motor #define
#define USER_MOTOR_TYPE MOTOR_Type_Pm // Motor_Type_Pm (All Synchronous: BLDC, PMSM, SMPM, IPM) or Motor_Type_Induction (Asynchronous ACI)
#define USER_MOTOR_NUM_POLE_PAIRS (2) // PAIRS, not total poles. Used to calculate user RPM from rotor Hz only
#define USER_MOTOR_Rr (NULL) // Induction motors only, else NULL
#define USER_MOTOR_Rs (NULL) // Identified phase to neutral resistance in a Y equivalent circuit (Ohms, float)
#define USER_MOTOR_Ls_d (NULL) // For PM, Identified average stator inductance (Henry, float)
#define USER_MOTOR_Ls_q (NULL) // For PM, Identified average stator inductance (Henry, float)
#define USER_MOTOR_RATED_FLUX (NULL) // Identified TOTAL flux linkage between the rotor and the stator (V/Hz)
#define USER_MOTOR_MAGNETIZING_CURRENT (NULL) // Induction motors only, else NULL
#define USER_MOTOR_RES_EST_CURRENT (0.2) // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
#define USER_MOTOR_IND_EST_CURRENT (-0.5) // During Motor ID, maximum current (negative Amperes, float) used for Ls estimation, use just enough to enable rotation
#define USER_MOTOR_MAX_CURRENT (1.5) // CRITICAL: Used during ID and run-time, sets a limit on the maximum current command output of the provided Speed PI Controller to the Iq controller

#define USER_MOTOR_FLUX_EST_FREQ_Hz     (20.0)         // During Motor ID, maximum commanded speed (Hz, float), ~10% rated

不知我的什么参数设置错误了,请帮忙看一下,谢谢了。

  •         现在识别的情况是:ROVERL和RS识别电机不转,RAMP_UP电机转动,FLUX和LS的识别电机又停止了,增加和减少USER_MOTOR_IND_EST_CURRENT时FLUX和LS识别电机都不转,增加USER_MOTOR_FLUX_EST_FREQ_Hz到40HZ,电机速度很快然后过流停止。

     

    电机的参数能找到么?将USER_MOTOR_FLUX_EST_FREQ_Hz减小为10Hz试试。

    #define USER_IQ_FULL_SCALE_CURRENT_A (1.3)

    这个值是用于归一化的值,所以最好是设置大点,比如2.5。ADC运放修改的话,那么#define USER_ADC_FULL_SCALE_CURRENT_A (2.5) //需要相应修改。

  • 您好,感谢你及时的回复。

    我现在不知道电机参数,想通过TI的识别算法来测出来。我试过把USER_MOTOR_FLUX_EST_FREQ_Hz,测FLUX状态时,电机还是停止了。我发现增加USER_MOTOR_FLUX_EST_FREQ_Hz到40HZ(我把保护范围加大了点,不出现过流了),FLUX状态电机终于能转动,到测LS的时候,开始电机可以转动,3秒左右停了下来,不知什么原因造成的。我现在的电机参数设置是这样的:

    #define USER_MOTOR_TYPE MOTOR_Type_Pm
    #define USER_MOTOR_NUM_POLE_PAIRS (2)
    #define USER_MOTOR_Rr (NULL)
    #define USER_MOTOR_Rs (NULL) 
    #define USER_MOTOR_Ls_d (NULL) 
    #define USER_MOTOR_Ls_q (NULL) 
    #define USER_MOTOR_RATED_FLUX (NULL)
    #define USER_MOTOR_MAGNETIZING_CURRENT (NULL) 
    #define USER_MOTOR_RES_EST_CURRENT (0.4) 
    #define USER_MOTOR_IND_EST_CURRENT (-0.8)
    #define USER_MOTOR_MAX_CURRENT (1.5)
    #define USER_MOTOR_FLUX_EST_FREQ_Hz (40.0)

    1、文档说USER_MOTOR_IND_EST_CURRENT是控制LS测量的电流,无论怎么改,在LS状态电机还是过几秒停下来,我应该怎么修改这几个参数呢? 

    还有我的全局频率#define USER_IQ_FULL_SCALE_FREQ_Hz        (200.0) 设为200HZ,因为电机额定频率200HZ,根据公式算也是,这样设对吗?

    谢谢!


  • 上面的问题解决了,要增加USER_MOTOR_RES_EST_CURRENT 到0.5,LS状态才正常转。现在电机参数识别状态都能正常完成,用测出来的参数运行电机运转一来一回的卡。再测几次,发现LS电感参数值差别很大。有木有遇到这种情况的,怎样才能测出准确的电感值?帮小弟指点一下。。。

    谢谢!

  • liangcheng,

    请将use.h,drv.h发上来,是用哪个Lab.

    另外如果有原理图的话,可以帮助我们判断。

    关于频率设定,留下一些余量,如400Hz.

    Eric

  • Eric

           感谢您的回复。

           我用的是lab2b,user.h放在附件里了,drv.h只是增加了sci功能,其他没改动。我的电机参数:额定电流2.6A,额定电压220V,额定功率400W。

    另外我想问下user.c的测量各个阶段的时间可以改吗?因为我发现例程的时间和文档不一样,我进行一些简单修改电机才识别正常。

           原理图是仿照TI的板子改的,只改了驱动芯片和ADC的运放。

            代码有点多,还请耐心看下,谢谢了。

    liangheng

  • liangfeng,

    1.电流反馈的采样电阻,放大倍数是多少?

    2、电机电流2.6, USER_IQ_FULL_SCALE_CURRENT_A 只设为2.4, 太小了,应该留一些余量,如4.

    3.电压反馈有没有改动?

    4, motorware 版本及你现在用的芯片型号,是否是F28069F

    #define USER_IQ_FULL_SCALE_CURRENT_A (2.4) // 10.0 Example for hvkit_rev1p1 typical usage

    //! \brief Defines the maximum current at the AD converter
    //! \brief The value that will be represtented by the maximum ADC input (3.3V) and conversion (0FFFh)
    //! \brief Hardware dependent, this should be based on the current sensing and scaling to the ADC input
    #define USER_ADC_FULL_SCALE_CURRENT_A (4.6) // 19.89 hvkit_rev1p1 current scaling 这里ADC运放改过,公式是U = 1.65 - 0.719I,所以做了相应修改

  • 您好!

    1、不怎么明白问题,我的电流采样公式U = 1.65 - KRI = 1.65 - 0.719I ,R = 0.02, K= 35.95,是K值吗

    3、没有改动

    4、版本是

    Version: 01_01_00_11 ,是F28069F

  • liangfeng,

    1. 关于每个预测状态的时间,不建议改动。

    2. ADC映射有没有配置好?注意采样电流后使用的运放是正端输入还是负端输入。offline 状态后的电压偏置和电流偏置是否有问题?

    3. 拿电流钳观察输出电流,波形是否跟InstaSPIN的预测过程的电流波形一致,参照手册。

    4. user.h 建议频率设高一点,800Hz也ok,另标幺化电流应设大一点。

    Eric

  • Eric
          感谢你百忙之中的回复,万分感谢。
         我看了我的ADC映射是正常的,ADC采样电流运放是负反馈的,电路如下:

    所以我这段代码没改:

    // update the current bias
    for(cnt=0;cnt<DRV_getNumCurrentSensors(handle);cnt++)
    {
    bias = DRV_getBias(handle,DRV_SensorType_Current,cnt);

    bias += OFFSET_getOffset(obj->offsetHandle_I[cnt]); //+

    DRV_setBias(handle,DRV_SensorType_Current,cnt,bias);
    }



    offline状态观察到的数据:
    我觉得offset_I有点不正确,如果不正确,需要改哪里呢?
      谢谢了。
    liangheng
  • liangheng feng 说:
    Eric
          感谢你百忙之中的回复,万分感谢。
         我看了我的ADC映射是正常的,ADC采样电流运放是负反馈的,电路如下:

    所以我这段代码没改:

    // update the current bias
    for(cnt=0;cnt<DRV_getNumCurrentSensors(handle);cnt++)
    {
    bias = DRV_getBias(handle,DRV_SensorType_Current,cnt);

    bias += OFFSET_getOffset(obj->offsetHandle_I[cnt]); //+

    DRV_setBias(handle,DRV_SensorType_Current,cnt,bias);
    }



    offline状态观察到的数据:
    我觉得offset_I有点不正确,如果不正确,需要改哪里呢?
      谢谢了。
    liangheng

    如果是运放极性与开发板不一样的话,那么ADC的采样部分的程序符号也要修改。在这个函数DRV_readAdcData(),电流采样部分要改。

  • 您好

    我已经确认ADC运放是负反馈,跟TI板一样,所以不用修改相应程序。也试过把符号改变,程序一识别就过流,确定原本程序的ADC运放设置对我的开发板是适用正常的,这部分问题应该不大。关于ADC的采样,我想问下改了ADC的放大倍数,TI的公式是 U = 1.65 - 0.165I,现在我的公式改成U = 1.65 - 0.719I,程序需要做修改吗?修改哪里?

    我觉得问题主要在#define USER_IQ_FULL_SCALE_FREQ_Hz        (400.0) 

                                   USER_IQ_FULL_SCALE_VOLTAGE_V      (450.0)

                                  USER_ADC_FULL_SCALE_VOLTAGE_V       (409.6)

                                  USER_IQ_FULL_SCALE_CURRENT_A          (2.4) 

                                   #define USER_ADC_FULL_SCALE_CURRENT_A        (4.6)

    但是不知怎么修改好?

  • liangheng,

    电流参数系数如果跟你提供的公式一致的话,那应该没有问题。

    电压系数是否需要修改?

    另外,Lab中的代码除了相关比例系数,ADC映射,采样等代码需要修改外,其他的暂时不建议修改。

    Eric

  • 你好,看到这个帖子想请教一下。就是自己用控制板时,定义接口的drv.c在工程中的什么地方呀?为什么我没有找到呢,谢谢

  • 新版本的是hal.c。

    ERIC

  • 你好,看到这个帖子,我现在用的是motorware1_01_00_18,使用我自己的硬件板,与TI开发板的区别就在于电流采样运放的反馈极性相反,按照你的说法,我的理解是在程序中要改两个地方:

    1.是hal.c文件中的HAL_updateAdcBias(HAL_Handle handle)函数:

    // update the current bias
    for(cnt=0;cnt<HAL_getNumCurrentSensors(handle);cnt++)
    {
    bias = HAL_getBias(handle,HAL_SensorType_Current,cnt);

    bias -= OFFSET_getOffset(obj->offsetHandle_I[cnt]);

    HAL_setBias(handle,HAL_SensorType_Current,cnt,bias);
    }

    2.是hal.c文件中的HAL_readAdcData(HAL_Handle handle,HAL_AdcData_t *pAdcData)函数:

    // convert current A
    // sample the first sample twice due to errata sprz342f, ignore the first sample
    value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_1);
    value = _IQ12mpy(value,current_sf) + obj->adcBias.I.value[0]; // divide by 2^numAdcBits = 2^12
    pAdcData->I.value[0] = value;

    // convert current B
    value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_2);
    value = _IQ12mpy(value,current_sf) + obj->adcBias.I.value[1]; // divide by 2^numAdcBits = 2^12
    pAdcData->I.value[1] = value;

    // convert current C
    value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_3);
    value = _IQ12mpy(value,current_sf) + obj->adcBias.I.value[2]; // divide by 2^numAdcBits = 2^12
    pAdcData->I.value[2] = value;

    这样理解是否正确?

  • 你好,看到这个帖子,我现在用的是motorware1_01_00_18,使用我自己的硬件板,与TI开发板的区别就在于电流采样运放的反馈极性相反,按照你的说法,我的理解是在程序中要改两个地方:

    ERIC:

    如果你的电流反馈是运放的整端输入,则进入ADC的电流是和算法定义的电流方向是相反的。算法里面规定流入电机的电流方向为正。

    1.是hal.c文件中的HAL_updateAdcBias(HAL_Handle handle)函数:

    // update the current bias
    for(cnt=0;cnt<HAL_getNumCurrentSensors(handle);cnt++)
    {
    bias = HAL_getBias(handle,HAL_SensorType_Current,cnt);

    bias -= OFFSET_getOffset(obj->offsetHandle_I[cnt]);

    HAL_setBias(handle,HAL_SensorType_Current,cnt,bias);
    }

    Eric:

    如果电流反相,这里是要改成bias - =.

    2.是hal.c文件中的HAL_readAdcData(HAL_Handle handle,HAL_AdcData_t *pAdcData)函数:

    // convert current A
    // sample the first sample twice due to errata sprz342f, ignore the first sample
    value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_1);
    value = _IQ12mpy(value,current_sf) + obj->adcBias.I.value[0]; // divide by 2^numAdcBits = 2^12
    pAdcData->I.value[0] = value;

    // convert current B
    value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_2);
    value = _IQ12mpy(value,current_sf) + obj->adcBias.I.value[1]; // divide by 2^numAdcBits = 2^12
    pAdcData->I.value[1] = value;

    // convert current C
    value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_3);
    value = _IQ12mpy(value,current_sf) + obj->adcBias.I.value[2]; // divide by 2^numAdcBits = 2^12
    pAdcData->I.value[2] = value;

    Eric:

    这里和电流相关部分,要改成:

    pAdcData->I.value[] =  - value;