| [637] | 1 | #include "diabolo.h" | 
|---|
|  | 2 | #include "bolo.h" | 
|---|
|  | 3 | #include "acqui.h" | 
|---|
|  | 4 | #include "carte_acqui.h" | 
|---|
|  | 5 | #include "trace.h" | 
|---|
|  | 6 | #include "synchro.h" | 
|---|
|  | 7 |  | 
|---|
|  | 8 | static  double          table_som[nb_max_bolo]; //  table de moyennage | 
|---|
|  | 9 | static  double          table_moy[nb_max_bolo][max_points_DS];  //  table de moyennage | 
|---|
|  | 10 | static  double          temps_per[max_points_DS];       //  table de moyennage | 
|---|
|  | 11 | static  int                     nombre_moy;                             //  nombre de moyennage | 
|---|
|  | 12 | static int                      indice_per; | 
|---|
|  | 13 | static int                      flag_trace_moy; | 
|---|
|  | 14 |  | 
|---|
|  | 15 | static double           temps_origine_local; | 
|---|
|  | 16 |  | 
|---|
|  | 17 |  | 
|---|
|  | 18 | void exec_trace_1_per(int fen,int item,double valeur,...) | 
|---|
|  | 19 | { | 
|---|
|  | 20 | static double y[nb_max_bolo]; | 
|---|
|  | 21 | double decale; | 
|---|
|  | 22 | static int lissage=10,ipas=1; | 
|---|
|  | 23 | int  j,k; | 
|---|
|  | 24 | double x; | 
|---|
|  | 25 |  | 
|---|
|  | 26 | switch(item) | 
|---|
|  | 27 | { | 
|---|
|  | 28 | case ouverture     :        gg->trace_ouvert=gg->trace_ouvert | 2 ; | 
|---|
|  | 29 | selectgra(fen); | 
|---|
|  | 30 | graph->ymin=-120; | 
|---|
|  | 31 | graph->ymax=120; | 
|---|
|  | 32 | graph->ypas=20; | 
|---|
|  | 33 | graph->xmax=2; | 
|---|
|  | 34 | graph->xpas=0.5; | 
|---|
|  | 35 | graph->taille_graduations=7; | 
|---|
|  | 36 | //                                              graph->flag_tracen=0; | 
|---|
|  | 37 | //                                              for(j=0;j<nb_max_bolo;j++)      if( (j<10) && gg->bolo_type[j]) graph->flag_tracen+=(1<<j); | 
|---|
|  | 38 | flag_trace_moy=0; | 
|---|
|  | 39 |  | 
|---|
|  | 40 |  | 
|---|
|  | 41 | case t_raz :                        if(synchro_periode>=max_points_DS) synchro_periode=0; | 
|---|
|  | 42 | nombre_moy=0; | 
|---|
|  | 43 | ecritD(fen,tp_nb_moy,"0"); | 
|---|
|  | 44 |  | 
|---|
|  | 45 | for(indice_per=0;indice_per<synchro_periode;indice_per++) | 
|---|
|  | 46 | for(j=0;j<nb_max_bolo;j++) | 
|---|
|  | 47 | table_moy[j][indice_per]=0; | 
|---|
|  | 48 | flag_trace_moy=0; | 
|---|
|  | 49 | break; | 
|---|
|  | 50 |  | 
|---|
|  | 51 | case fermeture     :        gg->trace_ouvert=gg->trace_ouvert & (255-2);            // enleve le 2 | 
|---|
|  | 52 | break; | 
|---|
|  | 53 |  | 
|---|
|  | 54 | //    case t_lissage    :       case t_lissage+1000     :               lissage=valeur; break; | 
|---|
|  | 55 |  | 
|---|
|  | 56 | case t_efface               :       if(!flag_trace_moy) flag_trace_moy=1; | 
|---|
|  | 57 | else flag_trace_moy=0; | 
|---|
|  | 58 | break; | 
|---|
|  | 59 |  | 
|---|
|  | 60 |  | 
|---|
|  | 61 | case    ds_debut        :       if(synchro_periode>=max_points_DS) synchro_periode=0; | 
|---|
|  | 62 | flag_trace_moy=litD(fen,tp_moy,0L); | 
|---|
|  | 63 | decale=litD(fen,tp_decale,0L); | 
|---|
|  | 64 | lissage=litD(fen,tp_lissage,0L); | 
|---|
|  | 65 | if(lissage<1) {lissage=1;ecritD(fen,tp_lissage,"1");} | 
|---|
|  | 66 | //                                                      printf("debut avec flag_trace_moy=%d  et nombre_moy=%d  \n",flag_trace_moy,nombre_moy); | 
|---|
|  | 67 | if(flag_trace_moy) | 
|---|
|  | 68 | { | 
|---|
|  | 69 | if(nombre_moy) | 
|---|
|  | 70 | { | 
|---|
|  | 71 | efface(fen); | 
|---|
|  | 72 | for(j=0;j<nb_max_bolo;j++) | 
|---|
|  | 73 | { | 
|---|
|  | 74 | table_som[j]=0; | 
|---|
|  | 75 | } | 
|---|
|  | 76 | for(indice_per=0;indice_per<synchro_periode-2;indice_per++) | 
|---|
|  | 77 | { | 
|---|
|  | 78 | for(j=0;j<nb_max_bolo;j++) | 
|---|
|  | 79 | { | 
|---|
|  | 80 | table_som[j]+=table_moy[j][indice_per]; | 
|---|
|  | 81 | } | 
|---|
|  | 82 | } | 
|---|
|  | 83 |  | 
|---|
|  | 84 | for(indice_per=0;indice_per<synchro_periode-lissage;indice_per+=lissage) | 
|---|
|  | 85 | { | 
|---|
|  | 86 | for(j=0;j<nb_max_bolo;j++) | 
|---|
|  | 87 | { | 
|---|
|  | 88 | y[j]=0; | 
|---|
|  | 89 | for(k=0;k<lissage;k++) | 
|---|
|  | 90 | y[j]+=table_moy[j][indice_per+k]-table_som[j]/(synchro_periode-2); | 
|---|
|  | 91 | y[j]=y[j]/(nombre_moy*lissage) + decale*j; | 
|---|
|  | 92 | } | 
|---|
|  | 93 | montracen(fen,nb_max_bolo,temps_per[indice_per],y); | 
|---|
|  | 94 | } | 
|---|
|  | 95 | } | 
|---|
|  | 96 | nombre_moy++; | 
|---|
|  | 97 | ecritD(fen,tp_nb_moy,"%d",nombre_moy); | 
|---|
|  | 98 | } | 
|---|
|  | 99 | temps_origine_local=gg->temps_cntl; | 
|---|
|  | 100 | indice_per=0; | 
|---|
|  | 101 |  | 
|---|
|  | 102 | for(j=0;j<nb_max_bolo;j++) y[j]=0; | 
|---|
|  | 103 | ipas=lissage; | 
|---|
|  | 104 |  | 
|---|
|  | 105 | move(fen,0,0); | 
|---|
|  | 106 |  | 
|---|
|  | 107 | case        ds_suite        :       if(indice_per>=max_points_DS) indice_per=max_points_DS-1; | 
|---|
|  | 108 |  | 
|---|
|  | 109 | x=gg->periode_echantillonage*(double)(gg->temps_cntl-temps_origine_local); | 
|---|
|  | 110 |  | 
|---|
|  | 111 | if(flag_trace_moy) for(j=0;j<nb_max_bolo;j++)   table_moy[j][indice_per]+=xbol(j); | 
|---|
|  | 112 |  | 
|---|
|  | 113 | if(!flag_trace_moy) | 
|---|
|  | 114 | { | 
|---|
|  | 115 | for(j=0;j<nb_max_bolo;j++)      y[j]+=xbol(j); | 
|---|
|  | 116 | ipas--; | 
|---|
|  | 117 | if(ipas<=0) | 
|---|
|  | 118 | { | 
|---|
|  | 119 | ipas=lissage; | 
|---|
|  | 120 | for(j=0;j<nb_max_bolo;j++) y[j]=y[j]/(double)lissage; | 
|---|
|  | 121 | montracen(fen,nb_max_bolo,x,y); | 
|---|
|  | 122 | for(j=0;j<nb_max_bolo;j++) y[j]=0; | 
|---|
|  | 123 | } | 
|---|
|  | 124 | } | 
|---|
|  | 125 |  | 
|---|
|  | 126 |  | 
|---|
|  | 127 |  | 
|---|
|  | 128 |  | 
|---|
|  | 129 |  | 
|---|
|  | 130 | temps_per[indice_per]=x; | 
|---|
|  | 131 | indice_per++; | 
|---|
|  | 132 | //                                                      symbole(fen,x,y[0],6,rond,1,rouge); | 
|---|
|  | 133 |  | 
|---|
|  | 134 | default  :   break; | 
|---|
|  | 135 | } | 
|---|
|  | 136 |  | 
|---|
|  | 137 | } | 
|---|
|  | 138 |  | 
|---|
|  | 139 |  | 
|---|