| 1 | 
 | 
|---|
| 2 | /*======================================================================*/
 | 
|---|
| 3 | /*                                                                      */
 | 
|---|
| 4 | /*               arcunit.h  :   conversion en mesure physique                   */
 | 
|---|
| 5 | /*                                                                      */
 | 
|---|
| 6 | /*======================================================================*/
 | 
|---|
| 7 | 
 | 
|---|
| 8 | 
 | 
|---|
| 9 | 
 | 
|---|
| 10 | /* ----------------------------   prototypes des fonctions       ------------------------------ */
 | 
|---|
| 11 | /* -------------------------------------------------------------------------------------------- */
 | 
|---|
| 12 | 
 | 
|---|
| 13 | 
 | 
|---|
| 14 | double          bolo_muV        (param_bolo*    param_pt,       reglage_bolo*   reglage_pt, int valbrut,int indice_bolo);                                                                                       
 | 
|---|
| 15 | double          bolo_temp       (param_bolo*    param_pt,       reglage_bolo*   reglage_pt, double R,int indice_bolo);
 | 
|---|
| 16 | 
 | 
|---|
| 17 | double          DAC_muV         (param_bolo*    param_pt,       reglage_bolo*   reglage_pt, int indice_bolo);
 | 
|---|
| 18 | double          DAC_muA         (param_bolo*    param_pt,       reglage_bolo*   reglage_pt, int indice_bolo);
 | 
|---|
| 19 | 
 | 
|---|
| 20 | int     voyant_EVO(block_type_dilution* blk);
 | 
|---|
| 21 | int     voyant_EVF(block_type_dilution* blk);
 | 
|---|
| 22 | int     commande_EVO(block_type_dilution*       blk);
 | 
|---|
| 23 | int     commande_EVF(block_type_dilution*       blk);
 | 
|---|
| 24 | int     commande_EVB(block_type_dilution*       blk);
 | 
|---|
| 25 | int     commande_EVV(block_type_dilution*       blk);
 | 
|---|
| 26 | 
 | 
|---|
| 27 | 
 | 
|---|
| 28 | double pression_entree_3He(block_type_dilution* blk);   
 | 
|---|
| 29 | double debit_3He(block_type_dilution*   blk)    ;
 | 
|---|
| 30 | double pression_sortie_3He(block_type_dilution* blk)    ;
 | 
|---|
| 31 | double pression_entree_4He(block_type_dilution* blk)    ;
 | 
|---|
| 32 | double debit_4He(block_type_dilution*   blk)    ;
 | 
|---|
| 33 | double pression_sortie_4He(block_type_dilution* blk)    ;
 | 
|---|
| 34 | double pression_air_vanne(block_type_dilution*  blk)    ;
 | 
|---|
| 35 | double pression_pompe_charbon(block_type_dilution*      blk);   
 | 
|---|
| 36 | double pression_membranne(block_type_dilution*  blk)    ;
 | 
|---|
| 37 | double pression_externe(block_type_dilution*    blk)    ;
 | 
|---|
| 38 | double tension_pile_10T(block_type_dilution*    blk)    ;
 | 
|---|
| 39 | double tension_pile_p18D(block_type_dilution*   blk)    ;
 | 
|---|
| 40 | double tension_pile_m18D(block_type_dilution*   blk)    ;
 | 
|---|
| 41 | double tension_pile_10B(block_type_dilution*    blk)    ;
 | 
|---|
| 42 | double tension_pile_p18B(block_type_dilution*   blk)    ;
 | 
|---|
| 43 | double tension_pile_m18B(block_type_dilution*   blk)    ;
 | 
|---|
| 44 | double tension_pile_Ch(block_type_dilution*     blk)    ;
 | 
|---|
| 45 | int switch_pile_5(block_type_dilution*  blk)    ;
 | 
|---|
| 46 | int switch_pile_15(block_type_dilution* blk)    ;
 | 
|---|
| 47 | double  temperature_caisson_haut1(block_type_dilution*  blk)    ;
 | 
|---|
| 48 | double  temperature_caisson_haut2(block_type_dilution*  blk)    ;
 | 
|---|
| 49 | double  temperature_caisson_bas1(block_type_dilution*   blk)    ;
 | 
|---|
| 50 | double  temperature_caisson_bas2(block_type_dilution*   blk)    ;
 | 
|---|
| 51 | double  temperature_caisson_tube_helium(block_type_dilution*    blk)    ;
 | 
|---|
| 52 | double  temperature_caisson_piles(block_type_dilution*  blk)    ;
 | 
|---|
| 53 | double  temperature_caisson_driver_moteur(block_type_dilution*  blk)    ;
 | 
