【1】环路指导书
【1】环路指导书
【1】环路指导书
Analog loop:
1、stable state and FFT
2、vector network Analyzer manual
3、self-oscillation conditions
4、phase margin 45°,Gain margin -10dB criterion
5、zero point and pole point characteristic
6、pole-zero point compensation circuit
7、LCR network frequency characteristic
8、system transfer function
9、voltage ripple
Digital loop:
10、continue domain to discrete domain,c2d
11、Tustin bilinear transformation analysis
12、 Matlab calculate difference Equation coefficient
13、 pole-zero point compensation circuit to discrete domain
14、Butterworth low pass filter
15、 incremental PID control algorithm
16、digital flyback power block
数字电源开源社区 1
系统框图
Ø Amplifier Ø ADC
Ø Comparator Ø Timer
Ø Lantch Ø PID/loop alogrithm
数字电源开源社区 2
矢量网络分析仪
Gain
margin:-50dB
Phase
margin:8.9°
数字电源开源社区 3
one pole point(1p)
jwc1
Vin 0 0 V0 Vo R2 1
H (s)
Z1 Z2 Vin R1 1 SR2C1
0V R2 1 R
20 lg H ( s ) 20 lg( ) 20 lg 2 20 lg wR2C1
R1 1 ( SR2C1 ) 2 R1
f 1
arctan f0 800Hz
f0 2 R2C1
20 lg wR2C2 3dB
数字电源开源社区 4
one zero point(1z)
Small signal analysis:
Z2
Z1 1
Z1 R1 / / Z 2 R2 S jw
jwc1
Vin 0 0 V0 Vo R2
0V H (s) (1 SR1C1)
Z1 Z2 Vin R1
R2 R
20 lg H ( s) 20 lg( 1 ( SR1C1) 2 ) 20 lg 2 20 lg wR1C1
R1 R1
f 1
arctan f0 1600Hz 20 lg wR1C1 3dB
f0 2 R1C1
数字电源开源社区 5
one pole with one zero point(1p1z)
Z2 Small signal analysis:
Z1 Z1 R1 Z2 R2
1 S jw
jwc2
Vin 0 0 V0 Vo (1 SR2C1 )
0V H (s)
Z1 Z2 Vin SR1C1
|1 SR2C1 | R
20 lg H ( s) 20 lg( ) 20 lg 2
| SR1C1 | R1
f0 1
arctan f0 800Hz
f 2 R2C1
数字电源开源社区 6
one pole with two zero point(1p2z)
Z2 Small signal analysis:
Z1 Z1 R1 / /
1
Z 2 R2
1
S jw
jwC1 jwc2
Vin 0 0 V0 Vo (1 SR1C1 )(1 SR2C2 )
0V H (s)
Z1 Z2 Vin SR1C 2
1 1
f zero1 800Hz f zero 2 1600Hz
2 R1C1 2 R2C2
R2
20 lg H ( s) 20 lg ( f zero1 f f zero 2 )
R1
数字电源开源社区 7
two pole point with one zero point(2p1z)
Z2 Small signal analysis:
1 1
Z1 R1 Z 2 ( R2 )// S jw
jwC2 jwC1
Z1 Vin 0 0 V0
0V Z1 Z2
Vo (1 SR2C2 )
H (s)
Vin SR (C C )(1 SR C1C2 )
1 1 2 2
C1 C2
1 1
f zero1 800Hz f pole2 36kHz
2 R2C2 CC
2 R2 1 2
C1 C2
Pole point position:0Hz/36kHz
f zero1 f pole 2 Zero point position:800Hz
magnitude-frequency characteristic :
Phase-frequency characteristic :
数字电源开源社区 8
two pole with two zero point(2p2z)
Z2 Small signal analysis:
1 1 1
Z1 R1/ / Z 2 ( R2 )// S jw
jwC1 jwC2 jwC3
Z1 Vin 0 0 V0
0V Z1 Z2
Vo (1 SR2C2 )(1 SR1C1 )
H (s)
Vin SR (C C )(1 SR C2C3 )
1 2 3 2
C2 C3
1 1
f zero1 800Hz fzero2 7.2kHz
2 R2C2 2RC1 1
1
f pole1 0 Hz f p o le 2
C 2C 3
36 kH z
2 R 2
C2 C3
f zero1 f zero 2 f pole 2 Pole point position:0Hz/36kHz
GBW
Zero point position:800Hz/7.2kHz
magnitude-frequency characteristic :
Phase-frequency characteristic :
数字电源开源社区 9
three pole with two zero point(3p3z)
Z2 Small signal analysis:
1 1 1
Z1 Z1 R1/ /
jwC1
Z 2 ( R2
jwC2
)//
jwC3
S jw
Vin 0 0 V0
Z1 Z2
0V 1 1
(S )( S )
Vo R1 R3 R2C2 (R1 R3 )C3
H (s)
Vin R1R3C1 C C2 1
S (S 1 )( S )
R2C1C2 R3C3
1 1
f zero1 340Hz f zero 2 3.6kHz
2 R2C2 2 ( R1 R3 )C3
f pole1
1
10kHz 1
CC f pole 2 72kHz
f zero1 f zero 2 f pole1
2 R2 1 2
C1 C2
2 R3C3
f pole 2
Pole point position:10kHz/72kHz
数字电源开源社区 10
TL431+817
V0 R R (1 SC3R7 )
H (s) CTR 6 5
V1 1 SC3 (R5 R7 )
V0 (1 SR2C2 )
G (s)
Vin CC
SR1 (C1 C2 )(1 SR2 1 2 )
C1 C2
(1 SR 2 C 2 )
F (s ) CTR
C 1C 2
SR 1 ( C 1 C 2 )(1 SR 2 )
C1 C 2
R 6 R 5 (1 SC 3 R 7 )
1 SC 3 ( R 5 R 7 )
数字电源开源社区 11
LCR
Small signal analysis:
1
Z1 jwL RL Z2 ( RC ) / / R3 S jw
Z1 jwC
Z2 H (s)
Vo
Z2
Vin Z1 Z 2
(1 SR2C ) R3
2
S LC ( R2 R3 ) S [ L ( R1R2 R1R3 R2 R3 )C ] R1 R3
(1 SR2C ) R3 1 SR2C
2
2
S LCR3 S [L 2R3 )C ] 1 S LC 1
1
f zero 3.4kHz
2 R2C
1
f pole 740Hz
2 LC
数字电源开源社区 12
Open loop
H(S K(S
) )
G(S)
1 1
(S )( S )
R1 R3 R2C2 (R1 R3 )C3 1 SR C
F (s) G (S ) H (S ) K (S ) 10 4 2 c S jw
R1 R3C1 C C2 1 S LC 1
S (S 1 )( S )
R2C1C2 R3C3
数字电源开源社区 13
Open loop
Gain
margin:-50dB
Phase
margin:8.9°
数字电源开源社区 14
Open loop
AF>1
Phase=360°
数字电源开源社区 15
C2d,continue domain to discrete domain
FT 1
X ( jw) x(t )e jwt dt
x( t )
2
X ( jw)e jwt dw Note : s jw
Fourier transform
FT 1
X (e jw ) x[n]e
n
jwn
x[n]
2 X (e
2
jw
)e jwn dw Note : s jw
1
X ( jw) x(t )e t e jwt dt LS x( t )
X ( jw)et e jwt dw Note : s jw Laplace transform
2
n
Z 1 Note : z e jw
X (e jw ) x[n]e
n
jwn
X ( n)
2 X (e )e dz
jw jw ( n 1)
Z transform
Uniform sampling
x(t ) x(n ) L[ x(t )] X ( s ) Z [ x(n )] X ( z )
Tustin transform
How to transform X(s) to X(z), or how to transform X(z) to X(s) ? It's a question.
2 Z 1
Tustin Tustin bilinear transformation: S
T Z 1
数字电源开源社区 16
one pole point
T Z 1
R2 1
H ( z) | 2 z 1 T 10uS
0V R1 1 SR2C1 s T z 1
Y ( n) 1
H ( z) 2
X ( n) 2 z 1
1 0.2 103
T z 1
Y ( n) 0.95Y ( n 1) 0.049 X ( n) 0.049 X ( n 1)
%Matlab code
clear all; %clear old data
s domain close all; %close old file
Ts=10*10^(-6) %sampling period
Cont_s=tf(-2,[0.2*10^(-3),1]) %S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
z domain Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v')%Equation coefficient
num_z = -0.0488 -0.0488
den_z =1.0000 -0.9512
数字电源开源社区 17
one zero point
Small signal analysis:
Z2
Z1 Vo R2 2 Z 1
H (s) (1 SR1C1) S
Vin R1 T Z 1
0V Y (n) R2
H ( z) (1 SR1C1 ) | 2 z 1 T 10uS
X ( n) R1 s
T z 1
Y ( n) Y ( n 1) 42 X ( n) 38 X ( n 1)
%Matlab code
clear all; %clear old data
close all; %close old file
z domain Ts=10*10^(-6) %sampling period
Cont_s=tf([-0.2*10^(-3),-2],1) %S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
s domain Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v')%Equation coefficient
数字电源开源社区 18
one pole with one zero point(PI控制器)
Z2 Small signal analysis:
Z1 H (s)
Vo
(1 SR2C1 ) S
2 Z 1
Vin SR1C1 T Z 1
0V Y ( n) (1 SR2C1 )
H ( z) | 2 z 1
X ( n) SR1C1 s T z 1
%Matlab code
clear all; %clear old data
z domain close all; %close old file
s domain Ts=10*10^(-6) %sampling period
Cont_s=tf([-0.2*10^(-3),-1],[0.1*10^(-3),0])%S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v') %Equation coefficient
num_z = -2.0500 1.9500
den_z = 1 -1
数字电源开源社区 19
one pole with one zero point(PI控制器)
Z2 Small signal analysis:
Z1 −�� (1+��2 �1 )
�
�∗ 2+
1
�1 �1 ∗�1
�(�) = =− =−
��� ��1 �1 �
0V 1
�∗�� +
�� �� 2 Z 1
PID(�) = �� + = S
T Z 1
� �
数字电源开源社区 20
one pole with two zero point
Z2 Small signal analysis:
Z1 H (s)
Vo (1 SR1C1 )(1 SR2C2 )
S
2 Z 1
Vin SR1C 2 T Z 1
%Matlab code
0V clear all; %clear old data
close all; %close old file
Ts=10*10^(-6) %sampling period
num_c=conv([-0.1*10^(-3),-1],[0.2*10^(-3),1]);
% numerator
den_c=conv([0.1*10^(-3),0],1); %denominator
Cont_s=tf(num_c,den_c) %S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v')%Equation coefficient
z domain
num_z =-43.0500 79.9000 -37.0500
den_z =1 0 -1
s domain
Y (n) Y (n 2) 43.05 X (n) 79 X (n 1)
- 37.05 X (n - 2)
数字电源开源社区 21
two pole with one zero point
Z2 Small signal analysis:
Vo (1 SR2C2 )
H (s) | 2 Z 1
Vin SR (C C )(1 SR C1C2 ) S T Z 1
Z1 1 1 2 2
C1 C2
0V
%Matlab code
clear all; %clear old data
close all; %close old file
Ts=1*10^(-6) %sampling period
num_c=conv([0.2*10^(-3),1],1);
%numerator
den_c=conv([0.1*10^(-3),0],[4.4*10^(-6),1]);
%denominator
Cont_s=tf(num_c,den_c) %S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
z domain Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
s domain bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v')%Equation coefficient
数字电源开源社区 22
two pole with two zero point
Z2 Small signal analysis:
Vo (1 SR2C2 )(1 SR1C1 ) 2 Z 1
H (s) S
Vin SR (C C )(1 SR C2C3 ) T Z 1
Z1 1 2 3 2
C2 C3
0V
%Matlab code
clear all; %clear old data
close all; %close old file
Ts=1*10^(-6) %sampling period
num_c=conv([0.2*10^(-3),1],[22*10^(-6),1]);
%numerator
den_c=conv([0.1*10^(-3),0],[4.4*10^(-6),1]);
%denominator
Cont_s=tf(num_c,den_c) %S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
z domain Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
s domain bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v')%Equation coefficient
数字电源开源社区 23
three pole with two zero point(Type3补偿器与差分方程)
Z2 Small signal analysis:
Z1 1
(S )( S
1
)
Vo R1 R3 R2C2 (R1 R3 )C3
H (s)
Vin R1R3C1 C C2 1
S (S 1 )( S )
0V R2C1C2 R3C3
2 Z 1
S
T Z 1
%Matlab code
clear all; %clear old data
close all; %close old file
Ts=1*10^(-6) %sampling period
num_c=conv([1,1/(470*10^(-6))],[1,1/(44*10^(-6))]);
z domain %numerator
den_c=conv([0.33*10^(-6),0],conv([1,1/(15.51*10^(-
s domain 6))],[1,1/(2.2*10^(-6))]));
%denominator
Cont_s=tf(num_c,den_c) %S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v')%Equation coefficient
Y ( n ) 2 .5 6 7 Y ( n 1) 2 .1 5 7 Y ( n 2 )
0 .5 9 Y ( n 3) 1 .2 1 0 9 X ( n ) 1 .1 8 1 X ( n 1)
1 .2 1 X ( n 2 ) 1 .1 8 X ( n 3)
数字电源开源社区 24
Butterworth low pass filter
1
H (s) 2
| 2 Z 1
2( SRC ) 2 SRC 1 S T Z 1
R 1K C 22nF
%Matlab code
clear all; %clear old data
close all; %close old file
Ts=10*10^(-6) %sampling period
num_c=1;
%numerator
den_c=conv([0.968*10^(-9),44*10^(-6),1],1);
%denominator
Cont_s=tf(num_c,den_c) %S domain function
bode(Cont_s,'g');grid on;hold on; %S domain bode
Cont_discret_s=c2d(Cont_s,Ts,'tustin') %Z domain function
bode(Cont_discret_s,'r');grid on;hold on; %Z domain bode
[num_z,den_z]=tfdata(Cont_discret_s,'v')%Equation coefficient
数字电源开源社区 25
PID
continue domain B
1 t de( t)
0
A
u ( x) k p [e(t ) e (t ) dt +Td ]
Ti dt
discrete domain
T k
Td
u ( k ) k p [e ( k )
Ti
e(n)+
n 0 T
(e(k ) e(k 1))]
Y (n) x (n) x (n 1) K p[e(n) e(n 1)] k ie(n) k d (e(n) 2e(n 1) e(n 2))
https://blog.csdn.net/qq229596421/article/details/51419813
数字电源开源社区 26
Incremental PID c-code
#define max(a, b) (a>b? a:b)
#define min(a, b) (a<b? a:b) continue domain
#define range(x, a, b) (min(max(x, a), b))
#define exchange(a, b, tmp) (tmp=a, a=b, b=tmp)
#define myabs(x) ((x<0)? -x:x)
typedef struct
{ float limit; //max limit
float target; //target voltage
float feedback; //pid output to control
float Kp;
float Ki;
float Kd;
float e_0; //current error voltage
float e_1; //last error voltage
float e_2; //before last error voltage
}PID; discrete domain
float pid_calc(PID *pid)
{
float out;
float ep, ei, ed;
pid->e_0 = pid->target - pid->feedback;
ep = pid->e_0 - pid->e_1;
ei = pid->e_0;
ed = pid->e_0 - 2*pid->e_1 + pid->e_2;
out = pid->Kp*ep + pid->Ki*ei + pid->Kd*ed;
out = range(out, -pid->limit, pid->limit);
pid->e_2 = pid->e_1;
pid->e_1 = pid->e_0;
return out;
}
数字电源开源社区 27