# Motor Simulator

Browser Compatibility: Anything modern except Firefox 6.0 (FF5, 4, and 3.X all fine).

Welcome to latest release of our online ebike simulator, now with full vehicle modeling, dual system comparisons, and a vertical cursor bar with text readout. Select your motor, controller, battery, and vehicle choices then hit **Simulate**. Click the mouse on the graph. Fool around, and if you have any questions please read the full explanation of the new features in the text below.

## How to Use the Simulator

Use the drop-down menu to choose from the list one of the hub motors that we have modelled, the battery pack, wheel size, and motor controller current limit. Then select the type of bicycle that you ride as well as the gross vehicle weight (you plus the machine) and hit "Simulator". The program will then output 4 graphical plots against your speed (in kph or mph) on the horizontal axis.

**Red Plot:**The red line shows the power output of the hub motor. The power output is zero at 0 rpm, rises up to a maximum, and then falls back down to zero once the wheel is spinning at its normal unloaded speed. If the motor current is not limited by the controller in any way, then the peak power happens at between 40-50% of the motor's unloaded rpm. Otherwise, the maximum power usually coincides with the point when the controller hits the current limit.

**Green Plot:**This is the efficiency curve for the electrical drive system. It is a ratio of the mechanical power coming out of the hub motor to the electrical power going in to the controller. This ratio accounts for losses inside the controller and the hub motor, but it does not include losses due to the internal resistance of the battery. Notice though that efficiency does not necessarily mean better range or less battery usage; a fast and powerful setup running at 80% efficiency may draw more power to cover the same distance than a slower arrangement at 75% efficiency.

**Blue Plot:**The blue line can be configured to display either the torque output of the hub in Newton-meters, or the thrust of the wheel in pounds. Thrust naturally increases as you select smaller wheel sizes, while the torque of the motor is independent of wheel diameter. Thrust is most convenient for estimating the climbing capacity of the vehicle, and it is what most people actually mean when they talk about 'torque'. To a first order approximation, the pounds thrust needed to overcome gravity when climbing a hill is simply weight * %grade.

**Black Plot:**The black line can be configured as either the load line of the vehicle, or the % grade hill that the system will climb at steady state. The load line is the default choice, and it directly shows the amount of power necessary to move the bicycle. The point where the power output of the hub motor crosses the load power of the bike is the speed you could expect to achieve without pedaling. As you increase the grade hill you are climbing, or switch to a less aerodynamic vehicle, you can see the load curve rise quite steeply at increasing speeds.

### Cursor Bar and Text Data

By default, right after each calculation the simulator will draw a dashed vertical cursor that coincides with the point where the output power of the motor intersects the load line of the vehicle. This is the expected steady-state cruising speed for that particular arrangement with no human pedal input. The table underneath the simulator shows the numeric performance values of the system at this point.

You can move the cursor to any other location by clicking the graph with the left mouse button, and see the corresponding numeric results anywhere else on the graph instead. For instance, if you want to see the expected performance with 100 watts of human pedal input, then click the graph at a point where the load line of the vehicle is about 100 watts higher than the output power of the motor. You will see that you get better range, efficiency, and speed than with no human input.

The numeric data is grouped into 3 categories:

**Graph**This data here corresponds exactly to the graphical power, efficiency, torque, and load data that has already been described above.

**Electrical**This shows some of the electrical characteristics of the system at the cursor speed:**Mtr Amps:**is the phase current flowing through the windings of the hub motor. This is not the same as the current that you measure from the battery pack with a Cycle Analyst or other watt meter. At low speeds when controller is PWM current limited, it is possible for the motor current to be several times greater than the current drawn from the pack.**Batt Power:**This the power that is being taken out of the battery pack (battery amps * battery volts), and is what you would see on the Cycle Analyst watts display. It is not the same as the actual output power of the motor.**Batt Amps:**This is the current flowing out of the battery pack, again as would be seen by an CA or inline ammeter. You will notice that at low speeds the battery amps stays fixed at the controller current limit. That is what a controller current limit does.**Batt Volts:**This is the terminal battery voltage as you would see by a CA or Voltmeter. As you move the cursor to lower speeds where more current is drawn from the battery, you'll the voltage on the battery pack sag due to internal resistance.

**Performance**The performance table shows the vehicle characteristics at the cursor speed:**Acceleration:**This shows the instantaneous expected acceleration or deceleration of the vehicle at the particular cursor location assuming no other (ie human) power input. If the motor output power exceeds the load power of the vehicle, it will accelerate. If the motor power is less, it will decelerate.**Consumption:**This is the Wh/km or Wh/mi as you would expect to see on the Cycle Analyst for the energy consumption of the vehicle. It is a direct measure of how much battery energy you use per distance travelled.**Range:**This is the predicted distance you could achieve from a full charge on the selected battery pack. It is based on the actual measured battery capacity and not the nominal amp-hours. So for instance the "12Ah" SLA option has an actual capacity of just under 8Ah due to the Peukert effect.**Overheat In:**This is a prediction on how long it would take the motor to overheat (reach 150oC) based on a simple first order thermal model that assumes the motor is not spinning and in still air. The actual time to overheat on a vehicle moving outdoors and associated air cooling would be substantially longer. It none the less provides a good relative indicator of how much the motor is being stressed until we develop a more complete model.