|---|
| 54 | double  pression_helium_bain(block_type_dilution*       blk)    ;
 | 
|---|
| 55 | double  pression_pirani(block_type_dilution*    blk)    ;
 | 
|---|
| 56 | 
 | 
|---|
| 57 | double  resistance_service(param_bolo*  param_pt,       reglage_bolo*   reglage_pt, block_type_dilution*        blk, int indice_tempe);
 | 
|---|
| 58 | double  temperature_service(param_bolo* param_pt,       reglage_bolo*   reglage_pt, block_type_dilution*        blk, int indice_tempe);
 | 
|---|
| 59 | 
 | 
|---|
| 60 | 
 | 
|---|
| 61 | /*      cette fonction transforme un char (sur 8 bit) en double avec une echelle logarythmique  */
 | 
|---|
| 62 | /*      elle est en particulier utilisée pour calculer les coef de la regul                     */
 | 
|---|
| 63 | 
 | 
|---|
| 64 | double          val_double(char x);
 | 
|---|
| 65 | 
 | 
|---|
| 66 | /*      cette fonction transforme un char (sur 8 bit) en entier int4 (echelle logarythmique)    */
 | 
|---|
| 67 | /*      elle est en particulier utilisée pour fixer le courant sur les bolometres               */
 | 
|---|
| 68 | 
 | 
|---|
| 69 | unsigned        int4    val_long(char x);
 | 
|---|
| 70 | 
 | 
|---|
| 71 | int                     new_val_dac(int a,char  code); 
 | 
|---|
| 72 | 
 | 
|---|
| 73 | 
 | 
|---|
| 74 | 
 | 
|---|
| 75 | /* ----------------------------   define utilise pour les calculs        ------------------------------ */
 | 
|---|
| 76 | 
 | 
|---|
| 77 | 
 | 
|---|
| 78 | #define bol_micro_volt(val,gain)        ((1e7*(double)val)/(65536.*gain))
 | 
|---|
| 79 | /*  avec  gain = (double)parametr.bolo[bolo].bolo_gain*gain_ampli(reglage.bolo[bolo])                           */
 | 
|---|
| 80 |                 
 | 
|---|
| 81 | 
 | 
|---|
| 82 | /* gains 0 .. 15 pour MLPA  ///   gain 16..19  pour BEBO   ///   gain 20..22  pour BEDIF        */              
 | 
|---|
| 83 | #define def_gains       double gains_reels[32]={1,2,4,8,10,20,40,80,100,200,400,800,1000,2000,4000,8000,0.5,2.5,10,50,0.93,3.777,18.974};
 | 
|---|
| 84 |                 /*                      gain bediff    10->9.3    40->37.77     200->189.74             */
 | 
|---|
| 85 | 
 | 
|---|
| 86 | #define         gain_ampli(aa)  gains_reels[gainbrut(aa)]               
 | 
|---|
| 87 | 
 | 
|---|
| 88 | 
 | 
|---|
| 89 | 
 | 
|---|
| 90 | #define bit_piles_5V    1
 | 
|---|
| 91 | #define bit_piles_15V   2
 | 
|---|
| 92 | #define bit_piles_auto  4
 | 
|---|
| 93 | 
 | 
|---|
| 94 | 
 | 
|---|
| 95 | /*      signification des bit lus dans switch_dil       */
 | 
|---|
| 96 | #define switch_EVF              0x00000080      /*      contact fin de course vanne fermee      */
 | 
|---|
| 97 | #define switch_EVO              0x00000040      /*      contact fin de course vanne ouverte     */
 | 
|---|
| 98 | 
 | 
|---|
| 99 | /* les bit suivants sont envoyés par telecommande et relus dans switch_dil      */
 | 
|---|
| 100 | #define switch_helium           0x00200000      /*  13: commande sond niveau helium     */
 | 
|---|
| 101 | #define switch_pile_par_5       0x00100000      /*  12: mise en parallele des piles pour le 5V  */
 | 
|---|
| 102 | #define switch_pile_par_15      0x00080000      /*  11: mise en parallele des piles pour le 15V */
 | 
|---|
| 103 | #define vanne_EVB               0x00008000      /*  7: commande vanne brooks    */
 | 
|---|
| 104 | #define vanne_EVO               0x00010000      /*  8: commande vanne EVO       */
 | 
|---|
| 105 | #define vanne_EVV               0x00020000      /*  9: commande vanne EVV       */
 | 
|---|
| 106 | #define vanne_EVF               0x00040000      /*  10: commande vanne EVF      */
 | 
