资源描述:
《WINCC读写记事本创建工艺配方全局脚本源码实例.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、WINCC读写记事本创建工艺配方全局脚本源码实例voidfjgy_save()//将数据写到记事本中{FILE*fp;inti;inta;intxx[27];floatyy[85];charch[40];charch1[40];charzz[9][40];sprintf(ch,"fjgy%s.txt",GetTagChar("发酵工艺名称"));//返回类型:char*remove(ch);fp=fopen(ch,"wb");{for(i=1;i<10;i++){sprintf(ch1,"设定检测时间_%d",i);a=i-1;xx[
2、a]=GetTagWord(ch1);sprintf(ch1,"温度参考点_%d",i);a=i+8;xx[a]=GetTagWord(ch1);sprintf(ch1,"1#罐段时间设定_%d",i);a=i+17;xx[a]=GetTagWord(ch1);sprintf(ch1,"阀最大输出_%d",i);a=i-1;yy[a]=GetTagFloat(ch1);sprintf(ch1,"主控死区_%d",i);a=i+8;yy[a]=GetTagFloat(ch1);sprintf(ch1,"底温控制偏差_%d",i);a=i+17
3、;yy[a]=GetTagFloat(ch1);sprintf(ch1,"阀1比例_%d",i);a=i+26;yy[a]=GetTagFloat(ch1);sprintf(ch1,"阀2比例_%d",i);a=i+35;yy[a]=GetTagFloat(ch1);sprintf(ch1,"1#罐段温度设定_%d",i);a=i+44;yy[a]=GetTagFloat(ch1);sprintf(ch1,"温控提前量_%d",i);a=i+53;yy[a]=GetTagFloat(ch1);sprintf(ch1,"压力设定_%d",i)
4、;a=i+62;yy[a]=GetTagFloat(ch1);sprintf(ch1,"压力偏差_%d",i);a=i+71;yy[a]=GetTagFloat(ch1);sprintf(ch1,"工艺段%d参数名",i);a=i-1;strcpy(zz[a],GetTagChar(ch1));}yy[81]=GetTagFloat("1#罐段温度设定_10");yy[82]=GetTagFloat("P_1");yy[83]=GetTagFloat("I_1");yy[84]=GetTagFloat("D_1");fwrite(xx,si
5、zeof(int),27,fp);fwrite(yy,sizeof(float),85,fp);fwrite(zz,40,9,fp);fclose(fp);}voidfjgy_upload()//从记事本中读取{FILE*fp;inti;inta;intxx[27];floatyy[85];charzz[9][40];charch[40];charch1[40];sprintf(ch,"fjgy%s.txt",GetTagChar("发酵工艺名称"));//返回类型:char*fp=fopen(ch,"rb");{fseek(fp,0L,S
6、EEK_SET);fread(xx,sizeof(int),27,fp);fread(yy,sizeof(float),85,fp);fread(zz,40,9,fp);for(i=1;i<10;i++){sprintf(ch1,"设定检测时间_%d",i);a=i-1;SetTagWord(ch1,xx[a]);sprintf(ch1,"温度参考点_%d",i);a=i+8;SetTagWord(ch1,xx[a]);sprintf(ch1,"1#罐段时间设定_%d",i);a=i+17;SetTagWord(ch1,xx[a]);
7、sprintf(ch1,"阀最大输出_%d",i);a=i-1;SetTagFloat(ch1,yy[a]);sprintf(ch1,"主控死区_%d",i);a=i+8;SetTagFloat(ch1,yy[a]);sprintf(ch1,"底温控制偏差_%d",i);a=i+17;SetTagFloat(ch1,yy[a]);sprintf(ch1,"阀1比例_%d",i);a=i+26;SetTagFloat(ch1,yy[a]);sprintf(ch1,"阀2比例_%d",i);a=i+35;SetTagFloat(ch1,yy[a
8、]);sprintf(ch1,"1#罐段温度设定_%d",i);a=i+44;SetTagFloat(ch1,yy[a]);sprintf(ch1,"温控提前量_%d",i);a