毕业论文-PID水温控制系统的设计与实现21148.doc

上传人:爱问知识人 文档编号:3939385 上传时间:2019-10-10 格式:DOC 页数:35 大小:886.02KB
返回 下载 相关 举报
毕业论文-PID水温控制系统的设计与实现21148.doc_第1页
第1页 / 共35页
毕业论文-PID水温控制系统的设计与实现21148.doc_第2页
第2页 / 共35页
毕业论文-PID水温控制系统的设计与实现21148.doc_第3页
第3页 / 共35页
毕业论文-PID水温控制系统的设计与实现21148.doc_第4页
第4页 / 共35页
毕业论文-PID水温控制系统的设计与实现21148.doc_第5页
第5页 / 共35页
点击查看更多>>
资源描述

《毕业论文-PID水温控制系统的设计与实现21148.doc》由会员分享,可在线阅读,更多相关《毕业论文-PID水温控制系统的设计与实现21148.doc(35页珍藏版)》请在三一文库上搜索。

1、XXX 大学本科毕业设计 I XXXXXXXX 大学本科毕业设计大学本科毕业设计 PIDPID 水温控制系统水温控制系统 学生姓名学生姓名 所所 在在 系系 专业名称专业名称 班班 级级 学学 号号 指导教师指导教师 XXX 大学本科毕业设计 II PIDPID 水温控制系统水温控制系统 摘要:摘要:随着社会主义现代化的发展,在科学技术突飞猛进的今天,人工智能起不不可忽 视的作用。尤其是各种智能化的仪器、仪表在农、工业的广泛应用给社会带来了极大的 便利。本文从温控模型和特点出发,采用以单片机 PIC16F877 为核心,用 AD7416 数字温 度传感器进行测量温度。以 PID 算法控制温度,

2、并对温度进行良好的精度控制。本系统 的多个部件如,定时器,加热开关,按键设置水温,实时显示温度,控制温度和报警保温 等功能等都可利用单片机来实现。文章着重介绍核心器件的选择、温度控制系统分析、 各部份电路及软件的设计。它具有结构简单、可靠性好,抗干扰能力强、实现容易,成 本低,具有实用价值等特点。它提供了一个通过温度来控制设备的基本思想和原理,相 信能在实际应用中为我们的生活带来更大的便利。 关键词:关键词:单片机 数字温度传感器 PID 温度控制 XXX 大学本科毕业设计 III PID-based temperature control system Abstract:Along with

3、 the development of socialist modernization, rapid progress in science and technology today, not artificial intelligence from the role that can not be overlooked. Especially the variety of intelligent instruments, meters in the agricultural, industrial society to the broad application brought great

4、convenience. In this paper the characteristics of the model and temperature control, the introduction of SCM PIC16F877 at the core, with AD7416 digital temperature sensor to measure the temperature. PID algorithm to control the temperature , and temperature control for good accuracy. Many parts of t

5、he system such as, timers, heating switches, buttons installed water temperature, real-time display of temperature, temperature control and alarm functions, such as insulation SCM can be used to achieve. The article highlights the core device of choice, temperature control system, part of the circui

6、t and software design. It has a simple structure, reliability, and strong interference capability to achieve easy, low cost, has practical value, and other characteristics. It provides a temperature controlled equipment through the basic ideas and principles, I believe in the practical application o

7、f our life more convenient. Keywords: microcomputer digital temperature PID temperature control XXX 大学本科毕业设计 IV 目 录 一、前 言.1 (一)设计任务及要求1 (二)方案的比较与选择2 二、总体设计.2 (一)系统总体设计2 (二)单元电路的功能原理分析7 (三)发挥部分设计8 三、系统软件设计.9 (一)程序的主流程图9 (二)各个功能模块流程10 四、系统测试与调试.14 (一)电路测试14 (二)仪器的使用15 (三)测试的结果15 (四)发挥部分测试15 五、结 论.15 致

8、 谢.16 附 录.17 附录一 设计总电路图17 附录二 设计 PCB 图.18 附录三 设计 3D 图.19 附录四 程序清单20 参考文献.28 XXX 大学本科毕业设计 1 一、前一、前 言言 (一)设计任务及要求 本文介绍的是一个由 PIC16F877 为核心的单片机制作的一个水温控制器。实现温度 控制系统的设计过程,其中涉及系统结构设计、元器件的选取和控制控制算法的选择、 和整体电路的设计以及部分电路的设计。在系统构建时选取了数字温度传感器 AD7416 测量温度,基于 PID 温度控制方式实现温度控制。系统设计水温可以在一定范围内由人 工设定,并能在环境温度降低时实现自动控制,以

