




已阅读5页,还剩13页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
基于PLC高速I/O口模拟信号的测量与控制 Hongtao Ma, Xiaojun Wang, FenPing ZhouCollege of Information Science & EngineeringHebei University of Science & Technology Shijiazhuang,C, 摘 要频率信号是从外部V/F转换器的电压信号得到的,然后被发送到PLC的高速计数器。作为主机,西门子S7-200系列PLC的CPU222被使用。通过PLC编程,高速I/O通道测量出输入电压。高速数字脉冲由PLC的PWM脉冲发生器产生的脉冲周期的数字转化为电压幅度可调后外部RC低通滤波电路过滤器,以实现输出模拟控制信号。该方法通过更换昂贵的模拟I/O模块来减少测量和控制系统的费用。给出外围电路的设计和PLC程序。通过分析和比较数据,发现该系统可以实现 0.1的准确度。 关键词: PLC,高速I/O口,A/D一、 介 绍可编程控制器具有可靠性高,编程简单易学,使用方便,体积小的优点。它可以实现顺序逻辑控制和模拟自动控制按照工艺要求,因此它被广泛应用于工业领域,也作出了良好的控制效果。在某些由PLC控制的系统中,通常会遇到测量模拟电压信号。在这种情况下,PLC的模拟扩展用以进行一些转换工作。但这些模块的价格接近于中小型PLC的价格,而且只提供少量的输入口。此外,更多的一个模块被连接为了实际应用的需要,这样使其成本上升从而降低性价比。1-8基于西门子S7-200系列PLC的CPU222,使用PLC的高速数字I/O通道与低成本的外接V/F转换器将电压信号转换成频率信号,然后发送到PLC的高速计数器。通过PLC编程,实现输入电压测量。利用PLC的高速PWM脉冲发生器产生具有可变占空比的数字脉冲。通过外部RC低通滤波电路,可以得到变幅电压。这个方法在没有特别昂贵的模拟I/O模块完成了测量和控制,从而降低了系统的成本。二、 电路设计A模拟输入电路 CPU222主机只能接受数字输入信号,作者设计的外部V/F转换器用于把0-10V电压信号转换为0-10kHz的频率信号。V/F转换器采用美国NS公司的LM331集成电路。LM331的主要特点包括:(1)宽动态范围,高达100dB;(2)良好的线性关系,最大非线性是真小于0.01%,实质具有更好的低频率0.1Hz的线性;(3)高精度转换,数字分辨率可达12位;(4)简单的外围电路,仅需少量的外部组件,轻松地确保其准确性。采用V/F转换电路如图1所示。该电路可实现对10Hz到10kHz的范围, 0.03的线性度。图 1 V/F 转换器电路该电路输出频率计算公式如下:RS=R4+RP1。根据图1中的原件参数来调节电位计RP1,因此通过改变RS的值来使Fout的值上升到10kHz。LM331实现输出频率信号送入PLC的高速计数器端口。计时器也开始在开始计算时间,使输出频率f =的D / t,其中d表示计数器的值和T表示计数时间。 T可能会设定计时器了,所以价值f可以能够计算出,如果我们知道D的PLC的处理和储存的价值函数f,使一个A / D转换实施。 B输入电压的测量方法 S7-200系列PLC有HSC0-HSC5 6个高数计数器。每个计数器可以在不同的模式下执行来实现不同的功能。在本文中的V/F转换器的输出频率为0-10kHz,对应输入电压为0-10V,也就是说,比例为1mV/Hz。首先,高速计数器的控制位MB47是由16进制的FC来实现的。这就是说:升序计数,更新现值,更新当前值,激活HSC1。然后计数器HSC1定为运行模式0使用HDEF指令,即复位输入,开始投入的方向和选择外部输入不存在的。复位电流值寄存器SMD48值是0,预设值寄存器SMD52与FFFFH设置。注册SMB34的时间间隔是100毫秒的中断设置。定时器中断分配给中断0,并允许中断。最后HSC1是开始数的指令。中断服务例程调用0去读每100毫秒计数器HSC1计数的值,然后清除它。输入电压可以根据转换关系,通过HSC1的值来计算。这里一个010kHz时的V / F转换器采用,因此,在100ms的时间,1000门脉冲可以累积最多。它相当于1000h10 = 10000脉冲可在一秒钟内积累,相当于实际10V的输入电压。假定计算值200 100ms的大门,那么它的实际电压为2V。这样这是10V/1000 = 0.01V = 10mV的分辨率可收购。一组由PLC高速计数器来记录V/F转换器的脉冲数的实验结果数据在表1中。表1. 每100ms记录V/F脉冲实验结果从实验结果可以看到这种方法可以达到10mV的分辨率和0.1%的全误差。PLC的定时中断间隔是可变的范围内,5255ms。这样的时间间隔延长,使门的时间延长,电压测量结果会更精确,测量速度将放慢,但在同一时间下降。如果门的时间定为200ms的,然后测量分辨率可达5mV,对完全错误可以达到 0.05C模拟输出电路模拟输出电路如图2所示,它是由PLC的+24 V电源供应。24Vp-p的PWM信号由主机CPU222 Q0.0端口输出,通过U1A和U1B整形后被R1和R2按比例减低。高精度PWM信号由U1B输出,由R6和C9低通滤波。最后,U2提供直流电压与PWM信号。RC时间常数直接输出电压的纹波振幅的影响。 RC值较大,较小的纹波电压。但使用过大的RC值不可取的,因为它会增加输出电压的相应时间。D输出电压的控制方法S7 - 200系列PLC的有2个发电机输出高速脉冲序列,它可以执行期间变量,宽度可调的PWM波形。二产出分别致力于Q0.0和Q0.1。 PWM周期的设置范围是在265535,PWM脉冲宽度的设置范围为065535。时间是1微秒的PWM基地或1毫秒。本文Q0.0是选择输出的PWM脉宽调制signal.Period设置为5000,脉冲的PWM宽度范围为05000。时间1微秒的基础是通过的时间是5000的PWM微妙(5毫秒),从0占空比变化到100。的PWM分辨率为1 / 5000,相当于12位A / D转换器。直流输出电压表二所列的情况时,被选中的PWM周期是5毫秒,对RC滤波器时间常数25毫秒和PWM在不同的占空比。从表二中,我们可以看到,虽然理论上的分辨率可以达到1 / 5000,即是为2mV,相当于0.02满量程,其实也有大约f10mV错误,f0.1完全错误。这是只相当于10位D / A转换器的精度。在实验中,改变时间常数RC滤波器,纹波电压是根据不同的工作周期示波器测量。测量结果列于表三。可以看出,从表三说明,纹波电压较大时,只有一个阶段是用RC滤波器。为了减少这种纹波电压,多级RC滤波器可以引进。表二 不同占空比的PWM输出电压表三 纹波电压和RC时间常数的关系和工作循环三、结 论在此,提出了一种简单的V / F转换电路转换成010V的电压为010kHz的频率。的频率信号,然后传送到高速PLC的数字输入。通过测量输入电压的PLC编程,能达到 0.1测量精度。可编程控制器的PWM能力与外部RC滤波器实现010V输出电压,达到 0.1accuracy.On没有要求的精度高之际,该解决方案实现的测量和模拟控制无昂贵的PLC的模拟量I / O模块,这大大降低了系统成本。参 考 文 献1 Henning Dierks. PLC-automata: a new class of implementable real-time automate. Theotetical computer science, 2001, 253:61-93.2 David G. Johnson. Programmable Controllers for Factory Automation. New York and Basel: Marcel Dekker Inc,1987.3 Can Saygin, Firat Kahraman. A Web-based Programmable Logic Controller laboratory for manufacturing engineering education. The International Journal of Advanced Manufacturing Technology, 2004,24(7): 590-598.4 J.-S. Lee, P.-L. Hsu. An improved evaluation of Ladder logic diagrams and Petri nets for the sequence controller design in manufacturing systems. The International Journal of Advanced Manufacturing Technology, 2004, 2(5): 279-287.5 John, Karl-Heinz, Michael. Programming Industrial Automation System, Berlin. New York: Springer, 2001.6 T. Mikulczynski, Z. Samsonowicz, R Wieclawek. The Grafpol Programming Language for Programmable Logic Controllers. Archives of Control Sciences, 2000,10(1):17-30.7 Nanette Bauer, Sebastian Engell, Ralf Huuck, etal. Verification of PLC Programs Given as Sequential Function Charts. Lecture Notes in Computer Science, 2004, 45(22): 517-540.8 Stephane Klein, Georg Frey, Mark Minas. PLC Programming with Signal Interpreted Petri Nets. Lecture Notes in Computer Science, 2003, 4(8): 440-449.外文文献原文()Measuring and Controlling of Analog signal Based on High-speed I/O port of PLCHongtao Ma, Xiaojun Wang, FenPing ZhouCollege of Information Science & EngineeringHebei University of Science & Technology Shijiazhuang,C, AbstractFrequency signal is gotten from voltage signal by external V/F converter, and then is sent to high-speed counter of PLC. As a host, CPU222 of Siemens S7-200 series PLC is used. Through programming PLC, input voltage is measured by high-speed I/O channels. High-speed digital pulse of variable duty cycle produced by PLCs PWM pulse generator is turned into voltage signal of amplitude-adjustable after external RC low-pass filter circuit filter to achieve controlling of output analog. The method reduces the cost of measurement and control system via replacing expensive analog I/O modules. Peripheral circuit design and PLC program are given. Through analyzing and comparing data, it is found that the system can achieve 0.1% accuracy.Key words: PLC; High-speed I/O; A/D;I.INTRODUCTIONPLC has advantages of high reliability, simple programming, easy learning, convenient usage and small volume. It can implement sequential logic control and automatic control of analog according to the requirement of technological process, so it is widely used in industrial field and also make a good control effect. In some systems controlled by PLC, the circumstance of measuring analog voltage signal often is encountered. Analog extended module of PLC is adopted to do some conversion work in this case. But these modules prices are close to the small and medium-sized PLCs price, and only provide few input port. In addition, more one module is connected in order to practical application, whose expensive cost cause to decrease of performance cost ratio1-8.Based on CPU222 of Siemens S7-200 series PLC, use PLCs high-speed digital I / O channel with low-cost add-in V/F converter to convert voltage signal into frequency signal and then send it into PLCs high-speed counter. By programming the PLC, it realizes measurement of input voltage. PLC use high-speed PWM pulse generator to produce digital pulse with variable duty cycle. Through external RC low-pass filter circuit, voltage with variable amplitude can be achieved. This method completes the measuring and controlling without special expensive analog I/O module and decrease the cost of system.II.CIRCUIT DESIGNA. Analog input circuitCPU222 host can only accept digital input signals, the author design external V / F converter to convert 010V voltage signal to 010kHz frequency signal. The V/F converter adopted LM331 IC, the production of NS Corporation, U.S. Main features of LM331 includes: (1) wide dynamic range, up to 100dB; (2) good linearity, the largest non-linear distortion is less than 0.01 percent, and even has better linearity at the low-frequency 0.1Hz; (3) high-precision conversion, digital resolution is up to 12 bit; (4) simple peripheral circuit, only a few external components are needed to form a V/F converter and easily ensure accuracy.The V/F converter circuit is shown as Figure 1. The circuit can achieve 0.03% linearity in the range of 10Hz -10kHz. Figure 1. V/F converter circuitThe output frequency of the circuit is calculated as following equationwhere RS=R4+RP1. According to component parameter in Figure 1 to adjust potentiometer RP1, so RS value changes, to make fOUT up equal to 10kHz.Output frequency signal of LM331 is fed into PLCs port of high-speed counter. Timer is also started at time of beginning to count, so that the output frequency f = D/T, in which D denotes counter value and T denotes counting time. T may be set up by timer, so the value of f can be able to calculate out if we know the value of D. PLC processes and stores the value of f, so that an A/D conversion is implemented.B. Measuring method of input voltageS7-200 family PLC have 6 high-speed counters of HSC0HSC5. Each counter may operates at different mode to implement different function. Output frequency of V/F converter in this paper is 010kHz, corresponding to input voltage 010V, that is, the resolution is 1mV/Hz.Firstly, control byte MB47 of high-speed counter is presented with hexadecimal value FC. Its meaning is: up counting, updateable preset value, updateable current value, activating HSC1.Then counter HSC1 is set at operating mode 0 using HDEF instruction, that is, reset input, start input and selecting input of external direction dont exist. Reset value of current-value register SMD48 is 0, preset value register SMD52 is set with FFFFH. Interval register SMB34 of timing interrupt is set with 100ms. Timer interrupt is allocated to interrupt 0 and allow interruption. Finally HSC1 is started to count by instruction.Interrupt serving routine 0 is called every 100ms to read out count value of counter HSC1 and then clear it. Input voltage can be calculated out by count value of HSC1 according to transform relationship. Here a 010kHz V/F converter is adopted, so in 100ms gate time 1000 pulses can be accumulated at most. It is equivalent to 1000h10=10000 pulses can be accumulated in one second, which corresponds to actual 10V input voltage. Supposed that count value is 200 in 100ms gate, and then its actual voltage is 2V. Such that a resolution of 10V/1000=0.01V=10mV can beacquired.A group of experimental result data of measured voltage with PLC high-speed counter to count pulses of V/F converter is listed in TABLE I.TABLE I. EXPERIMENTAL RESULT OF COUNT V/F PULSES IN 100ms GATEInputCalculatedFrom the experimental results it can be seen that this method can reach a resolution of 10mV and full error of 0.1%.Interval of PLC timing interruption is variable within the range of 5255ms. To extend the interval such that makes gate time longer, result of measuring voltage will be more accurate, but measuring speed will slow down at the same time. If gate time is set at 200ms, then measuring resolution may reach 5mV and full error can reach 0.05%.C Anolog output circuitAnalog output circuit is shown in Figure 2, which is supplied by PLCs +24V power. PWM signal of 24Vp-p outputted by Q0.0 port of host CPU222 is reshapinged by U1A and U1B after being stepped proportionally down by R1 and R2. High accuracy PWM signal outputted by U1B is filtered by low-pass filter constructed by R6 and C9. Finally U2 provides direct current voltage relating to PWM signal. RC time constant directly impact on the ripple amplitude of output voltage. The larger RC value is, the smaller the ripple voltage is. But to use too large RC value is inadvisable, because it will increase the corresponding time of output voltage.Figure 2. Analog output circuitD Output voltage control methodS7-200 series PLC have 2 generators to output high-speed pulse sequence, which can implement period-variable, width-adjustable PWM waveform. Two outputs are respectively dedicated to Q0.0 and Q0.1. The set range of PWM period is within 265535, the set range of PWM pulse width is within 065535. Time base of PWM is 1us or 1ms. In this paper, Q0.0 is selected to output PWM signal.Period of PWM is set to 5000, and pulse width of PWM is in range of 05000. Time base of 1us is adopted such that period of PWM is 5000 us (5 ms), and duty cycle changes from 0 to 100%. Resolution of PWM is 1/5000, which is equivalent to that of 12-bit A/D converter.Direct-current output voltages are listed in TABLE II when the case is selected that PWM period is 5ms, time constant of RC filter is 25 ms and PWM is in different duty cycle.From the TABLE II, we can see that although theoretical resolution can reach to 1/5000, that is, 2mV, equivalent to 0.02% of full scale, actually there is approximately f10mV error and f0.1% full error. This is only equivalent to the accuracy of 10-bit D/A converter.In experiment, changing time constant of RC filter, ripple voltage is measured with oscillograph under different duty cycle. The measured result is listed in TABLE III.It can beseen from TABLE III that ripple voltage is larger when only one stage RC filter is used. To decrease this ripple voltage,multi-stage Rcfilters can be introduced.TABLE II. PWM OUTPUT VOLTAGE OF DIFFERENT DUTY CYCLE】TABLE III. THE RELATIONSHIP OF RIPPLE VOLTAGE AND RC TIME CONSTANT AND DUTY CYCLEIII. CONCLUSIONIn this paper, a simple V/F converter circuit converts 0 10V voltage to 010kHz frequency. The frequency signal is then sent to high-speed digital input of PLC. Input voltage is measured through programming the PLC and can achieve the measurement accuracy of 0.1%. PWM ability of PLC with external RC filter implements 010V output voltage and reached 0.1% accuracy.On the occasio
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 水库扩建工程环境影响报告书
- 建筑预应力结构设计与优化方案
- 智能建筑系统能效提升方案
- 片区供水管网建设项目技术方案
- 混凝土结构施工技术与工艺优化方案
- 提供多元化评价机制激励学生创新探索
- 公路养护技术技能人才的职业生涯规划与能力发展路径
- 职业素养(团队凝聚力)试题及参考答案(互联网行业)
- 2025年印刷制版安全生产基础知识试题及答案
- 初中古诗词知识竞赛真题及答案解析
- 八上数学预习每日一练小纸条 30天【答案】
- 技术专家管理制度
- 2025年云南交投集团校园招聘管理人员86人笔试参考题库附带答案详解
- 黑龙江省哈尔滨市第九中学校2024-2025学年高二上学期11月期中考试生物试卷(有答案)
- 2025母婴护理员(中级)专业技能考评300题(含标准答案)
- 2025年小学语文一年级第一学期期中测试试卷
- 2025年6月上海市高考语文试题卷(含答案)
- (完整版)履带吊安装拆除专项施工方案
- 小学生消防安全知识竞赛题库及答案
- 2025年航空航天用特种电缆研发生产合同
- 侵袭性肺真菌病诊断路径专家共识(2024版)解读
评论
0/150
提交评论