# Weird behaviour on overcurrent : have to reflash then FOC doesn't work

10 posts / 0 new
marc426
Offline
Last seen: 2 weeks 5 hours ago
Joined: 2018-02-14 14:38
Posts: 6
Weird behaviour on overcurrent : have to reflash then FOC doesn't work

Hi All,

We've been using a FOC 75/300A from Trampa as a starter motor on a special application. We're using a big outrunner (10 pole pairs) and a AS5047 encoder.

Everything had been going -kinda- well until we started upping the phase Amps (going from 120 to 200, still well within spec) and then all of a sudden the VESC seemed to have "lost" track and produced loud growling noises and shut down.

At restarting, the VESC wouldn't work at all, when I tried to control it through the VESC tool using the UART apply, it would maybe apply a bit of current, just enough to make a small ticking noise then stop...

No amount of motor detection, even applying manually the settings would do... The only way was to reflash the firmware then reidentify the motor and tweak parameters here and there (as before).

Now, this behaviour had already happened on the bench when I had only part of the engine (and thus part of the torque) driven. At one point, I tried with too much of current and it somewhat "lost" sync / track, made loud noises and the only way to have a working VESC was to reflash the firmware.

EXCEPT this time, it won't work as before! No matter how much I reapply the old settings, tweak the observer gain or up the switching frequency (it's a very low inductance motor). Past a certain duty cycle or current, it will completely go crazy and sometimes a super loud hissing noise before shutting down. It will start and run OK up until 7% duty cycle which is already driving the motor past the sensorless RPM point. Going to 8% will make the motor go crazy.

When the VESC loses track, the phase and FOC currents also go berserk...

I sincerely hope somebody have some feedback on this because we're at a loss... It's as if the motor OR the Inverter had been damaged by something but apart from that very brief overcurrent (which was also something that happened before even though we were far from the ABS current limit) and the loud noises, we really haven't touched anything on the motor and Inverter...

Thanks to all of you!

Mar

TechAUmNu
Offline
Last seen: 3 hours 33 min ago
Joined: 2017-09-22 01:27
Posts: 378

Sounds a lot like you have damaged something, for low inductance motors if something goes wrong it can very quickly damage the hardware if it doesn't react in time. So keeping response times fast is very important. ie keeping switching frequency high, small time constant on FOC pid.

The 75/300 has been shown to work with some very low inductance motors so it shouldn't be an issue.

Was the motor running smoothly at the lower current before you had the problem?

Are you sure the encoder is working properly and setup correctly? When you get to the 7% duty cycle is the motor spinning already or not? If it is spinning is the ERPM when it hits 7% around the ERPM you set for the Sensorless ERPM on the Encoder page? See picture below. If it is then you might want to get the motor working properly without using the encoder first then move on to using the encoder. (If the VESC cannot figure out where the motor is when it switches over to sensorless then it can lose sync and go mad)

benjamin
Offline
Last seen: 19 hours 56 min ago
Joined: 2016-12-26 15:20
Posts: 361

Can you try lowering the observer gain 10 to 100 times? If that does not work, can you try lowering the flux linkage 5 - 50%? I have seen some problem with the detection for larger motors that can cause this kind of behavior.

marc426
Offline
Last seen: 2 weeks 5 hours ago
Joined: 2018-02-14 14:38
Posts: 6

TechAUmNu, Benjamin,

We've since had some developments :

• During some tests, we witnessed some sparks coming from inside the motor. Obviously we stopped and tried cleaning the rotor/stator gap. We really thought we had found the root cause of this problem (metal fillings magnetically shorting the motor?) since it was running smoothly after that...

• But then the next day, the loud growling noise would come back again if we didn't load the motor during it's acceleration. If we loaded it (just with the hand) then it accelerated fine. Also, after a number of starts (motor maybe a tad hotter but not even that much), it would behave consistently fine.

The "loading" procedure has been working well and the motor/controller behaves perfectly once we get rid of that noise but I suspect there's a depper problem lying behind.

Now that we can (kinda) reliably use the motor, we had been running some high current tests and we're now facing another problem :

