New Open Source E-Bike/E-vehicle calculator & simulator

Get all your technical information about electric bikes here.

Re: New E-Bike/E-vehicle calculator - Beta testing/Debug

Postby justin_le » Fri Dec 18, 2009 7:29 am

swbluto wrote:Thanks for the illustration. I was recently under the impression that the caveat you brought up affected performance in the region of 5-10%, but it certainly seems to be fairly important.


Yes, well the level of importance really depends on the motor and RPM under question. But when the inductive impedance of the windings at the commutation frequency starts to reach the same order as the ohmic resistance, then the effect can be very significant, and as illustrated with the geared eZee/BMC motors it is more than a factor of 2. If you look at an oscilloscope trace of the waveform, the current never comes close to leveling out at the value predicted by (V-emf)/R. It is still ramping up when the commutation event takes place, then it takes a big hit during the commutation as the current steers away from one phase to the other. The graph here shows a Nine Continent motor spinning at 510 RPM, with both the actual drive voltage when the controller is on (pink) and the back-emf voltage when it is off (green) showing. The blue line is the phase current when the controller is on.

BLDC Motor Waveforms.jpg
BLDC Motor Waveforms.jpg (38.88 KiB) Viewed 1695 times


Notice how the current through the phase is always ramping upwards? With a sinusoidal motor driven by a 6-step controller as is the case here, we would expect the current waveform to look a bit like a 'w', but here it is a 'w' on a pretty big slant.

By the way... can you tell me how the "commutation" period is so long at low speeds?
It seems obvious that the phases are activated for longer periods of time at lower RPM, but it also seems that you're encountering PWM at the lower speeds due to current limiting. Is the "commutation period" of the PWM waveform not particularly important (Once current limited has deceased at higher speeds, the PWM disappears and the phase waveform becomes the only one existent), and it's mostly just the phase current's period?


I think on my 6th read over that I see what you're getting at! In the context above, by "commutation period" I just meant the time period between one commutation event and the next, not the actual time duration that it takes the current to switch over from the non-driven phase to the newly driven phase. The actual time required for the commutation to take place is dependent on a) the current through the windings, b) the inductance of the windings, c) the back emf voltage, and c) the supply voltage.

I'm completely ignoring PWM in all of this, it's not part of the equation at all. At PWM frequencies the winding inductance is assumed to be for all intents and purposes infinite, and that approximation seems fine.

-Justin
Big Dummy with 24" eZee front hub, 25A infineon controller, and 48V 10Ah LiMn pack
My website: www.ebikes.ca
Please contact via email, info@ebikes.ca, rather than PMs
User avatar
justin_le
10 kW
10 kW
 
Posts: 919
Joined: Mon May 28, 2007 3:27 am
Location: Vancouver

Re: New E-Bike/E-vehicle calculator - Beta testing/Debug

Postby swbluto » Sun Dec 27, 2009 9:48 pm

Ok, I've gone through the steps for licensing and dedicating an SVN space to the open source movement. This software is now GPL licensed and ready for open sourcing to allow improvement or modification to the software by anyone who wishes to contribute. All improvements and derivatives must be open source under the same license as part of the terms for GPL licensing.

The SVN is http://svn2.assembla.com/svn/ebikecalculatoropen .

If you just want to browse or have a look around the space, the url is http://code.assembla.com/ebikecalculato ... sion/nodes .

Here's the directions for developing this.

This project was built using the NetBeans IDE for the GUI Builder and code editing and JDK 5 to maintain compatibility with Mac Systems. It also uses JFreeChart in order to create graphs and all those cool things.

What I would suggest is find JDK 5 as offered by Sun, download it bundled with netbeans and install it. If you want to contribute to the above project, please send your email address to me and I'll add you as a member to the group so that you can add to the project directly, otherwise you can check it out anonymously and create a derivative work. After installing it, checkout the project using the subversion feature of netbeans and, if you wish to contribute directly, add your member login info there. Once you've checked it out, make sure to add JDK 5 so that the project can use it and find and download JFreeChart-1.0.11 from sourceforge and add the libraries to Java's lib folder, and add to the folders to the project inside netbeans. After that's done, you should be able to compile and edit the project freely and you would commit changes to the source code by right clicking the project and clicking commit.

Some things that might be desired to change/add

-Change the built in 2d array for the motors so that it can read that information from an external CSV spreadsheet or some other database. This way, the motors can be added in the future without requiring compiling the program and so anyone could add motors to the motor database.