9、保持设定的温度基本不变;能在 40 摄 氏度至 90 摄氏度范围内设定控制水温,静态控制精度为 0.2 摄氏度;具有较好的快速性 与较小的超调等功能。 自 70 年代以来,由于工业过程控制的需要,特别是在微电子技术和计算机技术的迅 猛发展,以及自动控制理论和设计方法发展的推动下,国外温度控制系统发展迅速,并 在智能化自适应参数自整定等方面取得成果。在这方面以日本、美国、德国、瑞典等国 技术领先,并且都生产出了一批商品化的性能优异的温度控制器及仪器仪表,目前,国 外温度控制系统及仪表正朝着高精度智能化、小型化等方面快速发展。 温度控制是无论是在工业生产过程中,还是在日常生活中都起着非常重要的作用

10、, 过低的温度或过高的温度都会使水资源失去应有的作用,从而造成水资源的巨大浪费。 特别是在当前全球水资源极度缺乏的情况下,我们更应该掌握好对水温的控制,把身边 的水资源好好地利用起来。 在现代冶金、石油、化工及电力生产过程中,温度是极为重要而又普遍的热工参数 之一。在环境恶劣或温度较高等场合下,为了保证生产过程正常安全地进行,提高产品 的质量和数量,以及减轻工人的劳动强度、节约能源,要求对加热炉炉温进行测、显示、 控制,使之达到工艺标准,以单片机为核心设计的炉温控制系统,可以同时采集多个数 据,并将数据通过通讯口送至上位机进行显示和控制。那么无论是哪种控制,我们都希 望水温控制系统能够有很高的

11、精确度(起码是在满足我们要求的范围内) ,帮助我们实现 我们想要的控制,解决身边的问题提高人民的生活水平。 通过本方案的设计,使本系统具有设置水温、实时显示温度,控制温度和报警保温 等功能,它具有结构简单、实现容易,成本低,具有实用价值等特点。而且还可以根据 自己的需要来进行扩展,具有灵活使用的优点。 1. 基本要求 具备测量与控制两种工作方式; XXX 大学本科毕业设计 2 测量误差SetPoint*10 - NextPoint; / 偏差 pp-SumError += Error; / 积分 dError = pp-LastError - pp-PrevError; / 当前微分 pp-P

12、revError = pp-LastError; pp-LastError = Error; return (pp-Proportion * Error / 比例项 + pp-Integral * pp-SumError / 积分项 + pp-Derivative * dError / 微分项 ); XXX 大学本科毕业设计 14 N 初始化 开始 结束结束 计算 E 一次启动? C=0 计算 C 记录当温 计算 U 返回 U 图 11 温度控制框图 5其他功能模块 数据处理、保温、定时计数等其他功能程序都根据程运行时间进行了统筹设计,在此 不再进行详述。 四、系统测试与调试四、系统测试与调试

13、 (一)电路测试 电路焊接无误后,先将数字温度传感器放到水里,LED 会显示出当前水的温度,再 放一支标准温度计与之比较,若几乎相等,则说明电路无误;再设定目标温度,若可以 自动加热,使达到目标温度,则说明电路测试无误,实验可以正常进行。 XXX 大学本科毕业设计 15 (二)仪器的使用 首先连接好相应的电源线,将温度计和传感器放在水里,此时数码管会显示出当前 温度值,用户可以根据需要设定目标温度值,按下加热开关可开始加热。当温度达到你 所想要的温度时,系统会自动断电,接着系统它又会进入保温系统,进行保温。 (三)测试的结果 根据测试得到的部分实验数据如表 5-1:实验数据验证说明,测量误差为

14、 0.3控制 误差为 0.4,因此本系统的设计不管是在采样控制显示温度,还是在实时处理显示精度 上,都取得了理想的效果。 表 2 数据测量表 当前温度值20.520.53040506050.5131180 目标温度值60304050708060402090 精确温度值60.330.240.250.070.580.160.34020.389.9 实测温度值60.430.340.249.870.480.260.240.220.290.2 测量精度0.10.100.20.10.10.10.20.10.3 控制精度0.40.30.20.20.40.20.20.20.20.2 (四)发挥部分测试 当温度

