资源描述
单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,*,Chapter 5 The Implementation Issues,Physical Process Input and Output(AD,DA,S&H),Quantization Analysis,Software Implementation of Digital Controllers,Choice of Sample Rate,Generally,a computer control system may consist of the following elements:,(a)central processing unit,i.e.the computer,(b)process communication channels,(c)A/D and D/A converters,(d)sensors and actuators,(e)physical process,The elementary structure of a computer control system,y,Digital,Controller,-,Process,e,Reference,Actuator,+,r,D/A,Output,Sensor,u,A/D,Plant,Industrial PC,Physical Process Input and Output,-the interface between the computer and the physical world.,Sensors,:,A sensor,provides an accurate representation(preferably as electrical signal)of the physical variable being measured,usually consists of two parts,the,sensor element,and the,transducer,.,模拟量输入通道,生,产,过,程,传感器,变送器,模,拟,开,关,放大器,采,样,保,持,器,A/D,接,口,电,路,PC总线,Sensor,变送器(transducer),用于将传感器信号进行初步处理,包括:,1.信号滤波:实现一个低通滤波器,滤除常见高频干扰。,2.小信号放大:小信号易受干扰,不易传输,要进行放大。,3.I/V变换:将电压、电流、电阻信号统一变换为规定标准信号,以利于传输使用。,常见标准:计算机接口标准:范围05v,型仪表标准:范围010mA,型仪表标准:范围420mA,4.非线性补偿:对实际物理信号与电信号成非线性关系的情况进行补偿操作,使其成为线性关系,这局部工作亦可由计算机软件完成。,如:热电偶中:热电势e与温度T的关系一般为:,T=a1e4+a2e3+a3e2+a4e+a5 (a1a5为常数),补偿后,变送器的输出电压V与温度T的关系可转化为线性关系,即:V=aT+b,Conversion Between Analog and Digital Signals,Analog-to-Digital Conversion,An Analog-to-Digital Converter(ADC)converts an analog signal to a binary number representing the magnitude of the input signal.,Digital-to-Analog Conversion,A Digital-to-Analog Converter(DAC)produces an analog output whose magnitude is represented by the input digital data.,The Essential Parameters of A/D Converter(技术指标),转换时间(conversion time):从发出转换命令信号到转换结束信号有效的时间间隔;转换时间的倒数为每秒能完成的转换次数,称为转换速率;积分型:毫秒级低速,逐次比较:微秒级中速,全并行:纳秒级高速。,分辨率(resolution):数字量位数n。The conversion resolution ranges from 8 to 16 bits:ADC08098位,AD57412位。,也可用数字输出最低有效位LSB,least significant bit所对应的模拟量来表示,如n=8,VRH=5V,那么LSB对应5V28119.6mV。数字量位数n小于8位为低分辨率,1012为中分辨率,12以上为高分辨率。,线性误差(linearity error):量程范围内,偏离理想转换特性的最大误差,通常为1/2LSB或1LSB;也称为转换精度。,量程(range):能转换的电压范围。,对一个n位的A/D 转换输出的二进制数字量B与输入模拟电压VIN、正基准电压VREF+、负基准电压VREF-的关系为,设A/D转换器为位,VREF+=5.00V,VREF-=0V,那么VIN为0V、2.5V、5.0V对应的数字量分别为00H、7FH、0FFH。,Analog-to-Digital Converter(ADC),There are several different AD conversion techniques:,Successive Approximation ADC(逐次逼近型):转换时间短几s到100 s,抗扰性差电压比较;,Dual-Ramp Converter(双积分型):模拟电压先转换成积分时间,然后转换成计数脉冲数。转换时间长(几十ms到100 ms),抗扰性好积分;,Counter Ramp Converter 计数型:简单、廉价,但每输入一个时钟脉冲,计数器加或减1,转换很慢。,Parallel or“flash Converter(全并行比较型):采用多个比较器,速度极高,电路规模大,本钱高.,逐次逼近式A/D的工作原理,从SAR输出的数码送至D/A,其输出电压Vf与模拟量输入Vin 比较后,再控制SAR的数字,逐次逼近真实值。,Vin,模拟量输入,数字量输出,寄存器,D/A转换器,逐次逼近寄存器(SAR),控制时序,和逻辑电路,比较器,+,Vf(反馈电压),逐次逼近式A/D转换器原理框图,D,0,D,7,双积分式A/D转换器1,控制逻辑,计数器,时钟,+,比较器,+,积分器,1,2,3,积分电容,V,O,V,I,K,数据输出,V,in,V,REF,(基准电压),双积分式A/D转换的原理框图,t,1,V,O,t,2,t,A,V,O,t,1,t,3,t,B,t,t,1,V,I积分输出,t,2,t,3,A,B,双积分A/D的工作示意图,工作原理:,先对模拟输入电压,V,in进行固定时间t1的正向积分,积分器的输出电压上升的速率与输入电压,V,in成正比;,当固定时间t1到后,计数器清零,对积分器进行反向积分,并自动按一定的频率进行计数。积分器的输出电压,从正向积分结束时的,V,I开始以恒定的斜率下降,当反向积分使其积分器输出为零时,关闭计数器计数,完成一次A/D转换工作,。,双积分式A/D转换器2,双积分式A/D转换器特点,是一种间接A/D转换技术。,模拟电压先转换成积分时间,然后转换成计数脉冲数,最后将代表模拟输入电压大小的脉冲数转换成BCD码输出。,转换时间较长,一般需要几十毫秒。,器件少、使用方便、抗干扰能力强、数据稳定、价格廉价,适用于非快速计算机过程控制系统或精度要求较高的地方。,常用双积分式,A/D,转换器芯片,:MC14433,其他A/D转换方法,并行A/D转换器,n位那么需2n-1个比较器,本钱高,故只应用于转换速度要求极高的场合,计数器式A/D转换器,简单、廉价,但每输入一个时钟脉冲,计数器加或减1,故要逼近输入值,需输入许多个脉冲,因而转换很慢。,电压/频率转换器件,A/D转换器接口,A/D转换器与CPU的接口方式由它们之间数据传输方式决定,并行接口和串行接口,接口类型一般有三种,由A/D转换器与CPU之间的联系方式决定,查询法,定时法,中断法,8,位,A/D,转换器,ADC0809,带,8,通道模拟开关的,8,位逐次逼近,A/D,转换器,转换时间,100us,误差,1/2LSB,采样、保持及量化,信号的采样,采样过程:以周期时间间隔,T,,,把时间与幅值连续的模拟信号转变为一连串脉冲输出信号。,为采样宽度,即,K,闭合的时间。,A/D,转换的过程中,,信号的变化导致转换误差,,A/D,转换器需要采样保持器来提高输入信号的频率范围,。,采样保持器:把,t=KT,时刻的采样值保持到,A/D,转换结束。,采样:,K,闭合,,C,H,快速充电,,V,OUT,跟随,V,IN,保持:,K,断开,,V,OUT,保持,V,C,缓慢变化的信号无需采样保持器。,采样保持器(Sample&Hold),采样保持器芯片:,LF398,采样保持控制引脚,8,:高电平,采样,低电平,保持,C,H,外接高品质电容,其减小可以提高采样频率。,获取时间:,C,H,为,0.01uF,时,时间为,25us,量化 Quantization,量化:用一组数码逼近离散模拟信号的幅值。,模拟信号数字信号。,量化单位(Quantization unit):A/D转换器的最低有效位LSB对应的模拟量。,q=(ymax-ymin)/(2n-1),量化误差(Quantization error:q,The maximum error an ADC makes in digitizing a signal is LSB.,The actual quantization error is equally probable to occur at any point within the range q.,The quantization error can be approximated by an uncorrelated sawtooth waveform having a peak-to-peak amplitude of q,the quantization unit.,Quantization Error with an ADC,The,transducer,part of the actuator performs the electromechanical power conversion,e.g.a motor.,The,amplifier,part amplifies the low energy signal from the computer output to a level sufficient to drive the transducer.,Actuators,:An actuator is the device that converts control signal(usually electrical)to drive the physical process,can be divided into two elements,a,transducer,and an,amplifier,.,模拟量输出通道,BUS,变送机构,功率,放大,保持,D/A,接,口,电,路,控制,生,产,过,程,Actuator,Digital-to-Analog Conversion,A Digital-to-Analog Converter(DAC)produces an analog output whose magnitude is represented by the input digital data.,工作原理:,输入的数字量是二进制代码按数位的组合,如任一个n位数,D020+D121+D222+D
展开阅读全文