ГОСТ Р ИСО/МЭК 10373-6—2015
\
I
I
fclose(saraple_file);
return i;
/**• Read CSV FIle Function
***/
f +* +
/*** Description: *♦*/
/►** This function read’s the table of time and sense coil
***/
/*** voltage irom a File inCSV Format
***/
/***•**/
/*** input: filename
***/
/***
» * * /
/*•* Return: Number oi samples {sample Count)
***/
/***0 if an error occurred***/
/ »*•
** */
/*** Displays Statistics: •**/
/*** *«*/
/*** Filename, SampleCount,Samplingrate, Max/Min Voltage***’/
ln t :eadcsv{char* fname,double vtim e[ | , double vd[))
1
double maxvd, mm
_
vd;
lnt
1!
FILE
♦
sampie_!ile;
open F ile
* * • * * * * * * • * * + * • * * * * * * * * /
i f ( Istrchr(fnam e,strcat(fn am e, " . c s v " ) ;
i f ((sample file - topen(fname,NULL)
<
p r in t ! (“Cannot open input file t s . \ n " , Гпагсе);
retu rn 0;
/*
Read CSV File
***/
max_vd--le-9F;
mm_vd— maxvd;
1
-
0
;
1
while (!feof (sample_flle>)
I
i t (i>-MAX_3AMPLES)
\
print f("Too many samples m input file: only
’.a
samples reaa\n",i);
break;
1
fscanf (sample
_
file, "%1Г, .И Ч п", *v L iire [l], tv d fi]) ;
i f (vd(1
1
>max
_
vd) max
_
vd-vd[ i | ;
i f (vd(i]<m in
_
vd) m in
_
vd-vdl1|;
‘ ♦/
I
195