background image

RL78/G1G          Sensorless  Speed  control  of  120-degree  conducting  controlled  permanent  magnetic  synchronous  motor  (Implementation) 

R01AN3582EJ0100    Rev.1.00 

 

Page  38  of 46 

Jan 13, 2017 

 

Table 3-28 

List of Macro definitions “mtr_spm_less_120.h” [1/4] 

File name

 

Macro name

 

Definition value

 

Remarks

 

mtr_spm_less_

120.h 

MTR_POLE_PAIRS 

MP_POLE_PAIRS 

Motor Pole pairs 

MTR_TWOPI 

2 * 3.14159265f 

2

π

 

MTR_RPM_RAD 

13726 

Calculate parameter for 

[rpm

]→[rad/s] (scale: Q3) 

MTR_RAD_RPM 

4889 

Calculate parameter for 

[rad/s]

→[rpm] (scale: Q12) 

MTR_SPEED_LIMIT_RPM 

3500 

Speed limit Mechanical angle [rpm] 

MTR_SPEED_LIMIT 

MTR_SPEED_LIMIT_RPM 

* MTR_TWOPI / 60 

Speed limit Electrical angle [rad/s] 

MTR_SPEED_PI_DECIMATION 

Number of interrupt decimation times 

for speed PI control 

MTR_SPEED_PI_KP 

(int16) CP_SPEED_PI_KP 

Speed PI proportional gain 

MTR_SPEED_PI_KI 

(int16) CP_SPEED_PI_KI 

Speed PI Integral gain 

MTR_SPEED_PI_LIMIT_V 

24 * 0x80 

Voltage PI control output limit [V] 

(scale: Q7) 

MTR_SPEED_PI_I_LIMIT_V 

24 * 0x80 * 0x80000 

Voltage PI control output limit [V] 

Integral part (for calculation) 

(scale: Q12) 

MTR_SPEED_CALC_BASE 

576 

Calculate parameter to translate 

the timer counter to rotational speed 

[rad/s] (scale: Q3) 

MTR_CNT_START_CALC 

30 

Wait speed measurement still zero-

cross is detected become this counts 

MTR_SPEED_LPF_K 

(int16) CP_SPEED_LPF_K 

Speed LPF parameter 

MTR_LIMIT_SPEED_CHANGE 

CP_LIMIT_SPEED_CHANGE 

Step to increase speed reference 

Electrical angle [rad/s] 

MTR_MAX_DRIVE_V 

(int16) 22 * 0x80 

Maximum command voltage [V] 

(scale: Q7) 

MTR_MIN_DRIVE_V 

(int16) 0.10 * 0x80 

Minimum command voltage [V] 

(scale: Q7) 

MTR_MAX_BOOT_V 

8.0 * 0x80 

Maximum command voltage at draw-in 

[V] (scale: Q7) 

MTR_TIMEOUT_CNT 

50 

Timeout limit [ms] 

MTR_STOP_BEMF 

122 

Value to judge motor stopped 

MTR_SHIFT_ADJUST 

Value of angle shift adjusting 

MTR_OL_CTRL_PERIOD 

15 

Control period of open loop [ms] 

MTR_OL_START_RPM 

CP_OL_START_RPM 

Speed of open loop at start-up 

Mechanical angle [rpm] 

MTR_OL_MODE1_CHANGE_RPM  CP_OL_MODE1_CHANGE_RPM 

Speed to change open loop mode1 

Mechanical angle [rpm] 

MTR_OL_MODE2_CHANGE_RPM  CP_OL_MODE2_CHANGE_RPM 

Speed to change open loop mode2 

Mechanical angle [rpm] 

MTR_OL_START_REFV 

(int16) CP_OL_START_REFV 

Voltage reference of open loop at start-

up [V] 

MTR_OL_MODE1_RATE_RPM 

CP_OL_MODE1_RATE_RPM 

Increase step of speed at open loop 

mode1 [rpm/control period] 

MTR_OL_MODE2_RATE_REFV 

(int16) 

CP_OL_MODE2_RATE_REFV 

