Changeset 649 in Sophya for trunk/Poubelle/archediab.old/archediab.sources/c
- Timestamp:
- Nov 25, 1999, 2:56:34 PM (26 years ago)
- Location:
- trunk/Poubelle/archediab.old/archediab.sources/c
- Files:
-
- 6 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Poubelle/archediab.old/archediab.sources/c/acqui_util.c
r643 r649 189 189 void reset_epld(void) 190 190 { 191 char mot_tc[10]; 191 192 printf("reset epld"); 192 /* 193 if(gg->flag_tc_reduite) 194 { 195 int i; 196 for(i=0;i<15;i++) emission_tc_reduite(tc2_reset_epld,i,0); 197 } 198 else 199 */ 200 { 201 char mot_tc[10]; 202 emission_telecommande(tc_dir_reset_epld,mot_tc); 203 } 193 emission_tc_reduite(tc2_reset,tc3_reset,tc4_reset); 194 emission_telecommande(tc_dir_reset_epld,mot_tc); 195 196 } 197 198 void reset_trp(void) 199 { 200 char mot_tc[10]; 201 printf("reset trp"); 202 emission_tc_reduite(tc2_reset,tc3_reset,tc4_reset); 203 emission_telecommande(tc_dir_reset_trp,mot_tc); 204 204 } 205 205 -
trunk/Poubelle/archediab.old/archediab.sources/c/acquisition_archeops.c
r643 r649 42 42 // de la lecture du block bolo 43 43 44 block_type_gyro blk_gyro2; // block memoire pour les gyros qui seront traitées lors 45 // de la lecture du block bolo 46 44 47 45 48 … … 48 51 void lit_block_archeops(int err) 49 52 { 50 if(verifie_block_printf(blk_tm)) return; 51 52 { 53 def_nom_block 54 static int mon_num_block; 53 static char ss[1000]; 54 def_nom_block 55 static int mon_num_block; 56 57 if(!fenetre(fenetre_lecture_blocks)) nouveauT(fenetre_lecture_blocks,0,"lecture blocs"); 58 59 if(verifie_block_printf(blk_tm)) 60 { 61 if((mon_num_block+1)==numero_block(blk_tm)) 62 { 63 mon_num_block=numero_block(blk_tm); 64 if(!fenetre(fenetre_lecture_blocks)) nouveauT(fenetre_lecture_blocks,0,"lecture blocs"); 65 ecritT(fenetre_lecture_blocks,fin_f,"%s\n",ss); 66 sprintf(ss,"%d ->",mon_num_block); 67 } 68 if(strlen(ss)<500) sprintf(ss+strlen(ss)," **%s ",nom_block[type_block(blk_tm)]); 69 ecrit_fichier_ARCH(blk_tm); // ecrit les fichiers en erreur sur le disque 70 return; 71 } 72 73 { 55 74 if(mon_num_block!=numero_block(blk_tm)) 56 75 { 57 76 mon_num_block=numero_block(blk_tm); 58 printf("\n%d ->",mon_num_block); 59 } 60 printf(" %s ",nom_block[type_block(blk_tm)]); 77 if(!fenetre(fenetre_lecture_blocks)) nouveauT(fenetre_lecture_blocks,0,"lecture blocs"); 78 ecritT(fenetre_lecture_blocks,fin_f,"%s\n",ss); 79 sprintf(ss,"%d ->",mon_num_block); 80 } 81 if(strlen(ss)<500) sprintf(ss+strlen(ss)," %s ",nom_block[type_block(blk_tm)]); 61 82 } 62 83 … … 78 99 case block_bolo_comprime : traite_block_bolo_comprime((block_type_bolo_comprime*)blk_tm); break; 79 100 80 case block_sst : traite_block_sst((block_type_sst*)blk_tm); break; 81 case block_sst_comprime : traite_block_sst_comprime((block_type_sst_comprime*)blk_tm); break; 101 case block_sst : traite_block_sst((block_type_sst*)blk_tm); 102 traite_block_sst_brut((block_type_sst*)blk_tm); break; 103 case block_sst_comprime : traite_block_sst_comprime((block_type_sst_comprime*)blk_tm); 104 traite_block_sst_comprime_brut((block_type_sst_comprime*)blk_tm);break; 82 105 83 106 case block_gyro : traite_block_gyro((block_type_gyro*)blk_tm); break; … … 86 109 case block_synchro_sol : traite_block_synchro_sol((block_type_synchro_sol*)blk_tm); break; 87 110 88 case block_status_flash : printf("**** **************status flash recut ********************* \n");son(133);break;111 case block_status_flash : printf("**** status flash recut **** nblock=%x - %d *** \n",((block_type_status_flash*)blk_tm)->status.nb_total_blocks,((block_type_status_flash*)blk_tm)->status.nb_total_blocks/256);break; 89 112 90 113 #ifdef transmet_data_brute … … 115 138 void traite_block_journal(block_type_journal* blk) 116 139 { 140 long mothexa[5]; /* les 5 mots hexa de la telecommande */ 141 117 142 int i,code,blocknum; 118 143 if(!fenetre(fenetre_journal)) nouveauT(fenetre_journal,0,"journal"); … … 124 149 blocknum=numero_block(&blk->jj[i]); 125 150 if(code) break; // code vaut 1 pour vider une page de journal incomplete 126 ecritT(fenetre_journal,fin_f,"block_num= %d code %d ==> %d %d %d %d %d %d %d %d \n", 127 blocknum,code, 128 blk->jj[i].mot[0],blk->jj[i].mot[1],blk->jj[i].mot[2],blk->jj[i].mot[3], 129 blk->jj[i].mot[0],blk->jj[4].mot[5],blk->jj[i].mot[6],blk->jj[i].mot[7]); 130 } 131 } 151 mothexa[0]=blk->jj[i].mot[5]; /* 4 bit choix de commande */ 152 mothexa[1]=blk->jj[i].mot[6]>>2; /* les 4 bits poid fort du code direction */ 153 mothexa[2]=((blk->jj[i].mot[6]<<2)&0xc) + ((blk->jj[i].mot[7]>>6)&0x3); 154 mothexa[3]=(blk->jj[i].mot[7]>>2)&0xf; 155 mothexa[4]=(blk->jj[i].mot[7]&0x3); 156 157 if(blk->jj[i].mot[0]) 158 { 159 ecritT(fenetre_journal,fin_f,"block_num= %d code %d ==> telecommande_OK : %d %d %d -> %x %x %x %x %x \n", 160 blocknum,code,blk->jj[4].mot[5],blk->jj[i].mot[6],blk->jj[i].mot[7] 161 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]); 162 } 163 else 164 { 165 ecritT(fenetre_journal,fin_f,"block_num= %d code %d ==> erreur telecommande : %d %d %d -> %x %x %x %x %x \n", 166 blocknum,code,blk->jj[4].mot[5],blk->jj[i].mot[6],blk->jj[i].mot[7] 167 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]); 168 } 169 } 170 } 171 172 173 132 174 133 175 //----------------------------------------------------------------------------------------- … … 176 218 if(c1==13) i=80; 177 219 } 220 } 221 } 222 223 224 225 226 227 void traite_block_gyro_comprime(block_type_gyro_comprime* blk) 228 { 229 int i; 230 block_type_gyro bk_gyro; 231 block_type_gyro* blk2=& bk_gyro; 232 if(!fenetre(fenetre_gyroscope)) return; 233 //printf("*************** decompress data gyro \n"); 234 for(i=0;i<3;i++) decompress_7_2((long *)blk->gyro[i],blk2->gyro[i],nb_per_block*2); 235 blk2->code1=blk->code1; 236 blk2->code2=blk->code2; 237 traite_block_gyro(blk2); 238 } 239 240 241 void traite_block_gyro(block_type_gyro* blk) 242 { 243 int k; 244 double y[15]; 245 246 int temps_cntl; 247 double secondes; 248 blk_gyro2 = *blk; 249 250 if(!fenetre(fenetre_gyroscope)) return; 251 252 for(k=0;k<72;k++) 253 { 254 y[0]=20.*(blk->gyro[0][k]-32768)/32768.; 255 y[1]=20.*(blk->gyro[1][k]-32768)/32768.; 256 y[2]=20.*(blk->gyro[2][k]-32768)/32768.; 257 258 // printf(" y = %g %g %g %g %g \n",y[0],y[1],y[2],y[3],y[4]); 259 temps_cntl =numero_block(blk)*nb_per_block*2+k; 260 secondes=gg->periode_echantillonage*(double)temps_cntl-gg->temps_origine; 261 tracen(fenetre_gyroscope,3,secondes,y); 262 // printf("secondes=%g\n",secondes); 178 263 } 179 264 } … … 306 391 gg->don.don_bolo[j]=0.5*(ancien_don_bolo[j]+s*(((val_DS(j,i)-aa)<<1)/nb_coups)); // copy bolos 307 392 ancien_don_bolo[j]=s*(((val_DS(j,i)-aa)<<1)/nb_coups); 393 // if( (i==1) && (j==14) ) 394 // { 395 // def_gains 396 // printf(" brut=%d ofset=%d nbcoups=%d gg->don.don_bolo[j]=%d parametr.bolo[j].bolo_gain=%d gainampli=%g micro-volts=%g \n" 397 // , val_DS(j,i) ,aa ,nb_coups ,(int)gg->don.don_bolo[j] ,parametr.bolo[j].bolo_gain ,gain_ampli(gg->reglage.bolo[j]) ,(double)xbolbrut(j)); 398 // } 399 // 308 400 } 309 401 … … 313 405 } 314 406 407 gg->don.gyro[0]=20.*(blk_gyro2.gyro[0][i]-32768)/32768.; 408 gg->don.gyro[1]=20.*(blk_gyro2.gyro[1][i]-32768)/32768.; 409 gg->don.gyro[2]=20.*(blk_gyro2.gyro[2][i]-32768)/32768.; 410 411 315 412 316 413 // gg->don.sync[j]=synchro_DS(j,i); -
trunk/Poubelle/archediab.old/archediab.sources/c/acquisition_general.c
r643 r649 14 14 #include "compress.h" 15 15 #include "controle.h" 16 #include "simulmission.h" 16 17 17 18 … … 41 42 static int count_moy_err=0; 42 43 int err; 44 static bilan_err=0; 43 45 44 46 if (item!=tache_de_fond) return; … … 56 58 */ 57 59 58 if( count-- < 0 )60 //if( count-- < 0 ) 59 61 { 60 62 count=3; 61 ecritD(fenetre_controle,con_ retard1,"%d",tt->nb_lec_fofo_ext);62 tt-> nb_lec_fofo_ext=0;63 ecritD(fenetre_controle,con_fifo,tt->val_con_fifo/2); 64 tt->val_con_fifo=0; 63 65 } 64 66 65 67 66 68 err=test_erreur(); //______________ test des erreurs _______________________________ 69 70 if(err) bilan_err+=10*err; 71 72 // Pour la simulation, rempli les buffers avec les donnees simulees 73 74 if (tt->PCI_actif==3) SimulMissionReadLoop(); 67 75 68 76 69 77 //_____________________ lit la table télémesure ______________________________________ 70 78 71 79 if(bilan_err>100) bilan_err=100; 80 if(bilan_err>50) bilan_err-=20; 81 if(bilan_err>10) bilan_err-=5; 82 if(bilan_err>0) bilan_err--; 83 if(bilan_err) ecritD(fenetre_controle,con_erreur,20+bilan_err*10); 84 else ecritD(fenetre_controle,con_erreur,0); 72 85 73 86 q=(longueur_table_tm+tt->tm.pos_ecrit-tt->tm.pos_lit)%longueur_table_tm; 87 88 ecritD(fenetre_controle,con_pile,(1000*((longueur_table_tm+tt->tm.pos_ecrit-tt->tm.pos_lit)%longueur_table_tm))/longueur_table_tm); 89 ecritD(fenetre_controle,con_donnee,tt->val_con_donnee); 74 90 75 91 while(q) 76 92 { 77 ecritD(fenetre_controle,con_ retard2,"%d",(longueur_table_tm+tt->tm.pos_ecrit-tt->tm.pos_lit)%longueur_table_tm);78 93 ecritD(fenetre_controle,con_pile,(1000*((longueur_table_tm+tt->tm.pos_ecrit-tt->tm.pos_lit)%longueur_table_tm))/longueur_table_tm); 94 // printf(" pile = %d \n",(1000*((longueur_table_tm+tt->tm.pos_ecrit-tt->tm.pos_lit)%longueur_table_tm))/longueur_table_tm); 79 95 //***************************************************************************************** 80 96 // *** … … 109 125 { 110 126 case ouverture : gg->flag_tc_reduite=litD(fen,e_tc_reduite,0); 111 if( tt->PCI_actif==1) reset_carte;127 if(acquisition_PCI) reset_carte; 112 128 ecritD(fen,e_tache_inter,0); // arreter les interruptions 113 129 reset_epld(); … … 161 177 break; 162 178 163 case e_vanne : { 164 long ll=(long)(&(gg->reglage.dilu.vanne))-(long)(&(gg->reglage.dilu)); 179 case e_vanne : 180 { 181 long ll=(long)(&(gg->reglage.dilu.vanne))-(long)(&(gg->reglage.dilu)); 165 182 int a=(int) valeur; 183 if(a==vanne_ouvre) 184 if(alerte(2,"voulez-vous vraiment ouvrir la vanne ??")!=1) break; 166 185 emission_tc_reduite(tc2_auto_dilu,ll,a); 167 186 } … … 189 208 case e_tache_inter : calfreq(0); // command ou arrete le flag epld sortie data 190 209 if(TTm) stoptimer(TTm); 191 if( tt->PCI_actif==1) reset_carte;210 if(acquisition_PCI) reset_carte; 192 211 tt->vi.a=0; 193 212 if(valeur) -
trunk/Poubelle/archediab.old/archediab.sources/c/bit_block.c
r645 r649 18 18 19 19 20 #define cadence_taux 16 20 #define cadence_taux 16 // cadence de filtrage du taux d'occupation de telemetrie 21 21 #define mode_acquisition 0x00 //0xff en mode inverse, 0x00 en mode normal 22 22 unsigned long buffer; … … 137 137 //Calcul du taux de remplissage 138 138 taux=taux+(((0xffff-taux)*Nplein)>>cadence_taux); 139 tt-> nb_lec_fofo_ext=((taux*1000)>>cadence_taux);139 tt->val_con_donnee=((taux*1000)>>cadence_taux); 140 140 return(lit_bit_un_block); 141 141 … … 169 169 compteur=0; 170 170 taux=taux-((taux*Nvide)>>cadence_taux); 171 tt-> nb_lec_fofo_ext=((taux*1000)>>cadence_taux);171 tt->val_con_donnee=((taux*1000)>>cadence_taux); 172 172 } 173 173 if(buffer==debut_block_mesure) -
trunk/Poubelle/archediab.old/archediab.sources/c/bolo.c
r643 r649 22 22 int a,c,i; 23 23 int n=gg->reglage.horloge.nb_mesures; 24 //if(fen > 5 ) return;25 24 if(item>1000) item-=1000; // pour appeler le case pour tous les cara d'un edit texte 26 //controlemanip(0);27 25 //printf("execbolo avec fen=%d , item=%d \n",fen,item); 28 26 switch(item) … … 78 76 79 77 break; 80 78 // avec fenetre de dialogue pour envoyer une valeur directe 79 case b_carre : ouvreD(fen_change_bolo,change_bolo_id,"chgbolo",0); 80 if(1==modal(fen_change_bolo)) 81 { 82 valeur=litD(fen_change_bolo,chb_val,0); 83 printf(" val=%d %n",(int)valeur); 84 ecritD(fen,b_carre,(int)valeur); 85 ecritgain(fen); 86 } 87 ferme(fen_change_bolo); 88 break; 89 90 case b_tri : ouvreD(fen_change_bolo,change_bolo_id,"chgbolo",0); 91 if(1==modal(fen_change_bolo)) 92 { 93 valeur=litD(fen_change_bolo,chb_val,0); 94 printf(" val=%d %n",(int)valeur); 95 ecritD(fen,b_tri,(int)valeur); 96 ecritgain(fen); 97 } 98 ferme(fen_change_bolo); 99 break; 100 101 case b_trans : ouvreD(fen_change_bolo,change_bolo_id,"chgbolo",0); 102 if(1==modal(fen_change_bolo)) 103 { 104 valeur=litD(fen_change_bolo,chb_val,0); 105 printf(" val=%d %n",(int)valeur); 106 ecritD(fen,b_trans,(int)valeur); 107 ecritgain(fen); 108 } 109 ferme(fen_change_bolo); 110 break; 111 112 case b_lin : ouvreD(fen_change_bolo,change_bolo_id,"chgbolo",0); 113 if(1==modal(fen_change_bolo)) 114 { 115 valeur=litD(fen_change_bolo,chb_val,0); 116 printf(" val=%d %n",(int)valeur); 117 ecritD(fen,b_lin,(int)valeur); 118 ecritgain(fen); 119 } 120 ferme(fen_change_bolo); 121 break; 122 123 124 125 /* 81 126 // reecrit les valeurs dans la fenetre pour appel par un autre programme 82 127 case b_carre : ecritD(fen,b_carre,(int)valeur); ecritgain(fen); break; … … 84 129 case b_trans : ecritD(fen,b_trans,(int)valeur); ecritgain(fen); break; 85 130 case b_lin : ecritD(fen,b_lin,(int)valeur); ecritgain(fen); break; 131 132 */ 86 133 case b_gain : vg[fen-1]=0; ecritD(fen,b_gain,(int)valeur); ecritgain(fen); break; 87 134 case b_phase : ecritD(fen,b_phase,(int)valeur); ecritgain(fen); break; -
trunk/Poubelle/archediab.old/archediab.sources/c/corel.c
r637 r649 2 2 #include "corel.h" 3 3 4 4 /* 5 5 double coef_corel[nb_max_bolo][nb_max_bolo]; 6 6 int flag_corel[nb_max_bolo]; 7 7 */ 8 8 9 9 … … 30 30 { 31 31 for(j=0;j<nb_max_bolo;j++) gg->corel[j]=xbolbrut(j); 32 for(j=0;j<3;j++) gg->corel[nb_max_bolo+j]=gg->don.gyro[j]; 33 for(j=0;j<46;j++) gg->corel[nb_max_bolo+3+j]=xbolbrut(j); 32 34 } 33 35 -
trunk/Poubelle/archediab.old/archediab.sources/c/diabolo.c
r643 r649 19 19 #include "config_transputer.h" 20 20 #include "dilution.h" 21 #include "recons_sst.h" 22 #include "tm.h" 21 23 24 void InitSimulMission(void); 22 25 23 26 stglob* gg; // pointeur global sur la structure … … 44 47 //flag=2; // en mode simulation 45 48 if(clavier(touche_alt) ) flag=2; else flag=1; // en mode acquisition 49 if(clavier(touche_controle) ) flag=4; // avec emission des telecommandes au demarrage 50 if(clavier(touche_alt) && clavier(touche_controle) ) { 51 flag=3; // en mode simulateur de donnees mission 52 InitSimulMission(); 53 } 46 54 #endif 47 55 48 //return(1); 56 49 57 50 58 init_struct(flag); 59 60 init_recons_sst(); 51 61 52 62 //printf(" long_entete = %ld \n", sizeof(F_entete)); … … 65 75 66 76 nouveauM(0,diabolo_id,exec_menu_diabolo); 77 nouveauSM(0,menu_trace_tout_id,exec_menu_trace_tout); 67 78 68 79 ouvreD(fenetre_acquisition,acquisition_id,"acquisition",exec_acquisition); … … 85 96 #endif 86 97 98 initRS(port_A,baud1200+data8+stop10+noParity,0); 87 99 88 100 #ifdef lire_les_donnees_POM2 … … 117 129 118 130 119 if( flag==1)// mets en route les interruptions131 if( (flag==1) ou (flag==4) ) // mets en route les interruptions 120 132 { 121 133 ecritD(fenetre_acquisition,e_tache_inter,1); … … 125 137 select(fenetre_controle); 126 138 select(fenetre_acquisition); 139 140 // $CHECK$ on est toujours en mode 4 avec la derniere modif AB ??? 141 tt->PCI_actif=4; 142 if (flag==3) tt->PCI_actif=3; 127 143 128 144 return(option_texte+option_unclick); … … 154 170 void exec_controle(int fen,int item,double valeur,...) 155 171 { 156 if(item==caseferme) {stop_exec(fen);} 172 switch(item) 173 { 174 case caseferme : stop_exec(fen);break; 175 case con_reset_epld : reset_epld(); break; 176 case con_reset_trp : reset_trp(); break; 177 default : break; 178 } 157 179 } 158 180 -
trunk/Poubelle/archediab.old/archediab.sources/c/dilution.c
r645 r649 55 55 // la telecommande passe a travers le transputer sans etre traitee par lui 56 56 // elle arrive directement sur l'EPLD 57 57 /* 58 58 void ecrit_bit_dilution(int valeur,int bit); 59 59 … … 82 82 emission_telecommande(tc_dir_transputer,mot_tc); 83 83 } 84 84 */ 85 85 // fonction ecrit un des dac dilution 86 86 // c'est une telecommande normale 64 bit a supprimer … … 120 120 121 121 switch(item) 122 { 122 { 123 case dil_switch_helium : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_switch_helium); break; 124 case dil_EVB : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_vanne_EVB); break; 125 case dil_EVO : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_vanne_EVO); break; 126 case dil_EVF : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_vanne_EVF); break; 127 case dil_EVV : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_vanne_EVV); break; 128 case dil_sw_pp5 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_switch_pile_par_5); break; 129 case dil_sw_pp15 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_switch_pile_par_15); break; 130 131 /* 132 123 133 case dil_switch_helium : ecrit_bit_dilution((int)valeur,switch_helium); break; 124 134 case dil_EVB : ecrit_bit_dilution((int)valeur,vanne_EVB); break; … … 128 138 case dil_sw_pp5 : ecrit_bit_dilution((int)valeur,switch_pile_par_5); break; 129 139 case dil_sw_pp15 : ecrit_bit_dilution((int)valeur,switch_pile_par_15); break; 130 140 */ 131 141 // ---- commande directe d'un mot avec les 3 case de codage hexadecimales 132 142 … … 137 147 // ---- telecommande du raz periodique des fets 138 148 case dil_raz_modul : 139 case dil_fet_raz : 149 case dil_fet_raz : 150 i =0; 151 if(litD(fen,dil_fet_raz,0)==2) i+=1; 152 if(litD(fen,dil_fet_raz,0)==3) i+=7; 153 emission_tc_reduite(tc2_raz_fet,0,i); 154 /* 140 155 { 141 156 char mot_tc[10]; … … 150 165 emission_telecommande(tc_dir_transputer,mot_tc); 151 166 } 152 167 */ 153 168 break; 154 169 155 case dil_ch1 : e crit_bit_dilution((int)valeur,chauffage1); break;156 case dil_ch2 : e crit_bit_dilution((int)valeur,chauffage2); break;157 case dil_ch3 : e crit_bit_dilution((int)valeur,chauffage3); break;158 case dil_ch4 : e crit_bit_dilution((int)valeur,chauffage4); break;159 case dil_ch5 : e crit_bit_dilution((int)valeur,chauffage5); break;160 case dil_ch6 : e crit_bit_dilution((int)valeur,chauffage6); break;161 case dil_ch7 : e crit_bit_dilution((int)valeur,chauffage7); break;170 case dil_ch1 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_chauffage1); break; 171 case dil_ch2 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_chauffage2); break; 172 case dil_ch3 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_chauffage3); break; 173 case dil_ch4 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_chauffage4); break; 174 case dil_ch5 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_chauffage5); break; 175 case dil_ch6 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_chauffage6); break; 176 case dil_ch7 : emission_tc_reduite(tc2_dilution,(valeur==1),nbit_chauffage7); break; 162 177 163 178 // case dil_dac_1 : … … 227 242 // j=numero de bebo T[k] = R[k+4] en Kelvin 228 243 if ((R[k]-c(j,6))>1.) 229 {if((log(R[k]-c(j,6))-c(j,0))>0.001) llR= log(log(R[k]-c(j,6))-c(j,0)) ; else llR=0;} 244 {if((log(R[k]-c(j,6))-c(j,0))>0.001) llR= log(log(R[k]-c(j,6))-c(j,0)) ; else llR=0; 245 // printf("\nk=%d j=%d R=%g c2=%g c3=%g llR=%g",k,j,R[k],c(j,2),c(j,3),llR); 246 } 230 247 else llR=0; 231 248 R[k+4] = exp( c(j,1) + c(j,2)* llR + c(j,3)* llR* llR + c(j,4)* llR* llR* llR + c(j,5)* llR* llR* llR* llR) ; … … 235 252 } 236 253 254 gg->temperature_cryo=R[4]; // Charge la temperature_cryo (0.1K) pour les calculs futurs avec les bolos 255 /* La germanium doit toujours etre en premier par rapport aux autres thermos absolus */ 237 256 238 257 if(R[0]<90.) ecritD(fenetre_dilution,dil_temp … … 298 317 299 318 300 ecritD(fenetre_dilution,dil_temperatures,"temp-Haut = %4.1f° %4.1f° %4.1f° %4.1f° \rtemp-Bas = %4.1f° %4.1f° %4.1f° %4.1f° " 301 ,val_temperature(blk->ADC_dil[ t_h1]),val_temperature(blk->ADC_dil[ t_h2]),val_temperature(blk->ADC_dil[ t_h3]),val_temperature(blk->ADC_dil[ t_h4]) 302 ,val_temperature(blk->ADC_dil[ t_b1]),val_temperature(blk->ADC_dil[ t_b2]),val_temperature(blk->ADC_dil[ t_b3]),val_temperature(blk->ADC_dil[ t_b4]) 319 ecritD(fenetre_dilution,dil_temperatures,"temp-Haut = %4.1f° %4.1f° Base = %4.1f° %4.1f° \r tube He: %4.1f° piles %4.1f° driver %4.1f°" 320 ,val_temperature(blk->ADC_dil[ t_h2]),val_temperature(blk->ADC_dil[ t_h4]) 321 ,val_temperature(blk->ADC_dil[ t_b1]),val_temperature(blk->ADC_dil[ t_b2]),val_temperature(blk->ADC_dil[ t_b3]) 322 ,val_temperature(blk->ADC_dil[ t_pile]),val_temperature(blk->ADC_dil[ t_a1]) 303 323 ); 304 324 305 ecritD(fenetre_dilution,dil_t_h1,cnt_temperature(t_h1)); 306 ecritD(fenetre_dilution,dil_t_h2,cnt_temperature(t_h2)); 307 ecritD(fenetre_dilution,dil_t_h3,cnt_temperature(t_h3)); 308 ecritD(fenetre_dilution,dil_t_h4,cnt_temperature(t_h4)); 309 ecritD(fenetre_dilution,dil_t_a1,cnt_temperature(t_a1)); 310 ecritD(fenetre_dilution,dil_t_a2,cnt_temperature(t_a2)); 311 ecritD(fenetre_dilution,dil_t_a3,cnt_temperature(t_a3)); 312 ecritD(fenetre_dilution,dil_t_a4,cnt_temperature(t_a4)); 313 ecritD(fenetre_dilution,dil_t_b1,cnt_temperature(t_b1)); 314 ecritD(fenetre_dilution,dil_t_b2,cnt_temperature(t_b2)); 315 ecritD(fenetre_dilution,dil_t_b3,cnt_temperature(t_b3)); 316 ecritD(fenetre_dilution,dil_t_b4,cnt_temperature(t_b4)); 325 ecritD(fenetre_dilution,dil_t_h1,cnt_temperature(t_h2)); 326 ecritD(fenetre_dilution,dil_t_h2,cnt_temperature(t_h4)); 327 ecritD(fenetre_dilution,dil_t_h3,cnt_temperature(t_b1)); 328 ecritD(fenetre_dilution,dil_t_h4,cnt_temperature(t_b2)); 329 ecritD(fenetre_dilution,dil_t_a1,cnt_temperature(t_b3)); 330 ecritD(fenetre_dilution,dil_t_a2,cnt_temperature(t_pile)); 331 ecritD(fenetre_dilution,dil_t_a3,cnt_temperature(t_a1)); 317 332 318 333 -
trunk/Poubelle/archediab.old/archediab.sources/c/gyroscope.c
r643 r649 24 24 25 25 26 27 28 29 void traite_block_gyro_comprime(block_type_gyro_comprime* blk)30 {31 int i;32 block_type_gyro bk_gyro;33 block_type_gyro* blk2=& bk_gyro;34 if(!fenetre(fenetre_gyroscope)) return;35 //printf("*************** decompress data gyro \n");36 for(i=0;i<3;i++) decompress_7_2((long *)blk->gyro[i],blk2->gyro[i],nb_per_block*2);37 blk2->code1=blk->code1;38 blk2->code2=blk->code2;39 traite_block_gyro(blk2);40 }41 42 43 void traite_block_gyro(block_type_gyro* blk)44 {45 int k;46 double y[15];47 48 int temps_cntl;49 double secondes;50 51 if(!fenetre(fenetre_gyroscope)) return;52 53 for(k=0;k<72;k++)54 {55 y[0]=blk->gyro[0][k];56 y[1]=blk->gyro[1][k];57 y[2]=blk->gyro[2][k];58 59 // printf(" y = %g %g %g %g %g \n",y[0],y[1],y[2],y[3],y[4]);60 temps_cntl =numero_block(blk)*nb_per_block*2+k;61 secondes=gg->periode_echantillonage*(double)temps_cntl-gg->temps_origine;62 tracen(fenetre_gyroscope,3,secondes,y);63 // printf("secondes=%g\n",secondes);64 }65 }66 67 -
trunk/Poubelle/archediab.old/archediab.sources/c/menu.c
r643 r649 18 18 #include "dilution.h" 19 19 #include "senseur_stellaire.h" 20 #include "sstbrut.h" 21 #include "FindPeri.h" 22 #include "phaseSST.h" 20 23 #include "gyroscope.h" 21 24 … … 24 27 25 28 int j,ann; 29 30 26 31 27 32 void exec_menu_diabolo(int fen,int item,double valeur,...) … … 70 75 break; 71 76 72 case d_senseur_stellaire : if(fenetre(fenetre_senseur_stellaire)) select(fenetre_senseur_stellaire); 77 case d_sst_brut : if(fenetre(fenetre_sstbrut)) select(fenetre_sstbrut); 78 else ouvreD(fenetre_sstbrut,sstbrut_id,"senseur_stellaire",exec_sstbrut); 79 break; 80 81 case d_senseur_stellaire : if(fenetre(fenetre_senseur_stellaire)) select(fenetre_senseur_stellaire); 73 82 else ouvreD(fenetre_senseur_stellaire,senseur_stellaire_id,"senseur_stellaire",exec_senseur_stellaire); 74 if(fenetre(fenetre_gyroscope)) select(fenetre_gyroscope); 83 break; 84 85 case d_recons_sst : if(fenetre(fenetre_Find_Period)) select(fenetre_Find_Period); 86 else ouvreD(fenetre_Find_Period,FindPeri_id,"FindPeriod",exec_FindPeri); 87 if(fenetre(fenetre_Phase_SST)) select(fenetre_Phase_SST); 88 else ouvreD(fenetre_Phase_SST,phase_id,"phase",exec_phase); 89 break; 90 91 case d_gyros : if(fenetre(fenetre_gyroscope)) select(fenetre_gyroscope); 75 92 else ouvreD(fenetre_gyroscope,0,"fenetre_gyroscope",exec_gyroscope); 76 93 break; 94 default : break; 95 } 96 } 77 97 78 98 /* … … 82 102 */ 83 103 84 85 86 87 88 89 90 case d_trace_carte : ferme_annexe(); 91 ann=1; 92 ouvreD(fenetre_annexe ,carte_id ,"carte",exec_carte); 104 void exec_menu_trace_tout (int fen,int item,double valeur,...) 105 { 106 switch(item) 107 { 108 case d_trace_temperature : if(fenetre(fenetre_trace_tout_temperature)) select(fenetre_trace_tout_temperature); 109 else ouvreD(fenetre_trace_tout_temperature ,trace_tout_id ,"trace temperature" ,exec_trace_tout ); 93 110 break; 94 95 case d_pointage : ferme_annexe(); 96 ann=2; 97 ouvreD(fenetre_annexe ,pointage_id ,"pointage",exec_pointage); 111 case d_trace_bolos : if(fenetre(fenetre_trace_tout_bolos)) select(fenetre_trace_tout_bolos); 112 else ouvreD(fenetre_trace_tout_bolos ,trace_tout_id ,"trace bolos" ,exec_trace_tout ); 98 113 break; 99 100 case d_foyer : ferme_annexe(); 101 ann=3; 102 ouvreD(fenetre_annexe ,foyer_id ,"foyer",exec_foyer); 114 case d_trace_gyros : if(fenetre(fenetre_trace_tout_gyros)) select(fenetre_trace_tout_gyros); 115 else ouvreD(fenetre_trace_tout_gyros ,trace_tout_id ,"trace gyros" ,exec_trace_tout ); 103 116 break; 104 105 117 default : break; 106 118 } -
trunk/Poubelle/archediab.old/archediab.sources/c/mesures_bolo.c
r643 r649 70 70 // // 71 71 // Ptot = coef3 * ( (10*Tb) ** coef4 - (10*Tcryo) ** coef4 ) // 72 Tcryo=0.1; 73 72 /* Desormais 30/06/1999, Tcryo est calculee avec la germanium */ 73 //Tcryo=0.1; 74 Tcryo= gg->temperature_cryo ; 74 75 Ptot=0; if( (c(4)>0.01) && (T>0.01) ) Ptot = c(3) * ( pow(10.*T,c(4)) - pow(10.*Tcryo,c(4)) ); 75 76 … … 79 80 // tau = - ln ( 1 + Pciel / coef6 ) coef6= I * Bi (tables xavier) // 80 81 81 Pciel = 0; if( c(5)>Pelec) Pciel = c(5) - Pelec; 82 a=1; if( c(6) >0.1 ) a = 1 - Pciel / c(6) ; 83 tau=0; if( a>0 ) tau = - log ( a ); 84 82 //Pciel = 0; if( c(5)>Pelec) Pciel = c(5) - Pelec; 83 Pciel = 0; if( Ptot>Pelec) Pciel = Ptot - Pelec; /* Pour avoir la puissance de rayonnement absorbé */ 84 //a=1; if( c(6) >0.1 ) a = 1 - Pciel / c(6) ; 85 //tau=0; if( a>0 ) tau = - log ( a ); 86 tau=Tcryo ; /* FXD pour avoir Tcryo 16/07/99 */ 85 87 86 88 … … 92 94 93 95 94 ecritT(fenetre_mesures_bolo,fin_f," R=%7.3fM I=%6.3fnA V=%7.3fmV Pelec=% 5.1fpW",R*1e-6,I*1e3,V*1e-3,Pelec);96 ecritT(fenetre_mesures_bolo,fin_f," R=%7.3fM I=%6.3fnA V=%7.3fmV Pelec=%6.2fpW",R*1e-6,I*1e3,V*1e-3,Pelec); 95 97 96 98 if(T>0.01) ecritT(fenetre_mesures_bolo,fin_f," T=%6.1fmK ", T*1e3); 97 99 98 if( Ptot>0. 1) ecritT(fenetre_mesures_bolo,fin_f," Ptot=%5.1fpW Pciel=%5.1fpW tau=%5.3f ",Ptot,Pciel,tau);100 if( Ptot>0.01) ecritT(fenetre_mesures_bolo,fin_f," Ptot=%6.2fpW Pciel=%6.2fpW Tcryo=%6.1f ",Ptot,Pciel,tau*1e3); 99 101 100 102 -
trunk/Poubelle/archediab.old/archediab.sources/c/rafraichis_fenetre.c
r643 r649 22 22 ecritD(fenetre_acquisition,e_telemesure,1+(0x0f & (int)gg->reglage.dilu.transmission)); 23 23 ecritD(fenetre_acquisition,e_flash,1+((0x30 & (int)gg->reglage.dilu.transmission)>>4)); 24 ecritD(fenetre_acquisition,e_vanne,(int)gg->reglage.dilu.vanne); 25 ecritD(fenetre_acquisition,e_helium,(int)gg->reglage.dilu.helium); 24 26 25 27 // affichage de toutes les fréquences … … 68 70 ecritD(fenetre_regulation,regu_int+i,gg->reglage.regul[i].integ+1); 69 71 ecritD(fenetre_regulation,regu_deriv+i,gg->reglage.regul[i].deriv+1); 70 ecritD(fenetre_regulation,regu_chauffage+i,gg->reglage.regul[i].chauffage); 72 if(gg->reglage.regul[i].chauffage>0) ecritD(fenetre_regulation,regu_chauffage+i,gg->reglage.regul[i].chauffage); 73 else ecritD(fenetre_regulation,regu_chauffage+i,-gg->reglage.regul[i].chauffage); 71 74 } 72 75 -
trunk/Poubelle/archediab.old/archediab.sources/c/senseur_stellaire.c
r643 r649 1 1 #include "diabolo.h" 2 2 #include "senseur_stellaire.h" 3 4 3 #include "compress.h" 4 #include "recons_sst.h" 5 #include <math.h> 6 7 #define M_PI 3.1415926535 5 8 6 9 //-------------------- fonction exec de la fenetre : senseur_stellaire ------------------------------- 7 10 11 static int diodes[48]; 12 13 #define DIODE_UNUSED_1 3 14 #define DIODE_UNUSED_2 7 15 16 17 int diodesbuffer[dbufsz][48];int off[48]; 18 float zfoundstars[20]; 19 float mfoundstars[20]; 20 double tfoundstars[20]; 21 int nfoundstars; 22 int seuilSST=5; 23 24 static void init_sst_buffers(void); 25 static void remove_diode_offset(void); 26 static void find_stars(double secondes); 27 28 static void trace_lin(int fen, double secondes); 29 static void trace_radar(int fen, double secondes); 30 static void init_radar(void); 31 static void setup_gra(int fen); 32 static void clean_radar(float phase,int fen); 33 34 static double radarPer = 30.; // periode du radar, en secondes. 35 static double radarTUp = 0; // le temps de reference pour pointage "NORD" 36 static int radarSens = 1; 37 static int sstHas2Bars = false; 38 39 //static double tm = 0; 8 40 9 41 void exec_senseur_stellaire(int fen,int item,double valeur,...) 10 42 { 11 43 if(item>1000) item-=1000; // pour appeler le case pour tous les cara d'un edit texte 12 13 44 switch(item) 14 45 { 15 46 case ouverture : 16 47 selectgra(fen); 48 setup_gra(fen); 49 init_sst_buffers(); 50 radarPer = litD(fenetre_senseur_stellaire,sst_periode,0); 51 radarTUp = litD(fenetre_senseur_stellaire,sst_phase,0); 52 17 53 break; 18 54 case fermeture : 19 55 break; 20 case sst_azer : 21 break; 22 case sst_sortie_brute : 56 case sst_txt : 57 break; 58 case sst_twobars : 59 sstHas2Bars = litD(fenetre_senseur_stellaire,sst_twobars,0); 60 break; 61 case sst_radar : 62 setup_gra(fen); 63 break; 64 case sst_seuil : { 65 seuilSST = litD(fenetre_senseur_stellaire,sst_seuil,0); 66 if (seuilSST <=0) { 67 seuilSST = 1; 68 } 69 } 70 break; 71 case sst_periode : 72 case sst_sens_horaire: 73 case sst_phase : { 74 double sns = litD(fenetre_senseur_stellaire,sst_sens_horaire,0); 75 double phs = litD(fenetre_senseur_stellaire,sst_phase,0); 76 radarPer = litD(fenetre_senseur_stellaire,sst_periode,0); 77 radarTUp = phs/360. * radarPer; 78 selectgra(fen); 79 if (radarSens != (sns ? -1 : 1)) efface(fen); 80 radarSens = sns ? -1 : 1; 81 break; 82 } 83 case sst_efface : 84 setup_gra(fen); 85 efface(fen); 86 break; 87 case tache_de_fond: 88 selectgra(fen); 89 if(litD(fenetre_senseur_stellaire,sst_radar,0)) { 90 trace_radar(fen, valeur); 91 } else { 92 trace_lin(fen, valeur); 93 } 23 94 break; 24 95 default : break; 25 96 } 26 97 } 98 99 void setup_gra(fen) { 100 selectgra(fen); 101 if(litD(fenetre_senseur_stellaire,sst_radar,0)) { 102 graph->ymin=-60; 103 graph->ymax=60; 104 graph->ypas=0; 105 graph->xmin=-60; 106 graph->xmax=60; 107 graph->xpas=0; 108 graph->grille=0; 109 graph->graduations=0; 110 graph->taille_graduations=0; 111 graph->sans_image=1; 112 graph->avec_icones=0; 113 strcpy(graph->xtitre, ""); 114 graph->ytitre[0]=0; 115 init_radar(); 116 } else { 117 graph->ymin=0; 118 graph->ymax=48; 119 graph->ypas=5; 120 graph->xmin=0; 121 graph->xmax=240; 122 graph->xpas=30; 123 graph->grille=0; 124 graph->graduations=1; 125 graph->taille_graduations=10; 126 graph->sans_image=0; 127 graph->avec_icones=0; 128 strcpy(graph->xtitre, "T"); 129 graph->ytitre[0]=0; 130 } 131 efface(fen); 132 } 133 134 #define seuil1 500 135 #define seuil2 250 136 #define seuil3 120 137 #define seuil4 60 138 #define seuil5 30 139 #define seuil6 10 140 141 #define frc(x) ((x) - (int)(x)) 142 143 void trace_lin(int fen, double secondes) { 144 int i; 145 //tm += gg->periode_echantillonage; 146 //if (tm>graph->xmax) tm = 0; 147 double tm = secondes - (int)(secondes/graph->xmax)*graph->xmax; 148 if(!litD(fenetre_senseur_stellaire,sst_etoiles,0)) { 149 for (i=0; i<48; i++) { 150 if(fabs(off[i])>1000.) continue; 151 if (-diodes[i] +off[i]> seuil1) 152 symbole(fen, tm, i, 5, rondplein, 0, rouge); 153 else if (-diodes[i]+off[i] > seuil2) 154 symbole(fen, tm, i, 4, rondplein, 0, rouge); 155 else if (-diodes[i]+off[i] > seuil3) 156 symbole(fen, tm, i, 3, rondplein, 0, rouge); 157 else if (-diodes[i]+off[i] > seuil4) 158 symbole(fen, tm, i, 2, rondplein, 0, rouge); 159 else if (-diodes[i]+off[i] > seuil5) 160 symbole(fen, tm, i, 2, point, 0, rouge); 161 else if (-diodes[i]+off[i] > seuil6) 162 symbole(fen, tm, i, 2, point, 0, noir); 163 } 164 } else { 165 for (i=0; i<nfoundstars; i++) { 166 float z = zfoundstars[i]; 167 if (mfoundstars[i] > seuil1) { 168 symbole(fen, tm, z, 5, rondplein, 0, rouge); 169 } else if (mfoundstars[i] > seuil2) { 170 symbole(fen, tm, z, 4, rondplein, 0, rouge); 171 } else if (mfoundstars[i] > seuil3) { 172 symbole(fen, tm, z, 3, rondplein, 0, rouge); 173 } else if (mfoundstars[i] > seuil4) { 174 symbole(fen, tm, z, 2, rondplein, 0, rouge); 175 } else if (mfoundstars[i] > seuil5) { 176 symbole(fen, tm, z, 2, point, 0, rouge); 177 } else 178 symbole(fen, tm, z, 2, point, 0, noir); 179 } 180 } 181 } 182 183 #define NMAXRADARSTAR 1000 184 185 struct radarStar { 186 float phase; 187 float rayon; 188 float flux; 189 }; 190 191 static struct radarStar* radarstars = 0; 192 static double lastPhase = 0; 193 194 void init_radar() { 195 int i; 196 if (!radarstars) { 197 radarstars = (struct radarStar*) malloc(NMAXRADARSTAR*sizeof(struct radarStar)); 198 } 199 for (i=0; i<NMAXRADARSTAR; i++) { 200 radarstars[i].phase = -1; 201 radarstars[i].rayon = -1; 202 } 203 204 } 205 206 207 // Nettoyage radar pour trace jusqu'a phase 208 209 static void clean_radar(float phase, int fen) { 210 int i; 211 double x,y,r,th; 212 for (i=0; i<NMAXRADARSTAR; i++) { 213 // if (radarstars[i].phase >= 0 && radarstars[i].phase < 10 && 214 // ((phase > lastPhase && radarstars[i].phase > lastPhase && 215 // radarstars[i].phase <= phase) || 216 // ((phase < lastPhase && (radarstars[i].phase > lastPhase || 217 // radarstars[i].phase <= phase))))) { 218 if (radarstars[i].phase >= 0 && radarstars[i].phase < phase-1) { 219 r = (60-48) + radarstars[i].rayon; 220 th = (frc(radarstars[i].phase)*radarSens+.25) * 2 * M_PI ; 221 x = r * cos(th); 222 y = r * sin(th); 223 if (radarstars[i].flux > seuil1) { 224 symbole(fen, x, y, 5, rondplein, 0, blanc); 225 } else if (radarstars[i].flux > seuil2) { 226 symbole(fen, x, y, 4, rondplein, 0, blanc); 227 } else if (radarstars[i].flux > seuil3) { 228 symbole(fen, x, y, 3, rondplein, 0, blanc); 229 } else if (radarstars[i].flux > seuil4) { 230 symbole(fen, x, y, 2, rondplein, 0, blanc); 231 } else { 232 symbole(fen, x, y, 2, point, 0, blanc); 233 } 234 radarstars[i].phase = -1; 235 } 236 //if (radarstars[i].phase >= 10) { 237 // radarstars[i].phase -= 10; 238 //} 239 } 240 } 241 242 static long lastRadarTrace = 0; 243 244 void trace_radar(int fen, double secondes) { 245 // On a des nouvelles etoiles... 246 double phase; 247 int i,j; 248 long tk; 249 250 phase = (secondes - radarTUp)/radarPer; 251 //phase = phase - (int)(phase); 252 253 for (i=0; i<nfoundstars; i++) { 254 for (j=0; j<NMAXRADARSTAR; j++) { 255 if (radarstars[j].phase < 0) { 256 radarstars[j].phase = phase;// +10; // >=10 : nouvelle... 257 radarstars[j].rayon = zfoundstars[i]; 258 radarstars[j].flux = mfoundstars[i]; 259 break; 260 } 261 } 262 } 263 264 // Le trace... 265 // mais on ne trace pas tout le temps... 266 tk = TickCount(); 267 if (tk - lastRadarTrace < 10) return; 268 lastRadarTrace = tk; 269 270 if (litD(fenetre_senseur_stellaire,sst_autolock,0)) { 271 float per,phs,sns; 272 per = DonnePeriod(); 273 phs = DonnePhase(); 274 sns = DonneSens(); 275 if (per>0) { 276 ecritD(fenetre_senseur_stellaire, sst_periode, "%8.3f",per); 277 radarPer = per; 278 } 279 if (phs>-9000) { 280 ecritD(fenetre_senseur_stellaire, sst_phase, "%8.1f",phs); 281 radarTUp = phs/360. * radarPer; 282 } 283 if (sns > -9000) { 284 radarSens = -sns; 285 ecritC(fenetre_senseur_stellaire, sst_sens_horaire, sns > 0); 286 } 287 } 288 289 //cercle(fen,-(60-48),-(60-48),(60-48),(60-48),jaune); // trace le cercle x1,y1 - x2,y2 290 291 modtrace(fen,1,blanc); 292 segment(fen, (60-48)*cos((lastPhase*radarSens+.25)*M_PI*2), 293 (60-48)*sin((lastPhase*radarSens+.25)*M_PI*2), 294 60*cos((lastPhase*radarSens+.25)*M_PI*2), 295 60*sin((lastPhase*radarSens+.25)*M_PI*2)); 296 297 clean_radar(phase, fen); 298 299 modtrace(fen,1,jaune); 300 segment(fen, (60-48)*cos((frc(phase)*radarSens+.25)*M_PI*2), 301 (60-48)*sin((frc(phase)*radarSens+.25)*M_PI*2), 302 60*cos((frc(phase)*radarSens+.25)*M_PI*2), 303 60*sin((frc(phase)*radarSens+.25)*M_PI*2)); 304 305 for (i=0; i<NMAXRADARSTAR; i++) { 306 if (radarstars[i].phase >= 0) { 307 float x,y,r,th; 308 r = (60-48) + radarstars[i].rayon; 309 th = (frc(radarstars[i].phase)*radarSens+.25) * 2 * M_PI ; 310 x = r * cos(th); 311 y = r * sin(th); 312 if (radarstars[i].flux > seuil1) { 313 symbole(fen, x, y, 5, rondplein, 0, rouge); 314 } else if (radarstars[i].flux > seuil2) { 315 symbole(fen, x, y, 4, rondplein, 0, rouge); 316 } else if (radarstars[i].flux > seuil3) { 317 symbole(fen, x, y, 3, rondplein, 0, rouge); 318 } else if (radarstars[i].flux > seuil4) { 319 symbole(fen, x, y, 2, rondplein, 0, rouge); 320 } else if (radarstars[i].flux > seuil5) { 321 symbole(fen, x, y, 2, point, 0, rouge); 322 } else 323 symbole(fen, x, y, 2, point, 0, noir); 324 } 325 } 326 lastPhase = frc(phase); 327 328 } 329 330 27 331 28 332 //#define bit_sst(i,j,k) (((blk->sst[i][i*3+k/4])>>(j+8*k%4))&1) … … 50 354 #define place_paquet(i,j) (i/8) * 24 + j*8 + (i%8) 51 355 52 void traite_block_sst_comprime (block_type_sst_comprime* blk){} 356 357 void decode_sst(block_type_sst* blk, int i, int* diodes); // diodes = tableau a 48 entrees 358 359 void decode_sst(block_type_sst* blk, int i, int* diodes) { 360 int j; // 0-5 : numero du bloc de 8 diodes 361 int k; // 0-2 : indice du bloc de 4 bits (une diode = 12 bits = 3 blocs de 4 bits) 362 int l; // 0-7 : indice de la diode dans son bloc (8 diodes * 4 bits = 1 mot de 32 bits) 363 364 // numero de la diode (0-47) = j*8+l; 365 // indice dans le bloc sst du mot de 32 bits (0-17) = j*3+k; 366 // indice dans mot de 32 bits du premier bit utile = 4*l; 367 368 for (j=0; j<48; j++) diodes[j] = 0; 369 370 for (j=0; j<6; j++) 371 for (k=0; k<3; k++) 372 for (l=0; l<8; l++) { 373 long word = blk->sst[i][j*3+k]; 374 word = (word >> (4*l)) & 0xF; 375 //printf("diode %d mot %d valeur %d\n", j*8+l, k, word); 376 diodes[j*8+l] = (diodes[j*8+l] << 4) + word; 377 } 378 379 //for (j=0; j<48; j++) if (diodes[j]>2047) diodes[j] -= 4096; 380 for (j=0; j<48; j++) diodes[j] -= 2048; 381 } 382 383 384 385 //#define place_paquet(i,j) ((i/8) * 24 + j*8 + (i%8) ) 386 387 void traite_block_sst_comprime (block_type_sst_comprime* blk){ 388 block_type_sst blk2; 389 unsigned long sst_vrai[nb_per_block*2]; 390 int j,jc,i,k; 391 unsigned long a,b0,b1,b2; 392 393 394 for (j=0; j<18; j++) 395 for (i=0; i<nb_per_block*2; i++) 396 blk2.sst[i][j] = 0; 397 398 jc=0; 399 for(j=0;j<48;j++) { 400 if ((j!=0) && (j!=4)) 401 { 402 decompress_4_1((long*)blk->sst[jc],(long*)sst_vrai,nb_per_block*2); 403 for(k=0;k<nb_per_block*2;k++) { 404 b2 = sst_vrai[k] & 0xf; 405 b1 = (sst_vrai[k] >> 4) & 0xf; 406 b0 = (sst_vrai[k] >> 8) & 0xf; 407 a=place_paquet(j,0); 408 blk2.sst[k][a/8] |= (b0 << (a%8)*4); 409 a=place_paquet(j,1); 410 blk2.sst[k][a/8] |= (b1 << (a%8)*4); 411 a=place_paquet(j,2); 412 blk2.sst[k][a/8] |= (b2 << (a%8)*4); 413 } 414 jc++; 415 } 416 } 417 valide_block((block_type_modele*)&blk2,block_sst,numero_block(blk)); 418 traite_block_sst(&blk2); 419 } 53 420 54 421 55 422 void traite_block_sst(block_type_sst* blk) 56 423 { 57 int i, j,k;58 double y[15];59 double x;424 int i,k; 425 //double y[15]; 426 //double x; 60 427 61 428 int temps_cntl; 62 429 double secondes; 63 int a,b,b0,b1,b2; 64 int prem_d; 65 66 if(!fenetre(fenetre_senseur_stellaire)) return; 67 // ecriture des valeurs brutes du senseur stellaire 68 // les numero 0 et 4 sont dediés aux thermometres 69 // pour l'instant machent bien 1 2 3 8 9 10 11 70 if(litD(fenetre_senseur_stellaire,sst_sortie_brute,0)) 71 { 72 if(!fenetre(fenetre_senseur_stellaire_lecture_brute)) nouveauT(fenetre_senseur_stellaire_lecture_brute,0,"lecture senseur stellaire"); 73 74 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"\nsenseur stellaire \n"); 75 76 77 // k=0; 78 for(k=0;k<4;k++) 79 { 80 for(i=0;i<16;i++) // 16 senseurs 81 { 82 for(j=0;j<3;j++) // 3 paquets 83 { 84 a=place_paquet(i,j); 85 b= ( blk->sst[k][a/8] >>( (a%8)*4) ) & 0xf; 86 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"%x",b); 87 } 88 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f," "); 89 } 90 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"\n"); 91 } 92 93 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"\n"); 94 95 } 96 97 //k=0; 98 prem_d=litD(fenetre_senseur_stellaire,sst_prem_diode,0L); 99 for(k=0;k<72;k++) 100 { 101 for(i=0;i<12;i++) // seulement 12 diodes 102 { 103 int q; 104 q=i+prem_d-1; 105 106 a=place_paquet(q,0); 107 b0= ( blk->sst[k][a/8] >>( (a%8)*4) ) & 0xf; 108 a=place_paquet(q,1); 109 b1= ( blk->sst[k][a/8] >>( (a%8)*4) ) & 0xf; 110 a=place_paquet(q,2); 111 b2= ( blk->sst[k][a/8] >>( (a%8)*4) ) & 0xf; 112 113 114 x=(double)( (b0<<8) | (b1<<4) | b2 ) ; 115 if(x>2047) x-=4096; 116 y[i]=x; 117 } 118 // printf(" y = %g %g %g %g %g \n",y[0],y[1],y[2],y[3],y[4]); 119 temps_cntl =numero_block(blk)*nb_per_block*2+k; 120 secondes=gg->periode_echantillonage*(double)temps_cntl-gg->temps_origine; 121 tracen(fenetre_senseur_stellaire,12,secondes,y); 122 } 123 } 124 125 126 127 // les 46 valeurs en hexa 128 // i=0; // juste le premier point du block 129 // for(i=0;i<72;i++) 430 //int a,b,b0,b1,b2; 431 //char tab[5000]; 432 433 for (i=0; i<nb_per_block*2; i++) { 434 k=0; 435 decode_sst(blk, i, diodes); 436 temps_cntl=numero_block(blk)*nb_per_block*2+i; 437 secondes = temps_cntl*gg->periode_echantillonage; 438 439 // 1. Suppression d'offset sur la rangee de diodes, et remise en ordre 440 remove_diode_offset(); 441 // 2. Suppression des doubles impulsions et detection des etoiles 442 find_stars(secondes); 443 exec_recons_sst(); 444 445 if(fenetre(fenetre_senseur_stellaire)) 446 exec_senseur_stellaire(fenetre_senseur_stellaire,tache_de_fond,secondes); 447 } 448 } 449 450 void init_sst_buffers(void) { 451 int i,j; 452 for (i=0; i<dbufsz; i++) 453 for (j=0; j<48; j++) 454 diodesbuffer[i][j] = 0; 455 nfoundstars = 0; 456 } 457 458 // sans objet a cause des filtres de l'electronique ? 459 // se contente de permuter les diodes 460 461 // diodpermut[i] = channel de la diode i 462 static int diodpermut[46]= 463 { 8,24,40, 9,25,41,10,26,42,11, 464 27,43,16,32, 1,17,33, 2,18,34, 465 3,19,35,12,28,44,13,29,45,14, 466 30,46,15,31,47,20,36, 5,21,37, 467 6,22,38, 7,23,39}; 468 // voies 0 et 4 non connectees, voie 1 en panne. 469 470 void remove_diode_offset(void) { 471 int dd[46]; 472 int i; 473 for (i=0; i<46; i++) { 474 dd[i] = diodes[i]; 475 } 476 diodes[46] = diodes[47] = 0; 477 for (i=0; i<46; i++) { 478 diodes[i] = dd[diodpermut[i]]; 479 } 480 return; 130 481 /* 131 for(i=0;i<72;i++) 132 { 133 134 for(j=0;j<12;j++) // seulement les 12 premieres diodes 135 { 136 x=0; 137 for(k=0;k<12;k++) x=(x<<1) | bit_sst(i,j,k); 138 y[j]=(double)x; 139 } 140 temps_cntl =numero_block(blk)*nb_per_block*2+i; 141 secondes=gg->periode_echantillonage*(double)temps_cntl-gg->temps_origine; 142 tracen(fenetre_senseur_stellaire,12,secondes,y); 143 } 144 145 */ 146 /* i=1; // juste le premier point du block 147 // for(i=0;i<72;i++) 148 { 149 for(k=0;k<12;k++) // 12 bits 150 { 151 for(j=0;j<35;j++) // 46 senseurs 152 { 153 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"%d ",bit_sst(i,j,k)); 154 } 155 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"\n"); 156 } 157 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"\n"); 158 } 159 160 // les 46 valeurs en hexa 161 // i=0; // juste le premier point du block 162 // for(i=0;i<72;i++) 163 for(i=0;i<10;i++) 164 { 165 for(j=0;j<35;j++) // 46 senseurs 166 { 167 x=0; 168 for(k=0;k<12;k++) x=(x<<1) | bit_sst(i,j,k); 169 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"%3x ",x); 170 } 171 ecritT(fenetre_senseur_stellaire_lecture_brute,fin_f,"\n"); 172 } 173 174 175 } 176 177 178 */ 482 int i,j; 483 float m,sig; 484 // suppression des positions non utilisees. 3 et 7 ? 485 for (i=DIODE_UNUSED_1; i<46; i++) 486 diodes[i] = diodes[ i<DIODE_UNUSED_2-1 ? i+1 : i+2 ]; 487 488 // calcul d'un fond sur la rangee. Moyenne clippee. 489 m = 0; sig = 1.e10; 490 for (i=0; i<2; i++) { 491 float s=0; float s2=0; int n=0; 492 for (j=0; j<46; j++) { 493 if (fabs(diodes[j]-m)<3*sig+1) { 494 s += diodes[j]; s2 += diodes[j]*diodes[j]; n++; 495 } 496 } 497 if (n>0) { 498 m = s/n; sig = sqrt(s2/n - m*m); 499 } else { 500 m = 0; break; 501 } 502 } 503 for (j=0; j<46; j++) 504 diodes[j] -= m; 505 506 diodes[46] = diodes[47] = 0; 507 */ 508 } 509 510 511 void find_stars(double secondes) { 512 int i,j,feelasleep,sousoff; 513 float corrtemps,aufsete; 514 // Une etoile est validee seulement si impulsion dans meme canal 515 // ou dans canal juste au dessus dans les 4 echantillons qui precedent 516 // (en excluant le precedent). 517 // On demande aussi que le signal soit en train de remonter... 518 // en pratique on pourrait restreindre la contrainte avec une estimation 519 // de la vitesse de rotation. echantillon -2 ou -3... 520 nfoundstars = 0; 521 for (i=0; i<46; i++) { 522 // la diode 14 est morte (canal 1)... 523 if (i==14) continue; 524 aufsete=0.;feelasleep=0; 525 for (sousoff=0;sousoff<5;sousoff++) 526 {aufsete+=diodesbuffer[sousoff][i];feelasleep++;} 527 aufsete/=feelasleep; 528 off[i]=aufsete; 529 if ((diodes[i] -aufsete< -seuilSST || 530 diodesbuffer[dbufsz-1][i]-aufsete< -seuilSST || 531 diodesbuffer[dbufsz-2][i]-aufsete< -seuilSST) 532 && fabs(off[i])<1000.) { 533 if (sstHas2Bars) { 534 for (j=dbufsz-2; j>=0; j--) { 535 if (diodesbuffer[j][i] < -seuilSST) { 536 //printf("Found star same %d\n",dbufsz-j); 537 zfoundstars[nfoundstars] = i; 538 mfoundstars[nfoundstars] = diodes[i]-aufsete; 539 tfoundstars[nfoundstars] = secondes; 540 nfoundstars++; 541 if (nfoundstars >= MAXFOUNDSTARS) return; 542 break; 543 } 544 if (i < 45 && diodesbuffer[j][i+1] < -seuilSST) { 545 //printf("Found star decal %d\n",dbufsz-j); 546 zfoundstars[nfoundstars] = i+.5; 547 mfoundstars[nfoundstars] = diodes[i]-aufsete; 548 tfoundstars[nfoundstars] = secondes; 549 nfoundstars++; 550 if (nfoundstars >= MAXFOUNDSTARS) return; 551 break; 552 } 553 } 554 } else { 555 if ((diodes[i] > diodesbuffer[dbufsz-1][i]) 556 && (diodesbuffer[dbufsz-1][i] < 557 .5*(diodesbuffer[dbufsz-2][i]+diodesbuffer[dbufsz-3][i]))) { 558 zfoundstars[nfoundstars] = i; 559 mfoundstars[nfoundstars] = -(diodesbuffer[dbufsz-1][i]+diodesbuffer[dbufsz-2][i])/2.+aufsete; 560 corrtemps=(diodesbuffer[dbufsz-2][i]-diodes[i])*gg->periode_echantillonage; 561 corrtemps=-corrtemps/ 562 ((diodesbuffer[dbufsz-2][i]+diodesbuffer[dbufsz-1][i]+diodes[i])-3.*aufsete); 563 // corrtemps=0; 564 tfoundstars[nfoundstars] = secondes+corrtemps; 565 nfoundstars++; 566 if (nfoundstars >= MAXFOUNDSTARS) return; 567 } 568 } 569 } 570 } 571 572 // remplissage buffer echantillons precedents 573 for (j=0; j<dbufsz-1; j++) 574 for (i=0; i<46; i++) 575 diodesbuffer[j][i] = diodesbuffer[j+1][i]; 576 for (i=0; i<46; i++) 577 diodesbuffer[dbufsz-1][i] = diodes[i]; 578 } 579 580 581 // Comparaison avec le GSC. 582 // Preparer une carte pour une position et une heure. -
trunk/Poubelle/archediab.old/archediab.sources/c/tache_PCI.c
r637 r649 64 64 // for(i=0;i<1000;i++); 65 65 // ecrit_carte(tt->tc.btc[tt->tc.pos_lit].mot[j]); 66 if( tt->PCI_actif==1) ecrit_carte(mot[j]);66 if(acquisition_PCI) ecrit_carte(mot[j]); 67 67 } 68 68 tt->vi.flag_ecriture_data=0; -
trunk/Poubelle/archediab.old/archediab.sources/c/tache_archeops.c
r639 r649 10 10 #include "carte_pci.h" 11 11 12 #include "simulmission.h" 12 13 13 14 //***************************************************************************************** … … 87 88 } 88 89 } 89 90 else while(1) 90 else if (tt->PCI_actif==3) // simulation donnees mission 91 { 92 // EA + JD 93 // Lecture d'un block depuis le simulateur 94 95 if (SimulMissionBloc(tt)) { 96 97 // Sauvegarde du bloc dans la file d'attente 98 sauve_un_block(tt); 99 } 100 } 101 else while(1) // case 1 et 4 91 102 { 92 103 lit_carte; if(rien_a_lire) break; // fifo vide -> retour -> sort du while … … 146 157 } 147 158 if(lec_fifo > tt->nb_lec_fofo_int) tt->nb_lec_fofo_int=lec_fifo; 148 if(!tt-> nb_lec_fofo_ext) {tt->nb_lec_fofo_ext=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;}159 if(!tt->val_con_fifo) {tt->val_con_fifo=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;} 149 160 150 161 } -
trunk/Poubelle/archediab.old/archediab.sources/c/tache_archeops_bit2.c
r645 r649 12 12 13 13 14 #include "simulmission.h" 14 15 15 16 … … 42 43 tt->vi.b=0; 43 44 tt->vi.c=0; 44 //init_lit_bit();45 45 } 46 46 … … 48 48 #define max_fifo 4000 49 49 50 51 // un bit pour 8 bit en parallele dans la fifo52 /*53 char un_bit(void)54 {55 static int i;56 static unsigned long RR;57 i++;58 if( (i<0) ou (i>7) )59 {60 lit_carte; if(rien_a_lire) return(bit_vide); // fifo vide -> retour -> sort du while61 i=0;62 }63 if( (RR>>i) & 1 ) return(bit_un);64 else return(bit_zero);65 }66 67 */68 50 69 51 // un bit pour fifo avec un seul bit (bit0) et la valeur de la periode en bit 1..6 (37 ou 38) … … 101 83 //tt->nb_lec_fofo_ext=M; 102 84 103 104 105 //if( RR & 1 ) return(bit_un); 106 //else return(bit_zero); 107 if( RR & 1 ) return(bit_zero); 85 #ifdef signe_inverse 86 87 if( RR & 1 ) return(bit_zero); 108 88 else return(bit_un); 109 89 90 #else 91 92 if( RR & 1 ) return(bit_un); 93 else return(bit_zero); 94 95 #endif 110 96 } 111 97 … … 154 140 } 155 141 } 156 157 else while(1) 142 else if (tt->PCI_actif==3) // simulation donnees mission 143 { 144 // EA + JD 145 // Lecture d'un block depuis le simulateur 146 147 if (SimulMissionBloc(tt)) { 148 149 // Sauvegarde du bloc dans la file d'attente 150 sauve_un_block(tt); 151 } 152 } 153 else while(1) // case 1 et 4 158 154 { 159 155 i=lit_bit(&tt->vi.btt); … … 165 161 } 166 162 if(lec_fifo > tt->nb_lec_fofo_int) tt->nb_lec_fofo_int=lec_fifo; 167 //if(!tt->nb_lec_fofo_ext) {tt->nb_lec_fofo_ext=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;}163 if(!tt->val_con_fifo) {tt->val_con_fifo=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;} 168 164 169 165 } -
trunk/Poubelle/archediab.old/archediab.sources/c/tache_diabolo.c
r637 r649 84 84 int max_fifo; 85 85 86 if( tt->PCI_actif==1) max_fifo=3000; // 3000 points maxi par interruption (10ms) soit (3.3µs)86 if(acquisition_PCI) max_fifo=3000; // 3000 points maxi par interruption (10ms) soit (3.3µs) 87 87 else max_fifo=200; // ((1000)faux ) points maxi par interruption (10ms) soit (20µs) 88 88 … … 90 90 while(1) 91 91 { 92 if( tt->PCI_actif==1) {lit_carte; if(rien_a_lire) break;}// fifo vide -> retour -> sort du while92 if(acquisition_PCI) {lit_carte; if(rien_a_lire) break;}// fifo vide -> retour -> sort du while 93 93 lec_fifo++; 94 94 if (EPLD_occupe) tt->vi.flag_ecriture_data=0; … … 141 141 if( RR&FLAG_FIFO_FULL ) {ecrit_erreur(err_fifo_pleine);read_flags();reset_fifo();} // la fifo a débordée 142 142 if(lec_fifo > tt->nb_lec_fofo_int) tt->nb_lec_fofo_int=lec_fifo; 143 if(!tt-> nb_lec_fofo_ext) {tt->nb_lec_fofo_ext=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;}143 if(!tt->val_con_fifo) {tt->val_con_fifo=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;} 144 144 if(lec_fifo>max_fifo) 145 145 { -
trunk/Poubelle/archediab.old/archediab.sources/c/tache_regul.c
r637 r649 79 79 tt->vi.reg.cc=cc; 80 80 cc=( 0x0fff - cc ) & 0x0fff; // 12 bits avec inverser la polarité 81 if( ( tt->PCI_actif==1) && ( tt->vi.flag_ecriture_data>2 ) ) // rien en attente d'ecriture: j'ecris direct en interruption81 if( (acquisition_PCI) && ( tt->vi.flag_ecriture_data>2 ) ) // rien en attente d'ecriture: j'ecris direct en interruption 82 82 { 83 83 ecrit_carte(tc_regul ); // ecrit bolo 251 --> ecrit regulation -
trunk/Poubelle/archediab.old/archediab.sources/c/tache_transputer.c
r637 r649 70 70 int max_fifo; 71 71 72 if( tt->PCI_actif==1) max_fifo=4000; // 3000 points maxi par interruption (10ms) soit (3.3µs)72 if(acquisition_PCI) max_fifo=4000; // 3000 points maxi par interruption (10ms) soit (3.3µs) 73 73 else max_fifo=200; // ((1000)faux ) points maxi par interruption (10ms) soit (20µs) 74 74 … … 78 78 while(1) 79 79 { 80 if( tt->PCI_actif==1) {lit_carte; if(rien_a_lire) break;}// fifo vide -> retour -> sort du while80 if(acquisition_PCI) {lit_carte; if(rien_a_lire) break;}// fifo vide -> retour -> sort du while 81 81 lec_fifo++; 82 82 // tt->vi.bkb[tt->vi.a^3]=octet_a_lire; // dans l'ordre: 3 2 1 0 7 6 5 4 11 10 9 8 ... … … 96 96 } 97 97 if(lec_fifo > tt->nb_lec_fofo_int) tt->nb_lec_fofo_int=lec_fifo; 98 if(!tt-> nb_lec_fofo_ext) {tt->nb_lec_fofo_ext=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;}98 if(!tt->val_con_fifo) {tt->val_con_fifo=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;} 99 99 } 100 100 -
trunk/Poubelle/archediab.old/archediab.sources/c/telecommande.c
r645 r649 5 5 #include "acqui.h" 6 6 #include "tm.h" 7 #include "simulmission.h" 8 #include "controle.h" 7 9 8 10 … … 135 137 { 136 138 unsigned char mot_tc[10]; 137 mot_tc[0] = tc_reduite; 138 mot_tc[1] = mot1; 139 mot_tc[2] = mot2; 140 mot_tc[3] = mot3; 141 emission_telecommande(tc_dir_transputer,mot_tc); 139 { 140 mot_tc[0] = tc_reduite; 141 mot_tc[1] = mot1; 142 mot_tc[2] = mot2; 143 mot_tc[3] = mot3; 144 emission_telecommande(tc_dir_transputer,mot_tc); 145 } 142 146 } 143 147 … … 148 152 int j; 149 153 154 if(!acquisition_avec_telecommande) return; 155 156 150 157 //***************************************************************************************** 151 158 // *** … … 157 164 158 165 #define delai(xx) {long uu;for(uu=0;uu<(10000L*(long)xx);uu++){};} 159 #define tc_char(x) {delai( 20);if(tt->PCI_actif==1) ecrit_carte((x)&0xff);}166 #define tc_char(x) {delai(40);if(acquisition_PCI) ecrit_carte((x)&0xff);} 160 167 #define tc_int(x) {tc_char(x);tc_char(x>>8);tc_char(x>>16);tc_char(x>>24);} 161 168 //printf("telecommande: "); … … 200 207 if( ((mot[0]&0xff)!=tc_reduite) && gg->flag_tc_reduite) 201 208 { 202 printf("attention: une telecommande normale !!\n\n");209 printf("attention: une telecommande normale non envoyée !!\n\n"); 203 210 son(130); 204 211 select(printf_ref); 212 break; 205 213 } 206 214 // pour test en mode simulation sans le retour des blocks reglage du transputer 207 if(tt->PCI_actif==2) relit_telecommandes_reduites(tc); 208 else { 215 if(tt->PCI_actif==2) 216 { 217 relit_telecommandes_reduites(tc); 218 break; 219 } 220 else if(tt->PCI_actif==3) 221 { 222 simul_telecommandes_reduites(tc); 223 } 224 else {char ss[200]; 225 static long t; 226 227 #define tcl(iii) ((long)mot[iii]) 228 229 long mothexa[5]; /* les 5 cara hexa envoyée */ 230 /* on range les bit: bit 1 en poid fort de tout */ 231 mothexa[0]=tcl(1); /* 4 bit choix de commande */ 232 mothexa[1]=tcl(2)>>2; /* les 4 bits poid fort du code direction */ 233 mothexa[2]=((tcl(2)<<2)&0xc) + ((tcl(3)>>6)&0x3); 234 mothexa[3]=(tcl(3)>>2)&0xf; 235 mothexa[4]=(tcl(3)&0x3) + 0x0C; 236 printf("commande 18bit: %d %d %d -> %lx%lx%lx%lx%lx ",tcl(1),tcl(2),tcl(3) 237 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]); 238 ecritD(fenetre_controle,con_subscan,"tc: %x %x %x %x %x ",mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]); 239 240 tc_char(0x11); // synchro 241 tc_int(debut_telecommande); 242 for(j=0;j<4;j++) tc_char(mot[j]); 243 tc_char(0x00); // synchro 244 sprintf(ss,"S%X%X%X%X%X07WS%X%X%X%X%X07WS%X%X%X%X%X07W\r\n" 245 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4] 246 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4] 247 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]); 248 /* sprintf(ss,"S%x%x%x%x%x07WS%x%x%x%x%x07WS%x%x%x%x%x07W\r\l" 249 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4] 250 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4] 251 ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]);*/ 252 if(ss[7]!='7') erreur("adresse not equal to 7"); 253 if(ss[16]!='7') erreur("adresse not equal to 7"); 254 if(ss[25]!='7') erreur("adresse not equal to 7"); 255 while( (TickCount()>t) et (TickCount()<(t+60*15)) ) // 15sec 256 { 257 static int q; 258 q++; 259 son(130); 260 if(q%10==0) printf("attente pour envoi de telecommande\n"); 261 controlemanip(0); 262 } 263 son(133); 264 265 printf(" envoi de la telecommande : %s \n",ss); 266 ecritRS(0,ss,0); 267 t=TickCount(); // 10 secondes (tick = 1/60 sec) 268 } 269 /* else { 209 270 tc_char(0x11); // synchro 210 271 tc_int(debut_telecommande); … … 213 274 tc_char(0x00);tc_char(0x00); // synchro 214 275 } 276 */ 215 277 break; 216 278 217 279 case tc_dir_reset_epld : //printf("tc_reset_epld:\n"); 218 280 219 // for(j=0;j<14;j++) tc_char(j); 281 for(j=0;j<8;j++) tc_char(j); 282 tc_char(1);tc_char(1); 283 tc_char(0x00);tc_char(0x00); // synchro 284 285 break; 286 287 case tc_dir_reset_trp : //printf("tc_reset_epld:\n"); 288 220 289 for(j=0;j<15;j++) tc_char(j); // reset epld+transputer 221 290 tc_char(1);tc_char(1); … … 233 302 234 303 // delai pour separer les télécommandes (archeops, transputer ou non) 235 if( tt->PCI_actif==1) delai(1000);304 if(acquisition_PCI) delai(1000); 236 305 237 306 #endif //-------------------------------------------------------------------- *** -
trunk/Poubelle/archediab.old/archediab.sources/c/trace-DS.c
r639 r649 142 142 if(u==npt_DS-1) 143 143 { 144 for(j=0;j<nb_max_bolo;j++)145 {146 phase_mesure[j]=atan2(y1[j],y2[j]);147 confiance[j]=bb[j]*bb[j];148 if(confiance[j]) confiance[j]=log((y1[j]*y1[j]+y2[j]*y2[j])/(bb[j]*bb[j]));149 }150 j=5; // bolo pur mesurer la phase151 phase_memoire=0.95*phase_memoire+0.05*phase_mesure[j];152 ecritD(fenetre_trace_DS,ds_phase,"%d°",degre(phase_memoire));153 printf(" phase=%d°(%2.1f) \n",degre(phase_mesure[j]),confiance[j]);144 // for(j=0;j<nb_max_bolo;j++) 145 // { 146 // phase_mesure[j]=atan2(y1[j],y2[j]); 147 // confiance[j]=bb[j]*bb[j]; 148 // if(confiance[j]) confiance[j]=log((y1[j]*y1[j]+y2[j]*y2[j])/(bb[j]*bb[j])); 149 // } 150 // j=5; // bolo pur mesurer la phase 151 // phase_memoire=0.95*phase_memoire+0.05*phase_mesure[j]; 152 // ecritD(fenetre_trace_DS,ds_phase,"%d°",degre(phase_memoire)); 153 // printf(" phase=%d°(%2.1f) \n",degre(phase_mesure[j]),confiance[j]); 154 154 // printf(": phase memoire=%g \n",phase_memoire); 155 155 // printf(" trace y1= %g , %g , %g , %g , %g \n",y1[0],y1[1],y1[2],y1[3],y1[4]); -
trunk/Poubelle/archediab.old/archediab.sources/c/trace_tout.c
r639 r649 5 5 #include "trace_tout.h" 6 6 #include "synchro.h" 7 8 9 7 10 8 … … 38 36 graph->xpas=50; 39 37 graph->taille_graduations=8; 40 for(j=0;j<nb_max_ bolo;j++) SS->f1[j]=0;41 for(j=0;j<nb_max_ bolo;j++) SS->f2[j]=0;42 for(j=0;j<nb_max_ bolo;j++) SS->y[j]=0;38 for(j=0;j<nb_max_trace;j++) SS->f1[j]=0; 39 for(j=0;j<nb_max_trace;j++) SS->f2[j]=0; 40 for(j=0;j<nb_max_trace;j++) SS->y[j]=0; 43 41 44 42 … … 52 50 SS->fmini=litD(fen,t_fmini,0L); 53 51 SS->fmaxi=litD(fen,t_fmaxi,0L); 54 for(j=0;j<nb_max_ bolo;j++) SS->f1[j]=0;52 for(j=0;j<nb_max_trace;j++) SS->f1[j]=0; 55 53 56 54 c1=2*3.14*SS->fmini*gg->periode_echantillonage; c1=c1/(1+c1); … … 76 74 { 77 75 SS->bolo_couleur[i]=litD(fen,t_bolo_couleur+i,0L)-1; 78 if( (SS->bolo_couleur[i]<1) ou (SS->bolo_couleur[i]>nb_max_ bolo) ) SS->bolo_couleur[i]=0;76 if( (SS->bolo_couleur[i]<1) ou (SS->bolo_couleur[i]>nb_max_trace) ) SS->bolo_couleur[i]=0; 79 77 printf(" i=%d bolo=%d ",i,SS->bolo_couleur[i]); 80 78 } … … 95 93 c2=2*3.14*SS->fmaxi*gg->periode_echantillonage; if(c2>0) c2=c2/(1+c2); 96 94 97 for(j=0;j<nb_max_ bolo;j++)95 for(j=0;j<nb_max_trace;j++) 98 96 { 99 97 SS->f1[j]= (1-c1) * SS->f1[j] + c1 * xbol(j); … … 105 103 { 106 104 SS->ipas=SS->moyenne; 107 if(SS->moyenne) for(j=0;j<nb_max_ bolo;j++) SS->y[j]=SS->y[j]/(double)SS->moyenne;105 if(SS->moyenne) for(j=0;j<nb_max_trace;j++) SS->y[j]=SS->y[j]/(double)SS->moyenne; 108 106 // printf("trace_tout un point \n"); 109 107 … … 118 116 } 119 117 120 montracen_tout(fen,nb_max_ bolo,x,SS);118 montracen_tout(fen,nb_max_trace,x,SS); 121 119 122 120 … … 129 127 } 130 128 131 for(j=0;j<nb_max_ bolo;j++) SS->y[j]=0;129 for(j=0;j<nb_max_trace;j++) SS->y[j]=0; 132 130 } 133 131 … … 144 142 for(i=0;i<max_couleur;i++) 145 143 { 146 if( (SS->bolo_couleur[i]>=1) && (SS->bolo_couleur[i]<nb_max_ bolo+1) ) yy[i]=SS->y[SS->bolo_couleur[i]-1];144 if( (SS->bolo_couleur[i]>=1) && (SS->bolo_couleur[i]<nb_max_trace+1) ) yy[i]=SS->y[SS->bolo_couleur[i]-1]; 147 145 else yy[i]=0; 148 146 }
Note:
See TracChangeset
for help on using the changeset viewer.