### Using the Throttle Slider

Many people overlook the fact that there is a throttle slider and only bother looking at the full throttle output, and come to incorrect conclusions related to 'efficiency' and 'sweet spot'. If you want to see how a system behaves at slower speeds, which is achieved in practice by backing off on the throttle, then move the throttle slider to less than 100%. The vertical cursor will automatically move to your expected cruising speed at the new throttle position.

### Comparing Two Systems

If you would like to compare two setups side by side, then the link "Open System B->" will pull out a 2nd table from which you can select an entirely different system and have both plots show up together on the same graph. A second set of numeric data shows up in the tables as well.

### Hiding Plots

It is possible to hide any of the plotted data to make for a cleaner graph. The circle beside each plot title in the legend is also a radio button, so you can click the dot to show or hide the associated line. This is particularly useful when you are comparing two systems and otherwise would have 8 plots to deal with on the graph.

### Entering Custom Values

We have provided dropdown selection for a range of typical battery packs, vehicle types, and motor controllers. At the bottom of each of these menus is a 'custom' option that brings a pop-up menu if you would like to simulate with different components.

**Custom Battery:**This enables you to simulate a system with a battery type or voltage not listed in the dropdown.**V:**This is the open circuit and not the nominal battery voltage. So for instance, a nominal 36V LiFePO4 pack sits at about (12 cells * 3.3V/cell) = 39.6V, and not 36V.**Ω:**This is the internal battery resistance and is an important detail, and the simulator can misbehave if it is left at zero. If you do not know the resistance of your pack, then try to find this info from the manufacturer or vendor. Any respectable supplier would know or be able to get this detail. Lacking that, you can get the data by observing the voltage of your system under load. For instance, if a battery is showing 49V at rest, and 44V when you draw 25A at full throttle, then the battery resistance is approximated by ΔV/ΔA = (V49-44V)/(25A) = 0.2 Ω.**Ah:**This is the actual output capacity of the pack in amp-hours, and is used only for the expected range calculation. If you are modeling a lead acid battery, the actual capacity is usually about 30-40% less than the nominal capacity due to the Peukert effect.

**Custom Controller:**Controllers are currently modeled as having a battery current limit and a voltage throttle.**A:**This is the controller current limit, and reflects the maximum current that the controller will draw from the battery before automatically entering a PWM current limited mode.**Ω:**This is the combined resistance of both the mosfets and the phase leads going from the controller to the hub motor. It can be estimated from the resistance of 2 mosfets (one high side, one low side) plus the controller->motor lead resistance based on the wire gauge. For instance, a controller with 10mΩ mosfets and a 6 foot 14g motor lead wire would have a resistance of (2*10mΩ + 2*6 feet* 2.52Ω/foot) = 50 mΩ, or 0.05Ω.

**Custom Vehicle:**Here is where you can model the rolling and aerodynamic characteristics of your particular vehicle.**CdA:**This is the effective frontal area for the vehicle, which can range from 0.2 for a fairly streamlined recumbent up to 0.8 for a wide upright mountain bike with a puffy jacket. All aerodynamic calculations are done assuming sea level elevation and ambient temperatures.**Cr:**This is the rolling drag coefficient of the vehicle wheels. Bike tires range from about 0.004 for a high pressure road slick, up to 0.012 for a low pressure knobby wheel.

## Simulator FAQ (and some rarely asked questions too)

With the direct drive motors this is easy. Once you move the cursor passed the unloaded motor speed, the graphs for motor torque and battery current both go negative, allowing you to see how much power will be required to turn the motor and how much electrical current and power would be generated. Even though the graphs don't display far into the negative region, you can use the numeric tables to see generated power deep into regen mode.

With the geared motors (eZee and BMC), we have modeled the freewheeling behaviour of the motor. Above the unloaded speed the motor is assumed to spin at the unloaded RPM regardless of the wheel RPM, and you cannot see the regen behaviour that would be possible if either the freewheel was locked or the motor was spinning in reverse.

The inflection point that you see occurs when the motor controller hits the current limit. At speeds above this point, the current from the battery gradually declines until it reaches 0 amps at the unloaded rpm (where the graph outputs intersect). At speeds slower than the inflection point, the motor controller regulates the power to the hub, restricting battery current draw to the motor controller current limit (20A, for example). In this region, from 0 rpm up to the inflection point, there is constant power input into the motor rather than a constant voltage, and so the nature of the curves is different.