• When we are at 250A (same thing happens at 200 & 220A, haven't tried lower nor higher), the motor will behave perfectly fine until we reach about half of it's nominal speed (7000RPM), duty cycle is around 50% too and then it trips on ABS_OVERCURRENT fault. Even though we're still far from the 300A phase current limit and further still from the 420A absolute limit...

This behaviour has been consistent and seems to be more related to speed than anything else.

Any idea of the problem behind those two weird behaviours?

Thanks for the help!

Marc

velolac
Offline
Last seen: 5 days 1 hour ago
Joined: 2019-11-03 09:57
Posts: 5

Hi Marc,

I think I am facing similar problem (the speed related wobbling) which I think probably originates from inaccurate PID parameters. I don't know exactly what the applied model uses for controlling, maybe it could be possible to extend motor setup run by further testing. I am thinking about a higher duty and transient testing automatically to (better?) estimate motor inertia. With 2 known added inertia even true motor power (thus efficiency) could be calculated just like how some car dynos work.

As for the sparks: I had sparks with one of my NTM rotor drive 510kV motor too. Not quite normal for a brushless motor to make sparks...:) Mine had torn coil wiring and the sparks were created between the loose ends. I was quite amused to find it out as I was still able to ride with it, just some jerks sometimes. However it quickly got torn on another part of the wiring, so it was finally dead. I think it was due to low quality of winding together with high intermittent currents I was using my ebike which resulted in cyclic physical degradation of wire. Are you sure the wire is ok?

frank
Offline
Last seen: 1 day 3 hours ago
Joined: 2016-12-27 20:19
Posts: 366

But then the next day, the loud growling noise would come back again if we didn't load the motor during it's acceleration. If we loaded it (just with the hand) then it accelerated fine. Also, after a number of starts (motor maybe a tad hotter but not even that much), it would behave consistently fine.

The motor resistance changes with heat. It could be that the hotter/warmer motor matches the programmed resistance value better. You can try and change the resistance value by +-5%. In your case probably lower the motor resistance value by 5%. The resistance value is very important for the FOC operation and needs to be within 5% accuracy! That would maybe also explain your ABS issue.

marc426
Offline
Last seen: 2 weeks 5 hours ago
Joined: 2018-02-14 14:38
Posts: 6

Hi guys,

I did lower the resistance value by 5%, it's still working but I still got this control problem at run-down. Let the motor go to a lower RPM and then put the control back again and control came back on...

The ABS_OVERCURRENT did not go away either.

Been trying to log some datas but it doesn't work (cannot open file), I read that it was a common issue on WIN7/10... Tried logging at the C:/ root but to no avail.

Still looking!

TechAUmNu
Offline
Last seen: 3 hours 33 min ago
Joined: 2017-09-22 01:27
Posts: 378

Hi Marc,

Can you share with us the motor parameters that were detected? Knowing the Resistance and Inductance of the motor would be helpful. (Low inductance motors require quite different settings to run well)

If you haven't already you might want to increase the switching frequency a bit as that tends to help with abs_overcurrent issues. (In the advanced tab under FOC) you can go all the way up to 60KHz if needs be, but it will increase the heat produced slightly.

The other thing I might try is reducing the set motor inductance slightly by about 10% and see if that helps.

As for trying to find what helps the most, best way is to back the motor current down to the point it works correctly then slowly increase it till it just starts to have problems. Then try tweaking things until you can increase the current more.

marc426
Offline
Last seen: 2 weeks 5 hours ago
Joined: 2018-02-14 14:38
Posts: 6

Sure thing!

MOTOR & APP:

