-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReport.tex
More file actions
296 lines (247 loc) · 11.9 KB
/
Report.tex
File metadata and controls
296 lines (247 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
\documentclass[11pt,a4paper,oneside]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[backend=biber, style=alphabetic, sorting=ynt]{biblatex}
\usepackage{csquotes}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[labelfont=bf]{caption}
\usepackage{float}
\setlength{\parindent}{0pt}
\newcommand\img[3]{
\begin{figure}[H]\centering
\includegraphics[width=#1\textwidth]{imgs/#2.png}
\caption{#3}
\label{fig:#2}
\end{figure}
}
\newcommand\mtrx[1]{
\begin{bmatrix}
#1
\end{bmatrix}
}
\begin{document}
\begin{titlepage}
\begin{center}
\Large \textbf{UNIVERSITY OF SALERNO}
\vspace{0.5cm}
\normalsize DEPARTMENT OF INFORMATION AND ELECTRICAL
ENGINEERING AND APPLIED MATHEMATICS
\vspace{1.5cm}
\includegraphics[width=0.32\textwidth]{imgs/unisa.png}
\vspace*{1.5cm}
\huge \textbf{Report Digital Control Systems Design}
\vspace*{1cm}
\Large \textbf{Control of a DC motor with state feedback}
\vspace*{2cm}
\textbf{Francesco Avallone} - 0622701488 -
\href{mailto:f.avallone20@studenti.unisa.it}
{f.avallone20@studenti.unisa.it}
\textbf{Lorenzo Pagliara} - 0622701576 -
\href{mailto:l.pagliara5@studenti.unisa.it}
{l.pagliara5@studenti.unisa.it}
\vspace{\fill}
2021 - 2022
\end{center}
\end{titlepage}
\tableofcontents
\newpage
\newgeometry{left=2.5cm,bottom=2.5cm, right=2.5cm, top=2.5cm}
\section{Formulation of the control problem formulation at high level}
Nowadays, DC motors are widely used in many different technology
applications,in particular in the robotics field for the robot's
joints, but also in the locomotion field and others.
In these contests, it has a significative role the definition of a
control where it is possible to assign a position or velocity
reference.\bigskip
In this document has been developed both control approaches:
\begin{itemize}
\item position control;
\item velocity control.
\end{itemize}
For both approaches, it has been used the advanced
\textit{state feedback control} technique, starting from the state
space of the mathematical models of the same process on which apply
the control approaches mentioned before.
\section{Mathematical model}
\subsection{Mathematical model for the position controller}
The DC motor mathematical model in the state space form, which is
obtained from the DC motor electrical and mechanical equations, is the
following second-order system where the state's variables are the
angular position $\theta$ and the angular velocity $\omega$:
\begin{equation}
\begin{split}
&\mtrx{\dot{\theta}\\ \dot{\omega}}= \mtrx{0 & 1\\ 0
& -\dfrac{1}{\tau_m}}\mtrx{\theta\\ \omega} + \mtrx{0\\
\dfrac{k_m}{\tau_m}}v\\ &y = \mtrx{1 & 0}\mtrx{\theta\\
\omega}
\end{split}
\end{equation}
The control input is the tension applied to the motor $v$
which values are beetween $0V$ and $12V$, while the ouput is the
angular position $\theta$ in rad.
\begin{table}[H]
\centering
\begin{tabular}{|l|c|l|}
\hline
$R$ & $3.2\Omega$ \\ \hline
$L$ & $8.2mH$ \\ \hline
$K_e$ & $0.85Vs/rad$ \\ \hline
$K_t$ & $0.85Nm/A$ \\ \hline
$b$ & $0.016Nms/rad$ \\ \hline
$I$ & $0.0059Nms^2/rad$ \\ \hline
\end{tabular}
\caption{Motor parameters.}
\label{tab:motor_parameters}
\end{table}
Considering the parameters in Table \ref{tab:motor_parameters}, it is
possible to obtain the following state space model:
\begin{equation}
\begin{split}
&\mtrx{\dot{\theta}\\ \dot{\omega}}= \mtrx{0 & 1\\ 0 & -38.27}\mtrx{\theta\\ \omega} + \mtrx{0\\ 45.02}u\\
&y = \mtrx{1 & 0}\mtrx{\theta\\ \omega}
\end{split}
\end{equation}
\subsection{Mathematical model for the velocity controller}
In the same way, applying the Laplace trasformation and multiplying
for $60/2\pi$, it has been obtained the transfer function of the DC
motor. The control input is the tension $v$ and the ouput is the
angular velocity $\omega$ in RPM.
\begin{equation}
G(s) = \frac{\omega(s)}{v(s)} = \frac{9.5493k}
{(sL + R)(sI + b) + k^2}
\end{equation}
Considering the DC motor parameters in Table
\ref{tab:motor_parameters}, it is possible to obtain the relative
transfer function:
\begin{equation}
G(s) = \frac{\omega(s)}{v(s)} = \frac{167773.98}{s^2 + 392.96s + 15992.15}
\end{equation}
\section{Tecniche di controllo}
For both control approaches (position and speed) the state feedback
technique has been used. The starting point for the application of
this technique is the obtaining of a representation in the state
space. In the case of the control in position the starting model
already met this requirement, while for the speed control it was
necessary to carry out the transfer function. \bigskip
Having obtained both representations in the state space, the first
step was to verify the reachability and the observability. Having
made sure that both of these requirements were verified,and then the
models were extended with a fictitious state, representing the full error,
for the rejection of constant disturbances. In order to obtain a law
of discrete control, such extended representations were then converted
into models in the discrete time state space. The latter were then
used to design a feedback state controller, whose gains
were obtained through LQR.\bigskip
Due to the non-observability of the state, for both approaches,
a Luenberger observer, also obtained by the LQR technique, was made.
For a more complete view of the design steps followed, please refer
to the MATLAB code, which is considered an integral part of this
document.
\begin{center}
\href{https://github.com/favallone20/DigitalControlSystemDesignProject/blob/master/Speed_Feedback_MATLAB_Simulink/Speed_State_Feedback.mlx}{\textbf{Velocity control}}, \quad
\href{https://github.com/favallone20/DigitalControlSystemDesignProject/blob/master/Position_State_Feedback_MATLAB_Simulink/Position_State_Feedback.mlx}{\textbf{Position control}} \bigskip
\end{center}
The same control approaches were then implemented using the
\textit{direct coding}technique, the links, which reference to the source
files, are written below.
\begin{center}
\href{https://github.com/favallone20/DigitalControlSystemDesignProject/tree/master/Position_State_Feedback_Direct_Coding}{\textbf{Controllo in posizione direct coding}}, \quad
\href{https://github.com/favallone20/DigitalControlSystemDesignProject/tree/master/Speed_State_Feedback_Direct_Coding}{\textbf{Controllo in velocità direct coding}}
\end{center}
\section{Results obtained and discussion of performance}
Both for the control in position and for the control in speed, it has
been followed the model based development which previews a
phase of testing for each step of development. In particular, the
validation tasks were carried out:
\begin{enumerate}
\item Model in the Loop (MIL);
\item Software in the Loop (SIL);
\item Processor in the Loop (PIL);
\item Test sul processo reale;
\end{enumerate}
It should be noted that the test phase on the real process must be
preceded by the Hardware in the Loop (HIL) phase, which was not carried
out due to the unavailability of the appropriate instrumentation.
\subsection{Results with control in position}
For the simulations of the control in place the following references
were used: $0$, $-2\pi$, $\pi$, $2\pi$, $0$, updated every $2s$
through a Stateflow chart. \bigskip
From the various simulations corresponding to the different validation
tasks it can be noticed that the system response remains almost
unchanged, with a settling time less than 1 second and a behavior
quite free of overshoot. The slightly more relevant peaks are
obtained when the reference changes in form by a value of at least
$2 \pi$. This behavior depends on the presence of the integral action,
which in the absence of an anti windup scheme, with larger errors
makes the control input saturated at the limit of the actuator.
\bigskip
In the figures \ref{fig:Position_State_Feedback_Simulation},
\ref{fig:Position_State_Feedback_SIL_Simulation},
\ref{fig:Position_State_Feedback_PIL_Simulation} are reported
the relative outputs in the MIL,
SIL, PIL phase. In addition, in the figures
\ref{fig:Position_State_Feedback_SIL_Code_Profiling} and
\ref{fig:Position_State_Feedback_PIL_Code_Profiling} are reported
the relative execution time of SIL and PIL phase.
As can be expected, SIL validation took time
considerably lower than PIL.\bigskip
Particular attention should be paid to the execution of the control
algorithm on the physical engine. The responses of the auto-generated
algorithm and the direct coding algorithm respectively are given in
Figure \ref{fig:Position_State_Feedback_Motor_Simulation} e in Figure
\ref{fig:Position_State_Feedback_Direct_Coding}.
From these figures it is possible to notice that the motor response
has a slightly oscillatory behavior around the reference value. This
depends on the physical resolution of the motor that does not allow
to obtain an angular position perfectly coinciding with the reference.
\subsection{Risultati con controllo in velocità}
The following references were used for speed control simulations:
$0$, $80$, $125$, $0$, $-80$, $-125$, updated every $2s$
through a Stateflow chart. \bigskip
Also in this case in the simulations correspondent the answer of
the system remains almost unchanged, with times of settling of
approximately half second and a behavior totally free of overshoot.
\bigskip
In the Figures \ref{fig:Speed_State_Feedback_Simulation},
\ref{fig:Speed_State_Feedback_SIL_Simulation},
\ref{fig:Speed_State_Feedback_PIL_Simulation} are reported the relative
motor outputs in the MIL, SIL, PIL validation phases.
In addition, in the figures
\ref{fig:Speed_State_Feedback_SIL_Code_Profiling} and
\ref{fig:Speed_State_Feedback_PIL_Code_Profiling} are reported
the relative execution times of the SIL and PIL validation.
As can be expected, SIL validation took time considerably lower than
PIL.\bigskip
Particular attention should be paid to the execution of the control
algorithm on the physical engine. The responses to the auto-generated
algorithm and the direct coding algorithm respectively are given in
Figure \ref{fig:Speed_State_Feedback_Motor_Simulation} and in Figure
\ref{fig:Speed_State_Feedback_Direct_Coding}. From the figures it can
be noticed that the response of the motor has of the continuous peaks
due to the error of the estimate of the speed because of the loss of
ticks of the encoder.
\newpage
\appendix
\section{Simulations}
\subsection{Position control}
\img{1}{Position_State_Feedback_Simulation}{MIL Simulation with position control}
\img{1}{Position_State_Feedback_SIL_Simulation}{SIL Simulation with position control}
\img{1}{Position_State_Feedback_SIL_Code_Profiling}{Execution times of the SIL simulation with position control}
\img{1}{Position_State_Feedback_PIL_Simulation}{PIL Simulation with position control}
\img{1}{Position_State_Feedback_PIL_Code_Profiling}{Execution times of the PIL simulation with position control}
\img{1}{Position_State_Feedback_Motor_Simulation}{Execution on the real motor of the position control, with the auto-generated code}
\img{1}{Position_State_Feedback_Direct_Coding}{Execution on the real motor of the position control, with the direct coding approach}
\subsection{Velocity control}
\img{1}{Speed_State_Feedback_Simulation}{MIL simulation for velocity control.}
\newpage
\img{1}{Speed_State_Feedback_SIL_Simulation}{SIL simulation with velocity control.}
\img{1}{Speed_State_Feedback_SIL_Code_Profiling}{Execution times of SIL simulation with velocity control}
\img{1}{Speed_State_Feedback_PIL_Simulation}{PIL simulation with control velocity.}
\img{1}{Speed_State_Feedback_PIL_Code_Profiling}{Execution times of PIL simulation with velocity control.}
\img{1}{Speed_State_Feedback_Motor_Simulation}{Execution on the real motor of the velocity control, with the auto-generated code}
\img{1}{Speed_State_Feedback_Direct_Coding}{Execution on the real motor of the velocity control, with the direct coding approach}
\newpage
\end{document}