background image

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

R01AN3582EJ0100    Rev.1.00 

 

Page  29  of 46 

Jan 13, 2017 

 

3.3 

List of variables of sensorless 120-degree conducting control software   

Lists of variables used in this control program are given below. However, note that the local variables are not 

mentioned. 

In the control programs in this application note use fixed-point calculation. Therefore, some variables are already 

established with fixed-point calculation. Bits number in fractional part of fixed-point number is expressed in the Q 
format. For example, a "Q3" number has 3 fractional bits. "Qn" number is indicated on "Scale" column in below table. 

 

Table 3-17 List of variables [1/4] 

Variable name

 

Type

 

Scale

 

Content

 

Remarks

 

g_u2_max_speed_rpm 

uint16 

 

Rotational speed command 

maximum value 

Mechanical angle [rpm] 

g_u2_min_speed_rpm 

uint16 

 

Rotational speed command 

minimum value 

Mechanical angle [rpm] 

g_u2_margin_min_speed_rpm 

uint16 

 

Rotational speed command 

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_status 

uint8 

 

User motor status management 

0: Stop 

1: Rotating 

2: Error 

g_u1_reset_req 

uint8 

 

Reset request flag 

0: Turning SW2 ON in error status 

1: Turning SW2 OFF in error status 

g_u1_sw1_cnt 

uint8 

 

SW1 determination counter 

Chattering removal 

g_u1_sw2_cnt 

uint8 

 

SW2 determination counter 

Chattering removal 

g_u1_stop_req 

uint8 

 

VR1 stop command flag 

 

g_s2_v_ref 

int16 

Q7 

Voltage command value 

Speed PI control output value [V] 

g_s2_vdc_ad 

int16 

Q7 

Inverter bus voltage A/D value 

[V] 

g_u2_pwm_duty 

uint16 

 

PWM duty 

 

g_u2_ref_speed_rad 

uint16 

Q3 

Speed reference (user selected) 

value 

Electrical angle [rad/s] 

g_u2_speed_rad 

uint16 

Q3 

Measured rotational speed 

Electrical angle [rad/s] 

g_s2_speed_lpf_k 

int16 

Q14 

Speed LPF parameter 

 

st_speed 

MTR_PI

_CTRL 

 

Structure for speed PI control 

 

g_u2_vu_ad 

uint16 

 

U phase voltage A/D value 

 

g_u2_vv_ad 

uint16 

 

V phase voltage A/D value 

 

g_u2_vw_ad 

uint16 

 

W phase voltage A/D value 

 

g_u2_vn_ad 

uint16 

 

Three-phase voltage average 
A/D value 

 

g_u2_cnt_ol_ctrl 

uint16 

 

Counter for open-loop process 

 

 

 

Содержание 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...

Отзывы: