# How to discretize the continuous time domain state space model?

I have a dsp algorithm which is based on the below given state space model in the continuous-time domain

$$\begin{bmatrix} \frac{\mathrm{d}\hat{\psi}_{r_{\alpha}}}{\mathrm{d}t} \\ \frac{\mathrm{d}\hat{\psi}_{r_{\beta}}}{\mathrm{d}t} \end{bmatrix} = \begin{bmatrix} -\frac{R_R}{L_L + L_M} & -p_p\cdot\omega_m \\ p_p\cdot\omega_m & -\frac{R_R}{L_L + L_M} \end{bmatrix} \cdot \begin{bmatrix} \hat{\psi}_{r_{\alpha}} \\ \hat{\psi}_{r_{\beta}} \end{bmatrix} + \begin{bmatrix} \frac{L_M\cdot R_R}{L_L + L_M} & 0 \\ 0 & \frac{L_M\cdot R_R}{L_L + L_M} \end{bmatrix} \cdot \begin{bmatrix} i_{s_{\alpha}} \\ i_{s_{\beta}} \end{bmatrix}$$

It is basically a model of a dynamic system, where the variables $$i_{s_{\alpha}}$$, $$i_{s_{\beta}}$$ and $$\omega_m$$ are the inputs of the dynamic system and the $$\hat{\psi}_{r_{\alpha}}$$, $$\hat{\psi}_{r_{\beta}}$$ are its outputs (the unmeasurable state variables of the system). This model is intended to be used as a state observer. I know that there are much more robust approaches for estimation of the unmeasurable state variables of a dynamic system but I would like to do a comparison between several methods. As far as the parameters of the state space model: $$R_S = 7.400\cdot 10^{-3}$$, $$R_R = 7.548\cdot 10^{-3}$$, $$L_M = 4.265\cdot 10^{-3}$$, $$L_L = 0.231\cdot 10^{-3}$$, $$p_p = 3.0$$.

For the software implementation purposes it is necessary to discretize the continuous-time domain model (sampling period is $$T = 100\cdot 10^{-6}\,\mathrm{s}$$). I have been thinking about the simple Euler method (i.e. the state transition matrix $$\Phi$$ approximated only via the first two terms of the series expansion) usage. But I have noticed that the above given system is probably much more complex for computation than it seems at first glance. I have calculated the eigen values of the system matrix (i.e. poles of the system) in respect to the input $$\omega_m$$ and I have found that the poles are pretty near to the stability boundary in the s-plane.

If I transformed the system into the discrete form via the ZOH method I found that the system poles (in respect to the input $$\omega_m$$) are even nearly on the stability boundary.

My question is how I can implement this system in a software (in the single precision floating point) to be sure that the solution (the system state variables) will be stable?

Edit:

The idea behind my question is that I have noticed that the poles of the discretized system (zero-order hold discretization) are very close to the unit circle boundary (the "reserve" is only a couple of ten thousandths). Source of my doubt is that in case I implement the discrete system in a control software it is from my point of view very good chance that due to the limited precision the poles can move outside the unit circle and the system can become very easily unstable. On the other side the poles of the original continuous time domain system has its poles a little more far from the stability boundary. I have basically though about a discretization method which will preserve this reserve. The idea which I have is to use more terms of the approximation of the state transition matrix $$\Phi$$ which is used in the discretization process.

• Well, the continuous-time poles are "nearly on" the stability boundary, too. Both continuous-time and discrete poles have a $Q$ of 25 or so. Jan 18 at 16:23
• What is this for? I.e., are you trying to design an observer for a real object, are you simulating something for science, are you simulating something for a game or training purposes, or what? This has bearing on how accurate the model needs to be and thus, how hard you need to try to get the model right. Jan 18 at 16:27
• @TimWescott thank you for your reaction. I have been trying to design an observer for a real object - namely a three phase induction motor. Jan 18 at 18:14
• I should have included this in my question -- edit your question to state this. It's a Stackexchange thing. Jan 18 at 18:24
• So, you've completely changed the thrust of the question -- it may be best to leave the original question standing and ask another one. I'll happily give you the long answer if you do. But the short answer is (A) no, you have not substantially changed the level of stability of your system; so (B) you're stuck with determining if it's good enough (likely), deliberately using a model with more damping, or using more precision (32-bit fixed numbers or double-precision floats). Jan 19 at 15:27