Increase step of voltage at open loop 

mode2 [V] 

MTR_OL_MODE2_RATE_RPM 

CP_OL_MODE2_RATE_RPM 

Increase step of speed at open loop 

mode2 [rpm/control period] 

 

 

Содержание rl78/g1g

Страница 1: ...ice Operations of the control programs have been checked by using the following device RL78 G1G R5F11EBAAFP Target control programs The target control programs of this application note are as follows...

Страница 2: ...ontrol of 120 degree conducting controlled permanent magnetic synchronous motor Implementation R01AN3582EJ0100 Rev 1 00 Page 2 of 46 Jan 13 2017 Contents 1 Overview 3 2 System overview 7 3 Description...

Страница 3: ...explained in this application note Table 1 1 Development Environment H W Microcontroller Evaluation board Motor RL78 G1G R5F11EBAAFP 24V inverter board Note 1 and RL78 G1G CPU Card Note 2 TSUKASA Note...

Страница 4: ...and RL78 G1G CPU Card should be modified per below explanations 1 2 1 Modification of the VR1 input port 1 Remove R8 R15 C9 2 Connect CPU side of R7 and CPU side of R8 Figure 1 1 Modification of the C...

Страница 5: ...e overcurrent detection method is changed to PGA CMP0 CMP1 from default INTP0 the 24V Inverter Board and RL78 G1G CPU Card should be modified per below explanations 1 Modification of the 24V Inverter...

Страница 6: ...r circuit of comparator input 1 Mount 0 Ohms on R16 2 Change resister R10 from 100 Ohms to 1k Ohms 3 Change capacitor C11 from 100pF to 470pF Figure 1 5 Modification of the CPU Card Figure 1 6 Modific...

Страница 7: ...ter circuit DC 24V input Up Vp Wp Un Vn Wn TRD output P15 TRDIOB0 Up P13 TRDIOA1 Vp P12 TRDIOB1 Wp P14 TRDIOD0 Un P11 TRDIOC1 Vn P10 TRDIOD1 Wn Vu Vv Vw Over current detection input P01 PGAI HV port H...

Страница 8: ...troller of this system Table 2 2 Port Interface R5F11EBAAFP Port name Function P23 ANI3 Inverter bus voltage measurement P01 PGAI Shunt current input for over current detection use PGA CMP0 CMP1 Note1...

Страница 9: ...d command value input U phase voltage Vu V phase voltage Vv W phase voltage Vw and inverter bus voltage Vdc are measured by using the 10 bit A D converter The operation mode is set as below The channe...

Страница 10: ...nt magnetic synchronous motor Implementation R01AN3582EJ0100 Rev 1 00 Page 10 of 46 Jan 13 2017 6 Programmable Gain Amp PGA PGA is used to detect overcurrent with CMP0 CMP1 when selected 7 External in...

Страница 11: ..._rl78g1g_mrssk h RL78 G1G and board dependent processing part header mtr_feedback h Feedback control processing part header mtr_gmc h General motor control function part header mtr_driver_access h Dri...

Страница 12: ...name Application layer main c Motor control layer mtr_spm_less_120 c mtr_feedback c mtr_gmc c mtr_filter c mtr_driver_access c mtr_interrupt c Note H W control layer mtr_ctrl_rl78g1g_mrssk c mtr_ctrl...

Страница 13: ...induced voltage with A D converters by 60 degrees Input voltage DC24 V Main clock frequency CPU clock fCLK 24 MHz TRD clock fHOCO 48 MHz Carrier frequency PWM 20 kHz Dead time 2 s Control cycle Speed...

Страница 14: ...eed command value as shown below The maximum of the command value is set as the value from which maximum rotational speed is generated by the resolution of the A D converter Table 3 1 Conversion Ratio...

Страница 15: ...ning Pattern created from U phase induced voltage 2p Timer counter Check Check Check Check Check Check Check Counter value difference Motor rotational speed rad s 2 frequency of timer difference of ti...

Страница 16: ...0 Figure 3 2 PWM Control Modulation factor m is defined as follows E V m This modulation factor is reflected in the setting value of the register that determines the PWM duty In the target control pro...

