You are here

Generator app

4 posts / 0 new
Last post
arvidb
Offline
Last seen: 3 years 7 months ago
Joined: 2018-01-16 23:09
Posts: 77
Generator app

Since the generator usecase seems pretty common I wrote a custom app for that:

generator_app.zip

Uzip it to get generator_app.patch (unfortunately ordinary text files are not allowed here, so I had to zip it) and apply to a current firmware (current = 3.40, but older should work too) with

patch -Np1 < path/to/generator_app.patch

This should create the file applications/app_generator.c and modify conf_general.h to use it as the custom app.

Edit app_generator.c and modify GEN_ERPM and GEN_CURRENT (and possibly GEN_START and GEN_UPDATE_RATE_HZ) to your liking. Build the firmware, flash the VESC, and set app configuration to Custom. Now the motor should coast until it reaches GEN_START*GEN_ERPM where it should start to brake, reaching GEN_CURRENT at GEN_ERPM.

Note that if you set GEN_ERPM too low and/or GEN_CURRENT too high, and run the motor without an inertial load, you might get rather violent oscillations (as I couldn't help but notice while testing the code blush). Also, it's probably a bad idea (as in "weird things might happen") to use VESC_Tool to run the motor to a speed where it would start to generate. ;)

If you use it, please give some feedback about how it works, if you had to do any changes, etc.

rodread
rodread's picture
Offline
Last seen: 10 months 2 weeks ago
Joined: 2018-01-12 11:08
Posts: 12

Wow, Really cool.

I must take a good look at this and try it out. Thanks for the heads up and share arvidb. Star!

My tests so far use an arduino on the serial. (This way I can record the data more easily... I haven't sussed how to record VESC_Tool data yet... yes I'm that slow.)

In my system arduino reads the ERPM to build a long and a short running average speed. These are used to smooth response and detect speeding up or slowing down.

This is useful for safely loading the generator without messing up the turbine.

A couple of knob values are read. They are used to amplify the long running average ERPM value to give a brake current value which is sent to the VESC.

Usefully the knobs now adjust the braking response with respect to speed, so I can kinda set a smooth response in the field and change the braking characteristics to be appropriate to various turbines / input devices.

It's been running pretty smooth... I think... especially considering how gusty the wind on my field is and how elastic a kite turbine torque tube is. No idea really.

Tests are giving quite scary power output now. Just <1kW with a very small single ring, 3x foam blade NACA4412 20cm chord on a mast mounted top end.

This is the code https://drive.google.com/drive/folders/17SNo19sSsQUzfgIExbOuw2PaHOoovXHc?usp=sharing

 

The kite turbine builder

stiganielsen
Offline
Last seen: 3 months 3 weeks ago
VESC Free
Joined: 2017-12-27 23:38
Posts: 5

I tried the patch but got this message:

patching file applications/app_generator.c
patching file conf_general.h
Hunk #1 FAILED at 92.
1 out of 1 hunk FAILED -- saving rejects to file conf_general.h.rej

Should I rather follow the tutorial on custom apps from http://vedder.se/2015/08/vesc-writing-custom-applications/ ?

stiganielsen
Offline
Last seen: 3 months 3 weeks ago
VESC Free
Joined: 2017-12-27 23:38
Posts: 5

We have made it work, and we have been doing some testing of the braking app over here on this thread.. main conclusion is that it does not seem like there is any difference between 'mc_set_current' and 'mc_set_brake_current'.. we have also added some features to the braking app..