| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- /**
- ******************************************************************************
- * @file drive_parameters.h
- * @author Motor Control SDK Team, ST Microelectronics
- * @brief This file contains the parameters needed for the Motor Control SDK
- * in order to configure a motor drive.
- *
- ******************************************************************************
- * @attention
- *
- * <h2><center>© Copyright (c) 2019 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * This software component is licensed by ST under Ultimate Liberty license
- * SLA0044, the "License"; You may not use this file except in compliance with
- * the License. You may obtain a copy of the License at:
- * www.st.com/SLA0044
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __DRIVE_PARAMETERS_H
- #define __DRIVE_PARAMETERS_H
- /************************
- *** Motor Parameters ***
- ************************/
- /******** MAIN AND AUXILIARY SPEED/POSITION SENSOR(S) SETTINGS SECTION ********/
- /*** Speed measurement settings ***/
- #define MAX_APPLICATION_SPEED_RPM 4000 /*!< rpm, mechanical */
- #define MIN_APPLICATION_SPEED_RPM 0 /*!< rpm, mechanical,
- absolute value */
- #define MEAS_ERRORS_BEFORE_FAULTS 3 /*!< Number of speed
- measurement errors before
- main sensor goes in fault */
- /****** Hall sensors ************/
- #define HALL_MEAS_ERRORS_BEFORE_FAULTS 3 /*!< Number of failed
- derived class specific speed
- measurements before main sensor
- goes in fault */
- #define HALL_AVERAGING_FIFO_DEPTH 6 /*!< depth of the FIFO used to
- average mechanical speed in
- 0.1Hz resolution */
- #define HALL_MTPA false
- /* USER CODE BEGIN angle reconstruction M1 */
- #define REV_PARK_ANGLE_COMPENSATION_FACTOR 0
- /* USER CODE END angle reconstruction M1 */
- /************************** DRIVE SETTINGS SECTION **********************/
- /* PWM generation and current reading */
- #define PWM_FREQUENCY 16000
- #define PWM_FREQ_SCALING 1
- #define LOW_SIDE_SIGNALS_ENABLING LS_PWM_TIMER
- #define SW_DEADTIME_NS 800 /*!< Dead-time to be inserted
- by FW, only if low side
- signals are enabled */
- /* Torque and flux regulation loops */
- #define REGULATION_EXECUTION_RATE 1 /*!< FOC execution rate in
- number of PWM cycles */
- /* Gains values for torque and flux control loops */
- #define PID_TORQUE_KP_DEFAULT 1200
- #define PID_TORQUE_KI_DEFAULT 600
- #define PID_TORQUE_KD_DEFAULT 100
- #define PID_FLUX_KP_DEFAULT 1200
- #define PID_FLUX_KI_DEFAULT 600
- #define PID_FLUX_KD_DEFAULT 100
- /* Torque/Flux control loop gains dividers*/
- #define TF_KPDIV 8192
- #define TF_KIDIV 16384
- #define TF_KDDIV 8192
- #define TF_KPDIV_LOG LOG2(8192)
- #define TF_KIDIV_LOG LOG2(16384)
- #define TF_KDDIV_LOG LOG2(8192)
- #define TFDIFFERENTIAL_TERM_ENABLING DISABLE
- /* Speed control loop */
- #define SPEED_LOOP_FREQUENCY_HZ 1000 /*!<Execution rate of speed
- regulation loop (Hz) */
- #define PID_SPEED_KP_DEFAULT 400/(SPEED_UNIT/10) /* Workbench compute the gain for 01Hz unit*/
- #define PID_SPEED_KI_DEFAULT 200/(SPEED_UNIT/10) /* Workbench compute the gain for 01Hz unit*/
- #define PID_SPEED_KD_DEFAULT 0/(SPEED_UNIT/10) /* Workbench compute the gain for 01Hz unit*/
- /* Speed PID parameter dividers */
- #define SP_KPDIV 16
- #define SP_KIDIV 256
- #define SP_KDDIV 16
- #define SP_KPDIV_LOG LOG2(16)
- #define SP_KIDIV_LOG LOG2(256)
- #define SP_KDDIV_LOG LOG2(16)
- /* USER CODE BEGIN PID_SPEED_INTEGRAL_INIT_DIV */
- #define PID_SPEED_INTEGRAL_INIT_DIV 1 /* */
- /* USER CODE END PID_SPEED_INTEGRAL_INIT_DIV */
- #define SPD_DIFFERENTIAL_TERM_ENABLING DISABLE
- #define IQMAX 17872
- /* Default settings */
- #define DEFAULT_CONTROL_MODE STC_SPEED_MODE /*!< STC_TORQUE_MODE or
- STC_SPEED_MODE */
- #define DEFAULT_TARGET_SPEED_RPM 1000
- #define DEFAULT_TARGET_SPEED_UNIT (DEFAULT_TARGET_SPEED_RPM*SPEED_UNIT/_RPM)
- #define DEFAULT_TORQUE_COMPONENT 0
- #define DEFAULT_FLUX_COMPONENT 0
- /************************** FIRMWARE PROTECTIONS SECTION *****************/
- #define OV_VOLTAGE_PROT_ENABLING ENABLE
- #define UV_VOLTAGE_PROT_ENABLING ENABLE
- #define OV_VOLTAGE_THRESHOLD_V 32 /*!< Over-voltage
- threshold */
- #define UD_VOLTAGE_THRESHOLD_V 18 /*!< Under-voltage
- threshold */
- #if 0
- #define ON_OVER_VOLTAGE TURN_OFF_PWM /*!< TURN_OFF_PWM,
- TURN_ON_R_BRAKE or
- TURN_ON_LOW_SIDES */
- #endif /* 0 */
- #define R_BRAKE_SWITCH_OFF_THRES_V 26
- #define OV_TEMPERATURE_THRESHOLD_C 70 /*!< Celsius degrees */
- #define OV_TEMPERATURE_HYSTERESIS_C 10 /*!< Celsius degrees */
- #define HW_OV_CURRENT_PROT_BYPASS DISABLE /*!< In case ON_OVER_VOLTAGE
- is set to TURN_ON_LOW_SIDES
- this feature may be used to
- bypass HW over-current
- protection (if supported by
- power stage) */
- /****************************** START-UP PARAMETERS **********************/
- #define TRANSITION_DURATION 25 /* Switch over duration, ms */
- /****************************** BUS VOLTAGE Motor 1 **********************/
- #define M1_VBUS_SAMPLING_TIME LL_ADC_SAMPLING_CYCLE(1)
- /****************************** Current sensing Motor 1 **********************/
- #define ADC_SAMPLING_CYCLES (1 + SAMPLING_CYCLE_CORRECTION)
- /****************************** ADDITIONAL FEATURES **********************/
- /*** On the fly start-up ***/
- /**************************
- *** Control Parameters ***
- **************************/
- /* ##@@_USER_CODE_START_##@@ */
- /* ##@@_USER_CODE_END_##@@ */
- #endif /*__DRIVE_PARAMETERS_H*/
- /******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/
|