# Formula to determine acceleration based on constant energy input

I'm a software engineer building a simulator for train movement. What I would like to do is create an acceleration curve that's closer to reality.

This is my thinking, which includes some simplifications and may have errors in it: Engines have a power rating, for instance 1000 watts. Assuming 100% of that power is applied to acceleration, at first the vehicle accelerates quickly. But, overtime the vehicle accelerates less rapidly. My leap of logic is that this is related to the vehicle gaining kinetic energy. Apply a certain amount of work when kinetic energy is low and acceleration is high. Apply the same amount of work at high kinetic energy and acceleration is low. That's my starting hypothesis.

My first physics teacher emphasized keeping your units correct. And I've been looking at various questions and answers on the relationship between kinetic energy and acceleration. The basic equation for force is:

$F=ma$

Substituting units $\mathrm{m=kg}$, $\mathrm{a=\frac{m}{s^2}}$, which makes the units for $\mathrm{F}$ to be $\mathrm{\frac{kgm}{s^2}}$.

The ConvertUnits web site says watts can be converted to

(Kg-force m) / s

,which if applied over time has the same units as the $\mathrm{F}$ in the $\mathrm{F=ma}$. What I'm having a hard time is making the leap to include the effect of kinetic energy.

Hoping someone can at least point in the right direction.

• Don't use Latex to generate Gifs, use MathJax which is the standard around here. – StephenG Aug 3 '17 at 20:17
• I converted it to very beautiful mathjax. This (Kg-force m) / s, I couldn't understand. Consider it a homework, to do the conversion based on the examples. :-) – peterh - Reinstate Monica Aug 3 '17 at 20:25
• If you want "an acceleration curve that's close to reality" you have to specify the type of engine/motor that powers your train and accept the fact that you cannot have a constant power device. Although torque and power are related it is torque which produces the acceleration and note that maximum torque does not imply maximum power. – Farcher Aug 4 '17 at 7:25

Please, don't use "kg-force" though. The unit of force is the Newton (N); the unit of energy (work done) is the Joule (J), or Newton-meter (Nm); the unit of power is the Watt (W), Joule per second (J/s) or Newton-meter per second (Nm/s).

"Constant power" works fairly well when an engine is running in a certain narrow range of speeds - unfortunately other effects will get in the way when you are going slowly (you would experience "almost infinite acceleration" if the power were constant), and at that point you usually look at the torque that the engine can produce instead.

Some equations:

$$F = m\cdot a \tag1$$

With force (F) in N, mass (m) in kg, and acceleration (a) in $\rm m/s^2$.

Power (in W) is force (in N) times velocity (in $\rm m/s^2$):

$$P = F\cdot v \tag2$$

Kinetic energy E (in Joules):

$$E = \frac12 m v^2$$

Now we can write the equation of motion by substituting (2) into (1); if we write $a = \dot v = \ddot x$, we get

\begin{align}P &= m\cdot a \cdot v \tag3 \\&= m \cdot \dot v \cdot v \\&= \frac12 m \frac{dv^2}{dt}\end{align}

Integrating once, we get

$$P\cdot t = \frac12 m v^2 + A$$

This looks a lot like "the total energy supplied (power multiplied by time) is equal to the kinetic energy at the end, plus some factor". That factor is "whatever you need to take account of the initial velocity of the object".

If the initial velocity is zero, then this equation will tell you what the final velocity is. It doesn't tell you much about the acceleration - and unfortunately, these equations tell us that for a very slow-moving object, the acceleration is "almost infinite" at constant power. You see this by rearranging (3):

$$a = \frac{P}{mv}$$

Which tells us that when $v=0$, the value of $a$ becomes undefined... and as soon as you limit the maximum acceleration, the above equations need modification.

If you can assume that acceleration can be no greater than a certain value $a_{max}$, then you can break the problem into two smaller ones. As long as the velocity is less than

$$v_{min} = \frac{P}{m a_{max}}$$

we should use "constant acceleration" for our equation (and assume that the rest of the energy is lost in heat due to wheels, clutch etc. slipping), then switch to the "constant power" expression for the remainder.

Of course the equation of motion for constant acceleration are

$$v_t = v_0 + a_{max} t\\ x_t = x_0 + v_0 t + \frac12 a_{max} t^2$$

• BTW, I only KG-force because that's how the convert units web site labeled. When I queried the watts to newtons conversion. – Nottoc Aug 3 '17 at 23:43
• I'm marking this one as the answer because it's easier for me to implement. However, all the answers have principles I need to keep in mind. – Nottoc Aug 4 '17 at 14:57

