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

Get all your technical information about electric bikes here.
auraslip   1.21 GW

1.21 GW
Posts: 3535
Joined: Mar 05 2010 5:19pm

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

Post by auraslip » Jun 16 2010 4:38pm

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?
THANKS TO EVERYONE HERE WHO TAUGHT ME ABOUT EBIKES. I'M IN YOUR DEBT.

I sell Ebike Brake levers and throttles with custom connectors crimped on! $10 shipped!

ES facebook group

r/ebikes ebikes on reddit

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jun 16 2010 4:40pm

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
dozentrio   10 kW

10 kW
Posts: 504
Joined: May 26 2009 5:51pm
Location: Canada

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

Post by dozentrio » Jun 16 2010 11:12pm

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

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jun 16 2010 11:25pm

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
dozentrio   10 kW

10 kW
Posts: 504
Joined: May 26 2009 5:51pm
Location: Canada

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

Post by dozentrio » Jun 17 2010 8:56am

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!

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jun 17 2010 12:02pm

Ok, so this is NO WHERE near ready but, more to the point, I don't plan on making it ready because it works for my needs. If you want a "polished one" that uses the simple motor model, use .15. Otherwise, use .16.

So, what does this one do different? It uses inductance modeling, adds in motor pole and inductance boxes, I've added a motor current limit, and switching from a hub motor to custom doesn't delete the values. Also, the erroneous inefficiency code has been deleted. The inductance modeling code was shamelessly STOLEN from ebikes.ca. Actually, I'm just giving them the credit for it because I did basically copy and paste their javascript code and adapted it (If they email me and ask me to remove it or something, I'll have no problem with that, but I will publicize that request.) - I did make a feeble attempt at understanding the math and coming up with my own code, but it became clear to me that would take at least a week and no success was guaranteed. For some reason, the formulas give a NaN at some low speed for some reason (And messes up the graph below 7-10 mph) but since I don't particularly care about low motor speed performance, I don't really care. The simple model is a pretty good model of low speed performance anyhow.

I make no guarantees over accuracy. The only thing I can say is that the graphs are pretty close to the CA graphs, but not really exact. Like, there's will say 17 NM at 30 mph while mine will say 15 NM at that speed. So it's not exact, but close. It'll give me a more realistic idea of 9C performance which is all I'm really looking for.

There's a lot of errors with this one. Just about the only thing that works is the graphs, and that's only above 5-10 mph. So, if you need to predict your speed, you better start learning how to interpret graphs. :)
EbikeCalc.16.zip
(3.76 MiB) Downloaded 424 times
Edit: Actually, after playing around with this, it still seems better to just eyeball ebikes.ca's graphs. I guess I'll go back to the tired methods. I guess the point of this release is that it includes the source code (It's always available on the SVN repository, but it's actually distributed with the main program) so maybe someone could help make it better. :mrgreen:

auraslip   1.21 GW

1.21 GW
Posts: 3535
Joined: Mar 05 2010 5:19pm

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

Post by auraslip » Jun 17 2010 5:07pm

Do you mean in the help file?
I feel stupid......... maybe a link in the program that goes to online help, or opens the text document?
THANKS TO EVERYONE HERE WHO TAUGHT ME ABOUT EBIKES. I'M IN YOUR DEBT.

I sell Ebike Brake levers and throttles with custom connectors crimped on! $10 shipped!

ES facebook group

r/ebikes ebikes on reddit

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jul 08 2010 2:49pm

So I've updated the program. I reverted to the "simple resistance" model because I don't have time to figure out the inductance model (I know how to do it but it's going to take some time to implement - well, you know, I might catch a bug soon enough; it's usually how these things happen.), I also added in controller heat calculations that takes into consideration switching losses, resistive losses and freewheeling losses (The major ones) and all the details are provided in the textBox upon the calculation. You can also graph the controller heat, so you can see what controller heat may look like at its worst (0 mph where phase currents are at their highest).

The major differences here between this and the previous is that it includes a motor current limit, so you can see how performance will look like with such.
EbikeCalc17.zip
(3.39 MiB) Downloaded 1899 times
Last edited by swbluto on Jul 11 2010 2:19pm, edited 3 times in total.

User avatar
ambroseliao   100 kW

100 kW
Posts: 1221
Joined: Apr 27 2009 3:34pm
Location: Washington, DC, USA area
Contact:

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

Post by ambroseliao » Jul 08 2010 3:08pm

Very nice work. Thanks for creating this great software!

Ambrose
http://www.ebikes.ca/ is the best!

TidalForce M-750X, Tidalforce S-750 with Crystalyte HS3540, 1x TF iO-X Cruiser. E+ 1000W hybrid bike. ebikes.ca DrainBrain & Cycle Analyst meters. GoPro HD Hero2 camera. Bosch Fat Packs, 37V 10Ah LiPO pack. Turnigy Multistar batteries
My blog: http://ebikerider.blogspot.com
Remember LiFEPo4 HVC is 3.65V and LVC is 2.7V

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jul 08 2010 4:51pm