|---|
| 107 | #define chauffage1              0x00004000      /*  6: chauffage 1      */
 | 
|---|
| 108 | #define chauffage2              0x00002000      /*  5: chauffage 1      */
 | 
|---|
| 109 | #define chauffage3              0x00001000      /*  4: chauffage 1      */
 | 
|---|
| 110 | #define chauffage4              0x00000800      /*  3: chauffage 1      */
 | 
|---|
| 111 | #define chauffage5              0x00000400      /*  2: chauffage 1      */
 | 
|---|
| 112 | #define chauffage6              0x00000200      /*  1: chauffage 1      */
 | 
|---|
| 113 | #define chauffage7              0x00000100      /*  0: chauffage 7      */
 | 
|---|
| 114 | 
 | 
|---|
| 115 | enum{nbit_chauffage7,nbit_chauffage6,nbit_chauffage5,nbit_chauffage4,nbit_chauffage3
 | 
|---|
| 116 |         ,nbit_chauffage2,nbit_chauffage1,nbit_vanne_EVB,nbit_vanne_EVO
 | 
|---|
| 117 |         ,nbit_vanne_EVV,nbit_vanne_EVF,nbit_switch_pile_par_15,nbit_switch_pile_par_5,nbit_switch_helium};
 | 
|---|
| 118 | 
 | 
|---|
| 119 | /*  position des mesures sur les multiplexeurs          */
 | 
|---|
| 120 | /* J10A  ->  temperatures basses t_b1 t_b2,t_b3 t_b4 36 37 41 35        */ 
 | 
|---|
| 121 | /* J10B  ->  temperatures basses t_a1 t_a2,t_a3 t_a4 38 11 34 28        */ 
 | 
|---|
| 122 | /* J1??  ->  temperatures hautes t_h1 t_h2,t_h3 t_h4    */ 
 | 
|---|
| 123 | 
 | 
|---|
| 124 | enum{
 | 
|---|
| 125 | /* multiplex11..18:*/   mul11_  ,mul12_ ,p_haut ,p_memb ,t_h1   ,t_h4   ,t_h3   ,t_h2   
 | 
|---|
| 126 | /* multiplex21..28:*/,  mul21_  ,mul22_ ,p_charb,p_R4   ,mul25_ ,p_C3   ,p_R3   ,t_a4   
 | 
|---|
| 127 | /* multiplex31..38:*/,  mul31_  ,p_C4   ,p_air  ,t_a3   ,t_b4   ,t_b1   ,t_b2   ,t_a1   
 | 
|---|
| 128 | /* multiplex41..48:*/,  t_b3    ,d_4He  ,RP_He  ,t_pile ,d_3He  ,j_he3  ,j_he7  ,j_he4  
 | 
|---|
| 129 | /* multiplex51..58:*/,  j_he5   ,j_he1  ,j_he8  ,j_he2  ,j_he6  ,pirani ,mul57  ,mul58  
 | 
|---|
| 130 | /* multiplex61..68:*/,  p_m18B  ,p_10B  ,p_m18D ,mul64  ,p_p18B ,p_10T  ,p_Ch   ,p_p18D         
 | 
|---|
| 131 |         };
 | 
|---|
| 132 |         
 | 
|---|
| 133 | /* mul 11 , 12 , 21 , 31 , 25  sont les pins inutilisées  4  , 9 , 8 , 7 , 6  du connecteur pression hautes             */
 | 
|---|
| 134 | /* mul 22  est la pin 9 inutilisées  du connecteur pression basses              */
 | 
|---|
| 135 | /* mul 57 et 58  sont les lesctures des deux amplis mesure sur la prise gyroscope    */
 | 
|---|
| 136 | /*  mul 64 est non cablee  (entree en l'air)            */
 | 
|---|
| 137 | /* reste libres :  mul   11 - 12 - 21 - 22 - 25 -  31 - 57 - 58 - 64    */
 | 
|---|
| 138 | 
 | 
|---|
| 139 | /*  t_a2   n'est pas cable (que 3 thermometres sur connecteur ta (J10A)  )*/
 | 
|---|
| 140 | /*  t_a1   est cable sur J10A mais est aussi  la temperature du driver de moteur de pivot   */
 | 
|---|
| 141 | 
 | 
|---|
| 142 | #define  val_multiplex(qq)      (0.0003052*(double)((qq)-0x8000))       
 | 
|---|
| 143 | #define  val_temperature(qq)    ((val_multiplex(qq)<0.2)?-99:((1146.3/(val_multiplex(qq)-0.1)) - 245.13))
 | 
|---|
| 144 | 
 | 
|---|
| 145 | 
 | 
|---|