15、达到目标温度后,系统会自动报警提醒用户。这时候,系统会进入保温状态。 温度时温度达到的最高温度与目标温度的差值只有 0.3 的误差。 五、结五、结 论论 本次实验采用了 PICC 编程方式,实现了温度的测量与控制,完全达到了本次实验 的要求,更重要的是该实验的测量误差小于 0.3度,控制误差小于 0.4度,已基本实 现本实验扩展部分的要求。它可以广泛用于温度测量精度要求比较高的场面,实现简单, 成本低。综上所示,本系统的方案具有实用推广价值。本系统通过添加一个传感器,将 其贴放在电热杯的内壁上,系统开始加热,若温度迅速上升,则说明杯中水不足,很有 可能为干烧,为不安全加热,用户请注意,这属于该

16、系统需要改进的地方。 XXX 大学本科毕业设计 16 致致 谢谢 通过这次毕业设计,论文基本上掌握了开发一个电子监控控制系统的基本思路和实 施步骤。在设计和论文写作的整个过程中,指导汪光宅教授和刘强老师在各方面都给予 了全面的指导和帮助。导师的精深渊博知识、求实创新、勤奋严谨的治学风范、忘我的 工作作风时刻熏陶着我;导师的因材施教、诲人不倦的授业精神给学生留下了深刻的印 象,这将使我受益终身。 在校期间,得到辅导老师的亲切关怀和无私的培养,使我在学习的过程学到了许多 做人的道理。在此我向他们道声:您们辛苦了! 感谢四川师范大学成都学院的老师们多年来在工作、学习上给予的热情关怀、指导 与帮助。

17、另外,互联网上一些朋友也给我完成设计提出了很多宝贵的意见和无私的帮助。这 对于我以后的学习和工作都有很大的帮助,在此对他们表示由衷的感谢。 特别感谢我的姐姐对我的默默奉献,在学习上的理解和大力支持!感谢父母及家人 多年来的在生活和学习上的鼓励和支持! XXX 大学本科毕业设计 17 附附 录录 附录一 设计总电路图 XXX 大学本科毕业设计 18 附录二 设计 PCB 图 XXX 大学本科毕业设计 19 附录三 设计 3D 图 XXX 大学本科毕业设计 20 附录四 程序清单 #include /头文件 unsigned char s14,s24; /采集温度数据并存储到两个数组中,高字节存到

18、 S1 中,低字节存到 S2 中 unsigned int counter1,counter2,figure1=2,figure2,flag2; /定时器,目标温度,标志位申明 unsigned int num1,num2,flag1=0,i,j,m; /采集温度数据 num1:整数位,num2:小数位,启动标志位 flag1 及延时变量申明 double y,temp,e,c,t,u,k;/模糊控制参数申明 const char table10 =0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f; /不带小数点笔段码 const char t

19、able010 =0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef; /带小数点笔段码 /*系统 I/O 端口初始化子程序*/ void INITIAL() OPTION=0X0F; ADCON1=0X07;/设定 RA 口为变通数字端口 TRISD=0; TRISB=0; PORTD=0; PORTB=0; TRISA2=1; TRISA3=1; TRISC0=0; TRISA0=0; TRISA1=0; TRISC1=0; RC0=0; RC1=0; RA0=0; RA1=0; /tmr1 初始化子程序 void tmr1int() TMR

20、1IF=0; PEIE=1; TMR1IE=1; T1CON=0X30; /tmr2 初始化子程序 void tmr2int() XXX 大学本科毕业设计 21 TMR2IF=0; PEIE=1; TMR2IE=1; T2CON=0X7B; PR2=255; /i2c 初始化子程序 void i2cint() SSPCON=0X08;/初始化 sspcon 寄存器 TRISC3=1;/设置 scl 为输入口 TRISC4=1; /设置 sda 为输入口 SSPSTAT=0X80;/初始化 sspstat 寄存器 SSPADD=19;/设定 i2c 波特率 50khz 频率 SSPCON2=0X

21、00;/初始化 sspcon2 寄存器 di();/关闭总中断 SSPIF=0;/清 ssp 中断标志 SSPEN=1; /ssp 模块使能 /5ms 延时子程序 void delay() for(j=300;-j;) continue; /用户目标温度输出子程序 void ledout() PORTB=tablefigure1; RD7=1; delay(); RD7=0; PORTB=tablefigure2; RD6=1; delay(); RD6=0; PORTB=0X40; RD5=1; delay(); RD5=0; /键盘服务子程序 int keyserve() XXX 大学本科