Hey, no problem.

Just in case anyone wonders, they may notice a jump when it goes from the non-current limiting regime to the current-limiting regime in the controller heat. This is mostly due to switching losses. Some people think something that the switching losses start to decrease above something like 80-90% throttle and thus it should be more gradual, but the calculations don't support that assertion. Assuming a PWM frequency of 10 khz, the wave period will be 100 uS. That implies that 1 uS Turn-off/Turn-on time will only be "cut short" above a duty cycle of .98 or so (Or 98% throttle) - so, it stands to reason that the switching losses will occur rather suddenly (unless you happen to be within the 98-99.9% duty cycle range which would be rather peculiar).

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jul 08 2010 7:37pm

Okay, so just letting any other possibly interested developers what's going on (There doesn't seem to be much of those, but just in case. :) )

I'm trying to incorporate inductance modeling. I reasoned my own solution to the inductance modeling, and the resulting graph in the non-current limited region (The right of the "knee") seems to result in motor torque remarkably similar to ebikes.ca. That's good, even though I'm sure our equations are not that identical.

But, moving to the left of the graph's, I can't seem to come up with a formula that'll transition smoothly into the current limited region. It's either too high or too low and there doesn't really seem to be a "neat" solution (At least it's not obvious to me so far). So I'm wondering if this is why ebikes.ca eventually came up with an iterative approach to experimentally solving the problem because there isn't a formulaic solution.

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jul 08 2010 9:07pm

Okay, so I went back to re-implementing the ebikes.ca code and in the gap around 150 rpm and below where the results are invalid, I just used the simple resistive model because inductance makes little difference at those low RPMs. Resultingly, there's a "little jump" at that point of transition, but it seems negligible for most practical concerns.

After implementing the ebikes.ca code, I noticed that the battery current and motor current curves are slightly off from what you'd expect. While I messed around with a variable that I could've influenced (Our K factors seem to be off by a factor of around 10), that didn't seem to affect it. So, I'm thinking that's an artifact of the iterative experimental approach of solving the motor current and battery current problem, and it's not apparent on ebikes.ca's curves because they don't tell you the battery current nor motor current.

(The problem is that the motor current and battery current values diverge by 1 to 5 amps when they're supposed to be equal (Motor current > battery current) and the battery current isn't limited at exactly its battery current limit. It's more that battery current limit - .5 amps, but it converges to the actual limit at lower RPMs.)

Anyways, I'm thinking of releasing it in current's state but the curves are just funny. It doesn't really reflect my attention to precision since it's ebikes.ca's "good enough" code, but on the other hand, it makes such a small difference from what you'd actually experience in real life, that it doesn't really functionally matter.

If I release it, I'm thinking of making it a "special version" with a particular emphasis on... it's ebikes.ca's formulas, don't blame me. What do y'all think?

(Btw, I'm not saying the curves are "wrong" although they might be, it's just a little funny looking.)

tostino   10 kW

10 kW
Posts: 970
Joined: Mar 24 2008 4:12pm
Location: New Port Richey, FL

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

Post by tostino » Jul 15 2010 1:31am

SW, a few months ago I did a bit of work on making the program read a text file for motor info, and fill in the list, rather than having all that data hard coded. I just checked out your newest code, and merged my changes. Is that something you would want me to commit?

I would also like to let ya know... I don't know exactly how well the new formulas are calculating everything. It seems like the efficiency is incredibly low compared to what it should be, and so is the total power out. Also, the "power required" in graphing is broken for me. Haven't had a chance to look into it yet.

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jul 15 2010 2:08am

Sure, commit it! :D

I'll have to look at the latest release when I get to the work station. I've been trying to add inductance modeling to the code and have been doing some refining, and I haven't uploaded that version to the repository yet. If you can send an .esim file that demonstrates the problems you're noticing, that'd be great. If you let me know what output you were expecting, I can probably pinpoint any possible problems faster.

tostino   10 kW

10 kW
Posts: 970
Joined: Mar 24 2008 4:12pm
Location: New Port Richey, FL

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

Post by tostino » Jul 15 2010 3:24pm

I'll commit it asap then, i'll just need ya to add me to the team on Assembla. Same username as on here.

And lets see... here are a couple .esim's (one for the new version, one for the old).

Edit: that is not a real world proven setup (yet...) I will make a save of the current bike I have that matches it's performance and attach that too.

Edit#2: okay, the .esim files of my current bike must be on my home computer, i'll see if I can find them when I get home.
Attachments
Saves.rar
(288 Bytes) Downloaded 214 times

swbluto   100 GW

100 GW
Posts: 9532
Joined: May 30 2008 5:23pm
Contact:

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

Post by swbluto » Jul 15 2010 3:37pm

Okay, an invitation has been extended. If the code you're referring to is the "revision 4", yeah, that hasn't been released yet and it's definitely no-good. I have some code that I haven't uploaded yet that's a bit more accurate (And the user can choose between inductive and simple resistive modeling, depending on which they think is more applicable.)

tostino   10 kW

10 kW
Posts: 970
Joined: Mar 24 2008 4:12pm
Location: New Port Richey, FL

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

Post by tostino » Jul 15 2010 3:40pm

Ahh yeah I meant revision 4. When you said not released, I thought you meant that it wasn't even on the svn. Alright, now i'm on the same page! :)