-Add in a motor current limit so that motor-current limited controllers like Kelly controllers can be accurately simulated.

-Modify it so that it'd be possible to use more than one motor in the same drive-train. That honestly sounds like a lot of work to keep relatively simple.

-Include a drive-train loss box so that one could include drive-train losses into the simulation. A percentage may be the most intuitive.

-Add in inductance so that high inductance motors can be accurately simulated in the high RPM range.

-Get rid of the antiquated efficiency linear-interpolation code for hub motors, since the efficiency calculations now work.

...Some superficial things for maintainability reasons...

-Capitalize the "Final Int" variables to distinguish it as a constant used for the general motor's data array for array item access.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm


Re: New E-Bike/E-vehicle calculator - Beta testing/Debug

Postby damcard » Sun Jan 03, 2010 6:09 pm

swbluto wrote:it doesn't seem easy to port to an online format without heavy bandwidth costs.


Bandwidth should be minimal. I could see doing this app two ways to get it online. I could do either one fairly easily and would be glad to so I can loose my "lurker" status.

The first is with servlets and a html form via jsp's. The bandwidth would be comparable to any simple web application. Infact, it would only have a single main form with a few popups. The charts themselves are fairly small. Do people use the zoom functionality in the charts? The issue here is you would need a servlet engine such as Tomcat to run it. But it would work for limited devices like an Iphone.

The second would be to port the whole thing to actionscript3 (flash). For this application I would prefer to do that. The cool thing doing it that way is all the graphs could be dynamically updated as you change values in the form. It would be the most responsive. You could serve it from any web server as static content such as in a post on this forum. All the calculations and graphing would happen on the client. The bandwidth would be small as the user would simply download the swf and not interact with the server anymore. The downside is you need the flash player use it. For normal web browsers, its not an issue. But, it would not work on limited devices such as an Iphone.

Is anyone interested in making this a web application?
User avatar
damcard
100 W
100 W
 
Posts: 286
Joined: Mon Feb 02, 2009 6:15 pm
Location: San Antonio, TX

Re: New E-Bike/E-vehicle calculator - Beta testing/Debug

Postby wshi » Fri Jan 08, 2010 2:35 pm

swbluto wrote:Ok, I've gone through the steps for licensing and dedicating an SVN space to the open source movement. This software is now GPL licensed and ready for open sourcing to allow improvement or modification to the software by anyone who wishes to contribute. All improvements and derivatives must be open source under the same license as part of the terms for GPL licensing.

The SVN is http://svn2.assembla.com/svn/ebikecalculatoropen .

If you just want to browse or have a look around the space, the url is http://code.assembla.com/ebikecalculato ... sion/nodes .
.....



Well done! I would like to checkout and have a look. What's the username and password for read only access anyway?
wshi
1 mW
1 mW
 
Posts: 17
Joined: Fri Jan 08, 2010 2:14 pm

Re: New E-Bike/E-vehicle calculator - Beta testing/Debug

Postby damcard » Fri Jan 08, 2010 7:05 pm

swbluto wrote:Change the built in 2d array for the motors so that it can read that information from an external CSV spreadsheet or some other database. This way, the motors can be added in the future without requiring compiling the program and so anyone could add motors to the motor database.


How were you going to do this exactly? Would you have a folder with the files it could load? That is, where would the csv files be held? A form could be used to load custom csv's I suppose. If it is a hosted app or if it connected to a service I could see how users could add motors.

I ported Motor.java to Flash(as3). I will finish up the others once I can get read access to the repository and check out the entire project. Thanks -David.
User avatar
damcard
100 W
100 W
 
Posts: 286
Joined: Mon Feb 02, 2009 6:15 pm
Location: San Antonio, TX

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Fri Jan 08, 2010 7:30 pm

Quick response.

It appears they classify two types of people:

"watchers" and "members".

Under permissions for each type of the above user, they offer "read", "edit" and "all". Currently, watchers have read access and members have edit accesses. If the "watchers" category doesn't allow checkout, then I don't know how to offer anonymous access without also offering the ability to commit. It appears that checkout is tied up with commit abilities.

So if anyone has any insight into what can be done to allow anonymous checkout without commit abilities, please let me know.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Fri Jan 08, 2010 7:51 pm

Ok, I've created a watcher and maybe watchers will be "special" since they have a password.

Username: anonymous_1359
password: anony

This user has read access which might allow checkout, methinks.

