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

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?
 
auraslip said:
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.)
 
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
 
dozentrio said:
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.
 
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!
 
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. :)

View attachment EbikeCalc.16.zip

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:
 
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.

View attachment EbikeCalc17.zip
 
Very nice work. Thanks for creating this great software!

Ambrose
 
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).
 
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.
 
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.)
 
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.
 
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.
 
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 · Views: 235
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.)
 
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!
 
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 =).
 
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).
 
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=0AuLYJj0UJIOndHlaejFwLVRzVTdxenBKNHJTRjROUlE&hl=en&authkey=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?
 
Hey boys i try to download SWbluto simulator, but the file is corrupted...
Can you help me?
Thanks
 
esoria said:
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/ebikecalculatoropen/subversion/nodes/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
 
Back
Top