毕业论文(设计)基于Visual Basic 的微机线路保护实验台远程监控软硬件设计.doc
基于Visual Basic的微机线路保护实验台远程监控软硬件设计何桂雄,晁勤,李凤婷(新疆大学电气工程学院,乌鲁木齐,830008)摘要: 通过一定的软硬件设计,提出了一种将现有的多台独立微机线路保护实验台借助Visual Basic平台与计算机联网的方法。在所编制监控软件环境下,充分运用计算机的数据处理和数据存储能力,实现了继电保护室的网络化和四遥功能,在继电保护整定计算等电力系统软件与实验装置间构建了桥梁,把实验室模拟成变电站自动化实时控制系统现场。关键词: Visual Basic;微机保护;远程监控; 串口通讯The Hardware -Software Design concerning Remote Monitoring of Computer Line Protection Experiment Platform Based on Visual BasicHe Gui-xiong, Chao Qin(College of Electrical Engineering , Xinjiang University ,Urumqi ,830008)Abstract:A new approach was presented in the present paper concerning how to connect to the computer network the existing multiple independent microcomputer line protection experiment platform based on Visual Basic with the help of certain software and hardware design. In the pre-set monitoring software environment, by making full use of computer data processing and data storage capacity, a network of relay rooms was established, four remote functions realized, and a bridge built between the power system and the experimental devices. It was realized through such a method the simulation of a real-time control of substation automation system in the laboratory.Keywords : Visual Basic; Computer protection; Remote monitoring; Serial Communication0引言经过几十年的技术创新和技术改造1,继电保护技术已逐步成熟,形成了较为完整的科学体系。未来,继电保护技术势必会朝着微机化、网络化、智能化、以及保护控制、测量和数据通信一体化趋势发展。然而,目前部分高校微机线路保护实验台还是独立的单片机控制形式,不能实现遥调、遥控、遥测、遥信和集中管理功能,缺少与继电保护整定计算、故障分析等电力系统软件的接口平台。笔者通过一定的软硬件设计,提出了一种将现有的多台独立微机线路保护实验台借助Visual Basic平台与计算机联网的方法,充分运用计算机的数据处理和数据存储能力,实现继电保护实验装置的网络化和四遥功能,在电力系统软件与实验装置间构建了平台,使实验室更接近实际的变电站自动化实时控制现场。1微机线路保护实验台远程控制方案及监控网络(硬件结构连接)微机线路保护实验台远程监控网络结新疆教育厅重点项目:XJEDU2004E03构简图如图1所示。其中,工控机的打印机接口连接打印机,串行通讯口COM1口连接RS232转RS485/422的转换器23(COM1口通讯协议为RS232,而单片机通讯口为RS485或RS422,此处使用的是全双工的RS422协议),然后通过四芯屏蔽线串联3台实验设备(每台由2个单片机控制,共计6个单片机)。每个单片机都编有一个唯一的地址(17,18,19,20,21),采用广播、一问一答的方式,在设定的某一个很短的时间内依次与各个单片机进行数据的双向传递。图1 微机线路保护实验台远程监控网络简图2微机线路保护实验台远程监控软件开发设计软件主要通过Visual Basic 语言、89C51单片机汇编语言、数据库软件Access2003以及继电保护整定计算软件来实现。同时,在编写与串口进行数据传送时使用了支持串口通信的PComm 串口通讯函数集。软件编程分PC机通讯、 功能实现45和89C51单片机通讯、 功能实现6两大部分。2.1PC机通讯及功能实现WINDOWS 本身提供了API通讯函数,通过VB可以直接调用这些库中的函数7。VB使用动态链接库DLL(Dynamic Link Libraries),调用DLL 的格式为:Declare Sub 过程名Lib库名Alias别名 ( ByVal 参数As 类型)Declare Function 函数名Lib库名Alias别名 ( ByVal 参数As 类型) As 类型以下为MODULE(模块级)声明中,计算机通讯部分程序:Global Index As IntegerGlobal dantai As IntegerType jihaocomport As Integer End TypeGlobal Const SIO_OK = 0 Declare Function sio_open Lib "PComm.dll" (ByVal Port As Long) As LongDeclare Function sio_FtKermitRx Lib "PComm.dll" ( ByVal Port As Long, ByRef fname As Long, ByVal fno As Long, ByVal func As Long, ByVal key As Long ) As Long限于篇幅,其他功能实现代码从略。2.2单片机通讯及功能实现单片机89C51采用MCS51系列汇编语言编程。它有一个标准的串行口,4种工作方式,其中方式1是标准的10位异步通信方式,10位数据和PC机的标准串口相对应。本系统中89C51串口控制器SCON设置为50H,SM0、SM1为0、1,即为串行工作方式1;REN为1,即允许串口接收;中断允许寄存器IE的开放或禁止所有中断位EA为1,开放或禁止串行通道中断位ES为1,即允许串行口中断。89C51的并行口P0和P2分别作为八位数据的输入和输出口。P3口的输出作为数据锁存器和D/A、A/D的禁止和允许。通讯程序包括主程序、串口初始化程序、中断服务程序、延时及调D/A转换子程序等。限于篇幅,其他功能实现代码从略。3 软硬件功能测试在安装了该软件的非创建软件的计算机上进行各项实验测试,实验证明软硬件均达到了预期目标,具有较高的可靠性和稳定性,以下是部分实验结果。(此处选择了三号台A站结果,其他实验台类似。)图2为软件主控界面,此处首先进行了三号台A、B两站合闸操作,然后模拟A站A、C两相短路,A站III段动作跳闸,与实验台状态一致,如图2所示。(红色表示合闸,绿色表示跳闸。)图2 主控界面图3为软件单台控制界面,在该界面中同样可以显示实验台的运行状态,如线路电流值、电压值、故障类型、开关状态、数据记录等,也可以对单个实验台进行控制与操作。当选择“返回”时,将从单台操作界面返回主控操作界面。模拟系统故障时软件自动锁定并存储故障状态、参数,此时如不清除故障标志,软件将始终显示当前故障状态、参数。图3 单台控制界面图4为阻抗整定值管理界面,通过这个界面可以修改和查询设备的电流整定值、时间整定值、阻抗整定值等参数,编号即设备编号。当选择“缺省”时将对所有参数给定默认初值,当选择“计算”时将进入继电保护整定计算窗口,如图5所示。(电流整定值管理界面与此同。)图4 阻抗定值管理界面图5 整定计算界面图6为A站电压电流波形显示界面,可实时显示电流整定值、当前电压值、当前电流值,通过动态界面有助于加深对继电保护原理的理解,再现故障过程。图6 电流波形显示界面4 结论本文采用Visual Basic编程工具及一定硬件设计,实现了微机保护实验室网络化,相对原有条件主要有以下几方面改进:(1)实现网络化后,不仅可以进行硬件操作,还可以通过计算机软件进行远程控制和操作,实现故障再现和四遥功能。(2)采用动画构图、计算机实时采样、数据库管理运行状态及参数,可以随时查阅、调用、报表输出相应的运行参数、特性曲线,更直观且避免了人为读数误差和记录差错。(3)实验设备对电压、电流等运行参数的检测是采用机械式仪表,做短路实验时指针瞬间指向最大值,跳闸后又指向最小值,变化迅速难以准确读取数据。而采用计算机监控后能将实时数据以数字的形式显示出来,并自动存储故障瞬间的动作值及运行状态。(4)在所编制的软件环境下,可方便的调用继电保护整定计算程序,实现电力系统软件与实验台间的数据传递,把实验室模拟成变电站自动化实时监控系统。同时,为下一步Matlab与实验台间实现微机保护判据、算法的研究奠定了基础。参考书目及资料1施永梅微机继电保护的现状与发展J电世界,2007,48(3)2孔峰.微型计算机控制技术M,重庆:重庆大学出版社,2003年3范逸之,廖锦棋.Visual Basic与数字输入输出适配卡控制M.北京.清华大学出版社.2002年9月,3-95. 4 张保会.电力系统继电保护M.北京:中国电力出版社.2005年5michael Floyd .用Visual Basic 开发通信应用程序M.北京.机械工业出版社.1999年3月,12-106.6丁元杰.单片微机原理及应用M.北京:机械工业出版社.2005年7月7龚沛曾.Visual Basic 程序设计教程(6.0版).高等教育出版社.2000年7月作者简介:何桂雄(1984-),男,湖北黄冈人,硕士研究生,主要研究方向为电力系统稳定运行与控制。E-mail:xjdx2004晁勤( 1959- ),女,湖南宁乡人,教授,硕士、博士研究生导师,主要从事电力系统综合自动化及风力发电技术研究与教学工作。Editor's note: Judson Jones is a meteorologist, journalist and photographer. He has freelanced with CNN for four years, covering severe weather from tornadoes to typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to huddle around a shortwave radio and through the crackling static from space hear the faint beeps of the world's first satellite - Sputnik. I also missed watching Neil Armstrong step foot on the moon and the first space shuttle take off for the stars. Those events were way before my time.As a kid, I was fascinated with what goes on in the sky, and when NASA pulled the plug on the shuttle program I was heartbroken. Yet the privatized space race has renewed my childhood dreams to reach for the stars.As a meteorologist, I've still seen many important weather and space events, but right now, if you were sitting next to me, you'd hear my foot tapping rapidly under my desk. I'm anxious for the next one: a space capsule hanging from a crane in the New Mexico desert.It's like the set for a George Lucas movie floating to the edge of space.You and I will have the chance to watch a man take a leap into an unimaginable free fall from the edge of space - live.The (lack of) air up there Watch man jump from 96,000 feet Tuesday, I sat at work glued to the live stream of the Red Bull Stratos Mission. I watched the balloons positioned at different altitudes in the sky to test the winds, knowing that if they would just line up in a vertical straight line "we" would be go for launch.I feel this mission was created for me because I am also a journalist and a photographer, but above all I live for taking a leap of faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to do this, Felix Baumgartner, must have that same feeling, at a level I will never reach. However, it did not stop me from feeling his pain when a gust of swirling wind kicked up and twisted the partially filled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre balloon, with skin no thicker than a dry cleaning bag, scraped the ground I knew it was over.How claustrophobia almost grounded supersonic skydiverWith each twist, you could see the wrinkles of disappointment on the face of the current record holder and "capcom" (capsule communications), Col. Joe Kittinger. He hung his head low in mission control as he told Baumgartner the disappointing news: Mission aborted.The supersonic descent could happen as early as Sunday.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause), he can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here, "Fearless Felix" will unclip. He will roll back the door.Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, he'll be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end.Skydiver preps for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough to stop him completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes it's not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it won't. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).It might not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way I'd miss this.