That is because even though the battery current is limited by the controller, the current through the motor is not. It is the motor current, not the battery current, that determines the torque output of the hub motor. When there is no Pulse-Width-Modulation (PWM) going on in the motor controller (full throttle and moving fast enough that the battery current is under the motor controller current limit) then the amps flowing out of the battery is effectively the same as the amps flowing through the motor. But when the controller is doing PWM, then the current through the motor is higher than the battery current by the inverse of the PWM duty cycle.

That is because of the inductance of the motor windings. At each commutation event, current in the phase winding that was just disconnected needs to decay through a freewheeling diode in the controller. While this current decays, it is still present in the motor leads and generating torque even though it is not drawing any current from the battery pack. So the net result is a somewhat higher phase current than battery current, even at full duty cycle. This effect is most pronounced in high speed geared motors (e.g. BMC, eZee), somewhat less noticeable in high pole count direct drive hubs (e.g. Nine Continent, Clyte H series), and barely discernable in low pole count direct drive motors (eg. Clyte 400 and 5300 series).

While we appreciate the level of interest that has been shown in the simulator by other businesses who would like to have a copy of it on their site, the answer is that no, we are currently not interested in licensing this online software. It is first and foremost a tool that we have made freely available via our website to the ebike community.

The answer to this question is that we already have, it is contained within the output of these curves. If you know how to make use of this raw motor data, then you will be able to extract the motor and other parameters from the output graphs. It's what we had to do with a million times more work first building and calibrating our own dynamo and running endless real world tests to get discrete measured data points on all these different hub types. You've got it *made* being able to get those same curves at the click of a button.

Doing a full characterization of a hub motor takes a lot of our time and also requires destructive testing to understand the thermal limits. To add a new motor we require a) that it is readily available as a motor only and without an integrated controller (so no BionX), and b) that we are given for keeping two samples of said motor, one for destructive test and the other to keep on hand as reference should we ever need to repeat tests, and c) that it is sufficiently popular amongst DIY ebike conversions to be of value to have listed.

## Simulator Details (also being updated...)

The old simulator was based on the following circuit model for a battery-powered permanent magnet motor and controller setup:

- V
_{OC}is the open circuit battery voltage. - R
_{batt}is the first order internal resistance of the battery. - I
_{batt}is the current draw from the battery pack. - Controlleris assumed to be a single quadrant (non-regen) controller, with the indicated input and output equations.
- D is the PWM duty cycle, which can range from 0 to 1. This value is generally equal to the throttle setting, but that can be over-ridden to keep I
_{batt}at the specified current limit. - I
_{motor}is the current through the motor windings. - R
_{motor}is the winding resistance of the motor. - Kis the motor constant, in Nm/A or V/(Rad/sec).
- w is the wheel speed in radians per second.

The actual model in SimulatorV2 is substantially more complicated, taking into account the commutations that happen on a regular basis as a function of the speed and number of poles of the hub motor, and determining the resulting current waveforms that are produced when this is applied to the inductive motor windings.

The power is calculated simply as this output torque times wheel speed:

The efficiency is calculated from the input power to the controller divided by the output power (it does not take into account the losses internal to the battery pack):

Finally, the road speed is calculated based on wheel size. The simulator also correctly shows the regen currents and negative power when the wheel is spinning faster than the unloaded voltage, so the axis go slightly in the negative region to show this.

### Accuracy and Limitations

The parameter values that are chosen for the motor model are based on directly measured data that we have compiled from tests using a custom built dynamometer made for the task.

Our original 2005 dynamo setup pictured above was limited to a maximum loading of about 5 N-m, but we have since built two newer devices, one of which allows for continuous load testing of the hub motors of over 50 N-m of torque. This has enabled us to verify the mathematical model above to the measured output performance with a high degree of accuracy and over a wide speed and power range. The performance of a hub motor is dependant on the temperature of the windings, and even during the course of a short test the winding resistance can go up by 15-20%. The values used in our simulator assume a winding resistance that is about 15% higher than what is measured at room temperature.

The characteristics for the battery packs are also from our own independent testing, with the value for R_{batt} calculated from the DC impedance from 1C - 2C loading, and with V_{OC}chosen at the 50% state of charge. A freshly charged pack would be faster and more powerful than indicated, while a nearly flat pack would be slower.

Finally, the program does not simulate the low voltage rollback of the controller. If you have a setup with a particularly high impedance battery, like a 5Ah NiCd, it is possible that in real life it would hit the low voltage point at high loadings and have a lower power output than indicated.

**Credits: **Motor modeling, core simulator algorithms, and text by Justin Lemire-Elmore. The web application coding to make this into an awesome online app was done by the hard work of Zev Thompson and (more recently) Michael Vass.