Страница 17: ...ss Speed control of 120 degree conducting controlled permanent magnetic synchronous motor Implementation R01AN3582EJ0100 Rev 1 00 Page 17 of 46 Jan 13 2017 U V W U V W Figure 3 4 Complimentary first 6...

Страница 18: ...180 WIDE 120 INACTIVE ACTIVE ERROR RESET SYSTEM MODE INACTIVE ACTIVE ERROR INACTIVE INACTIVE INACTIVE ACTIVE ERROR ERROR ERROR ERROR ERROR INACTIVE ACTIVE ERROR MTR_V_PI_OUTPUT g_u2_state_voltage_ref...

Страница 19: ...caught without enough speed Therefore as a start up method there is a method to lead the synchronous speed by generating a rotating magnetic field by forcibly switching conduction patterns regardless...

Страница 20: ...e setting Channel PGA Gain CMP1 2 A CMP1 120 PGA out 4 is selected CMP0 2 A CMP0 83 Overvoltage error The inverter bus voltage is monitored at the overvoltage monitoring cycle When an over voltage is...

Страница 21: ...stem Protection Function Error name Threshold Overcurrent error Note Overcurrent limit A 2 0 Overvoltage error Overvoltage limit V 28 Monitoring cycle ms 1 Low voltage error Under voltage limit V 15 M...

Страница 22: ...n and event execution function call Main process User interface call Watchdog timer clear function call board_ui Input None Output None Motor status change Determination of rotational speed command va...

Страница 23: ...0 1 and PGA clear_wdt Input None Output None Clear the watchdog timer WDT mtr_clear_oc_flag Input None Output None Clear the high impedance state mtr_clear_trd0_imfa Input None Output None Clear the C...

Страница 24: ...Input uint8 u1_dir rotation direction Output None Set the rotation direction R_MTR_GetSpeed Input None Output uint16 u2_speed_rpm rotational speed Obtain the calculated rotational speed R_MTR_GetDir...

Страница 25: ...or happens Check low voltage error mtr_check_over_speed_error Input uint16 u2_speed_rad rotational speed uint16 u2_speed_limit speed limit Output uint16 u2_temp0 over speed error flag when error happe...

Страница 26: ...rror event Changing the motor status Set the flag of error about overcurrent mtr_oc_cmp1_interrupt Input None Output None Overcurrent detection process CMP1 interrupt Disable CMP0 CMP1 interrupt servi...

Страница 27: ...state motor status Output uint8 u1_state motor status Global variables initialization mtr_act_error Input uint8 u1_state motor status Output uint8 u1_state motor status Call motor control stop functio...

Страница 28: ...None Set the conduction pattern at draw in the rotor mtr_set_angle_shift Input None Output None Calculate the counts for phase shift based on the detection of zero cross mtr_check_pattern Input None O...

Страница 29: ...minimum value for motor stop Mechanical angle rpm g_u2_ref_speed_rpm uint16 User setting rotational speed Mechanical angle rpm g_u1_rot_dir uint8 User setting rotation direction 0 CW 1 CCW g_u1_motor...

Страница 30: ...tive mode 0x01 Active mode 0x02 Error mode g_u1_state_v_offset uint8 State management of voltage offset process 0x00 None 0x01 Measure with PWM off 0x02 Measure with PWM on 0x03 Finish measurement Ref...

Страница 31: ...open loop Mechanical angle rpm g_s2_ol_mode1_change_rpm int16 Change speed of open loop mode1 Mechanical angle rpm g_s2_ol_mode2_change_rpm int16 Change speed of open loop mode2 Mechanical angle rpm g...

Страница 32: ...interruption counter value g_u1_v_pattern_num uint8 Control number for forced conduction pattern at open loop g_u1_v_pattern_open 2 7 uint8 Array of forced conduction patterns at open loop g_u2_offse...

Страница 33: ...less 120 degree conducting control software structure Lists of structure used in this control program are given below Table 3 21 List of structure Structure Member Type Scale Content Remarks MTR_PI_CT...