Hmmmmm... it appears I changed something relevant because it seems eclipse checked out the project without a user logon, while also not presenting the commit option. It appears "anonymous checkout" has been somehow enabled.
Last edited by swbluto on Fri Jan 08, 2010 7:58 pm, edited 1 time in total.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New E-Bike/E-vehicle calculator - Beta testing/Debug

Postby swbluto » Fri Jan 08, 2010 7:55 pm

damcard wrote:
swbluto wrote:Change the built in 2d array for the motors so that it can read that information from an external CSV spreadsheet or some other database. This way, the motors can be added in the future without requiring compiling the program and so anyone could add motors to the motor database.


How were you going to do this exactly? Would you have a folder with the files it could load? That is, where would the csv files be held? A form could be used to load custom csv's I suppose. If it is a hosted app or if it connected to a service I could see how users could add motors.

I ported Motor.java to Flash(as3). I will finish up the others once I can get read access to the repository and check out the entire project. Thanks -David.


I have no idea how a csv would be situated.

I was just thinking of a simple comma-separated-value(csv) sheet that contained the motor database. Basically, each line contains a distinct motor, and each comma separated value is a distinct value (Motor Name, kv, resistance, io, whatever else.). If you're creating it online, you could connect it to whatever database schema you want, with maybe something like mySql.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby wshi » Sat Jan 09, 2010 12:58 am

Have you looked at Google code project hosting? It's pretty cool and support SVN.

http://code.google.com/opensource/
wshi
1 mW
1 mW
 
Posts: 17
Joined: Fri Jan 08, 2010 2:14 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Mon Jan 11, 2010 8:45 pm

It looks cool. I'm not going to put more effort into putting it somewhere else, though, especially if all the desired functionality appear to be working where it is already.

I noticed development is slow / non-existent which is OK. Maybe it's just fine the way it is. I've stopped personally contributing to it largely because it does most of what I wanted in a simulator - it easily enables me to design an electric vehicle with a good educated guess as to what I might expect of performance and efficiency. However, maybe some people want more but don't have the programming skills to do it. I may be willing to help in that regard in return for services, goods or payment. My rates are fairly cheap since I know any improvements would help out the community at large and I really want to help the revolution, but my time isn't free. ;)

Anyone can contribute to it whenever they want, whatever they want. If it significantly deviates from some of the inherent stated goals of the project, it might be good to make a branch. I'm just offering services to help those who don't know how to contribute programming to the project but want some specific feature or set of features implemented. Like perhaps dual motors. Motor current limiting. Or something else.

For the main branch, I want to....

Minimize screen clutter. If someone is going to implement dual motors, it'd probably be best to have a dialog box to input motor and drivetrain characteristics for a given motor, and then to have a summary on the main input screen then it would to have double the amount of boxes on the main input window. There's probably way too many boxes on the main window as it stands.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby wookey » Mon Jan 18, 2010 7:54 pm

OK. I just had a go with this. It works fine on java 6 openjdk on Debian Linux. Or at least everything except the help works. Clicking on the help button launches a browser containing the URL: http://www.help\mainindex.htm/ rather than openning the URL file:///home/wookey/archive/vehicles/Help/mainIndex.htm where it actually is. Something small not quite right there.

It's a nice application, and I'm very pleased to see it gpled and put online. I could package it for Debian/Ubuntu if there was any demand, but as has been pointed out it's probably most useful as a web-app.

Could I ask that if people are going to make this into a flash application that they _please_ test it with/write it for Gnash and swfdec - the free flash applications. Currently flash is a real problem on the net because it requires Adobe's proprietary technology for much of it to work - that is not the sort of web we all want to be using (imagine where we'd be if 10 years ago there was only one web-browser available to us all, from one supplier and no-one else could write web-browsers because how stuff worked was not documented). I'd much prefer for it to remain a java application, now that java has been made a free language. flash is not searchable, flash is not link-to-able.

I found a couple of minor corrections in the help. I just tried to check the code out and fix these but it seems the help docs are not actually checked in. Is this just an oversight? Shall I do that? I've joined the project and it's set me to 'member' does that give me svn checkin rights?

Now, on to the app itself. I am trying to simulate my moped. The motor is the e-fun 1500W twin-mode device with data here:
http://www.efun-ev.com/technology/advan ... raphic.swf
http://www.efun-ev.com/technology/advan ... L_data.swf
http://www.efun-ev.com/technology/advan ... raphic.swf
http://www.efun-ev.com/technology/advan ... _data2.swf
(Snigger at the craziness that takes about 1K of data, scans it and then turns it into a swf application to display pages (and hides access behind a login) - a triumph of gratuitous technology over accessibilty)
Can anyone tell me how I work out K or Motor resistance from that data?

