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: 35kV变电站监控系统中告警事件生成与语音告警软件设计(11):http://www.751com.cn/zidonghua/lunwen_7940.html