I have a second order ODE with derivative terms
$$ \alpha_1\frac{d^2i}{dt^2}+\alpha_2\frac{di}{dt}+\alpha_3i=-\beta_1V_r-\beta_2\frac{dV_r}{dt}-\beta_3\frac{d^2V_r}{dt^2} $$
I want to transform this system into state-space, but I'm not sure how to manage the second derivative input term of $V_r$. I currently have defined $x_1$ and $x_2$ as the following.
$$ x_1=I\left(t\right) $$
$$ x_2=\dot{I}\left(t\right)+\frac{\beta_2}{\alpha_1}V_r+\frac{\beta_3}{\alpha_1}{\dot{V}}_r$$
Its derivatives are given as
$$ {\dot{x}}_1=\ \dot{I}\left(t\right)=\ x_2-\frac{\beta_2}{\alpha_1}V_r-\frac{\beta_3}{\alpha_1}{\dot{V}}_r$$
$$ {\dot{x}}_2=\ \ddot{I}\left(t\right)+\frac{\beta_2}{\alpha_1}{\dot{V}}_r+\frac{\beta_3}{\alpha_1}{\ddot{V}}_r=\ -\frac{\alpha_3}{\alpha_1}I-\frac{\alpha_2}{\alpha_1}\dot{I}-\frac{\beta_1}{\alpha_1}\ V_r $$
$$ where, \dot{I} = x_2-\frac{\beta_2}{\alpha_1}V_r-\frac{\beta_3}{\alpha_1}{\dot{V}}_r$$
$$ {\dot{x}}_2=\ -\frac{\alpha_3}{\alpha_1}x_2-\frac{\alpha_2}{\alpha_1}\left(x_2-\frac{\beta_2}{\alpha_1}V_r-\frac{\beta_3}{\alpha_1}{\dot{V}}_r\right)-\frac{\beta_1}{\alpha_1}\ V_r$$
Because I still have a $\dot{V}_r$ term in both $\dot{x}_1$ and $\dot{x}_2$, I am unable to transform the the system into the state-space representation. Let me know if you have any suggestions.
A simple way to perform this is to first compute the transfer function, which is given by $$\dfrac{I(s)}{V_r(s)}=-\dfrac{\beta_3s^2+\beta_2s+\beta_1}{\alpha_1s^2+\alpha_2s+\alpha_3}.$$
Now we define
$$\dfrac{X(s)}{V_r(s)}=\dfrac{1}{\alpha_1s^2+\alpha_2s+\alpha_3}$$
and
$$\dfrac{I(s)}{X(s)}=-(\beta_3s^2+\beta_2s+\beta_1),$$
where $X(s)$ is the Laplace transform of the state.
This yields $$\dfrac{d}{dt}\underbrace{\begin{bmatrix} x\\\dot x \end{bmatrix}}_{X}=\underbrace{\begin{bmatrix} 0 & 1\\ -\frac{\alpha_3}{\alpha_1} & -\frac{\alpha_2}{\alpha_1} \end{bmatrix}}_{\mbox{$A$}}\begin{bmatrix} x\\\dot x \end{bmatrix}+\underbrace{\begin{bmatrix}0\\1\end{bmatrix}}_{\mbox{$B$}}V_r$$
together with
$$\begin{array}{rcl} I&=&-(\beta_3\ddot x+\beta_2\dot x+\beta_1x)\\ &=&-\beta_3\left(-\frac{\alpha_3}{\alpha_1}x-\frac{\alpha_2}{\alpha_1}\dot x+V_r\right)-(\beta_2\dot x+\beta_1x)\\ &=&\underbrace{\begin{bmatrix}-\beta_1+\dfrac{\beta_3\alpha_3}{\alpha_1}& -\beta_2+\dfrac{\beta_3\alpha_2}{\alpha_1}\end{bmatrix}}_{\mbox{$C$}}\begin{bmatrix} x\\\dot x \end{bmatrix}+\underbrace{-\beta_3}_{\mbox{$D$}}V_r \end{array}$$
If you have initial conditions, $X(0)=(x(0),\dot{x}(0))$, this can be easily considered using the explicit solution for state-space models which is given here by
$$X(t)=\exp(At)X(0)+\int_0^t\exp{(A(t-s))}Bu(s)ds$$ and
$$I(t)=CX(t)+Du(t).$$