I'm interpreting your question as you wanting to know the resultent velocity for an object of mass $m$ and initial velocity $v_0$ being accelerated in the direction of its velocity by a constant source of energy inputting at a constant rate $P$, the 'power'.

Since the power is the rate of change of energy, in this case kinetic energy, we have $$P=\frac{dE} {dt} = \frac{1} {2} m \frac{dv^2} {dt} = m v \frac{dv} {dt}$$ thus $$\int \frac{P} {m} dt = \int v dv$$ and $$\frac{Pt} {m} = \frac{v^2} {2} +const$$

Applying the inital condition to find the constant, get that $$v=\sqrt{v_0 + \frac{2Pt} {m}}$$

Does that help?

• and note that if the initial velocity is zero, the initial acceleration is infinite, making this model unrealistic. – user154997 Aug 3 '17 at 21:51
• Give me a day to think on this. – Nottoc Aug 3 '17 at 23:36
• Is $v_0$ the initial velocity? If so, your final equation is not right. Your calculation boils down to work done = change in KE ie $Pt=\frac12mv^2-\frac12mv_0^2$. There is no need for an integral. – sammy gerbil Aug 5 '17 at 10:42
• Yes it is the initial velocity, and yes it is right. He asked for a constant input of energy, so change in kinetic energy is power times time. I thought this might be a helpful way of presenting this, but perhaps you disagree. – Eddy Aug 5 '17 at 10:47
• No, that constant is not the initial velocity. Look at units. It has units of a velocity squared. If you substitute t = 0 into your final equation you get $v = \sqrt{v_0}$ which makes no sense. So that constant is actually the initial velocity squared. – gleedadswell Apr 26 at 15:17

If your goal is to be closer to reality, you should use a model of a real engine. Call it European bias but when I think of train, I think of electric trains, so let's crudely model a DC motor. The crucial shortcoming of your model in that case would be that you would only take into account mechanical energy, ignoring the electrical energy. And we will eventually see that the power does vary, contrary to your hypothesis. The rated power of an electric motor is more like a maximum power. Warning: the following is from the top of my head as I haven't touched electrical engineering for 20 years!

The DC motors has a difference of potential $V(t)$ between its two terminals, and an intensity $I(t)$ flows into it, both depending on time $t$. This is a rotatory machine, so I will use a torque $T(t)$ instead of a force, and an angular speed $\omega(t)$ instead of a linear speed [*].

There are two key physical laws at work in the DC motor.

• Lorentz force: the current $I(t)$ flows through a square loop inside the motor which is inside a magnetic field, and this result into a force perpendicular to the field, proportional to $I(t)$. The force on the top part of the loop is opposite to the force in the bottom part and this results into a torque, therefore also proportional to $I(t)$ (a diagram would really help here!),

$$T(t) = K_1 I(t).$$

• Faraday law: as the loop rotates inside the magnetic field, an electromotive force (EMF) $V_e(t)$ appears in the wires. This is proportional to the speed of the wire, so to $\omega(t)$ too. This is called the back EMF iirc:

$$V_e(t) = K_2 \omega(t).$$

A detailed calculation (with diagrams!) would show that $K_1 = K_2$ but there is a heuristic argument demonstrating that: the electrical power is $V(t)I(t)$ and barring any loss it shall be equal to the mechanical power $T(t)\omega(t)$. Then that same loss-free hypothesis means no electrical resistance, and we will neglect any self-induction effect, resulting in $V(t)=V_e(t)$. From the two equations above, it is then clear that the two constants have to be equal. I will denote

$$K=K_1=K_2.$$

Let's be a bit more realistic. I will take into account,

• on the electrical side, the resistance $R$ of the circuit,
• on the mechanical side, the wheel the motor is attached to: it has a moment of inertial $J$ and also turns at an angular speed of $\omega(t)$; I will also add some viscous friction, in the form of a torque $T_f(t) = f \omega(t)$.

So we have:

$$V(t) -RI(t) - V_e(t) = 0$$

and

$$J\dot{\omega}(t) = T(t) + T_f(t).$$

I.e. the coupled equations for $I(t)$ and $\omega(t)$ [**],

\begin{aligned} RI(t)+K\omega(t) &= V(t)\\ J\dot{\omega}(t)+f\omega(t) &= KI(t) \end{aligned}

The equation for $\omega(t)$ is easily extracted:

$$J\dot{\omega}(t) + \left(f + \frac{K^2}{R}\right)\omega(t) = \frac{K}{R}V(t).$$

To finish it up, we need to specify the input $V(t)$. I think the most realistic one is to assume that at $t=0$, one switches on the mains, i.e. $V(t)=0$ for $t<0$ and $V(t)$ is a constant $U$ for $t>0$. We then have a classic first-order system with a unit step on the right-hand side. The solution, traditionally obtained by Laplace transforms, reads

