当前位置:文档之家› 温度控制pid 过控课程设计

温度控制pid 过控课程设计

温度控制pid 过控课程设计摘要人类的生活环境中,温度扮演着极其重要的角色,可以说几乎80%的工业部门都不得不考虑温度对自身系统的影响,温度是与人类生产生活密切相关的一个物理量,由此便产生了各种各样的温度测量方法。

根据测温精度和范围的不同,可选用不同的测温方式。

目前常常采用模拟集成温度传感器,该传感器是采用硅半导体集成工艺制成,因此亦称硅传感器或单片集成温度传感器。

此种传感器的特点是,功能单一(仅测量温度)、测温误差小、价格低、响应速度快、传输距离远、体积小、微功耗等,适合远距离测温、控温,不需要进行非线性校准,外围电路简单。

然而在很多工业应用的场合下,环境非常恶劣,这种以人工的方式直接操作设置仪表很不现实,采用有线数据通信的方式也会受很多环境、质量、功能等方面的限制,在数据记录上也还要靠人工抄写,不能形成自动控制的系统。

温度控制是工业生产过程中经常遇到的过程控制,有些工艺过程对其温度的控制效果直接影响着产品的质量,因而设计一种较为理想的温度控制系统是非常有价值的。

随着单片机技术的日益成熟,单片机在温度控制上的应用也日趋广泛。

本文采用STC89C52单片机采用积分分离式PID算法和带死区的PID算法两种控制方式,并通过对试验结果的比较,发现对控制精度较高的系统和响应速度较慢的系统带死区的PID算法确实不大实用,而前者在应一定程度上若再辅以微分先行则基本上能满足系统要求。

关键字:STC89C52单片机,PID算法,积分分离式,微分先行。

AbstractMan's living environment, the temperature plays a very important role, can be said that almost 80% of the industrial sector had to take into account the effects of temperature on their systems, temperature is closely related to human production and life of a physical quantity, thus given rise to a wide range of temperature measurement method. According to the different temperature measurement accuracy and scope may make use of the temperature in different ways. There is often analog integrated temperature sensor, the sensor is made using silicon semiconductorintegrated process, so also known as monolithic integration of silicon sensors or temperature sensors. Such sensors are characterized by single function (only measured temperature), temperature measurement error is small, low prices, fast response, transmission distance, small size, micro-power consumption, suitable for remote temperature measurement, temperature control, no non-linear calibration, the external circuit is simple. However, in many occasions industrial applications, the environment is very bad, this way of direct manipulation to artificially set the instrument is very practical, using wireline data communications, the way will be subject to many environmental, quality, functionality and other aspects, in the data record is also still rely on manual transcription, do not create automatic control systems.Temperature control is often encountered in the process of industrial production process control, and some process to control the temperature effect on their direct impact on the quality of products, has designed a more ideal temperature control system is very valuable.With SCM technology has become more sophisticated, single-chip temperature controlapplications are becoming increasingly widespread. In this paper, STC89C52 separate microcontroller with integral PID algorithm and the dead-zone of the PID algorithm two kinds of control mode, and through comparison of test results and found that the control system, high precision and response speed of a slower system with dead-zone of the PID algorithm is not really practical, but the former should be supplemented with a certain degree Ruozai first differential isgenerally adequate to meet system requirements.Keywords: STC89C52 microcontroller, PID algorithm, split points, differential first.目录一、方案设计总体方案选择 (3)方案一1带死区的PID算法简介 (5)2算法程序流程图 (7)3软件设计 (8)4硬件设计 (9)方案二1积分分离式PID算法简介 (14)2算法程序流程图 (15)3软件设计 (15)4硬件设计 (15)二、总结与展望1设计总结 (15)2改进方向 (16)三、附录1主程序 (17)2参考资料…………………………………………………………………正文一、方案选择总体方案选择:电热锅炉温度控制系统由核心处理模块、温度采集模块、键盘显示模块、及控制执行模块等组成。

总体方案一:采用8031作为控制核心,以使用最为普遍的器件ADC0809作模数转换,控制上使用对电阻丝加电使其升温和开动风扇使其降温。

此方案简易可行,器件的价格便宜,但8031内部没有程序存储器,需要扩展,增加了电路的复杂性,且ADC0809是8位的模数转换,不能满足本题目的精度要求。

总体方案二:采用比较流行的AT89S51作为电路的控制核心,使用12位的高精度模数转换器AD574A进行数据转换,控制电路部分采用PWM控制可控硅的通断以实行对锅炉温度的连续控制,此方案电路简单并且可以满足题目中的各项要求的精度。

综上分析,我们采用方案二。

系统设计总体框图如下:图1 控制器设计总体框图根据温度变化慢,并且控制精度不易掌握的特点,我们设计了以STC89C51单片机为检测控制中心的电热锅炉温度自动控制系统。

温度控制采用改进的PID数字控制算法,显示采用3位LED静态显示。

该设计结构简单,控制算法新颖,控制精度高,有较强的通用性。

所设计的控制系统有以下功能:·温度控制设定波动范围小于±1%,测量精度小于±1%,控制精度小于±2%,超调整量小于±4%;·实现控制可以升温也可以降温;·实时显示当前温度值;·按键控制:设置复位键、运行键、功能转换键、加一键、减一键;·越限报警。

方案一1、带死区的PID算法某些生产过程对控制精度要求不是很高但希望系统工作稳定,执行机构不要频繁动作。

针对这一类系统,带死区的PID算法应运而生。

所谓带死区的PID,实在计算机中认为的设置一个不灵敏区域β,当偏差的绝对值|e(k)|<β时,不产生新的控制增量,控制量维持不变;当偏差的绝对值|e(k)|>β时,则进行正常的PID运算后输出。

带死区的PID控制算法为:0 (|e(k)|< β)∆u(k)={ Kp[e(k)-e(k-1)]+Kie(k)+Kd[e(k)-2e(k-1)+e(k-2)] (|e(k)|> β)-β-β是一个人为设置的死区,β是一个可调参数,其值根据具体对象由实验确定或者根据经验确定,这种控制方式适用于控制精度不太高,控制动作尽可能少的场合。

其控制特性在VC++中测得一组控制特性曲线如下图:图2带死区的PID控制特性曲线返回u(k) u(k-1)e(k-1) e(k-2) e(k) e(k-1)输出u(k)u(k)=u(k-1)+∆u(k)∆u(k)=Kp[e(k)-e(k-1)]+Kie(k)+Kd[e(k)-2e(k-1)+e(k-2)]|e(k)|> βe(k)= r(k)- c(k)采样r(k)、c(k)初始化2、算法程序流程图3、软件设计在主程序中首先由vc测出PID算法的参数值,然后通过循环显示当前温度,并且设定键盘外部中断为最高优先级,以便能实时响应键盘处理;软件设定定时器T0为5秒定时,在无键盘响应时每隔5秒响应一次,以用来采集经过A/D转换的温度信号;设定定时器T1为嵌套在T0之中的定时中断,初值由PID算法子程序提供。

相关主题