Страница 34: ...oltage at draw in ms CP_MAX_SPEED_RPM 2650 Maximum of rotational speed command Mechanical angle rpm CP_MIN_SPEED_RPM 1200 Minimum of rotational speed command Mechanical angle rpm CP_LIMIT_SPEED_CHANGE...

Страница 35: ...PM Speed to change open loop mode1 Mechanical angle rpm OL_MODE2_CHANGE_RPM CP_OL_MODE2_CHANGE_RPM Speed to change open loop mode2 Mechanical angle rpm OL_START_REFV int16 CP_OL_START_REFV Voltage ref...

Страница 36: ...setting value MTR_HALF_CARRIER_SET MTR_CARRIER_SET 2 Half of MTR_CARRIER_SET MTR_NDT_CARRIER_SET MTR_CARRIER_SET MTR_DEADTIME_SET MTR_PORT_UP CA P1 5 CC RL P1_bit no5 U phase positive phase output por...

Страница 37: ..._ADCCH_VR1 0 A D Converter channel of VR1 MTR_ADCCH_VDC 3 A D Converter channel of inverter bus voltage MTR_ADCCH_VU 17 A D Converter channel of U phase voltage MTR_ADCCH_VV 18 A D Converter channel o...

Страница 38: ...s scale Q3 MTR_CNT_START_CALC 30 Wait speed measurement still zero cross is detected become this counts MTR_SPEED_LPF_K int16 CP_SPEED_LPF_K Speed LPF parameter MTR_LIMIT_SPEED_CHANGE CP_LIMIT_SPEED_...

Страница 39: ..._OL_MODE1_CHANGE_RPM Frequency to change open loop mode1 Hz MTR_OL_MODE2_CHANGE_FREQ int16 MTR_OL_FREQ_CALC MTR_POLE_PAI RS MTR_OL_MODE2_CHANGE_RPM Frequency to change open loop mode2 Hz MTR_PATTERN_C...

Страница 40: ...LG_CLR 0 Constant for flag management MTR_FLG_SET 1 MTR_MODE_INACTIVE 0x00 Inactive mode MTR_MODE_ACTIVE 0x01 Active mode MTR_MODE_ERROR 0x02 Error mode MTR_SIZE_STATE 3 State size MTR_EVENT_INACTIVE...

Страница 41: ...r MTR_ERROR_UNKNOWN 0xff Unknown error MTR_DRAW_IN_NONE 0 initial state not work MTR_DRAW_IN_1ST 1 draw in the 1st initial position MTR_DRAW_IN_2ND 2 draw in the 2nd initial position MTR_DRAW_IN_FINIS...

Страница 42: ...Figure 3 7 Main Process Flowchart Main process Initialization of peripheral functions Initialization of user interface Initialization of variables used in the main process Initialization of sequence p...

Страница 43: ...t Get inverter bus voltage value Measure the voltage of three phase Cancel voltage offset SYSTEM MODE speed reference PI control Commutation with pseudo Hall pattern Detect zero cross End INACTIVE ACT...

Страница 44: ...ing DRIVE MODE BOOT MODE Calculate speed reference Calculate voltage reference Set PWM duty Set conduction pattern to draw in the rotor Finish draw in Go to DRIVE MODE Go to BOOT MODE Finish offset pr...

Страница 45: ...ure 3 10 Overcurrent detection process Hardware detection Figure 3 11 Overcurrent detection process PGA CMP0 1 interrupt Overcurrent detection interrupt Hardware End Generate error event Disable INTP0...

Страница 46: ...netic synchronous motor Implementation R01AN3582EJ0100 Rev 1 00 Page 46 of 46 Jan 13 2017 Website and Support Renesas Electronics Website http www renesas com Inquiries http www renesas com contact Al...

Страница 47: ...Revision History Rev Date Description Page Summary 1 00 Jan 13 2017 First edition issued...

Страница 48: ...p power on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified 3 Prohibition of Access to Reserved Addresse...

Страница 49: ...any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or systems manufactured by you 8 Please contac...

Отзывы: