ГОСТ Р 56914—2016
/* A rray to r tim e and sense c o il vo lta g e vd */
float vtimelMAX SAMPLES);
/*
tim e a rra y*/
float vdIMAX SAMPLES);/* A rray to r d itte re n t c o il vo lta g e
*t
/**** t *** t *** t *** t *** t *** t *** t *************** t *************** t **/
/***
Read CSV P ile F unction
***/
/*** *** /
/***
D e scrip tio n :
***/
/* * * This tu n c tio n reads
/***
vo lta g e from a P ile
the ta b le o t tim e and sense c o il * * * /
in CSV Format
***/
/ +ФФ
ФФФ/
/* * *Inputs filename* * * /
/•** *** /
/***
R eturn: Number o£ sainples(sample Count)
***/
/***
0i t an e rro r occurred* * * /
/*** ***/
/•**
D isplays S ta tis tic s : * * * /
/+•* ***/
/* * *Filenam e, SampleCount, Sample ra te , Max/Min V oltage* * * /
/***************************************************************/
in t readcsv(char* tname)
float a,b;
float max vd,min. vd;
in t l ;
FILE‘ sample h ie ;
/************
open F ile
***•***•***********•*******•*******/
i t U s trc h r (tname, ’.• )>strcat(tnam e, *.c s v ’ >;
i t ((sample h ie = £open(tname, *r"> ) == NULL)
{
p rin tft"C a n n o t open in p u t h ie % s.\n*. tname);
re tu rn 0;
)
/+******+*+•+*******+*+***+********************************/
/*
Read CSV P ile♦/
/**********************************************************/
max vd=-le-9P ;
min. vd=-max. vd;
i=0;
w h ile ( ! teot(sam ple h ie ) )
{
I t (i>=MAX SAMPLES)
{
p n n tt l"W arning: F ile truncated !! i\ n * ) ;
p r in t ! ("To much samples in file % s\b\n",tnam e);
break;
}
tscant (sample h ie , * %E, % l\n *, £.a, & b);
v tim e (i) = a;
v d li) = b;
i t (vd[ij>m ax vd) m ax,.vd=vd[i) ;
i t (vd[i)< m m va) min v d = v d )i);
1++;
}
tclose(sam ple file );
(
/************
D isplays S ta tis tic s
************************/
pr ir.Lt
* \ z i + + + * * + * + + + * + + + * + + + * + + + * + + + * + + + * + + + * + + + * + + + * + + + + \ t \ * ) ;
34