大型货车超载超速实时检测系统

时间:2014-04-18来源:网络

Void BeforeTheStateDidNotExercise(float* parameter,float weight,int *countR,int *countW)

{

(*countR)++;

if(*countR>=17)

*countR=0;

if(weight>M)

{

(*countW)++;

if(*countW>=12)

{

*parameter=0;

*countW=0;

overloadAlarm();//启动报警

}

}

}

运动中超载处理程序:

void campaignStatus(float* parameter,float weight,int *countR,int *countW,clock_t *start)

{

if(* parameter!=1)

(*countR)++;

momentNow();//记录当前时间

*start=clock();

t1recordTheCurrenttime();//记录当前时间

if(weight>M)

(*countW)++;

if(*countR>=100)

{

if( *countW>=70)

{

overloadAlarm();//启动报警

* parameter=1;

}

*countR=0;

*countW=0;

}

}

运动后停车超载处理:

void afterStoppingState(float* parameter,float weight,int *countR,int *countW,clock_t *finish)

{

(*countR)++;

//记录当前时间t2

*finish=clock();

if(weight>M)

(*countW)++;

if(*countR>=100)

{

if(*countW30)

{

*parameter=-1;

sendRelevantInformationToTheHost(countW,countR);// 发送相关信息到主机

}

*countR=0;

*countW=0;

}

}

//根据速度和参数K和parameter确定车体状态

void carStatus(float speed,float* parameter,float weight,int *countR,int *countW)

{

//超载持续时间

clock_t start, finish;

double duration;

if(speed==0)

{

if(*parameter=0)

BeforeTheStateDidNotExercise(parameter,weight,countR,countW);

else

afterStoppingState(parameter,weight,countR,countW,clock_t finish);

}

else

campaignStatus(parameter,weight,countR,countW,clock_t start);

//超重持续时间

duration = (double)(finish - start) / CLOCKS_PER_SEC;

printf( %f secondsn, duration );

}

//获取当前时间

int momentNow(void)

{

time_t t;

t=time(0);

local=localtime(t);

printf( %d-%d-%dn%d:%d:%dn,local->tm_year+1900,local->tm_mon,local->tm_mday,local->tm_hour,local->tm_min,local->tm_sec);

return 0;

}

4.2 获取速度模块设计

4.2.1 硬件设计

本方法采用测量一个转盘的转速间接地测出货车的速度,因此转盘要与货车的转轴相连,转盘的转速与车轴的转速成一定的关系。将转盘等分为四等份,在每等份的分界线上安装一块磁钢,如图4.2所示。

图4.5 测速硬件原理

霍尔开关的VCC端接5~12V直流电源,OUT端接到SPCE061A的IOB3(外部中断2输入口)[27],另一端接公共地。每次磁钢经过霍尔开关下方时,OUT端都会产生一个脉宽的负脉冲。

1 2 3 4 5 6 7 8 9 10 11 12 13

关键词: 超载检测 超速检测 霍尔开关 ARM9

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW

或用微信扫描左侧二维码

相关文章

查看电脑版