This motor is not in the datbase already so I picked 'Custom'. Setting 1 amp no load current (perhaps this box should be next to the other 2 that need filling in?) 0.04 V/RPM and 0.1ohm resistance, gives me something approximately in the right ballpark, but I can't get anywhere near the 2500W that my watt's up tells me is peak current.

The help could use some generic values for mopeds too (for tyre rolling resistance, frontal area, drag co-efficient, etc). Does anyone have ideas for typical values? Similarly do we know any of the motor specs?
wookey
10 W
10 W
 
Posts: 94
Joined: Mon Jul 13, 2009 8:22 am

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Mon Jan 18, 2010 8:32 pm

Your motor might not be 100 mOhm.

Also, the power output value you see in the calculator is just that - the motor's power output. The peak you see with your wattsup is the input electrical power firstly, and secondly, the peak power probably does not correspond to your "current limit" as there's some current overshoot with almost all current limiters so you're not going to see that in the simulator. You'll need to make your current limiter perfect, first. :wink:

As far as the help files, I'm pretty sure they were sitting in a separate folder from development that was just zipped into the rest of the program's zip file, so that makes sense. That computer has since crashed (And data lost), so someone will have to check it in to make it part of the project.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby damcard » Mon Jan 18, 2010 9:52 pm

wookey wrote:Could I ask that if people are going to make this into a flash application that they _please_ test it with/write it for Gnash and swfdec - the free flash applications. Currently flash is a real problem on the net because it requires Adobe's proprietary technology for much of it to work - that is not the sort of web we all want to be using (imagine where we'd be if 10 years ago there was only one web-browser available to us all, from one supplier and no-one else could write web-browsers because how stuff worked was not documented). I'd much prefer for it to remain a java application, now that java has been made a free language. flash is not searchable, flash is not link-to-able.

I found a couple of minor corrections in the help. I just tried to check the code out and fix these but it seems the help docs are not actually checked in. Is this just an oversight? Shall I do that? I've joined the project and it's set me to 'member' does that give me svn checkin rights?


I had started to port this to Flash. I just started my Masters degree, so my time is limited. I think it would be easier for me to just do a web app using the existing java code except for the UI code of course. It will be another week before I can start up on it again.
User avatar
damcard
100 W
100 W
 
Posts: 286
Joined: Mon Feb 02, 2009 6:15 pm
Location: San Antonio, TX

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby tostino » Sat Apr 03, 2010 9:57 am

SW I was thinking of taking a look at the code, but for some reason, it is just not wanting to see the jFreeChart libraries I imported.

Any ideas of what I did wrong?
Attachments
error.jpg
tostino
100 kW
100 kW
 
Posts: 1036
Joined: Mon Mar 24, 2008 4:12 pm
Location: New Port Richey, FL

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Sat Apr 03, 2010 10:49 am

I believe that one needs to include the libraries inside the library manager, as well. So, I think you might have to point netbeans to the appropriate .jar.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby tostino » Sun Apr 04, 2010 8:44 pm

Silly me! I downloaded the source for jFreeChart and jCommon, and didn't build it, so there was no Jar for it to point to (even though I "added" the library in the library manager). I built them, and now it's working :D. Time to take a look at all this.
tostino
100 kW
100 kW
 
Posts: 1036
Joined: Mon Mar 24, 2008 4:12 pm
Location: New Port Richey, FL

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Tue Jun 15, 2010 8:46 am

Heads up, I don't trust the hub motors, at least not when you're looking for heat generated and efficiency information - everything else should be fine. If the heat figures are distrusted, just copy down the k, motor resistance and the no-load current into the custom option and it'll be accurate. This is because of some antiquated "If block" that uses a linear approximation model for the hub motor's efficiency near the end of the RPM range, which was made before the efficiency formulas became accurate. Simply deleting the "if block" should make the hub motors evaluation correct again.

The graphs are unaffected by this, so they'll be accurate either with a hub motor or a custom motor.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm


Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Wed Jun 16, 2010 3:49 pm

No problem.

