基于涡流流量传感器的流量测量系统设计

2012-08-10 16:58:15   来源:21ic   

关键字: 传感器  锁相倍频  流量测量

|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->

  1.硬件电路

  如图13所示为基于涡流流量传感器流量测量系统设计原理图。本次实验中,我们将P1.0作为输入,接涡流流量传感器的输出,为了提高流量的测量精度,我们将P0口和P2口作为倍频数输入,在不同的流量情况下,我们选择不同的倍频数。显而易见,当所测流量较大时,我们所选的倍频数就相应减小,精度就相应降低;反之亦然。本次实验中,我们利用P1.7仅实现验证倍频正确与否。

基于涡流流量传感器的流量测量系统设计原理图 

图12 基于涡流流量传感器的流量测量系统设计原理图

  2.电路原理

  具体实现过程:

  (1)利用P1.0信号的电平变化和定时器T0实现输入信号的周期测定:置定时器T0为方式0定时,在P1.0上升沿到来之前,启动定时器T0开始对内部时钟进行计数,在下一个P1.0上升沿到来之后,关闭定时器T0,读取计数值M,来启动下一次定时过程。输入信号周期为:

公式

  (4)输出信号不仅要倍频,而且应与输入信号同相,即在输入信号的上升沿时刻应同时出现倍频输出信号的上升沿。在模拟电路中,自动相位同步的实现是由锁相环电路来实现的,它通过对输入输出信号的鉴相和闭环调整来逐步达到同步目的。在数字电路中,同步锁相可通过控制输出信号相对于输入信号的起始点来实现。为此,同步以一个输入信号周期为时段,在输入信号每个上升沿时刻,启动定时器T1并使P1.7输出高电平,而在定时器T1产生了(2N-1)个定时中断之后,关闭定时器T1,并使P1.7输出低电平,等待下一个时段的同步时刻。

  3.实验流程

锁相倍频程序流程图

图13锁相倍频程序流程图

  综上所述,涡流流量传感器测得的流量Q即为P1.7输出的脉冲频率f0除以分频数与48.67的乘积,即Q=f0/(48.67*N)。

本网站转载的所有的文章、图片、音频视频文件等资料的版权归版权所有人所有,本站采用的非本站原创文章及图片等内容无法一一联系确认版权者。如果本网所选内容的文章作者及编辑认为其作品不宜公开自由传播,或不应无偿使用,请及时通过电子邮件或电话通知我们,以迅速采取适当措施,避免给双方造成不必要的经济损失。