C語言采樣程序_第1頁
C語言采樣程序_第2頁
C語言采樣程序_第3頁
C語言采樣程序_第4頁
C語言采樣程序_第5頁
免費預覽已結束,剩余1頁可下載查看

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、# in clude# in clude# in clude# in clude#in clude int j=0;char file name20;float b,c,k;/b為根號下的浮點數(shù)據(jù),d為b的雙浮點數(shù)據(jù),e為(根號*電流),c為e的浮點數(shù)據(jù),h為cos里面的數(shù)據(jù),f為時間周期double d,e,f,h,g;int i=0;float m,s; /s為g的浮點數(shù)據(jù)int q;struct data_typefloat num;data1000;FILE *fp;void mai n() dd: time_t time_s;/*系統(tǒng)時間*struct tm *date_time;/

2、 while (1)/ Sleep(1000);time( &time_s);date_time = localtime(&time_s);COORD RD=0,0;SetCo nsoleCursorPositio n(GetStdHa ndle(STD_OUTPUT_HANDLE),RD);prin tf(%04d/%02d/%02d %02d:%02d:%02d”,date_time-tm_year+1900,date_time-tm_ mon+1,date_time-tm_mday,date_time-tm_hour, date_time-tm_mi n,date_time-tm_sec

3、);/ /*系統(tǒng)時間*int a,b, z;void huitu();prin tf(n*);printf(”歡迎使用n);printf(*nn);/# 常用故障檢測 # printf(”請輸入你的選擇:1數(shù)據(jù)生成2數(shù)據(jù)查看n);scan f(%d, &z);if(z=1)/常用故障檢測的選中prin tf(1三相短路故障n);prin tf(2兩相短路故障n);prin tf(3兩相接地故障n);prin tf(4單相接地故障n);prin tf(5三相斷線故障n);prin tf(6兩相斷線故障n);prin tf( 7 ss: scan f(%d,&a);switch(a)case 1:

4、 prin tf(n單相斷線故障nn您的選擇為:);請輸入PSASP提供的故障參數(shù)”);break;case 2: prin tf(n請輸入PSASP提供的故障參數(shù));break;case 3: prin tf(n請輸入PSASP提供的故障參數(shù));break;case 4: prin tf(n請輸入PSASP提供的故障參數(shù));break;case 5: prin tf(n請輸入PSASP提供的故障參數(shù));break;case 6: prin tf(n請輸入PSASP提供的故障參數(shù));break;case 7: prin tf(n請輸入PSASP提供的故障參數(shù));break;default:pr

5、i ntf(! goto ss;huitu();Sleep(IOOO);輸入錯誤!n請重新輸入故障類型:);system(cls);/# 常用故障檢測 #elseif(fp=fope n(stabledata.dat,r)=NULL)prin tf(ca nnot ope n this filen);exit(0);elsewhile(feof(fp)=0)fseek(fp,j*sizeof(struct data_type),O); fread( &dataj,sizeof(struct data_type),1,fp); prin tf(%fn,dataj. nu m);j+;fclose

6、(fp);scan f(%d, &b); system(cls);goto dd;printf(*n);printf(”謝謝使用n);printf(*nn);/ooooooooooooooooooooWI夂I ooooooooooooooooooooooooooo/$丿|7個2| 心 I $void huitu()/ float b,c,k;/b為根號下的浮點數(shù)據(jù),d為b的雙浮點數(shù)據(jù),e為(根號*電流),c為e的浮點數(shù)據(jù),h為cos里面的數(shù)據(jù),f為時間周期/ double d,e,f,h,g;為g的浮點數(shù)據(jù)/ int i;/float m,s;/s/int q;/ struct data_ty

7、pe/ float num;/data1000;/printf(已進入繪圖函數(shù)”);printf(根號下的數(shù)b=);scan f(%f,&b);printf(”scan f(%f,&k);d=(double)b;e=k*sqrt(d);c=(float)e;/*關于采樣時間的處理*prin tf(請輸入您所需的采樣時間:scan f(%f, &m);q=(i nt)(0.02/m);f=0;);故障數(shù)據(jù)電壓或者電流k=);/ char file name20;/ FILE *fp;strcpy(file name,stabledata.dat);fp=fope n(file name,w+);

8、if(fp=fope n(file name,w+)=NULL) prin tf(ca nnot ope n this filen); exit(0);elseprin tf(n數(shù)據(jù)處理結果如下:n);for(i=0;i=q_1;i+)f=f+m;h=314*f;g=e*cos(h);/ prin tf(%fn,g);s=float(g);/*文件*datai. num=s;fseek(fp,i*sizeof(struct data_type),O);/ fread(&datai,sizeof(struct data_type),1,fp);if(fwrite(&datai,sizeof(struct data_type),1,fp)!=1) prin tf(file write error n);/ prin tf(%fn,datai. num);/ fseek(fp,-sizeof(struct data_type),

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論