1 | #include "diabolo.h"
|
---|
2 | #include "fichier.h"
|
---|
3 | #include "bolo.h"
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | void lit_fichier_DIA2(int fen)
|
---|
11 | {
|
---|
12 | //int i,f;
|
---|
13 | F_entete *E;
|
---|
14 | F_block_desc *BD;
|
---|
15 | F_block_param *BP;
|
---|
16 | F_donne * T; // tableau courant de donnee
|
---|
17 | long tt=1397151033;
|
---|
18 | long total=0;
|
---|
19 | long val_controleur;
|
---|
20 | long blockold=0;
|
---|
21 | double total_controleur=-1;
|
---|
22 | int bb=0;
|
---|
23 | int i;
|
---|
24 | def_gains;
|
---|
25 |
|
---|
26 | T=malloc(max_nb_donne*sizeof(F_donne));
|
---|
27 | E=malloc(sizeof(F_entete));
|
---|
28 | BD=malloc(sizeof(F_block_desc));
|
---|
29 | BP=malloc(sizeof(F_block_param));
|
---|
30 | printf("lecture du fichier \n");
|
---|
31 | position(fen,0L);
|
---|
32 | select(printf_ref);
|
---|
33 | litF(fen,sizeof(F_entete),E);
|
---|
34 | printf(" version : =%d ",E->version);
|
---|
35 | printf("temps debut, fin =%ld , %ld \n",tt+E->tempsdebut,tt+E->tempsfin);
|
---|
36 | E->commentaires[255]=0;
|
---|
37 | printf("commentaires à la main : %s \n",E->commentaires);
|
---|
38 |
|
---|
39 | while ( litF(fen,sizeof(F_block_desc),BD) != -1)
|
---|
40 | {
|
---|
41 | // printf(" BD.change = %d nb ligne= %d \n",BD->change,BD->n_ligne_don);
|
---|
42 | if(BD->change>10)
|
---|
43 | {
|
---|
44 | char buf[20000];
|
---|
45 | printf("block type %d, longueur %d ",BD->change,BD->n_ligne_don);
|
---|
46 | litF(fen,BD->n_ligne_don,buf);
|
---|
47 | }
|
---|
48 | else
|
---|
49 |
|
---|
50 | if(BD->change==10)
|
---|
51 | {
|
---|
52 | char comment[10000];
|
---|
53 | printf(" commentaire longueur %d ",BD->n_ligne_don);
|
---|
54 | litF(fen,BD->n_ligne_don,comment);
|
---|
55 | // printf("commentaire : \n");
|
---|
56 | // printf(comment);
|
---|
57 | printf("\n");
|
---|
58 | }
|
---|
59 | else
|
---|
60 | {
|
---|
61 |
|
---|
62 | bb++;
|
---|
63 | litF(fen,sizeof(F_block_param),BP);
|
---|
64 | if(total_controleur==-1) {val_controleur=BP->temps_controleur_debut;total_controleur=0;}
|
---|
65 | total_controleur+=(double)( (BP->temps_controleur_fin - val_controleur) & 0x7fffffff ) ;
|
---|
66 | val_controleur=BP->temps_controleur_fin;
|
---|
67 | printf(" block %d :chg=%d , %d lignes , horloge %x ,temps debut %ld , fin =%ld , ereur%ld ",
|
---|
68 | BD->n_blok,
|
---|
69 | BD->change,
|
---|
70 | BD->n_ligne_don,
|
---|
71 | BP->reglage.horloge,
|
---|
72 | BP->temps_controleur_debut,BP->temps_controleur_fin,
|
---|
73 | BP->temps_controleur_fin-(blockold+(long)BD->n_ligne_don));
|
---|
74 | blockold=BP->temps_controleur_fin;
|
---|
75 | // printf("bololu =%d \n",BD->bololut);
|
---|
76 | if(BD->n_ligne_don>max_nb_donne) {printf("\n trop de ligne a lire : erreur \n\n");break;}
|
---|
77 | litF(fen,sizeof(F_donne)*(long)BD->n_ligne_don,T);
|
---|
78 | total+=BD->n_ligne_don;
|
---|
79 | if(bb==5) // pour le 5 eme block uniquement
|
---|
80 | {
|
---|
81 | for(i=0;i<nb_max_bolo;i++)
|
---|
82 | {
|
---|
83 | printf("\nbolo%d : gain=%d -> %g V=%d I=%d T=%d L=%d phase=%d "
|
---|
84 | ,i+1,gainbrut(BP->reglage.bolo[i]),gain_ampli(BP->reglage.bolo[i])
|
---|
85 | ,dac_V(BP->reglage.bolo[i]),dac_I(BP->reglage.bolo[i])
|
---|
86 | ,dac_T(BP->reglage.bolo[i]),dac_L(BP->reglage.bolo[i])
|
---|
87 | ,phase(BP->reglage.bolo[i]) );
|
---|
88 | }
|
---|
89 | printf("\n periode horloge=%g , nb_mesures=%d , frequence=%g , temps mort=%d \n"
|
---|
90 | ,2./(double)(BP->reglage.horloge.nb_mesures*24),BP->reglage.horloge.nb_mesures/2 ,500000.,BP->reglage.horloge.temp_mort);
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | printf("\n");
|
---|
97 | }
|
---|
98 |
|
---|
99 | printf(" total fichier %ld lignes \n",total);
|
---|
100 | printf("temps fichier %ld sec \n",E->tempsfin-E->tempsdebut);
|
---|
101 | printf("temps controleur %8.3f sec \n",1e-6*total_controleur);
|
---|
102 | printf("frequence de modulation calculée a partir du temps controleur = %g Hz \n",((double)(total-1))/(2*1e-6*total_controleur));
|
---|
103 | printf("periode calculee = %g ms \n",(1e-3*total_controleur/((double)(total-1))));
|
---|
104 | printf("frequence moyenne reelle = %g Hz \n",((double)total)/(double)(2*(E->tempsfin-E->tempsdebut)));
|
---|
105 | printf("frequence generateur = %g MHz \n",
|
---|
106 | 15.0*(((double)(total-1))/(double)(E->tempsfin-E->tempsdebut))/(((double)(total-1))/(1e-6*total_controleur)));
|
---|
107 | /*
|
---|
108 | f=ouvreD(0,0,"",0);
|
---|
109 | for(i=0;i<1000;i++)
|
---|
110 | {
|
---|
111 | double x,y;
|
---|
112 | x=i;
|
---|
113 | y=T[i].bolo[0];
|
---|
114 | // y=BP->bol_per[0][i];
|
---|
115 | trace(f,x,y);
|
---|
116 | }
|
---|
117 | */
|
---|
118 | }
|
---|