I was thinking about getting a 9C motor so I was looking at the graphs and it looked like the performance was pretty impressive. But then I went to double check ebikes.ca's newfound suggestion of modeling motor inductance which applies to "high inductance" or "high pole count" motors and apparently 9c is a high pole motor. It turns out that there was indeed a significant difference in performance at high motor RPM, and meant the difference between a prediction of 30 mph up a hill and 18 mph. :roll:

Well, this is reshaping my 9C plans. More importantly, inductance should be modelled but I getting the data would probably require one to have ready access to the motors - i.e., a dealer like ebikes.ca. *sigh*

EDIT: I quoted the below for reference because I must bite my tongue. It appears they provide L(inductance) when you use the custom option near the bottom of the graph. Now armed with the L value, what can I do? I know the L/R time constant will tell me how fast the phase current rises as it switches phases, so one just needed to take an integration of current and find the average phase current and thus torque, and the time period will be determined by the electric RPM which increases with motor RPM. Now, the question is... is the phase current 0 immediately when it switches? The time period I believe will be
1 / (motor RPM * pole count), where RPM really is radians/sec.

They haven't exactly been too forthcoming in releasing the inductance data and it's not readily extractable from the graphs since "numerical estimation" techniques are used (LOL- in other words, no formula), so I guess they have the monopoly of "true performance" simulation and unfortunately doesn't include all the detailed vehicle analysis that I've come to love about mine (Like heat generation, acceleration, predicted speed given a defined hill and motor temperature and the such).


In otherwords, true performance prediction for 9C's will be LABORIOUS. I really really really really don't want to fall back on the old tiring methods. Design will be a huge PITA that way. Freak, I really have taken a huge hiatus on this but I really need to include this. Now I need to get the programming environment up and running again, haha (My windows system has crashed and burned so many times since I've last developed this that I've lost all the necessary programs and libraries for development.).
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby auraslip » Wed Jun 16, 2010 4:38 pm

I'd be happy just to get a quick reference for top speed, range, current draw, and such.

Leave the science stuff to scientist.....Concentrate on making a great program and fill in the blanks as they become available.

Also I have no idea what my rolling resistance is or drag coefficient. Could you put in some examples the next version?
User avatar
auraslip
1.21 GW
1.21 GW
 
Posts: 3646
Joined: Fri Mar 05, 2010 5:19 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Wed Jun 16, 2010 4:40 pm

auraslip wrote:Also I have no idea what my rolling resistance is or drag coefficient. Could you put in some examples the next version?


Do you mean in the help file? I was just wondering because I kind of wonder how many people actually know it's there.

(I'm kind of wanting to know because I wonder if I need to make the help file more obvious somehow.)
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby dozentrio » Wed Jun 16, 2010 11:12 pm

I tried to simulate the Turnigy 80-100B without much luck. I think there is either a bug, or the specs they report on Hobby King are wrong. I put in 130Kv, 32ohms motor resistance, 2A no load current, 200Amp limit, Gear Ratio 15, and left everything else the same, and it couldn't come up with reasonable predictions. Not sure what to do :P
My Turnigy 80-100 bike (40V 120A)
http://www.youtube.com/watch?v=GGc1hF5evVE
User avatar
dozentrio
1 kW
1 kW
 
Posts: 467
Joined: Tue May 26, 2009 5:51 pm
Location: Canada

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby swbluto » Wed Jun 16, 2010 11:25 pm

dozentrio wrote:I tried to simulate the Turnigy 80-100B without much luck. I think there is either a bug, or the specs they report on Hobby King are wrong. I put in 130Kv, 32ohms motor resistance, 2A no load current, 200Amp limit, Gear Ratio 15, and left everything else the same, and it couldn't come up with reasonable predictions. Not sure what to do :P


They meant 32 mOhms, so that's actually .032 ohms.
User avatar
swbluto
10 GW
10 GW
 
Posts: 4415
Joined: Fri May 30, 2008 5:23 pm

Re: New Open Source E-Bike/E-vehicle calculator & simulator

Postby dozentrio » Thu Jun 17, 2010 8:56 am

ahh, that makes sense. I don't have a sense of what a reasonable motor resistance is yet. I did kinda suspect that, but when I checked other motors they were also in ohms :P Thanks!
My Turnigy 80-100 bike (40V 120A)
http://www.youtube.com/watch?v=GGc1hF5evVE
User avatar
dozentrio
1 kW
1 kW
 
Posts: 467
Joined: Tue May 26, 2009 5:51 pm
Location: Canada

PreviousNext

Return to E-Bike Technical

Who is online

Users browsing this forum: No registered users and 11 guests