#include "diabolo.h" #include "bolo.h" #include "synchro.h" #include "fichier.h" #include "trace.h" #include "menu.h" static int choix_DS=0; static int npt_DS=0; // nombre de points (periode) pour le calcul de la DS static double table_DS[2*max_points_DS]; // table de detection synchrone, dupliquer en double longueur static double norme_DS; static int raz_parasite=2; void exec_trace_DS_suite(int u); void trace_DS(double *y,int enregistre); void calcul_table_DS(double periode); #define degre(x) ((int)(x*180./3.14159)) // calcul ya pendant la periode , yb a cheval sur 2 periodes , yc= somme des deux void exec_trace_DS(int fen,int item,double valeur,...) { static int u=-1; static flag_err=0; switch(item) { case ouverture : gg->trace_ouvert=gg->trace_ouvert | 4 ; graph->ymin=-20; graph->ymax=20; graph->ypas=5; graph->xmax=500; graph->xpas=50; graph->taille_graduations=7; // graph->flag_tracen=0; // for(j=0;jbolo_type[j]) graph->flag_tracen+=(1<flag_tracen+=(1<temps_origine=gg->periode_echantillonage*(double)gg->temps_cntl; efface(fen); break; case ds_debut : if( (u<8*npt_DS/10) ou (u>15*npt_DS/10) ) { if(!flag_err) {printf("erreur periode \n");flag_err=20;} flag_err--; } else flag_err=0; while(u=0) && (utrace_ouvert=gg->trace_ouvert & (255-4); // enleve le 4 break; default : break; } } // le trace de la detection synchrone passe par un appel a chaque point avec u=0,1,2,.... , npt_DS-1 // // la commande de trace sera faite par exec_trace_DS_suite pour certaines valeures de u // pour une detection avec trois positions qui se suivent, le parametre supplementaire pernum // compte de 0 a 2. Il est remis a zero pour un appel de la fonction avec u=-1 (qui ne fait rien d'autre) // la detection est accumulée simultanement dans deux registres y1 et y2 qui sont plotte simultanement. // on a ainsi deux points par periode void exec_trace_DS_suite(int u) // appellé quoiqu'il arrive avec u=0,1,2,.... , npt_DS-1 { static double y[nb_max_bolo+1],y1[nb_max_bolo+1],y2[nb_max_bolo+1],bb[nb_max_bolo+1]; int j; static double phase_mesure[nb_max_bolo],confiance[nb_max_bolo],phase_memoire; switch(choix_DS) { case choix_DS_sinus_1f : for(j=0;j le cosinus bb[j]+= xbol(j)* (((double)(u%2))-0.5); // estimation du bruit } if(u==npt_DS-1) { for(j=0;jperiode_echantillonage*(double)gg->temps_cntl-gg->temps_origine; if(enregistre) { printf("traceDS avec enregistre=1\n"); ecritT(fenetre_enregistre_DS,fin_f," %9.3f ",x ); for(j=0;jtrace_ouvert&16) trace_annexe(yt); // données razparasite mais non filtrées raz_parasite=0; selectgra(fenetre_trace_DS); yt[nb_max_bolo]=(0.95*graph->ymin+0.05*graph->ymax) + + ( (gg->don.sync[sync_subscan]!=0) et (gg->don.sync[sync_scan]!=0) ) * 0.9 * (graph->ymax-graph->ymin); //printf(" signal subscan=%g ",yt[nb_max_bolo]); //printf(" avant moyenne= %g , %g , %g , %g , %g \n",yt[0],yt[1],yt[2],yt[3],yt[4]); moy=litD(fenetre_trace_DS,ds_moyenne,0L); if(moy>10) {moy=10;ecritD(fenetre_trace_DS,ds_moyenne,"10");} if(moy) { uf++; if(uf>=moy) uf=0; for(j=0;jscroll_courbe) && litD(fenetre_trace_DS,ds_retour,0L) && ( (xxmin) ou (x>graph->xmax) )) { graph->xmax-=graph->xmin;graph->xmin=0; gg->temps_origine=gg->periode_echantillonage*(double)gg->temps_cntl; x=0; } //ecritD(fenetre_trace_DS,ds_bol1,"%gµV",yt[0]); //ecritD(fenetre_trace_DS,ds_bol2,"%gµV",yt[1]); } // fabrique une table double longueur pour ne pas poser de problèmes // la table de detection synchrone est deja dephase comme il faut void calcul_table_DS(double periode) { int i,v,tm,phase; npt_DS=(int)(periode+0.2); // synchro_periode est un double et npt_DS est un entier if (npt_DS>max_points_DS) npt_DS=max_points_DS; choix_DS=litD(fenetre_trace_DS,ds_choix_DS,0L); tm=litD(fenetre_trace_DS,ds_temps_mort,0L); phase=litD(fenetre_trace_DS,ds_phase,0L); norme_DS=0; switch(choix_DS) { case choix_DS_sinus_1f : npt_DS=2* (int) (npt_DS/2); // plus moins plus moins (hacheur) for(i=0 ;i=npt_DS) i=0; if(v=npt_DS) i=0; if(v=npt_DS) i=0; if(v=npt_DS) i=0; if(v=npt_DS) i=0; if(v=npt_DS) i=0; if(v=npt_DS) i=0; if(v=npt_DS) i=0; if(v=npt_DS) i=0; if(v