Hi,
I wrote this in another post, I guess I need separate thread for it.
I am doing current control and sending current command to vesc4 via CAN BUS in FOC mode with hall sensors. The motor is quite large and with kv of about 9rpm/volt with 36v battery. The current command is sent every 1 milisecond, the motor values are read every 5 millisecond on my MCU and the data of the following graphs is gathered every 5ms from my MCU into MATLAB. The following graphs show the speed, sent current command and read current value from the vesc. (all phase currents). The blue on the second subplot is the command I sent and asking vesc for that current. The first graph is is simply showing the
motor_current (read value from vesc)
in red. The second graph shows the
motor_current * sign(speed)
in red. By plotting both of them, I wanted to see if the sign of the reported current is dependent to the speed direction (sign). It seems it is, to some extent, true but not always.
(open images in new window for better quality)
First of all, why the sent command and measured current are not matching each other and I have discontinuity in the graph???
Secondly, If you see, slightly after each change of direction in current command (zero crossing). For example at times about 17.2s, 18.8s, 20.2s, 22.5 and 24.1 second. As you see, they are not only measurement problems because they are causing sudden drop in speed as well. I guess problem in measurement, causes problem in current controller inside the VESC. What am I doing wrong?? This question is more important.
The motor is under the load and changing direction of course from my current command.
By the way, do you think VESC6 doesn't have this issue??
The motor current sign depends on wether the motor is generating power (braking) or drawing power (accelerating). If you multiply it with the sign of the duty cycle instead of the speed it should match in your graph if I'm not mistaken.
Thanks Benjamin. I will try the sign of duty cycle. What about 2nd issue? A jerk after zero crossing of the current command? The following graph shows the jerks in speed and corresponds it to a pulse in read current from vesc. As it can be seen, it happens at first moments of braking period or when the absolute value of the speed starts to drop.
I'm not 100% sure, but I think the second issue comes from when the motor goes between being driven and being undriven. Sending a current command that is lower than the minimum current in the Motor > General > Advanced tab of VESC Tool will switch off modulation and make start tracking the back-EMF from the ADC measurements, and when sending a command larger than the minimum current will start modulation again which could cause a small glitch if it is done right too soon after switching off the modulation. To prevent that and keep the modulation on all the time, you can lower the minimum current to something like 0.01 A and make sure that the magnitude of your current command never is lower than that.
To Yosoufe
I would like to command VESC for position and rpm with MatLab.
Could you give me a hint, how to do that?
Would you mind, sharing your Matlab-File with me?
Kind regards
brushlessjoe
Best image of the perception is indulged or the approval of the tenets for the students. Yes, the particular use of the papers owl reviews is improved for the vital images for the field. Its impact is intensified for the molded elements for the parts in this ambit.