$$\omega(t) = \frac{KU}{R}\tau\left(1-e^{-\frac{t}{\tau}}\right),$$

where

$$\tau = \frac{J}{f+\frac{K^2}{R}}.$$

[*] Eventually, it will be connected to wheels and with the assumption that the wheels do not slide, it is easy to relate the linear speed $v(t)$ of the train to $\omega(t)$: assuming there are no gears, $v(t)=R\omega(t)$ where $R$ is the radius of the wheels. If there are gears, replace $\omega(t)$ by $k\omega(t)$ where $k$ would be the ratio of the gears.

[**] A self-inductance would have added a term proportional to $\dot{I}(t)$ to the electrical equation, making the coupling non-trivial.

• This is a very good answer - but to a slightly different question, I believe. Still, when the OP wants to make the model more realistic there is some great material here. – Floris Aug 4 '17 at 15:21
• Yes, I know, but I just felt that his premise was not quite right if realism was the order of the day. – user154997 Aug 4 '17 at 16:03

The answers by @Eddy and @Floris give a monotonically increasing speed because there is no resistance. Introducing a resistive force $R$ turns the ODE into $$P=mv\frac{dv}{dt}+Rv$$

If we put $R=kv$ the solution to this is nice; $$v(t)=\sqrt{\frac{P}{k}(1-\exp{(-\frac{2kt}{m}}))}$$ and the speed reaches $\sqrt{P/k}$ asymptotically.

That is probably not very realistic, because aerodynamic drag varies more like $v^2$ and rolling resistance is roughly constant. These assumptions dont seem to give simple explicit solutions for $v(t)$. However, for your purpose it might be OK to use this formula with $P$ and $k$ set to give the best match with observation.

The initial acceleration is still infinite, as @Luc observes. That is because the model assumes that full power is available instantaneously, we let the clutch out very fast.For early times Floris' solution is better. • At low speeds one of the primary limitations will be that the force accelerating the train (or car or whatever) is a static friction and so the acceleration can't exceed $\mu_s g$. That makes the problem a bit messy since now you need a piecewise function to describe it. – gleedadswell Apr 26 at 15:23

At speed v a vehicle has such gear on that the torque of the engine is multiplied by x.

At double that speed the gear is different, and the torque multiplication factor is x/2.

At low speed v/1000 the gear is very low, and the torque multiplication factor is 1000 * x.

You see how this works: when speed doubles then acceleration halves, because the accelerating force halves, because torque halves. At low speeds real vehicles don't accelerate like crazy for various reasons, like for example not having a ridiculously low gear available.

• Acceleration due to constant power $P$ output is $$a= \frac{P}{m v}$$

This leads to the following distance and time relationships, starting from initial time $t_1$, position $x_1$ and speed $v_1$:

\begin{align} x -x_1 & = \int \frac{v}{a} \,{\rm d}v = \frac{m}{3 P} ( v^3 - v_1^3 ) \\ t -t_1 & = \int \frac{1}{a} \,{\rm d}v = \frac{m}{2 P} ( v^2 - v_1^2) \end{align}

Solve the 2nd equation for $v(t)$ is possible, and then for $x(t) \rightarrow x( v(t) )$.

• Now lets add a constant drag force (like friction) for $$a = \frac{P}{m v} - \gamma$$

Using the same integrals the motion is described by

\begin{align} x -x_1 & = \frac{P^2}{\gamma^3 m^2} \ln \left( \frac{P-\gamma m v_1}{P-\gamma m v} \right) - \frac{P}{\gamma^2 m} (v-v_1) - \frac{v^2-v_1^2}{2 \gamma} \\ t -t_1 & =\frac{P}{\gamma^2 m} \ln\left( \frac{P-\gamma m v_1}{P - \gamma m v} \right) - \frac{v-v_1}{\gamma} \end{align}

Unfortunately this cannot be solved for $v(t)$, nor $v(x)$. But it your simulation you can use speed as an independent variable and find for example the time and distance needed to go from 60 mph to 61 mph, and so on so forth.

• Sometimes drag forces are aerodynamic with a relationship like $$a = \frac{P}{m v} - \beta v^2$$

Again, using the same integrals the motion is described by

\begin{align} x -x_1 & = \frac{1}{3 \beta} \ln \left( \frac{P-\beta m v_1^3}{P-\beta m v^3} \right) \Rightarrow v^3 = \frac{1}{\beta m}\left(P - (P-\beta m v_1^3) {\rm e}^{-3\beta (x-x_1)} \right) \\ t -t_1 & = \int \frac{1}{v(x)}\,{\rm d}x = \mbox{too complex to write out} \end{align}