A train consists of an engine and $n$ trucks. It is travelling along a straight horizontal section of track. The mass of the engine and of each truck is $M$. The resistance to motion of the engine and of each truck is $R$, which is constant. The maximum power at which the engine can work is $P$.
The train starts from rest with the engine working at maximum power. Obtain an expression for the time $t$ taken to reach a given speed $v$.
I wrote $$a(t)=\frac{P}{v(t)M(n+1)}-\frac{R}{M} \tag{1}$$
Putting $(1)$ into standard differential form: $$[M(n+1)v]dv+[(Rv(n+1)-P)]dt=0 \tag{2}$$ Since $(2)$ is non-exact, let $$M(n+1)v=f(v) \tag{3}$$ and $$(Rv(n+1)-P)=g(v) \tag{4}$$ Since $$\frac{1}{g}\left(\frac{\partial f}{\partial t}-\frac{\partial g}{\partial v}\right)=\frac{R(n+1)}{P-Rv(n+1)}=h(v) \tag{5}$$ i.e. a function of $v$ only.
The integrating factor to $(2)$ is then given by: $$I(v)=e^{\int h(v)dv}=e^{-\ln(P-Rv(n+1))}=\frac{1}{P-Rv(n+1)} \tag{6}$$ The final solution then looks something like this $$M(n+1)\left[\frac{-Rv(n+1)-P\ln(P-Rv(n+1))+P\ln(P)}{R^2(n+1)^2}\right]-t=0 \tag{7}$$
But doesn't the argument of $\ln()$ have to be some dimensionless quantities for it to make sense? (I got $\ln(P)$ and $P$ is not dimensionless in this case.)
Can someone please explain where my conceptual errors lie?