22、毕业设计 22 RC0=0;RC1=1; if(RA2=0) figure1+=1; RC0=1;RC1=0; if(RA2=0) figure2+=1; if(figure1=10) figure1=2; if(figure2=10) figure2=0; RC0=0;RC1=1; if(RA3=0) flag1=1; RC0=0;RC1=0; i2cin(); display(); while(1) if(RA2=1) i2cin(); /模糊控制算法 float control( ) if(flag2=1) /判断是否第一次启动控制 c=0; /是,则 C 设定为 0; else c=(

23、float)(num1*100+num2)/100-temp;/否,则 C 为当前温度与上一采样温度 之差 u=k*e+(1-k)*c; /模糊控制公式 temp=(float)(num1*100+num2)/100;/记录上一时刻温度值 return u; /返回控制参数 /冒泡从小到大排序算法 void bubblesort(char a,int num) int m,n,flag=1,temp; for(m=1;man+1) flag=1; XXX 大学本科毕业设计 23 temp=an;an=an+1; an+1=temp; /led 显示部分 int display() CLRWDT

24、(); bubblesort(s1,4);/S1 从小到大排序 bubblesort(s2,4);/S2 从小到大排序 num1=(s11+s12)/2; /滤去最大,最小数再求平均值 PORTB=tablenum1/10;/送显 RD4=1; delay(); RD4=0; PORTB=table0(num1-(num1/10)*10); RD3=1; delay(); RD3=0; PORTB=tablenum2/10; RD2=1; delay(); RD2=0; ledout();/目标温度显示 int i2cin() /数据接收子程序 for(i=0;i=(float)(figure

25、1*10+figure2) /判断当前温度是否大于等于目标温度 RA0=1; i2cin(); RA0=0; / 是,则不可控制并报警 else /否,则执行下列程序 while(1) if(float)(num1*100+num2)/100=(float)(figure1*10+figure2- 7) TMR2ON=0; i2cin(); XXX 大学本科毕业设计 26 counter1=0; counter2=0; TMR1H=0; TMR1L=0; TMR2=0; TMR2ON=1; TMR1ON=1; /清除相关寄存器和计数器,并重新打开 flag2+;RA1=1; /控制次数计算器自

26、加,并启动继电器 for(y=control();y0;y=y-0.25) /根据 control()返回的 U 自动修整加热时间 display(); RA1=0; /关闭继电器 while(counter2=(float)(figure1*10+figure2) /判断当前温度是否大于等于目标温度 for(m=40;m-;) i2cin(); /是延时 4S,从而让它稳定 if(float)(num1*100+num2)/100=(float)(figure1*10+figure2) /再次判断当前温度是否真的大于等于目标温度 TMR1ON=0;TMR2ON=0;counter1=0; c

27、ounter2=0; RA1=0;/关闭计算器 while(1) /循环报警 RA0=1; i2cin(); RA0=0; i2cin(); if(float)(num1*100+num2)/100(float)(figure1*10+figure2) /判断当前温度是否小于目标温度 break; /是,则跳出开始控制,即保温 TMR1H=0;TMR1L=0;TMR2=0;TMR1ON=1;TMR2ON=1; /重新开始打开计数器 if(float)(num1*100+num2)/100(float)(figure1*10+figure2-7) /判断当前温度是否小于控制温度外 break;

28、/是,则跳出开始全功率加热 else XXX 大学本科毕业设计 27 RA1=1;i2cin();/全功率加热子程序 flag1=0;i2cin(); /清出启动标示位并采样数据 XXX 大学本科毕业设计 28 参考文献参考文献 1 窦振中. PIC 系列单片机原理和程序设计,北京:北京航空航天大学出版社 2 李学海. PIC 单片机原理, PIC 单片机实用教程北京:航空航天大学出版社陈尔绍. 电子控制电路实 例,电子工业出版社 3 陈新建. PIC 单片机 C 语言开发入门,北京:航空航天大学出版社 4 刘瑞新. 汪远征,李凤华. Delphi 程序设计教程 ,北京:机械工业出版社出版 5

29、 左美云. 邝孔武. 信息系统的开发与管理教程 ,北京:清华大学出版社 6 朱振元. 一个面向对象应用程序的设计与实现, 计算机应用 g an employment tribunal claim Employment tribunals sort out disagreements between employers and employees. You may need to make a claim to an employment tribunal if: you dont agree with the disciplinary action your employer has take

30、n against you your employer dismisses you and you think that you have been dismissed unfairly. For more information about dismissal and unfair dismissal, see Dismissal. You can make a claim to an employment tribunal, even if you havent appealed against the disciplinary action your employer has taken

31、 against you. However, if you win your case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal. Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are complaining about happ

32、ened. If your application is received after this time limit, the tribunal will not usually accept it. If you are worried about how the time limits apply to you, take advice from one of the organisations listed under Further help. Employment tribunals are less formal than some other courts, but it is

33、 still a legal process and you will need to give evidence under an oath or affirmation. Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed un

34、der Further help. If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win the case. This is known as a damages-based agreement. In England and Wales, your solicitor cant charge you more than 35% of

35、 your compensation if you win the case. If you are thinking about signing up for a damages-based agreement, you should make sure youre clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at a Citizens Advice Bureau. To find your nearest CA

36、B, including those that give advice by e-mail, click on nearest CAB. For more information about making a claim to an employment tribunal, see Employment tribunals. The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifas anti-racism taskforce, is in London for the Football Asso

37、ciations 150th anniversary celebrations and will attend Citys Premier League match at Chelsea on Sunday. XXX 大学本科毕业设计 29 “I am going to be at the match tomorrow and I have asked to meet Yaya Toure,“ he told BBC Sport. “For me its about how he felt and I would like to speak to him first to find out w

38、hat his experience was.“ Uefa has opened disciplinary proceedings against CSKA for the “racist behaviour of their fans“ during Citys 2-1 win. Michel Platini, president of European footballs governing body, has also ordered an immediate investigation into the referees actions. CSKA said they were “su

39、rprised and disappointed“ by Toures complaint. In a statement the Russian side added: “We found no racist insults from fans of CSKA.“ Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of the same day; May be back i

40、n the past, to oneself the paranoid weird belief disillusionment, these days, my mind has been very messy, in my mind constantly. Always feel oneself should go to do something, or write something. Twenty years of life trajectory deeply shallow, suddenly feel something, do it. 一字开头的年龄已经到了尾声。或许是愧疚于自己似

41、乎把转瞬即逝的很多个不同的日子过成了同 一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌 乱,在脑海中不断纠缠。总觉得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深 深浅浅,突然就感觉到有些事情,非做不可了。 The end of our life, and can meet many things really do? 而穷尽我们的一生,又能遇到多少事情是真正地非做不可? During my childhood, think lucky money and new clothes are necessary for New Year, b

42、ut as the advance of the age, will be more and more found that those things are optional; Junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumni in peace, suddenly found that isnt really grow up, it seems is not so i

43、mportant; Then in high school, think dont want to give vent to out your inner voice can be in the high school children of the feelings in a period, but was eventually infarction when graduation party in the throat, later again stood on the pitch he has sweat profusely, looked at his thrown a basketb

44、all hoops, suddenly found himself has already cant remember his appearance. 童年时,觉得压岁钱和新衣服是过年必备,但是随着年龄的推进,会越来越发现,那些东西根本 就可有可无;初中时,以为要有一场暗恋才意味着真正的成长,但三年过去后,自己心平气和的写同 学录的时候,突然就发现是不是真正的成长了,好像并没有那么重要了;然后到了高中,觉得非要吐 露出自己的心声才能为高中生涯里的懵懂情愫划上一个句点,但毕业晚会的时候最终还是被梗塞在了 咽喉,后来再次站在他曾经挥汗如雨的球场,看着他投过篮球的球框时,突然间发现自己已经想不起 他

45、的容颜。 Originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time. 原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。 A persons time, your ideas are always special to clear. Want, want, line is clear, as if nothing could shake his. Also once seemed to be

46、determined to do something, but more often is he backed out at last. Dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. Those who do, just green years oneself give oneself an arm injection, or is a self-righteous spiritual

47、. 一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以 撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自 XXX 大学本科毕业设计 30 己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做 不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。 At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid s

48、hirt; Those were broken into various shapes of stationery; From the corner at the beginning of deep friendship; Have declared the end of the encounter that havent start planning. Those years, those days of do, finally, like youth, will end in our life. 此刻,天空是阴暗的,空气里有着刚下过雨之后的清新因子。突然想到那件蓝格子衬衫;那些被 折成各种各样形状的信纸;那段从街角深巷伊始的友谊;还有那场还没有开始就宣告了终结的邂逅计 划那些年那些天的非做不可,终于和青春一样,都将在我们的人生中谢幕。 Baumgartner the disappointing news: Mission aborted. r plays an important role in this mission. Starting at the ground, conditions have to be very ca

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1