Professional Documents
Culture Documents
IC02 ProgramaIC
IC02 ProgramaIC
1uF
+
R1
1k
INGENIERIA DE CONTROL
V1
0/5V
L1 PROGRAMACION
PLATAFORMA DE
C2
1H
R2
100
1uF
100 Hz
R6
1k
L2
1H
C6
1uF
R3
100
Vi(t)
Vc(t)
C7
1uF
Funcin de Transferencia:
R8
1k
G( s)
R10
100
L3
1H
C8
1uF
+
1
RC
s
s2
C5
1uF
1
1
s
RC
LC
Diagrama de Bloques:
SIMULACION DE CIRCUITO SERIE-PARALELO
1/(R*C)s
s2 +1/(R*C)s+1/(L*C)
Step
E_Sistema
Escalon
Transfer Fcn
1/(R*C)s
s2 +1/(R*C)s+1/(L*C)
Sine Wave
01
02
03
04
05
06
07
08
09
S_Sistema
Transfer Fcn2
%***********************************************************************
% Programa
: analisis_rlc_sp.m
% Descripcion : Analiza el Sistema Lineal
%
Vc(s)
1
s
%
G(s)= --------- = ------1/(R*C)s
--------------------------%
Vi(s)
s^2 + s/RC + 1/LC
2 +1/(R*C)s+1/(L*C)
sRC
Stepp
ES_Sistema
%
Transfer Fcn1
% Autor
: Freedy Sotelo V.
%***********************************************************************
Seno Wave
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.1
PID C
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
INGENIERIA DE CONTROL
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.2
INGENIERIA DE CONTROL
>> analisis_rlc_sp
Parametros del Sistema...
R= 1
L= 1
C= 1
Funcion de Transferencia del Sistema...
num =
0 1 0
den =
1 1 1
num/den =
s
--------------s^2 + s + 1
Raices del Sistema...
ans =
-0.5000 + 0.8660i
-0.5000 - 0.8660i
Presione tecla para continuar...
Presione tecla para continuar...
Presione tecla para continuar...
Presione tecla para continuar...
Presione tecla para continuar...
Espacio de Estado del Sistema...
A=
-1
1
B=
1
0
-1
0
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.3
C=
1
D=
0
INGENIERIA DE CONTROL
0.5
Amplitude
0.4
0.3
0.2
0.1
-0.1
10
12
Time (sec)
Entrada 10*Step
6
Amplitude
-1
10
12
Time (sec)
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.4
INGENIERIA DE CONTROL
1.2
0.8
0.6
0.4
0.2
-0.2
10
Root Locus
1
0.8
0.6
Imaginary Axis
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-1.4
-1.2
-1
-0.8
-0.6
-0.4
-0.2
Real Axis
Bode Diagram
0
Magnitude (dB)
-10
-20
-30
-40
-50
-60
90
Phase (deg)
45
0
-45
-90
-2
10
-1
10
10
10
10
Frequency (rad/sec)
Respuesta en Frecuencia.
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.5
INGENIERIA DE CONTROL
G( s)
1
RC
s
s2
1
1
s
RC
LC
1 x1 0
u
a1 x 2 b1
x
y 0 1 1 0u
x2
a1
1
RC
a2
1
LC
b1
1
RC
%***********************************************************************
% Programa
: ed2rlc_sp.m
% Descripcion : Analiza el Sistema Lineal
%
Vc(s)
1
s
%
G(s)= -------- = ----- -------------------------%
Vi(s) RC s^2 + s/RC + 1/LC
%
%
Para: a1=1/RC a2=1/LC b1=1/RC
%
%
Modelo de Espacio de Estado
%
Ecuaciones Diferenciales Lineales
%
x1'(t,x1,x2,u) = x2(t)
%
x2'(t,x1,x2,u) = -a2x1(t) - a1x2(t) +b1u(t)
%
Vc(t) = x2(t)
%
%
u(0) = 1 x1(0) = 0 x2(0) = 0
%
%
Por Metodo de Euler
%
%
x1(i+1)=x1(i)+h*x1'(i); % Solucion Euler
%
x2(i+1)=x2(i)+h*x2'(i); % Solucion Euler
%
% Autor
: Freedy Sotelo V.
%***********************************************************************
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.6
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
INGENIERIA DE CONTROL
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.7
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
INGENIERIA DE CONTROL
>> ed2rlc_sp
Parametros del Sistema...
R= 1
L= 1
C= 1
Tiempo de Evaluacion [Escalon] : 12
Periodo de Muestreo [h=0.1]
: .1
Frecuencia de Evaluacion [f_seno]: 1
Periodos de Evaluacion [Ts_seno] : 3
Periodo de Muestreo [h=0.01] : .01
Funcion de Transferencia del Sistema...
num =
0 1 0
den =
1 1 1
num/den =
s
-----------s^2 + s + 1
t
u
x1
x2
ans =
0 1.0000
0
0
0.1000 1.0000
0 0.1000
0.2000 1.0000 0.0100 0.1900
0.3000 1.0000 0.0290 0.2700
0.4000 1.0000 0.0560 0.3401
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.8
INGENIERIA DE CONTROL
Step Response
0.6
0.5
Amplitude
0.4
0.3
0.2
0.1
-0.1
10
12
Time (sec)
u(t),x1(t),x2(t)
0.8
t vs u [Vi(t)]
t vs x1 [I(x2)]
t vs x2 [Vc(t)]
0.6
0.4
0.2
0
0
6
t
10
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.9
INGENIERIA DE CONTROL
0.8
0.6
u(t),x1(t),x2(t)
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
R1 0.5
1k
1.5
t
2.5
V1
0/5V
R2
100
C1
1uF
+
L1
1H
100 Hz
C2
1uF
R6
1k
L2
1H
C6
1uF
R3
100
Vi(t)
Vc(t)
C7
1uF
R10
100
L3
1H
C8
1uF
+
20
Kp
C5
1uF
1/(R*C)s
s2+1/(R*C)s+1/(L*C)
50
Step
Ki
1
Kd
1
s
Scope
RLC Serie_Paralelo
Integrator
du/dt
Derivative
1/(R*C)s
PID
_______________________________________________________________________
Scope1
s2+1/(R*C)s+1/(L*C)
MSC.ING. FREEDY SOTELO V.
PAG.10
PID Controller
RLC Serie_Paralelo1
Step1
INGENIERIA DE CONTROL
G( s)
1
RC
s
s2
1
1
s
RC
LC
Kd s 2 K p s Ki
Ki
K ( s) K p
Kd s
s
s
Funcin de Transferencia de la Realimentacin:
H ( s) 1
Hallando la Funcin de Transferencia del Sistema de Control:
3
2
1 Kd s K p s Ki s
K ( s)G ( s)
1 2
1
RC
s3
s
s
RC
LC
C ( s)
1
R( s) RC
K d s3 K p s 2 Ki s
1 2
1
( K d 1) s 3 ( K p
)s ( K i
)s
RC
LC
Para:
a1 K d 1
b1
1
Kd
RC
a2 K p
b2
1
RC
1
Kp
RC
a3 K i
b3
1
LC
1
Ki
RC
Modelo en el Tiempo:
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.11
INGENIERIA DE CONTROL
Para:
a1 K d 1
c1
a3
a1
c2
b1a3
a1
a2 K p
b3
a1
c3
1
RC
a2
a1
a3 K i
c4
a 2 b1
a1
1
LC
b2
a1
c5
x1 c1 x2 c2u
.
x 2 x1 c3 x2 c4u
y x 2 c5 u
Forma Matricial:
. 0 c x c
1
x1
1 2 u
.
x 1 c3 x 2 c 4
2
x
y 0 1 1 c5 u
x2
Programa de Anlisis del Sistema:
01
02
03
04
05
06
07
08
09
10
11
12
13
%************************************************************************
% Programa
: ed2rlc_sp_pid.m
% Descripcion : Analiza el Sistema Lineal Controlado
%
%
Planta Bajo Control
%
Vc(s) 1
s
%
G(s)= ------- = ---- -------------------------%
Vi(s) RC s^2 + s/RC + 1/LC
%
%
Controlador
%
Ki
%
K(s)= Kp + ---- + Kd s [20,50,1]
%
s
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.12
b1
a1
INGENIERIA DE CONTROL
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
%
%
Kd s^2 + Kp s + Ki
%
K(s)= ----------------------------%
s
%
%
Sistema de Control
%
C(s) 1
Kd s^3 + Kp s^2 + Ki s
%
------ = ---- --------------------------------------------------------%
R(s) RC (Kd+1)s^3 + (Kp+1/RC)s^2 + (Ki+1/LC)s
%
%
Para: a1=(Kd+1) a2=(Kp+1/RC) a3=(Ki+1/LC)
%
1
1
1
%
b1=----- Kd b2=----- Kp
b3=----- Ki
%
RC
RC
RC
%
%
Luego: a3
b1 a3
b3
%
c1=----- c2=----------- - ---%
a1
a1^2
a1
%
%
a2
a2 b1
b2
b1
%
c3=------ c4=----------- - ---- c5=----%
a1
a1^2
a1
a1
%
%
Modelo de Espacio de Estado
%
Ecuaciones Diferenciales Lineales
%
x1'(t,x1,x2,u) = c1 x2(t) + c2 u(t)
%
x2'(t,x1,x2,u) = -x1(t) - c3 x2(t) - c4 u(t)
%
Vc(t) = x2(t) + c5 u(t)
%
%
u(0) = 1 x1(0) = 0 x2(0) = 0
%
%
Por Metodo de Euler
%
%
x1(i+1)=x1(i)+h*x1'(i); % Solucion Euler
%
x2(i+1)=x2(i)+h*x2'(i); % Solucion Euler
%
% Autor
: Freedy Sotelo V.
%***********************************************************************
clear all; clc
fprintf('Parametros del Sistema...\n');
R=input('R= ');
L=input('L= ');
C=input('C= ');
57
58
59
60
INGENIERIA DE CONTROL
111
112
113
114
115
116
117
INGENIERIA DE CONTROL
xlabel('t'), ylabel('u(t),Vc(t),Err(t)')
mx=0;
Mx=max(t);
my=min([min(u) min(Vc) min(Error)]);
My=max([max(u) max(Vc) max(Error)]);
axis([mx Mx my My])
%**********************************************************************
>> ed2rlc_sp_pid
Parametros del Sistema...
R= 1
L= 1
C= 1
Parametros del Controlador...
Kp[20]= 20
Ki[50]= 50
Kd[ 1]= 1
Periodo de Muestreo [h=0.1] : .1
Tiempo de Evaluacion [Escalon]: 12
Funcin de Transferencia del Sistema...
num/den =
s
--------------s^2 + s + 1
Funcin de Transferencia del Controlador...
num/den =
s^2 + 20 s + 50
-------------------s
F.T. del Sistema de Control...
num/den =
s^3 + 20 s^2 + 50 s
----------------------------2 s^3 + 21 s^2 + 51 s
>>
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.15
INGENIERIA DE CONTROL
Vc(t)CC&SC
0.8
0.6
Vc S/C
Vc C/C
0.4
0.2
-0.2
10
12
t (sec)
u(t),Vc(t),Err(t)
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
6
t
10
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.16
INGENIERIA DE CONTROL
20
1/(R*C)s
Kp
s2+1/(R*C)s+1/(L*C)
50
Step
Ki
1
Kd
1
s
Scope
RLC Serie_Paralelo
Integrator
du/dt
Derivative
PID
PID Controller
1/(R*C)s
s2+1/(R*C)s+1/(L*C)
RLC Serie_Paralelo1
Step1
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.17
Scope1
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.18
Seno Wave
Stepp
Sine Wave
Step
Transfer Fcn1
s2 +1/(R*C)s+1/(L*C)
1/(R*C)s
Transfer Fcn2
s2 +1/(R*C)s+1/(L*C)
1/(R*C)s
Transfer Fcn
s2 +1/(R*C)s+1/(L*C)
1/(R*C)s
Escalon
ES_Sistema
S_Sistema
E_Sistema
1/(R*C)s
Transfer Fcn3
s2 +1/(R*C)s+1/(L*C)
Sistema_C/S Control
PID Controller
PID
S_Controlado
INGENIERIA DE CONTROL
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.19
INGENIERIA DE CONTROL
R1
1k
V1
0/5V
R2
100
V3
0/5V
L1
1H
1000 Hz
100 Hz
C2
1uF
A: v1_1
B: c2_1
5.000 V
4.000 V
3.000 V
2.000 V
1.000 V
0.000 V
-1.000 V
-2.000 V
-3.000 V
0.000ms
5.000ms
10.00ms
15.00ms
20.00ms
25.00ms
30.00ms
35.00ms
40.00ms
45.00ms
50.00ms
Diagrama
de un Circuito Derivador:
D
R
1k
C1
1uF
+
R1
1k
V3
0/5V
V2
0/5V
V1
0/5V
R2
100
C
1uF
1000 Hz
L
1
1000 Hz
100 Hz
A: v3_1
B: c1_2
5.000 V
3.000 V
1.000 V
-1.000 V
-3.000 V
-5.000 V
0.000ms
1.000ms
2.000ms
3.000ms
4.000ms
5.000ms
6.000ms
7.000ms
8.000ms
9.000ms
10.00ms
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.20
INGENIERIA DE CONTROL
C1
1uF
+
B
V3
0/5V
V2
0/5V
R2
100
C
1uF
1000 Hz
1000 Hz
A: v2_1
B: d_a
5.000 V
4.000 V
3.000 V
D
2.000 V
C1
1uF
+
R
1k
1.000 V
V3
0/5V
V2
0/5V
1.000ms
2.000ms
3.000ms
4.000ms
0.000 V
0.000ms
5.000ms
V1
0/5V
6.000ms
8.000ms
R2
100
7.000ms
C
Formas de Onda del1uF
Circuito. 1000 Hz
1000 Hz
100 Hz
C3
1uF
+
V5
0/5V
+
R3
100
C4
1uF
1000 Hz
A: v5_1
B: c3_1
5.000 V
4.000 V
3.000 V
2.000 V
1.000 V
0.000 V
0.000ms
1.000ms
2.000ms
3.000ms
4.000ms
5.000ms
6.000ms
7.000ms
8.000ms
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.21
C1
1uF
+
R
1k
R1
1k
V3
0/5V
V2
0/5V
V1
0/5V
INGENIERIA DE
R2 CONTROL
1000 Hz
L1
1H
100
1000 Hz
100 Hz
C3
1uF
+
R6
1k
D
+
V5
0/5V
C4
1uF
1000 Hz
R
1k
R3
100
L2
1H
V3
0/5V
+
5.000 V
R2
100
A: v5_1
B: c3_1
C6 C1
1uF 1uF
V2
0/5V
D2
R4
1k
1000 Hz
1000 Hz
R5
1k
4.000 V
V4
0/5V
D1
C5
1uF
3.000 V
1000 Hz
C3
1uF
+
R4
1k
2.000 V
R3
100
+
1.000ms
2.000ms
1000 Hz
3.000ms
C4
1uF
4.000ms
5.000ms
6.000ms
7.000ms
8.000ms
R5
1k
V4
0/5V
R7
1k
1000 Hz
Circuito Proporcional.
A: v4_1
B: r5_2
5.000 V
4.000 V
3.000 V
2.000 V
1.000 V
0.000 V
0.000ms
1.000ms
2.000ms
3.000ms
4.000ms
5.000ms
6.000ms
7.000ms
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.22
8.000ms
L2
1H
V5
0/5V
1.000 V
0.000 V
0.000ms
R6
1k
D1
C3
1uF
+
R4
1k
R6
1k
UNIVERSIDAD
NACIONAL DE INGENIERA
V5
INGENIERIA DE CONTROL
R3
100
C4
1uF
1000 Hz
L2
1H
0/5V
C6
1uF
R5
1k
C8
1uF
+
R9
1k
R8
1k
R10
100
R7
1k
C7
1uF
1000 Hz
V4
0/5V
L3
1H
5.000 V
A: v4_1
B: r5_2
4.000 V
3.000 V
2.000 V
1.000 V
0.000 V
0.000ms
R2
1
Vi
10V
+
-
1.000ms
L1
1H
2.000ms
3.000ms
R3
1
4.000ms
5.000ms
6.000ms
7.000ms
8.000ms
C1
1F
1k
R6
1
1k
L3
1H
R4
1
C3
1F
IDEAL
2V
-
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.23
C5
1uF
INGENIERIA DE CONTROL
Circuito Proporcional.
Circuito Integrador.
Circuito Derivador.
Circuito Sumador.
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.24
INGENIERIA DE CONTROL
Circuito Inversor.
_______________________________________________________________________
MSC.ING. FREEDY SOTELO V.
PAG.25