Combine second order ODE with a first order ODE into a state space model? 
Assume that we have those equations:
$$q = A\dot{x} + \frac{V}{\beta}\dot{p} \\ M\ddot{x} = Ap - B\dot{x} - F$$
As you can see, it's one first order ODE and one second order ODE.
We must always rewrite the second order ODE into a first order ODE if we want to have the state space model form:
$$\dot{x} = Ax+ Bu\\y = Cx + Du$$
So I create some states
$$x_1 = p  , x_2 = \dot{p}  \\ x_3 = x, x_4 = \dot{x}$$
Then my equations are going to be like this:
$$q = Ax_4 + \frac{V}{\beta}x_2 \\ M\dot{x_4} = Ax_1 -Bx_4 - F$$
If I set up all equations:
$$
\dot{x_1} = \frac{\beta}{V}q - \frac{A\beta}{V}x_2 \\
\dot{x_2} = 0 \\
\dot{x_3} = x_4\\
\dot{x_4} = \frac{A}{M}x_1 - \frac{B}{M}x_4 - \frac{1}{M}F$$
I try to create a state space model like this:
$$
\begin{bmatrix}
\dot{x_1}\\ 
\dot{x_2}\\ 
\dot{x_3}\\ 
\dot{x_4}
\end{bmatrix} = \begin{bmatrix}
0 & -\frac{A\beta}{V} & 0 & 0\\ 
0 & 0 & 0 & 0\\ 
0 & 0 & 0 & 1\\ 
\frac{A}{M} & 0 & 0 & - \frac{B}{M}
\end{bmatrix}\begin{bmatrix}
x_1\\ 
x_2\\ 
x_3\\ 
x_4
\end{bmatrix} +\begin{bmatrix}
\frac{\beta}{V} &0 \\ 
0 &0 \\ 
 0&0 \\ 
0 & - \frac{1}{M}
\end{bmatrix}\begin{bmatrix}
q\\ 
F
\end{bmatrix}$$
But is this correct?
Here is a step answer with arbitrary parameters. y1 = $p$, ... , y4 = $\dot{x}$ 

 A: Finally I got the answer!
We have those:
$$q = A\dot{x} + \frac{V}{\beta}\dot{p} \\ M\ddot{x} = Ap - B\dot{x} - F$$
Rewrite the flow equation to:
$$\dot{p} = \frac{\beta}{V}q - \frac{A\beta}{V}\dot{x}$$
Then we write the force equation to:
$$M\ddot{x} = A\dot{p} - B\dot{x} - F$$
And we continue:
$$M\ddot{x} = \frac{A\beta}{V}q -(\frac{A^2\beta}{V} + B)\dot{x} - F$$
Then we can rewrite these second order ODE to first order:
$$\dot{x_1} = x_2 \\ \dot{x_2} = \frac{A\beta}{MV}q -(\frac{A^2\beta}{MV} + \frac{B}{M})x_2 - \frac{F}{M}$$
State space model:
$$\begin{bmatrix}
\dot{x_1}\\ 
\dot{x_2}
\end{bmatrix} = \begin{bmatrix}
0 & 1\\ 
0 & -[\frac{A^2\beta}{MV} + \frac{B}{M}]
\end{bmatrix}\begin{bmatrix}
x_1\\ 
x_2
\end{bmatrix} + \begin{bmatrix}
0 & 0\\ 
\frac{A\beta}{MV}  & -\frac{1}{M}
\end{bmatrix}\begin{bmatrix}
q\\ 
F
\end{bmatrix}$$
The motivation is that if the piston is going to move out, then the pressure need to be stronger that the force load. But force is not a velocity or position. Force is something else.
When the force is so strong so the force pushing back the piston. Then the derivative $\dot{x}$ going to be negative, which increase the pressure:
$$\dot{p} = \frac{\beta}{V}q - \frac{A\beta}{V}\dot{x}$$
The only reason why a hydraulic cylinder move out is due to the flow. No flow, the cylinder having a static position only. 
Here is a step answer where y1 = $x_1$ and y2 = $x_2$. The force and pressure are equal. The flow is grater that 2.

Please let me know if you like this answer.