<?xml version="1.0" encoding="UTF-8"?>
<MCConfiguration>
<motor_quality_bearings>0</motor_quality_bearings>
<si_battery_cells>3</si_battery_cells>
<l_current_max_scale>1</l_current_max_scale>
<foc_encoder_cos_offset>1.65</foc_encoder_cos_offset>
<foc_current_ki>2.29</foc_current_ki>
<pwm_mode>1</pwm_mode>
<l_min_vin>8</l_min_vin>
<l_watt_min>-1.5e+06</l_watt_min>
<comm_mode>0</comm_mode>
<m_ntc_motor_beta>3380</m_ntc_motor_beta>
<l_in_current_min>0</l_in_current_min>
<m_duty_ramp_step>0.02</m_duty_ramp_step>
<p_pid_kp>0.03</p_pid_kp>
<foc_pll_ki>30000</foc_pll_ki>
<foc_observer_gain>2.0091e+08</foc_observer_gain>
<l_min_erpm>-100000</l_min_erpm>
<hall_sl_erpm>2000</hall_sl_erpm>
<sl_cycle_int_limit>62</sl_cycle_int_limit>
<sl_cycle_int_rpm_br>80000</sl_cycle_int_rpm_br>
<foc_hall_table__2>255</foc_hall_table__2>
<foc_encoder_sincos_filter_constant>0.5</foc_encoder_sincos_filter_constant>
<l_max_erpm_fbrake_cc>1500</l_max_erpm_fbrake_cc>
<l_abs_current_max>450</l_abs_current_max>
<motor_loss_torque>0.03</motor_loss_torque>
<m_bldc_f_sw_min>3000</m_bldc_f_sw_min>
<foc_encoder_offset>319.4</foc_encoder_offset>
<foc_hall_table__1>255</foc_hall_table__1>
<foc_encoder_inverted>1</foc_encoder_inverted>
<foc_openloop_rpm>400</foc_openloop_rpm>
<m_current_backoff_gain>0.5</m_current_backoff_gain>
<hall_table__1>1</hall_table__1>
<s_pid_allow_braking>1</s_pid_allow_braking>
<l_in_current_max>120</l_in_current_max>
<hall_table__4>5</hall_table__4>
<l_temp_accel_dec>0.15</l_temp_accel_dec>
<motor_sensor_type>0</motor_sensor_type>
<l_erpm_start>0.8</l_erpm_start>
<l_current_max>300</l_current_max>
<l_battery_cut_end>8</l_battery_cut_end>
<l_max_vin>72</l_max_vin>
<foc_hall_table__4>255</foc_hall_table__4>
<cc_startup_boost_duty>0.01</cc_startup_boost_duty>
<foc_sl_d_current_factor>0</foc_sl_d_current_factor>
<s_pid_min_erpm>900</s_pid_min_erpm>
<foc_temp_comp_base_temp>25</foc_temp_comp_base_temp>
<si_wheel_diameter>0.083</si_wheel_diameter>
<p_pid_kd>0.0004</p_pid_kd>
<l_slow_abs_current>1</l_slow_abs_current>
<hall_table__6>4</hall_table__6>
<cc_gain>0.0046</cc_gain>
<sl_max_fullbreak_current_dir_change>10</sl_max_fullbreak_current_dir_change>
<l_temp_motor_end>100</l_temp_motor_end>
<foc_sensor_mode>1</foc_sensor_mode>
<hall_table__5>6</hall_table__5>
<foc_current_filter_const>0.1</foc_current_filter_const>
<si_motor_poles>20</si_motor_poles>
<l_current_min>0</l_current_min>
<motor_model>Not Specified</motor_model>
<cc_ramp_step_max>0.04</cc_ramp_step_max>
<foc_motor_r>0.002</foc_motor_r>
<motor_quality_description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Some comments about the motor quality. Images can be added as well.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</motor_quality_description>
<l_current_min_scale>1</l_current_min_scale>
<foc_hall_table__6>255</foc_hall_table__6>
<foc_temp_comp>0</foc_temp_comp>
<foc_hall_table__5>255</foc_hall_table__5>
<hall_table__0>-1</hall_table__0>
<foc_f_sw>30000</foc_f_sw>
<s_pid_kd_filter>0.2</s_pid_kd_filter>
<si_battery_ah>6</si_battery_ah>
<sl_bemf_coupling_k>600</sl_bemf_coupling_k>
<foc_sl_openloop_time>0.1</foc_sl_openloop_time>
<foc_sat_comp>0</foc_sat_comp>
<foc_duty_dowmramp_ki>200</foc_duty_dowmramp_ki>
<foc_encoder_ratio>10</foc_encoder_ratio>
<motor_quality_magnets>0</motor_quality_magnets>
<foc_sl_d_current_duty>0</foc_sl_d_current_duty>
<m_sensor_port_mode>2</m_sensor_port_mode>
<l_battery_cut_start>10</l_battery_cut_start>
<sensor_mode>0</sensor_mode>
<sl_min_erpm_cycle_int_limit>1100</sl_min_erpm_cycle_int_limit>
<m_invert_direction>0</m_invert_direction>
<foc_sl_erpm>2500</foc_sl_erpm>
<l_temp_motor_start>85</l_temp_motor_start>
<l_temp_fet_start>85</l_temp_fet_start>
<m_dc_f_sw>25000</m_dc_f_sw>
<gpd_current_ki>50</gpd_current_ki>
<foc_observer_gain_slow>0.15</foc_observer_gain_slow>
<foc_encoder_sin_offset>1.65</foc_encoder_sin_offset>
<l_max_duty>0.95</l_max_duty>
<gpd_buffer_interpol>0</gpd_buffer_interpol>
<foc_hall_table__0>255</foc_hall_table__0>
<foc_duty_dowmramp_kp>10</foc_duty_dowmramp_kp>
<l_max_erpm_fbrake>300</l_max_erpm_fbrake>
<hall_table__7>-1</hall_table__7>
<foc_motor_l>3.9e-07</foc_motor_l>
<foc_sl_openloop_hyst>0.1</foc_sl_openloop_hyst>
<foc_pll_kp>2000</foc_pll_kp>
<s_pid_kp>0.002</s_pid_kp>
<sl_min_erpm>150</sl_min_erpm>
<p_pid_ki>0</p_pid_ki>
<foc_dt_us>0.08</foc_dt_us>
<si_battery_type>0</si_battery_type>
<foc_hall_table__7>255</foc_hall_table__7>
<motor_type>2</motor_type>
<motor_weight>0</motor_weight>
<l_watt_max>1.5e+06</l_watt_max>
<motor_brand>Unnamed</motor_brand>
<cc_min_current>0.1</cc_min_current>
<m_encoder_counts>8192</m_encoder_counts>
<p_pid_ang_div>1</p_pid_ang_div>
<foc_encoder_sin_gain>1</foc_encoder_sin_gain>
<foc_sample_v0_v7>0</foc_sample_v0_v7>
<foc_hall_table__3>255</foc_hall_table__3>
<m_fault_stop_time_ms>500</m_fault_stop_time_ms>
<motor_description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;A motor description can be edited here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</motor_description>
<s_pid_kd>0.0001</s_pid_kd>
<foc_encoder_cos_gain>1</foc_encoder_cos_gain>
<l_max_erpm>100000</l_max_erpm>
<foc_sample_high_current>1</foc_sample_high_current>
<gpd_buffer_notify_left>200</gpd_buffer_notify_left>
<foc_current_kp>0.0004</foc_current_kp>
<s_pid_ki>0.002</s_pid_ki>
<hall_table__3>2</hall_table__3>
<p_pid_kd_filter>0.2</p_pid_kd_filter>
<l_temp_fet_end>100</l_temp_fet_end>
<si_gear_ratio>3</si_gear_ratio>
<m_drv8301_oc_mode>0</m_drv8301_oc_mode>
<m_out_aux_mode>0</m_out_aux_mode>
<gpd_current_filter_const>0.1</gpd_current_filter_const>
<motor_poles>20</motor_poles>
<m_bldc_f_sw_max>35000</m_bldc_f_sw_max>
<motor_quality_construction>0</motor_quality_construction>
<l_min_duty>0.005</l_min_duty>
<hall_table__2>3</hall_table__2>
<gpd_current_kp>0.03</gpd_current_kp>
</MCConfiguration>

