Ignore:
Timestamp:
Nov 25, 1999, 2:56:34 PM (26 years ago)
Author:
ansari
Message:

archediab 28 vol

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  
    189189void    reset_epld(void)
    190190{
     191char mot_tc[10];       
    191192printf("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         }
     193emission_tc_reduite(tc2_reset,tc3_reset,tc4_reset);
     194emission_telecommande(tc_dir_reset_epld,mot_tc);
     195
     196}
     197
     198void    reset_trp(void)
     199{
     200char mot_tc[10];       
     201printf("reset trp");
     202emission_tc_reduite(tc2_reset,tc3_reset,tc4_reset);
     203emission_telecommande(tc_dir_reset_trp,mot_tc);
    204204}
    205205
  • trunk/Poubelle/archediab.old/archediab.sources/c/acquisition_archeops.c

    r643 r649  
    4242                                        // de la lecture du block bolo
    4343
     44block_type_gyro blk_gyro2;      // block memoire pour les gyros qui seront traitées lors
     45                                                        // de la lecture du block bolo
     46
    4447
    4548
     
    4851void lit_block_archeops(int err)
    4952{
    50 if(verifie_block_printf(blk_tm))        return;
    51 
    52         {
    53         def_nom_block
    54         static int mon_num_block;
     53static char ss[1000];
     54def_nom_block
     55static int mon_num_block;
     56
     57if(!fenetre(fenetre_lecture_blocks)) nouveauT(fenetre_lecture_blocks,0,"lecture blocs");
     58
     59if(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        {
    5574        if(mon_num_block!=numero_block(blk_tm))
    5675                {
    5776                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)]);       
    6182        }                               
    6283
     
    7899        case block_bolo_comprime :      traite_block_bolo_comprime((block_type_bolo_comprime*)blk_tm);  break; 
    79100       
    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;
    82105
    83106        case block_gyro :               traite_block_gyro((block_type_gyro*)blk_tm);                    break;
     
    86109        case block_synchro_sol :        traite_block_synchro_sol((block_type_synchro_sol*)blk_tm);      break;
    87110       
    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;
    89112       
    90113#ifdef  transmet_data_brute
     
    115138void    traite_block_journal(block_type_journal*        blk)
    116139{
     140long mothexa[5];        /* les 5 mots hexa de la telecommande  */
     141
    117142int i,code,blocknum;
    118143if(!fenetre(fenetre_journal)) nouveauT(fenetre_journal,0,"journal");
     
    124149        blocknum=numero_block(&blk->jj[i]);
    125150        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
    132174
    133175//-----------------------------------------------------------------------------------------     
     
    176218                if(c1==13) i=80;
    177219                }
     220        }
     221}
     222
     223
     224
     225
     226
     227void    traite_block_gyro_comprime(block_type_gyro_comprime* blk)
     228{
     229int i;
     230block_type_gyro  bk_gyro;
     231block_type_gyro* blk2=& bk_gyro;
     232if(!fenetre(fenetre_gyroscope)) return;
     233//printf("***************   decompress data gyro \n");
     234for(i=0;i<3;i++)        decompress_7_2((long *)blk->gyro[i],blk2->gyro[i],nb_per_block*2);
     235blk2->code1=blk->code1;
     236blk2->code2=blk->code2;
     237traite_block_gyro(blk2);
     238}
     239
     240
     241void    traite_block_gyro(block_type_gyro* blk)
     242{
     243int k;
     244double  y[15];
     245
     246int temps_cntl;
     247double secondes;
     248blk_gyro2 = *blk;
     249
     250if(!fenetre(fenetre_gyroscope)) return;
     251
     252for(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);
    178263        }
    179264}
     
    306391                gg->don.don_bolo[j]=0.5*(ancien_don_bolo[j]+s*(((val_DS(j,i)-aa)<<1)/nb_coups));                // copy bolos
    307392                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//
    308400                }
    309401
     
    313405                }
    314406       
     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
    315412       
    316413//      gg->don.sync[j]=synchro_DS(j,i);       
  • trunk/Poubelle/archediab.old/archediab.sources/c/acquisition_general.c

    r643 r649  
    1414#include "compress.h"
    1515#include "controle.h"
     16#include "simulmission.h"
    1617
    1718
     
    4142static int count_moy_err=0;
    4243int err;
     44static bilan_err=0;             
    4345
    4446if      (item!=tache_de_fond)           return;
     
    5658*/
    5759
    58 if( count-- < 0 )
     60//if( count-- < 0 )
    5961                {
    6062                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;
    6365                }
    6466
    6567
    6668err=test_erreur();  //______________   test des erreurs   _______________________________
     69
     70if(err) bilan_err+=10*err;
     71
     72// Pour la simulation, rempli les buffers avec les donnees simulees
     73
     74if (tt->PCI_actif==3) SimulMissionReadLoop();
    6775
    6876
    6977//_____________________   lit la table télémesure  ______________________________________
    7078                                       
    71 
     79if(bilan_err>100)       bilan_err=100;
     80if(bilan_err>50)        bilan_err-=20;
     81if(bilan_err>10)        bilan_err-=5;
     82if(bilan_err>0)         bilan_err--;
     83if(bilan_err)   ecritD(fenetre_controle,con_erreur,20+bilan_err*10);
     84else            ecritD(fenetre_controle,con_erreur,0);
    7285
    7386q=(longueur_table_tm+tt->tm.pos_ecrit-tt->tm.pos_lit)%longueur_table_tm;
     87
     88ecritD(fenetre_controle,con_pile,(1000*((longueur_table_tm+tt->tm.pos_ecrit-tt->tm.pos_lit)%longueur_table_tm))/longueur_table_tm);
     89ecritD(fenetre_controle,con_donnee,tt->val_con_donnee);
    7490
    7591while(q)
    7692        {
    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);
    7995//*****************************************************************************************
    8096//                                                                                      ***
     
    109125        {
    110126        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;
    112128                                ecritD(fen,e_tache_inter,0);    // arreter les interruptions
    113129                                reset_epld();
     
    161177                                break;
    162178
    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));
    165182                                int a=(int) valeur;     
     183                                if(a==vanne_ouvre)     
     184                                        if(alerte(2,"voulez-vous vraiment ouvrir la vanne ??")!=1) break;
    166185                                emission_tc_reduite(tc2_auto_dilu,ll,a);
    167186                                }
     
    189208        case e_tache_inter :    calfreq(0);     //  command ou arrete le flag epld sortie data
    190209                                if(TTm)         stoptimer(TTm);
    191                                 if(tt->PCI_actif==1) reset_carte;
     210                                if(acquisition_PCI) reset_carte;
    192211                                tt->vi.a=0;
    193212                                if(valeur)
  • trunk/Poubelle/archediab.old/archediab.sources/c/bit_block.c

    r645 r649  
    1818 
    1919
    20 #define cadence_taux    16
     20#define cadence_taux    16      // cadence de filtrage du taux d'occupation de telemetrie
    2121#define mode_acquisition        0x00    //0xff en mode inverse, 0x00 en mode normal
    2222unsigned long   buffer;
     
    137137                                                        //Calcul du taux de remplissage
    138138                                                        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);
    140140                                                        return(lit_bit_un_block);
    141141                                                                               
     
    169169                                compteur=0;
    170170                                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);
    172172                        }       
    173173                        if(buffer==debut_block_mesure)
  • trunk/Poubelle/archediab.old/archediab.sources/c/bolo.c

    r643 r649  
    2222int a,c,i;
    2323int n=gg->reglage.horloge.nb_mesures;
    24 //if(fen > 5 ) return;
    2524if(item>1000) item-=1000;               // pour appeler le case pour tous les cara d'un edit texte
    26 //controlemanip(0);
    2725//printf("execbolo avec fen=%d , item=%d \n",fen,item);
    2826switch(item)
     
    7876
    7977                                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/*
    81126//  reecrit les valeurs dans la fenetre pour appel par un autre programme                                               
    82127        case b_carre    :       ecritD(fen,b_carre,(int)valeur);                ecritgain(fen);         break;
     
    84129        case b_trans    :       ecritD(fen,b_trans,(int)valeur);                ecritgain(fen);         break; 
    85130        case b_lin      :       ecritD(fen,b_lin,(int)valeur);                  ecritgain(fen);         break; 
     131
     132*/
    86133        case b_gain     :       vg[fen-1]=0;  ecritD(fen,b_gain,(int)valeur);   ecritgain(fen);         break;                                                                                         
    87134        case b_phase    :       ecritD(fen,b_phase,(int)valeur);                ecritgain(fen);         break;
  • trunk/Poubelle/archediab.old/archediab.sources/c/corel.c

    r637 r649  
    22#include "corel.h"
    33
    4 
     4/*
    55double coef_corel[nb_max_bolo][nb_max_bolo];
    66int flag_corel[nb_max_bolo];
    7 
     7*/
    88
    99
     
    3030        {
    3131        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);
    3234        }
    3335       
  • trunk/Poubelle/archediab.old/archediab.sources/c/diabolo.c

    r643 r649  
    1919#include "config_transputer.h"
    2020#include "dilution.h"
     21#include "recons_sst.h"
     22#include "tm.h"
    2123
     24void InitSimulMission(void);
    2225
    2326stglob* gg;                     // pointeur global  sur la structure
     
    4447//flag=2;       // en mode simulation
    4548if(clavier(touche_alt) ) flag=2; else flag=1;           // en mode acquisition
     49if(clavier(touche_controle) ) flag=4;                           // avec emission des telecommandes au demarrage
     50if(clavier(touche_alt) && clavier(touche_controle) ) {
     51  flag=3;               // en mode simulateur de donnees mission
     52  InitSimulMission();
     53  }
    4654#endif
    4755
    48 //return(1);
     56
    4957
    5058init_struct(flag);
     59
     60init_recons_sst();
    5161
    5262//printf(" long_entete          = %ld \n",      sizeof(F_entete));
     
    6575
    6676nouveauM(0,diabolo_id,exec_menu_diabolo);
     77nouveauSM(0,menu_trace_tout_id,exec_menu_trace_tout);
    6778
    6879ouvreD(fenetre_acquisition,acquisition_id,"acquisition",exec_acquisition);
     
    8596#endif
    8697
     98initRS(port_A,baud1200+data8+stop10+noParity,0);       
    8799
    88100#ifdef lire_les_donnees_POM2
     
    117129
    118130
    119 if(flag==1)                                     //  mets en route les interruptions
     131if( (flag==1) ou        (flag==4) )                             //  mets en route les interruptions
    120132        {
    121133        ecritD(fenetre_acquisition,e_tache_inter,1);
     
    125137select(fenetre_controle);
    126138select(fenetre_acquisition);
     139
     140// $CHECK$ on est toujours en mode 4 avec la derniere modif AB ???
     141tt->PCI_actif=4;
     142if (flag==3) tt->PCI_actif=3;
    127143
    128144return(option_texte+option_unclick);
     
    154170void exec_controle(int fen,int item,double valeur,...)
    155171{
    156 if(item==caseferme)  {stop_exec(fen);}
     172switch(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    }   
    157179}
    158180
  • trunk/Poubelle/archediab.old/archediab.sources/c/dilution.c

    r645 r649  
    5555// la telecommande passe a travers le transputer sans etre traitee par lui
    5656//  elle arrive directement sur l'EPLD
    57 
     57/*
    5858void  ecrit_bit_dilution(int valeur,int bit);
    5959
     
    8282emission_telecommande(tc_dir_transputer,mot_tc);
    8383}
    84 
     84*/
    8585//   fonction ecrit un  des dac dilution
    8686//  c'est une telecommande normale 64 bit  a supprimer
     
    120120
    121121switch(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   
    123133    case dil_switch_helium :    ecrit_bit_dilution((int)valeur,switch_helium);  break;
    124134    case dil_EVB :              ecrit_bit_dilution((int)valeur,vanne_EVB);      break;
     
    128138    case dil_sw_pp5 :           ecrit_bit_dilution((int)valeur,switch_pile_par_5);      break;
    129139    case dil_sw_pp15 :          ecrit_bit_dilution((int)valeur,switch_pile_par_15);     break;
    130 
     140*/
    131141//  ----   commande directe d'un mot avec les 3 case de codage hexadecimales
    132142
     
    137147//  ----   telecommande du raz periodique des fets
    138148    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/*
    140155                {
    141156                char mot_tc[10];
     
    150165                emission_telecommande(tc_dir_transputer,mot_tc);
    151166                }
    152 
     167*/
    153168                 break;
    154169                 
    155     case dil_ch1 :              ecrit_bit_dilution((int)valeur,chauffage1);     break;
    156     case dil_ch2 :              ecrit_bit_dilution((int)valeur,chauffage2);     break;
    157     case dil_ch3 :              ecrit_bit_dilution((int)valeur,chauffage3);     break;
    158     case dil_ch4 :              ecrit_bit_dilution((int)valeur,chauffage4);     break;
    159     case dil_ch5 :              ecrit_bit_dilution((int)valeur,chauffage5);     break;
    160     case dil_ch6 :              ecrit_bit_dilution((int)valeur,chauffage6);     break;
    161     case dil_ch7 :              ecrit_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;
    162177   
    163178//    case dil_dac_1 :
     
    227242 // j=numero de bebo    T[k] = R[k+4] en Kelvin
    228243                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                        }
    230247                else llR=0;
    231248                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) ;
     
    235252        }
    236253
     254gg->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 */
    237256
    238257if(R[0]<90.)    ecritD(fenetre_dilution,dil_temp
     
    298317
    299318
    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])   
     319ecritD(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])
    303323        );
    304324
    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));
     325ecritD(fenetre_dilution,dil_t_h1,cnt_temperature(t_h2));
     326ecritD(fenetre_dilution,dil_t_h2,cnt_temperature(t_h4));
     327ecritD(fenetre_dilution,dil_t_h3,cnt_temperature(t_b1));
     328ecritD(fenetre_dilution,dil_t_h4,cnt_temperature(t_b2));
     329ecritD(fenetre_dilution,dil_t_a1,cnt_temperature(t_b3));
     330ecritD(fenetre_dilution,dil_t_a2,cnt_temperature(t_pile));
     331ecritD(fenetre_dilution,dil_t_a3,cnt_temperature(t_a1));
    317332
    318333
  • trunk/Poubelle/archediab.old/archediab.sources/c/gyroscope.c

    r643 r649  
    2424
    2525
    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  
    1818#include "dilution.h"
    1919#include "senseur_stellaire.h"
     20#include "sstbrut.h"
     21#include "FindPeri.h"
     22#include "phaseSST.h"
    2023#include "gyroscope.h"
    2124
     
    2427
    2528int j,ann;
     29
     30
    2631
    2732void exec_menu_diabolo(int fen,int item,double valeur,...)
     
    7075                                                                break;
    7176
    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);
    7382                                                                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);
    7592                                                                else    ouvreD(fenetre_gyroscope,0,"fenetre_gyroscope",exec_gyroscope);
    7693                                                                break;
     94        default                                 :       break;
     95        }
     96}
    7797
    7898/*
     
    82102*/
    83103
    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);               
     104void exec_menu_trace_tout  (int fen,int item,double valeur,...)
     105{
     106switch(item)
     107        {
     108case    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 );
    93110                                                                break;
    94 
    95         case    d_pointage              :       ferme_annexe();
    96                                                                 ann=2;
    97                                                                 ouvreD(fenetre_annexe   ,pointage_id   ,"pointage",exec_pointage);             
     111case    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 );
    98113                                                                break;
    99 
    100         case    d_foyer                 :       ferme_annexe();
    101                                                                 ann=3;
    102                                                                 ouvreD(fenetre_annexe   ,foyer_id   ,"foyer",exec_foyer);               
     114case    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 );
    103116                                                                break;
    104 
    105117        default                                 :       break;
    106118        }
  • trunk/Poubelle/archediab.old/archediab.sources/c/mesures_bolo.c

    r643 r649  
    7070//                                                                                                      //
    7171//      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;
     74Tcryo= gg->temperature_cryo ;
    7475Ptot=0; if( (c(4)>0.01) && (T>0.01) )   Ptot = c(3) * ( pow(10.*T,c(4)) - pow(10.*Tcryo,c(4)) );
    7576
     
    7980//              tau     =       - ln ( 1 +  Pciel / coef6 )     coef6= I * Bi (tables xavier)           //
    8081
    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;
     83Pciel = 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 );
     86tau=Tcryo ;  /* FXD pour avoir Tcryo 16/07/99 */
    8587
    8688
     
    9294
    9395
    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);
     96ecritT(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);
    9597
    9698if(T>0.01) ecritT(fenetre_mesures_bolo,fin_f,"  T=%6.1fmK  ", T*1e3);
    9799
    98 if( Ptot>0.1) ecritT(fenetre_mesures_bolo,fin_f," Ptot=%5.1fpW   Pciel=%5.1fpW   tau=%5.3f  ",Ptot,Pciel,tau);
     100if( Ptot>0.01) ecritT(fenetre_mesures_bolo,fin_f," Ptot=%6.2fpW   Pciel=%6.2fpW   Tcryo=%6.1f  ",Ptot,Pciel,tau*1e3);
    99101
    100102
  • trunk/Poubelle/archediab.old/archediab.sources/c/rafraichis_fenetre.c

    r643 r649  
    2222        ecritD(fenetre_acquisition,e_telemesure,1+(0x0f & (int)gg->reglage.dilu.transmission));
    2323        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);
    2426
    2527        // affichage de toutes les fréquences 
     
    6870                ecritD(fenetre_regulation,regu_int+i,gg->reglage.regul[i].integ+1);
    6971                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);
    7174                }
    7275
  • trunk/Poubelle/archediab.old/archediab.sources/c/senseur_stellaire.c

    r643 r649  
    11#include "diabolo.h"
    22#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
    58
    69//--------------------  fonction  exec  de  la  fenetre : senseur_stellaire  -------------------------------
    710
     11static int diodes[48];
     12
     13#define DIODE_UNUSED_1 3
     14#define DIODE_UNUSED_2 7
     15
     16
     17int diodesbuffer[dbufsz][48];int off[48];
     18float zfoundstars[20];
     19float mfoundstars[20];
     20double tfoundstars[20];
     21int nfoundstars;
     22int seuilSST=5;
     23
     24static void init_sst_buffers(void);
     25static void remove_diode_offset(void);
     26static void find_stars(double secondes);
     27
     28static void trace_lin(int fen, double secondes);
     29static void trace_radar(int fen, double secondes);
     30static void init_radar(void);
     31static void setup_gra(int fen);
     32static void clean_radar(float phase,int fen);
     33
     34static double radarPer = 30.; // periode du radar, en secondes.
     35static double radarTUp = 0; // le temps de reference pour pointage "NORD"
     36static int    radarSens = 1;
     37static int  sstHas2Bars = false;
     38
     39//static double tm = 0;
    840
    941void exec_senseur_stellaire(int fen,int item,double valeur,...)
    1042{
    1143if(item>1000) item-=1000;               // pour appeler le case pour tous les cara d'un edit texte
    12 
    1344switch(item)
    1445    {
    1546    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
    1753                 break;
    1854    case fermeture               :
    1955                 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            }
    2394                 break;
    2495    default  :   break;
    2596    }
    2697}
     98
     99void 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
     143void 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
     185struct radarStar {
     186  float phase;
     187  float rayon;
     188  float flux;
     189};
     190
     191static struct radarStar* radarstars = 0;
     192static double lastPhase = 0;
     193
     194void 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
     209static 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
     242static long lastRadarTrace = 0;
     243
     244void 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
    27331
    28332//#define       bit_sst(i,j,k)  (((blk->sst[i][i*3+k/4])>>(j+8*k%4))&1)   
     
    50354#define place_paquet(i,j)        (i/8) * 24  + j*8 + (i%8)
    51355
    52 void    traite_block_sst_comprime       (block_type_sst_comprime*       blk){}
     356
     357void decode_sst(block_type_sst* blk, int i, int* diodes); // diodes = tableau a 48 entrees
     358
     359void 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
     387void    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}
    53420
    54421
    55422void    traite_block_sst(block_type_sst*        blk)
    56423{
    57 int i,j,k;
    58 double  y[15];
    59 double  x;
     424int i,k;
     425//double        y[15];
     426//double        x;
    60427
    61428int temps_cntl;
    62429double 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
     433for (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
     450void 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
     462static 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
     470void 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;
    130481/*
    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
     511void 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  
    6464                        //                      for(i=0;i<1000;i++);
    6565//                      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]);
    6767                        }
    6868                tt->vi.flag_ecriture_data=0;
  • trunk/Poubelle/archediab.old/archediab.sources/c/tache_archeops.c

    r639 r649  
    1010#include "carte_pci.h"
    1111
     12#include "simulmission.h"
    1213
    1314//*****************************************************************************************
     
    8788                }
    8889        }
    89 
    90 else    while(1)
     90else 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        }
     101else    while(1)                //  case 1 et 4 
    91102        {
    92103        lit_carte;      if(rien_a_lire)         break;                          //  fifo vide  ->  retour  ->  sort du while
     
    146157        }
    147158if(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;}
     159if(!tt->val_con_fifo)           {tt->val_con_fifo=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;}
    149160
    150161}
  • trunk/Poubelle/archediab.old/archediab.sources/c/tache_archeops_bit2.c

    r645 r649  
    1212
    1313
     14#include "simulmission.h"
    1415
    1516
     
    4243tt->vi.b=0;
    4344tt->vi.c=0;
    44 //init_lit_bit();
    4545}
    4646
     
    4848#define max_fifo  4000
    4949
    50 
    51 //              un bit pour 8 bit en parallele dans la fifo             
    52 /*
    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 while
    61         i=0;
    62         }
    63 if( (RR>>i) & 1 )       return(bit_un);
    64         else            return(bit_zero);
    65 }
    66 
    67 */
    6850
    6951//              un bit pour  fifo avec un seul bit (bit0) et la valeur de la periode en bit 1..6  (37 ou 38)           
     
    10183//tt->nb_lec_fofo_ext=M;
    10284
    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
     87if( RR & 1 )  return(bit_zero);
    10888else            return(bit_un);
    10989
     90#else
     91       
     92if( RR & 1 )    return(bit_un);
     93else            return(bit_zero);
     94
     95#endif
    11096}
    11197
     
    154140                }
    155141        }
    156 
    157 else    while(1)
     142else 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        }
     153else    while(1)                //  case 1 et 4
    158154        {
    159155        i=lit_bit(&tt->vi.btt);
     
    165161        }
    166162if(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;}
     163if(!tt->val_con_fifo)           {tt->val_con_fifo=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;}
    168164
    169165}
  • trunk/Poubelle/archediab.old/archediab.sources/c/tache_diabolo.c

    r637 r649  
    8484int max_fifo;
    8585
    86 if(tt->PCI_actif==1)    max_fifo=3000;  //  3000  points maxi par interruption (10ms)  soit (3.3µs)
     86if(acquisition_PCI)     max_fifo=3000;  //  3000  points maxi par interruption (10ms)  soit (3.3µs)
    8787         else           max_fifo=200;   //  ((1000)faux )  points maxi par interruption (10ms)  soit  (20µs)
    8888
     
    9090while(1)
    9191        {
    92         if(tt->PCI_actif==1)    {lit_carte;     if(rien_a_lire) break;}//  fifo vide  ->  retour  ->  sort du while
     92        if(acquisition_PCI)     {lit_carte;     if(rien_a_lire) break;}//  fifo vide  ->  retour  ->  sort du while
    9393        lec_fifo++;
    9494        if (EPLD_occupe) tt->vi.flag_ecriture_data=0;
     
    141141                if( RR&FLAG_FIFO_FULL )         {ecrit_erreur(err_fifo_pleine);read_flags();reset_fifo();}      // la fifo a débordée                   
    142142                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;}
    144144                if(lec_fifo>max_fifo)
    145145                        {
  • trunk/Poubelle/archediab.old/archediab.sources/c/tache_regul.c

    r637 r649  
    7979tt->vi.reg.cc=cc;
    8080cc=( 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 interruption               
     81if( (acquisition_PCI) && ( tt->vi.flag_ecriture_data>2 ) )              //    rien en attente d'ecriture: j'ecris direct en interruption               
    8282        {
    8383        ecrit_carte(tc_regul );                 // ecrit bolo 251  -->  ecrit regulation
  • trunk/Poubelle/archediab.old/archediab.sources/c/tache_transputer.c

    r637 r649  
    7070int max_fifo;
    7171
    72 if(tt->PCI_actif==1)    max_fifo=4000;  //  3000  points maxi par interruption (10ms)  soit (3.3µs)
     72if(acquisition_PCI)     max_fifo=4000;  //  3000  points maxi par interruption (10ms)  soit (3.3µs)
    7373         else           max_fifo=200;   //  ((1000)faux )  points maxi par interruption (10ms)  soit  (20µs)
    7474
     
    7878while(1)
    7979        {
    80         if(tt->PCI_actif==1)    {lit_carte;     if(rien_a_lire) break;}//  fifo vide  ->  retour  ->  sort du while
     80        if(acquisition_PCI)     {lit_carte;     if(rien_a_lire) break;}//  fifo vide  ->  retour  ->  sort du while
    8181        lec_fifo++;
    8282//      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 ...
     
    9696        }
    9797if(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;}
     98if(!tt->val_con_fifo)           {tt->val_con_fifo=tt->nb_lec_fofo_int;tt->nb_lec_fofo_int=0;}
    9999}
    100100
  • trunk/Poubelle/archediab.old/archediab.sources/c/telecommande.c

    r645 r649  
    55#include "acqui.h"
    66#include "tm.h"
     7#include "simulmission.h"
     8#include "controle.h"
    79
    810
     
    135137{
    136138unsigned 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        }
    142146}
    143147
     
    148152int j;
    149153
     154if(!acquisition_avec_telecommande)  return;
     155
     156
    150157//*****************************************************************************************
    151158//                                                                                      ***
     
    157164
    158165#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);} 
    160167#define  tc_int(x)      {tc_char(x);tc_char(x>>8);tc_char(x>>16);tc_char(x>>24);}
    161168//printf("telecommande: ");
     
    200207                        if( ((mot[0]&0xff)!=tc_reduite) && gg->flag_tc_reduite)
    201208                                {
    202                                 printf("attention: une telecommande normale !!\n\n");
     209                                printf("attention: une telecommande normale non envoyée !!\n\n");
    203210                                son(130);
    204211                                select(printf_ref);
     212                                break;
    205213                                }
    206214//                      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    {
    209270                                tc_char(0x11);  //  synchro
    210271                                tc_int(debut_telecommande);
     
    213274                                tc_char(0x00);tc_char(0x00);    //  synchro
    214275                                }
     276*/
    215277                        break;
    216278
    217279        case    tc_dir_reset_epld       :       //printf("tc_reset_epld:\n");
    218280               
    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               
    220289                        for(j=0;j<15;j++) tc_char(j);   // reset epld+transputer
    221290                        tc_char(1);tc_char(1);
     
    233302
    234303//  delai pour separer les télécommandes (archeops, transputer ou non)
    235 if(tt->PCI_actif==1) delai(1000);
     304if(acquisition_PCI) delai(1000);
    236305
    237306#endif          //--------------------------------------------------------------------  ***
  • trunk/Poubelle/archediab.old/archediab.sources/c/trace-DS.c

    r639 r649  
    142142                if(u==npt_DS-1)
    143143                        {
    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]);
     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]);
    154154//                      printf(": phase memoire=%g  \n",phase_memoire);
    155155//                      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  
    55#include "trace_tout.h"
    66#include "synchro.h"
    7 
    8 
    97
    108
     
    3836                                                graph->xpas=50;
    3937                                                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;
    4341                                                       
    4442                                       
     
    5250                                        SS->fmini=litD(fen,t_fmini,0L);
    5351                                                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;
    5553
    5654                                                        c1=2*3.14*SS->fmini*gg->periode_echantillonage;         c1=c1/(1+c1);   
     
    7674                                        {
    7775                                        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;
    7977                                        printf(" i=%d bolo=%d    ",i,SS->bolo_couleur[i]);
    8078                                        }
     
    9593                                                        c2=2*3.14*SS->fmaxi*gg->periode_echantillonage; if(c2>0)        c2=c2/(1+c2);   
    9694                                                       
    97                                                 for(j=0;j<nb_max_bolo;j++)             
     95                                                for(j=0;j<nb_max_trace;j++)             
    9896                                                        {
    9997                                                        SS->f1[j]= (1-c1) * SS->f1[j]   + c1 * xbol(j);
     
    105103                                                                {
    106104                                                                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;
    108106//                                                              printf("trace_tout  un  point \n");
    109107
     
    118116        }
    119117
    120                                                                 montracen_tout(fen,nb_max_bolo,x,SS);
     118                                                                montracen_tout(fen,nb_max_trace,x,SS);
    121119
    122120
     
    129127                                                                                        }
    130128
    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;
    132130                                                                }
    133131                               
     
    144142for(i=0;i<max_couleur;i++)
    145143        {
    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];
    147145                else            yy[i]=0;
    148146        }
Note: See TracChangeset for help on using the changeset viewer.