低频数字式相位测量仪1.docx
- 文档编号:9246258
- 上传时间:2023-05-17
- 格式:DOCX
- 页数:23
- 大小:99.44KB
低频数字式相位测量仪1.docx
《低频数字式相位测量仪1.docx》由会员分享,可在线阅读,更多相关《低频数字式相位测量仪1.docx(23页珍藏版)》请在冰点文库上搜索。
低频数字式相位测量仪1
电子竞赛
低频数字式相位测量仪
目录
1设计原理3
1.1系统方案设计3
1.1.1测量方法的比较与选择3
1.2设计方案的确定3
2系统硬件的基本组成部分4
2.1移向网络4
2.2相位处理6
2.2.1信号处理电路6
2.2.2相位测量电路7
3系统的软件原理设计8
4系统的调试8
4.1测量仪器仪表8
4.2移相网络电路参数测定8
4.3两路输出的正弦信号峰-峰值测定9
5结果分析9
6参考文献10
附录10
低频数字式相位测量仪
摘要:
低频数字相位测量仪是在工业领域中经常用到的一种测量工具,主要应用于同频率正弦信号间的相位差的测量显示。
本系统采用CycloneⅡEP2C35F48I8作为数据处理及控制核心,由移相网络,相位测量以及显示电路组成。
该系统可以对20Hz~20kHz频率范围内的信号进行高频采样处理,并把收集到的数据送入FPGA进行相位差测量运算并送显示电路显示,测相绝对误差不大于≦2°。
关键词:
低频;移向网络;相位测量仪;FPGA
1设计原理
1.1系统方案设计
1.1.1测量方法的比较与选择
1)DFT测相法
即将待测信号通过A/D转换得到f(n)、f(n)按离散傅里叶变换得出离散频谱F(k)、f(n)和F(k)为傅里叶变换对,通过运算得到两路信号的基波相位,从而计算出相位差。
DFT测相法的精度受限于ADC的采样精度,需要高速ADC对信号进行过采样,测量方案复杂,可以通过采集卡在计算机上实现虚拟仪器,所以主要应用在精度要求很高的场合和虚拟仪器中。
2)填充计数测相法
即两路同频的正弦信号经过信号整形电路后得到方波信号,方波信号经过鉴相器后,得到两路输入信号的相位差信号,用固定频率的采样脉冲进行填充并计数,从而计算出相位差。
填充计数测相法主要应用在要求一定的精度,测量的频率不是太高但实时性要求很强的场合,易于实现数字化和自动化,低频数字相位仪适合用填充计数法。
填充计数测相法的基本算法:
若正弦波整形后的方波信号频率为f,周期为T,采样脉冲周期为TC,方波一个周期内对采样脉冲计数为,n则被测信号频率f=1/T=1/nTC。
同样的方法测出两个同频正弦波起点之间的时间差为△t,则两信号的相位差
。
1.2设计方案的确定
根据系统测量方法及电路设计的简单可靠性,所以系统由三部分组成:
移向网络、相位测量、显示部分构成。
结构如图1所示。
2系统硬件的基本组成部分
2.1移向网络
对于A路输出,将波形信号输入不加移相而直接输出;而B路输出,是将波形信号经过低移相网络进行移相变化输出。
通过改变开关K1、K2的位置来控制相移范围。
移向网络电路图如图所示。
信号输出A、B的相位关系,电位器Rw1接的是电压跟随器,调节电位器Rw1可以使B输出在
~
范围内。
调节电位器Rw2、Rw3可以调节A输出和B输出的正弦信号峰值在0.3—5V范围内变化。
采用NE5532运算放大器是为了减少输出对EC网络的影响。
NE5532运算放大器有10KHZ的带宽,能使输出信号真实地反映RC网络相移情况。
用开关K1、K2同时分别接电阻R1、R2、R3,可以使频率为100HZ、1KHZ、10KHZ的相移在
~
范围内变化。
R1、R2、R3的数值是实验值。
理论估算值根据
(1-1)
UR、UC分別为A、B输出幅值;
(1-2)
ω为相位角,C为电容值;
(1-3)
f为输入频率;
当电阻、电容的系数阻抗相等时,移相满足90°要求。
(1-4)
(1-5)
当f变化时,
(1-6)
(1-7)
=15.9kΩ(1-8)
为使移相范围大于
~
,则在高通电路中使电阻小于15.9K,在低通电路中大于15.9K。
电容不变,当频率变化时,对应阻值的变化。
频率
阻值
电容
100HZ
160kΩ
10uF
1KHZ
16kΩ
10uF
10KHZ
1.6kΩ
10uF
2.2相位处理
2.2.1信号处理电路
相位测量前置级是信号处理电路,由阻抗变换和放大、限幅、电平转换、整形电路组成。
如图所示。
阻抗变换和放大采用同比例放大,具有输入阻抗高的特点,但有共模输入电压,为了提高输入电阻,限制共模输入电压幅值,在输入端并联100电阻。
限幅电路的主要目的是限制信号的幅度,保护运放的输入级且提高输入电压的变化速度。
将信号转换成幅值5V的方波。
整形电路是将输出电压波形边沿变陡去除噪声.信号处理电路的相位超前输出端、相位滞后输出端的信号给FPGA。
2.2.2相位测量电路
测量两个信号之间的相位差通过计算实现。
(2-1)
(2-2)
其中t—两个信号之间的时间差;
N—两个信号之间的计数器的计算值;
T—计数器之间的时钟周期;
θ—两个信号之间的相位差;
Tx—被测信号的周期;
f—计数器的时钟频率;
fx—被测信号的频率。
计数模块MEASURE_N计算N。
频率计数模块FREQ24T测被测信号的频率fx,BCD_TO_8421模块将fx由二-十进制转换成二进制数。
计算相位模块CONSIDER计算相位差θ。
COUNT模块将相位差θ由二进制数转换成二-十进制数。
最后进过译码用四位数码管显示出相位差θ。
3系统的软件原理设计
4系统的调试
4.1测量仪器仪表
(1)信号发生器RIGOLDG3061A
(2)数字式万用表RIGOLDM3051
(3)数字存储式示波器RIGOLDS1102CA
4.2移相网络电路参数测定
用函数发生器分别产生100HZ、1KHz、10KHZ正弦信号,开关K1、K2同时拨至位置1、2、3,用示波器观察移相前后的相位差。
开关内容
输入信号频率
连续移相范围
1
100HZ
-44.76°—44.35°
2
1KHZ
-45.43°—43.76°
3
10KHZ
-45.74°—43.21°
4.3两路输出的正弦信号峰-峰值测定
当频率f变化,幅值为5V时,对应输出峰-峰值的变化范围如表所示。
信号输出频率
100HZ
1KHZ
10KHZ
A
6.8mv—5.08v
5.4mv—4.96v
3.8mv—3.76v
B
14mv—5.80v
14.4mv—5.64v
7.4mv—4.28v
5结果分析
1、当信号输入时移相网络输出相移范围为-45.74°~44.35°满足题目要求;
2、两路输出在正弦信号峰-峰值均可在0.3~5V范围内变化;
3、实现了相位差的数字显示,分辨率为0.1°,符合题目要求。
4、相位测量绝对误差≦2℃。
6参考文献
[1]高吉祥.唐朝京.模拟电子线路设计[M].北京:
电子工业出版社,2007
[2]潘松.黄继业.EDA技术与VHDL[M].北京:
清华大学出版社,2009
[3]周雪.电子技术基础[M].北京电子工业出版社,2004.
附录
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entitybcd_to_8421is
port(clk:
instd_logic
c_in:
instd_logic_vector(23downto0);
c_out:
outstd_logic_vector(14downto0));
endbcd_to_8421;
architecturearchofbcd_to_8421is
signala,b:
std_logic_vector(23downto0);
begin
process(clk)---BCD_TO_8421
begin
ifclk'eventandclk='1'then
a<=c_in;
b<=a(23downto20)*"11000011010100000000"+
a(19downto16)*"10011100010000000"+
a(15downto12)*"1111101000000"+
a(11downto8)*"1100100000"+
a(7downto4)*"1010000"+
a(3downto0);
endif;
c_out<=b(14downto0)
endprocess;
endarch;
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entityconsideris
port(clk:
instd_logic;
n:
instd_logic_vector(25downto0);
freq:
instd_logic_vector(14downto0);
cout:
outstd_logic_vector(10downto0));
endconsider;
architecturearchofconsideris
signalc0,c1,e,e0,d0,d1,d2,d3:
integerrange0to400000000;
signalcount:
std_logic_vector(10downto0);
signalj:
std_logic_vector(14downto0);
signalm:
std_logic_vector(25downto0);
begin
process(n,clk)
begin
ifclk'eventandclk='1'then
m<=n;
c0<=conv_integer(m);
d0<=c0*315;
d1<=d0/1024;
endif;
endprocess;
process(clk,freq)------CONSIDER
begin
ifclk'eventandclk='1'then
j<=freq;
c1<=conv_integer(j);
e<=c1*d1;
e0<=e/2048;
count<=conv_std_logic_vector(e0,11);
endif;
endprocess;
cout<=count;
endarch;
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entitycountis
port(clk,clr:
instd_logic;
c_in:
instd_logic_vector(10downto0);
c_out1,c_out2,c_out3,c_out4:
outstd_logic_vector(3downto0));
endcount;
architecturearchofcountis
signalb1,b2,b3,b4:
std_logic_vector(3downto0);
signala:
std_logic_vector(1downto0);
signalmid:
std_logic_vector(15downto0);
begin
process(clk,clr,c_in)-----COUNT
begin
ifclk'eventandclk='1'then
ifclr='0'then
a<="00";
b1<="0000";
b2<="0000";
b3<="0000";
b4<="0000";
else
caseais
when"00"=>
mid<="00000"&c_in;
a<="01";
when"01"=>
ifmid>="1010"then
mid<=mid-"1010";
b2<=b2+1;
ifb2="1001"then
b2<="0000";
b3<=b3+1;
ifb3="1001"then
b3<="0000";
b4<=b4+1;
endif;
endif;
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entitycountis
port(clk,clr:
instd_logic;
c_in:
instd_logic_vector(10downto0);
c_out1,c_out2,c_out3,c_out4:
outstd_logic_vector(3downto0));
endcount;
architecturearchofcountis
signalb1,b2,b3,b4:
std_logic_vector(3downto0);
signala:
std_logic_vector(1downto0);
signalmid:
std_logic_vector(15downto0);
begin
process(clk,clr,c_in)-----COUNT
begin
ifclk'eventandclk='1'then
ifclr='0'then
a<="00";
b1<="0000";
b2<="0000";
b3<="0000";
b4<="0000";
else
caseais
when"00"=>
mid<="00000"&c_in;
a<="01";
when"01"=>
ifmid>="1010"then
mid<=mid-"1010";
b2<=b2+1;
ifb2="1001"then
b2<="0000";
b3<=b3+1;
ifb3="1001"then
b3<="0000";
b4<=b4+1;
endif;
endif;
else
b1<=mid(3downto0);
endif;
a<="01";
whenothers=>null;
endcase;
endif;
endif;
endprocess;
c_out4<=b4;
c_out3<=b3;
c_out2<=b2;
c_out1<=b1;
endarch;
else
b1<=mid(3downto0);
endif;
a<="01";
whenothers=>null;
endcase;
endif;
endif;
endprocess;
c_out4<=b4;
c_out3<=b3;
c_out2<=b2;
c_out1<=b1;
endarch;
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityfreq_tis
port(clk:
instd_logic;--1Hzshizhong
freq_en:
outstd_logic;
cnt_clr:
outstd_logic;
load:
outstd_logic);
endfreq_t;
architectureaoffreq_tis
signaldiv2clk:
std_logic;
begin
process(clk)----------FREQ24T
begin
ifclk'eventandclk='1'then--1Hzshizhong2fenpin
div2clk<=notdiv2clk;
endif;
endprocess;
process(clk,div2clk)
begin
ifclk='0'anddiv2clk='0'then
cnt_clr<='1';
else
cnt_clr<='0';
endif;
endprocess;
load<=notdiv2clk;
freq_en<=div2clk;
enda;
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entitymeasure_nis
port(clk_15m:
instd_logic;
clk1:
instd_logic;
clk0:
instd_logic;
f_out:
outstd_logic;
n_out:
outstd_logic_vector(25downto0));
endmeasure_n;
architecturearchofmeasure_nis
signalx,y,a,clk10,clk11,clk20,clk21:
std_logic;
signalcount0,count01,count02,count1,count2:
std_logic_vector(25downto0);
begin
process(clk_15m,clk0,clk1,x,y,count1,count2)----xiangchashijianneidejishumokuai
begin---111MEASURE_N
ifclk_15m'eventandclk_15m='1'then
caseais
when'0'=>
clk10<=clk0;
clk11<=clk1;
ifclk10='0'andclk11='0'then
count1<=(others=>'0');
endif;
ifclk10='0'then
x<='1';
endif;
ifx='1'then
ifclk10='1'then
ifclk11='0'then
y<='1';
endif;
ify='1'then
ifclk11='1'then
count01<=count1;
count1<=count1;
else
count01<=count1+1;
endif;
endif;
endif;
endif;
ifcount01=0then
a<='1';
else
a<='0';
endif;
when'1'=>
clk20<=clk1;
clk21<=clk0;
ifclk20='0'andclk21='0'then
count2<=(others=>'0');
endif;
ifclk20='0'then
x<='1';
endif;
ifx='1'then
ifclk20='1'then
ifclk21='0'then
y<='1';
endif;
ify='1'then
ifclk21='1'then
count02<=count2;
count2<=count2;
else
count2<=count2+1;
endif;
endif;
endif;
endif;
ifcount02=0then
a<='0';
else
a<='1';
endif;
whenothers=>a<='1';
endcase;
count0<=count01orcount02;
endif;
f_out<=a;
n_out<=count0;
endprocess;
endarch;
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entitydispis
port(clk,a:
instd_logic;
inl:
instd_logic_vector(3downto0);
inm:
instd_logic_vector(3downto0);
inh:
instd_logic_vector(3downto0);
inhh:
instd_logic_vector(3downto0);
midd:
outstd_logic_vector(7downto0);
disp1:
outstd_logic_vector(2downto0));
enddisp;
architecturearchofdispis
signalmid:
std_logic_vector(4downto0);
signaldisp2:
std_logic_vector(2downto0);
begin
process(clk,inl,inm,inh,inhh)------DISP
begin
ifclk'eventandclk='1'then
ifdisp2="111"then
disp2<="010";
else
disp2<=disp2+1;
endif;
disp1<=disp2;
casedisp2is
when"110"=>mid<='0'&inl;
when"101"=>mid<='1'&inm;
when"100"=>mid<='0'&inh;
when"011"=>mid<='0'&inhh;
when"010"=>midd<='0'&a&"000000";
whenothers=>nu
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 低频 数字式 相位 测量仪