<?xml version="1.0" encoding="UTF-8"?>
<APPConfiguration>
<imu_conf.accel_confidence_decay>1</imu_conf.accel_confidence_decay>
<shutdown_mode>7</shutdown_mode>
<app_chuk_conf.ramp_time_neg>0.2</app_chuk_conf.ramp_time_neg>
<app_nrf_conf.speed>1</app_nrf_conf.speed>
<app_ppm_conf.hyst>0.15</app_ppm_conf.hyst>
<app_balance_conf.tiltback_low_voltage>0</app_balance_conf.tiltback_low_voltage>
<app_uart_baudrate>115200</app_uart_baudrate>
<app_chuk_conf.smart_rev_max_duty>0.07</app_chuk_conf.smart_rev_max_duty>
<app_chuk_conf.throttle_exp_brake>0</app_chuk_conf.throttle_exp_brake>
<app_balance_conf.hertz>1000</app_balance_conf.hertz>
<imu_conf.mahony_ki>0</imu_conf.mahony_ki>
<app_balance_conf.pitch_fault>20</app_balance_conf.pitch_fault>
<app_ppm_conf.median_filter>1</app_ppm_conf.median_filter>
<app_ppm_conf.ramp_time_neg>0.2</app_ppm_conf.ramp_time_neg>
<send_can_status_rate_hz>50</send_can_status_rate_hz>
<app_chuk_conf.throttle_exp>0</app_chuk_conf.throttle_exp>
<app_chuk_conf.hyst>0.15</app_chuk_conf.hyst>
<app_ppm_conf.throttle_exp_brake>0</app_ppm_conf.throttle_exp_brake>
<imu_conf.accel_offsets__1>0</imu_conf.accel_offsets__1>
<pairing_done>0</pairing_done>
<app_balance_conf.use_switches>0</app_balance_conf.use_switches>
<imu_conf.rot_roll>0</imu_conf.rot_roll>
<app_balance_conf.startup_pitch_tolerance>20</app_balance_conf.startup_pitch_tolerance>
<app_ppm_conf.pulse_end>2</app_ppm_conf.pulse_end>
<app_balance_conf.startup_roll_tolerance>8</app_balance_conf.startup_roll_tolerance>
<app_balance_conf.current_boost>0</app_balance_conf.current_boost>
<permanent_uart_enabled>1</permanent_uart_enabled>
<imu_conf.gyro_offset_comp_clamp>5</imu_conf.gyro_offset_comp_clamp>
<app_ppm_conf.ctrl_type>0</app_ppm_conf.ctrl_type>
<uavcan_esc_index>0</uavcan_esc_index>
<imu_conf.gyro_offset_comp_fact__0>0</imu_conf.gyro_offset_comp_fact__0>
<app_ppm_conf.ramp_time_pos>0.4</app_ppm_conf.ramp_time_pos>
<imu_conf.rot_yaw>0</imu_conf.rot_yaw>
<imu_conf.mahony_kp>0.3</imu_conf.mahony_kp>
<app_balance_conf.overspeed_duty>0.9</app_balance_conf.overspeed_duty>
<imu_conf.gyro_offset_comp_fact__1>0</imu_conf.gyro_offset_comp_fact__1>
<app_ppm_conf.tc_max_diff>3000</app_ppm_conf.tc_max_diff>
<imu_conf.mode>0</imu_conf.mode>
<imu_conf.gyro_offsets__0>0</imu_conf.gyro_offsets__0>
<uavcan_enable>0</uavcan_enable>
<imu_conf.accel_offsets__2>0</imu_conf.accel_offsets__2>
<imu_conf.gyro_offsets__1>0</imu_conf.gyro_offsets__1>
<app_balance_conf.tiltback_duty>0.75</app_balance_conf.tiltback_duty>
<app_ppm_conf.pulse_start>1</app_ppm_conf.pulse_start>
<app_balance_conf.ki>0</app_balance_conf.ki>
<imu_conf.accel_offsets__0>0</imu_conf.accel_offsets__0>
<app_chuk_conf.stick_erpm_per_s_in_cc>3000</app_chuk_conf.stick_erpm_per_s_in_cc>
<app_nrf_conf.channel>76</app_nrf_conf.channel>
<imu_conf.rot_pitch>0</imu_conf.rot_pitch>
<send_can_status>0</send_can_status>
<app_to_use>0</app_to_use>
<timeout_brake_current>0</timeout_brake_current>
<app_ppm_conf.throttle_exp_mode>2</app_ppm_conf.throttle_exp_mode>
<app_balance_conf.startup_speed>30</app_balance_conf.startup_speed>
<app_balance_conf.roll_fault>45</app_balance_conf.roll_fault>
<controller_id>6</controller_id>
<app_nrf_conf.retries>3</app_nrf_conf.retries>
<app_chuk_conf.use_smart_rev>1</app_chuk_conf.use_smart_rev>
<app_chuk_conf.ctrl_type>1</app_chuk_conf.ctrl_type>
<app_chuk_conf.throttle_exp_mode>2</app_chuk_conf.throttle_exp_mode>
<app_balance_conf.kp>0</app_balance_conf.kp>
<app_ppm_conf.tc>0</app_ppm_conf.tc>
<app_nrf_conf.power>3</app_nrf_conf.power>
<app_balance_conf.kd>0</app_balance_conf.kd>
<app_chuk_conf.tc>0</app_chuk_conf.tc>
<app_chuk_conf.multi_esc>1</app_chuk_conf.multi_esc>
<app_ppm_conf.pulse_center>1.5</app_ppm_conf.pulse_center>
<app_ppm_conf.smart_rev_max_duty>0.07</app_ppm_conf.smart_rev_max_duty>
<app_nrf_conf.send_crc_ack>1</app_nrf_conf.send_crc_ack>
<app_ppm_conf.pid_max_erpm>15000</app_ppm_conf.pid_max_erpm>
<app_ppm_conf.multi_esc>1</app_ppm_conf.multi_esc>
<imu_conf.sample_rate_hz>200</imu_conf.sample_rate_hz>
<app_chuk_conf.ramp_time_pos>0.4</app_chuk_conf.ramp_time_pos>
<app_chuk_conf.tc_max_diff>3000</app_chuk_conf.tc_max_diff>
<app_nrf_conf.crc_type>1</app_nrf_conf.crc_type>
<app_balance_conf.tiltback_speed>5</app_balance_conf.tiltback_speed>
<app_ppm_conf.max_erpm_for_dir>4000</app_ppm_conf.max_erpm_for_dir>
<app_balance_conf.tiltback_high_voltage>100</app_balance_conf.tiltback_high_voltage>
<imu_conf.gyro_offsets__2>0</imu_conf.gyro_offsets__2>
<timeout_msec>1000</timeout_msec>
<app_balance_conf.tiltback_angle>15</app_balance_conf.tiltback_angle>
<can_baud_rate>1</can_baud_rate>
<imu_conf.gyro_offset_comp_fact__2>0</imu_conf.gyro_offset_comp_fact__2>
<imu_conf.type>1</imu_conf.type>
<app_ppm_conf.smart_rev_ramp_time>3</app_ppm_conf.smart_rev_ramp_time>
<app_ppm_conf.safe_start>1</app_ppm_conf.safe_start>
<app_ppm_conf.throttle_exp>0</app_ppm_conf.throttle_exp>
<app_chuk_conf.smart_rev_ramp_time>3</app_chuk_conf.smart_rev_ramp_time>
<app_nrf_conf.retry_delay>0</app_nrf_conf.retry_delay>
</APPConfiguration>


marc426
Offline
Last seen: 2 weeks 5 hours ago
Joined: 2018-02-14 14:38
Posts: 6

And about upping the switching speed, I'm a bit worried about the heat-up (we're already pushing 50°C with T_amb =10°C @ 240A phase amps).

Also, I'm just wondering why it would do so at speed (it really stops @8000RPM everytime) and not at low speed. The inductance of the motor stays the same over RPM, does it?

Thanks for the help,

Marc