And thanks for the invite!

tostino   10 kW

10 kW
Posts: 970
Joined: Mar 24 2008 4:12pm
Location: New Port Richey, FL

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

Post by tostino » Feb 18 2011 11:02am

Just wanted to bump this and say that i've spent the past couple days coding (without all that much to show for it honestly). I committed my changes to the svn, and I still have more work to do. I reverted the inductance code from v4, because it is not working correctly. We need to get a stable version on the svn, then work on the inductance code (I won't be much help I don't think =/).

I also disabled the motor current limiting until I can make sure that it models it correctly (which I wasn't sure of last night).

I added the ability for the program to read the motor info from a text file, rather than having it hard coded. That way we can add new motors easily and quickly.

Some UI errors have been fixed as well.

More work to do! Hopefully I will have a little time this weekend =).

tostino   10 kW

10 kW
Posts: 970
Joined: Mar 24 2008 4:12pm
Location: New Port Richey, FL

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

Post by tostino » Feb 20 2011 12:37am

Grrr! Well I fixed a few more things such as the graph generating correctly with the Power Needed lining up and all, and I am trying to work on having it tell you predicted quarter mile times... I am just having a hard time with the math for it =/. Anyone have any ideas?

I honestly have no idea how I can put in a distance, and have it tell me the time it takes to get to it... I fail lol.

Edit:
Gah! I thought I had it... but for some reason when I try and feed getDistance() a time, it doesn't return anything... and I don't know where it is looking for info it doesn't have... The only place I see it used is in TimeGraph.java (and it works just fine when used there exactly the same way as I am trying to use it).

auraslip   1.21 GW

1.21 GW
Posts: 3535
Joined: Mar 05 2010 5:19pm

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

Post by auraslip » Feb 20 2011 1:08pm

Hey guys,

Totally not related, but I tried to make a spreadsheet to calculate heating a battery pack due to Ri. https://spreadsheets.google.com/ccc?key ... y=COLxqNYI

I know it's inaccurate because it doesn't take into account Ri change as a result of heat or SOC (among other things), but I thought you might be interested in it. Maybe you can make something useful with the idea?
THANKS TO EVERYONE HERE WHO TAUGHT ME ABOUT EBIKES. I'M IN YOUR DEBT.

I sell Ebike Brake levers and throttles with custom connectors crimped on! $10 shipped!

ES facebook group

r/ebikes ebikes on reddit

esoria   100 W

100 W
Posts: 149
Joined: Sep 07 2010 4:57am

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

Post by esoria » Mar 21 2011 4:21am

Hey boys i try to download SWbluto simulator, but the file is corrupted...
Can you help me?
Thanks

User avatar
damcard   100 W

100 W
Posts: 237
Joined: Feb 02 2009 6:15pm
Location: San Antonio, TX

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

Post by damcard » Apr 04 2011 11:42pm

esoria wrote:Can you help me?
I just tried to download the versions posted here and found them to be corrupted too. Best thing I can come up with short of getting Netbeans and building it is going to http://www.assembla.com/code/ebikecalcu ... des/EvCalc and get the zip there. Or you could look at the previous revisions to get an older one. Hopefully only a correctly built file was committed. Thats what I am trying anyhow. -Damcard

User avatar
damcard   100 W

100 W
Posts: 237
Joined: Feb 02 2009 6:15pm
Location: San Antonio, TX

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

Post by damcard » Apr 05 2011 12:14am

Worked for me. I unzipped it to a directory (in my case '/home/david/Desktop/ebikecalc/EbikeCalc17'). Opened a console in that directory and ran 'java -jar /home/david/Desktop/ebikecalc/EbikeCalc17/EvCalc.jar ebikecalc2.mainFrame'. I have version 1.6.0_24 on 64 bit Ubuntu. -Damcard

esoria   100 W

100 W
Posts: 149
Joined: Sep 07 2010 4:57am

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

Post by esoria » Apr 05 2011 2:19am

Thanks boys :)

tostino   10 kW

10 kW
Posts: 970
Joined: Mar 24 2008 4:12pm
Location: New Port Richey, FL

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

Post by tostino » Apr 05 2011 6:26pm

Give me a bit if you want my latest revision... i'll zip it up and post it here.

Post Reply