MessageBox(NULL, L"打开Analog_data.txt出错", L"ERROR", MB_OK);
//若打开出错,则弹出对话框提示出错
else if(stream_Analog)
{
fseek( stream_Analog, 0L, SEEK_SET ); // 将文件指针指定位置
while((! fs_Analog.eof())&&Num_Analog_Data<Analog_MAX_NUM)
{ //一行一行循环读入,直至文件读完
fscanf_s(stream_Analog,"%s", Analog[Num_Analog_Data].devName, _countof( Analog[Num_Analog_Data].devName));//所属设备编码数据
fscanf_s(stream_Analog,"%s", Analog[Num_Analog_Data].name, _countof( Analog[Num_Analog_Data].name));//变量监测点代码
fscanf_s(stream_Analog,"%s", Analog[Num_Analog_Data].desc, _countof( Analog[Num_Analog_Data].desc));//变量描述
fscanf_s(stream_Analog,"%d", &Analog[Num_Analog_Data].type);//变量类型
fscanf_s(stream_Analog,"%f", &Analog[Num_Analog_Data].uLimit1);//一级上限值
fscanf_s(stream_Analog,"%f", &Analog[Num_Analog_Data].dLimit1);//一级下限值
fscanf_s(stream_Analog,"%f", &Analog[Num_Analog_Data].uLimit2);//二级上限值
fscanf_s(stream_Analog,"%f", &Analog[Num_Analog_Data].dLimit2);//二级下限值
fscanf_s(stream_Analog,"%f", &Analog[Num_Analog_Data].coef);//变量系数 fscanf_s(stream_Analog,"%d", &Analog[Num_Analog_Data].soundFlag);//告警标志
fscanf_s(stream_Analog,"%d", &Analog[Num_Analog_Data].comChannel);//通信频道号 fscanf_s(stream_Analog,"%d", &Analog[Num_Analog_Data].comNo);//通信编号
fscanf_s(stream_Analog,"%f", &Analog[Num_Analog_Data].sim_ref);//仿真基准值
fscanf_s(stream_Analog,"%f", &Analog[Num_Analog_Data].sim_coef);//仿真系数
Num_Analog_Data++;
}
fclose( stream_Analog );
}
return TRUE;
}
3.4.2 语音播报线程的建立
如下如下为线程创建程序和线程服务程序代码
int ThreadProcTest(LPVOID lpParameter)
{
while(glThreadFlag)//线程运行标志
{
Read_Alarm();//语音播报子程序
Sleep(1000);
}
return 0;
}
int CreateAppThreadTeat() //线程构建函数
{
SECURITY_ATTRIBUTES secAttr;
DWORD id=0;
secAttr.nLength = sizeof(SECURITY_ATTRIBUTES); //长度
secAttr.bInheritHandle = false; //继承句柄
secAttr.lpSecurityDescriptor = NULL; //安全描述
glAppTreadHandle = CreateThread(&secAttr,0,(LPTHREAD_START_ROUTINE)ThreadProcTest,NULL,0,&id); //创建线程句柄
return 0;
}
3.5 告警生产算法
3.5.1 模拟量
模拟量告警事件生成算法的数据传递如图3.4:
- 上一篇:AT89S51单片机的车载应答器设计方案
- 下一篇:89C52单片机LED点阵视屏动画显示系统设计
-
-
-
-
-
-
-
杂拟谷盗体内共生菌沃尔...
十二层带中心支撑钢结构...
当代大学生慈善意识研究+文献综述
中考体育项目与体育教学合理结合的研究
河岸冲刷和泥沙淤积的监测国内外研究现状
大众媒体对公共政策制定的影响
乳业同业并购式全产业链...
电站锅炉暖风器设计任务书
java+mysql车辆管理系统的设计+源代码
酸性水汽提装置总汽提塔设计+CAD图纸