1 | //for archediab
|
---|
2 | //#include "manip.h"
|
---|
3 | //for archTOI
|
---|
4 | #include <stdio.h>
|
---|
5 | #include "archeops.h"
|
---|
6 |
|
---|
7 |
|
---|
8 | /********** coefficients pour les mesures bolo ********************************/
|
---|
9 | /* toutes les puissances en pW */
|
---|
10 | /* -1- loi de reponse thermique des bolos avec R en ohms et T en Kelvin */
|
---|
11 | /* */
|
---|
12 | /* T = coef2 * ( ln ( R / coef1) ** ( -1 / coef0 ) */
|
---|
13 | /* */
|
---|
14 | /* -2- fuite thermique du bolo coef 3,4 */
|
---|
15 | /* */
|
---|
16 | /* Ptot = coef3 * ( (10*Tb) ** coef4 - (10*Tcryo) ** coef4 ) */
|
---|
17 | /* */
|
---|
18 | /* -3- calcul empirique de Pciel et de tau coef 5,6 */
|
---|
19 | /* */
|
---|
20 | /* Pciel = coef5 - Pelec coef5= I * Ai (tables xavier) */
|
---|
21 | /* tau = - ln ( 1 + Pciel / coef6 ) coef6= I * Bi (tables xavier) */
|
---|
22 | /* */
|
---|
23 | /**************************************************************************************/
|
---|
24 |
|
---|
25 |
|
---|
26 | /**************************************************************************************/
|
---|
27 | /* */
|
---|
28 | /* pour les MLPA : gain = 100 diviseur = 101 ou 330 */
|
---|
29 | /* pour les bebodiff : gain = diviseur = 100Kohm / R preampli */
|
---|
30 | /* pour les bebodiff : la capa est corrigee d'un facteur 0.868 */
|
---|
31 | /* pour les cartes modifiees : mettre diviseur=0 */
|
---|
32 | /* et capa = la resistance de chage en Megohm */
|
---|
33 | /* */
|
---|
34 | /**************************************************************************************/
|
---|
35 |
|
---|
36 |
|
---|
37 | /* nom , on/off , 0 = MLPA , N° bolo , gain_pa , capa*1000 , diviseur , coef*10000
|
---|
38 | /* , 0 ou 1 , 2..8 = BEBO , hard , , 4700 , 333 ,
|
---|
39 | /* 10 = Bediff , , ,
|
---|
40 |
|
---|
41 | /* pour les bediff (code 10) le n° de bolo est N° de bebo*8 + numero dans la bebo
|
---|
42 | /* soit : 1 2 3 4 5 6 .. 9 10 11 12 13 14 .. 17 18 19 20 21 22 .. etc
|
---|
43 |
|
---|
44 |
|
---|
45 | /*debut_param*/
|
---|
46 | /*---------------------------------- fenetre : -----------------------------------*/
|
---|
47 |
|
---|
48 | param_bolo parametr={24,24,36,88,18,
|
---|
49 |
|
---|
50 | {
|
---|
51 | { "v1-bedif1" , 1,10,1 , 200, 22000, 200, { 5000 , 123100 , 334200 } },
|
---|
52 | { "v1-bedif2" , 1,10,2 , 200, 22000, 200, { 5000 , 12.31 , 33.42 } },
|
---|
53 | { "v1-bedif3" , 1,10,3 , 200, 22000, 200, { 5000 , 50.0 , 14.0 } },
|
---|
54 | { "v1-bedif4" , 1,10,4 , 200, 22000, 200, { 5000 , 12.31 , 33.42 } },
|
---|
55 | { "v1-bedif5" , 1,10,5 , 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
56 | { "v1-bedif6" , 1,10,6 , 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
57 |
|
---|
58 | { "v1-bedif7" , 1,10,9 , 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
59 | { "v1-bedif8" , 1,10,10, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
60 | { "v1-bedif9" , 1,10,11, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
61 | { "v1-bedif10" , 1,10,12, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
62 | { "v1-bedif11" , 1,10,13, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
63 | { "v1-bedif12" , 1,10,14, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
64 |
|
---|
65 | { "v1-bedif13" , 1,10,17, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
66 | { "v1-bedif14" , 1,10,18, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
67 | { "germanium" , 3,10,19, 1000, 22000 , 0, { 5000 , 12.31 , 33.42 } },
|
---|
68 | { "therm_4k" , 3,10,20, 1000, 1000 , 0, { 5000 , 12.31 , 33.42 } },
|
---|
69 | { "therm_1.6k" , 3,10,21, 1000, 1000 , 0, { 5000 , 12.31 , 33.42 } },
|
---|
70 | { "therm_10k" , 3,10,22, 1000, 1000 , 0, { 5000 , 12.31 , 33.42 } },
|
---|
71 |
|
---|
72 | { "v1-bedif19" , 2,10,25 , 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
73 | { "v1-bedif20" , 2,10,26, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
74 | { "v1-bedif21" , 2,10,27, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
75 | { "v1-bedif22" , 2,10,28, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
76 | { "v1-bedif23" , 2,10,29, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } },
|
---|
77 | { "v1-bedif24" , 2,10,30, 1000, 4700, 1000, { 5000 , 12.31 , 33.42 } }
|
---|
78 |
|
---|
79 | }
|
---|
80 | };
|
---|
81 | /*fin_param*/
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 | /* bolos campagne 1998-1999 */
|
---|
86 | /*
|
---|
87 | reg_NbSi.J, 1, 0, 1, 100, 4.7, 333, .5 ,519.6 , 8.286
|
---|
88 | v1-231...L, 1, 0, 2, 100, 4.7, 333, .5 , 1.7 , 32.41 , 0.333 , 10 , 20.30 , 11.41
|
---|
89 | v1-232...N, 1, 0, 3, 100, 4.7, 333,
|
---|
90 | v1-237...E, 1, 0, 4, 100, 4.7, 333,
|
---|
91 |
|
---|
92 | reg_JamieO, 1, 0, 5, 100, 4.7, 101,
|
---|
93 |
|
---|
94 | V2-NbSi..H, 1, 0, 6, 100, 4.7, 101, .5 ,433.8 , 9.25
|
---|
95 | V2-230...B, 1, 0, 7, 100, 4.7, 333, .5 , 8.26 , 26.61 , 5.10 , 7 , 9.354 , 1.026
|
---|
96 | V2-205...Q, 1, 0, 8, 100, 4.7, 333, .518 , 81 , 25.2
|
---|
97 | V2-208...P, 1, 0, 9, 100, 4.7, 333, .5 , 12.31 , 33.42 , 0.627 , 6.5 , 8.113 , 2.958
|
---|
98 |
|
---|
99 | */
|
---|
100 | /*bolos campagne 1997-1998 */
|
---|
101 | /*
|
---|
102 |
|
---|
103 | v1-208...J, 1, 0, 1, 100, 4.7, 333, .5 , 12.31 , 33.42
|
---|
104 | v1-232...L, 1, 0, 2, 100, 4.7, 333,
|
---|
105 | v1-205...N, 1, 0, 3, 100, 4.7, 333, .518 , 81 , 25.2
|
---|
106 | v1-NbSi..E, 1, 0, 4, 100, 4.7, 333, .5 ,519.6 , 8.286
|
---|
107 | Jamie....O, 1, 0, 5, 100, 4.7, 101,
|
---|
108 | V2-NbSi..H, 1, 0, 6, 100, 4.7, 101, .5 ,433.8 , 9.25
|
---|
109 | V2-224...B, 1, 0, 7, 100, 4.7, 333, .5 ,3.43 , 26.6
|
---|
110 | V2-230...Q, 1, 0, 8, 100, 4.7, 333, .5 , 8.26 , 26.61
|
---|
111 | V2-231...P, 1, 0, 9, 100, 4.7, 333, .5 , 1.7 , 32.41
|
---|
112 |
|
---|
113 | */
|
---|
114 |
|
---|
115 |
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 | /*debut_nom_reglage*/
|
---|
120 | /* 0->aa*/
|
---|
121 | /* 1->bb*/
|
---|
122 | /* 2->cc*/
|
---|
123 | /* 3->reglage 3 */
|
---|
124 | /* 4->reglage 4 */
|
---|
125 | /* 5->reglage 5 */
|
---|
126 | /* 6->reglage 6 */
|
---|
127 | /* 7->reglage 7 */
|
---|
128 | /*fin_nom_reglage*/
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 |
|
---|
133 |
|
---|
134 |
|
---|
135 |
|
---|
136 | reglage_bolo reglage_standard[8]={{
|
---|
137 |
|
---|
138 |
|
---|
139 | /*debut reglage 0 */
|
---|
140 | {30,76,9,1},
|
---|
141 | {0
|
---|
142 | ,10
|
---|
143 | ,1
|
---|
144 | ,3
|
---|
145 | ,10
|
---|
146 | ,2
|
---|
147 | ,0
|
---|
148 | ,0
|
---|
149 | ,1
|
---|
150 | ,0
|
---|
151 | ,0
|
---|
152 | ,0
|
---|
153 | ,0
|
---|
154 | ,0
|
---|
155 | ,0
|
---|
156 | ,0
|
---|
157 | ,0
|
---|
158 | ,0
|
---|
159 | ,0
|
---|
160 | ,0
|
---|
161 | },{
|
---|
162 | {22,100663296}
|
---|
163 | ,{-100646890,1}
|
---|
164 | ,{-100646890,1}
|
---|
165 | ,{22,0}
|
---|
166 | ,{-100638698,1}
|
---|
167 | ,{22,253952}
|
---|
168 | ,{-100646890,1}
|
---|
169 | ,{22,0}
|
---|
170 | ,{-100646890,1}
|
---|
171 | ,{-100646890,1}
|
---|
172 | ,{22,0}
|
---|
173 | ,{235388950,221185}
|
---|
174 | ,{20,0}
|
---|
175 | ,{20,0}
|
---|
176 | ,{16406,0}
|
---|
177 | ,{24598,0}
|
---|
178 | ,{22,0}
|
---|
179 | ,{24598,0}
|
---|
180 | },{
|
---|
181 | {1,22,0,1}
|
---|
182 | ,{0,20,0,1}
|
---|
183 | ,{0,20,0,1}
|
---|
184 | ,{0,20,0,1}
|
---|
185 | ,{0,20,0,1}
|
---|
186 | ,{0,20,0,1}
|
---|
187 | },{
|
---|
188 | {0,1,9,1,0,0,0}
|
---|
189 | ,{0,1,9,1,0,0,0}
|
---|
190 | ,{0,1,9,1,0,0,0}
|
---|
191 | ,{0,1,9,1,0,0,0}
|
---|
192 | },{0,0,0,0,0,0,0,0}
|
---|
193 | /*fin_reglage*/
|
---|
194 |
|
---|
195 | },{
|
---|
196 |
|
---|
197 | /*debut reglage 1 */
|
---|
198 | {30,76,9,1},
|
---|
199 | {0
|
---|
200 | ,10
|
---|
201 | ,1
|
---|
202 | ,3
|
---|
203 | ,10
|
---|
204 | ,2
|
---|
205 | ,0
|
---|
206 | ,0
|
---|
207 | ,1
|
---|
208 | ,0
|
---|
209 | ,0
|
---|
210 | ,0
|
---|
211 | ,0
|
---|
212 | ,0
|
---|
213 | ,0
|
---|
214 | ,0
|
---|
215 | ,0
|
---|
216 | ,0
|
---|
217 | ,0
|
---|
218 | ,0
|
---|
219 | },{
|
---|
220 | {22,100663296}
|
---|
221 | ,{-100646890,1}
|
---|
222 | ,{-100646890,1}
|
---|
223 | ,{22,0}
|
---|
224 | ,{-100638698,1}
|
---|
225 | ,{22,253952}
|
---|
226 | ,{-100646890,1}
|
---|
227 | ,{22,0}
|
---|
228 | ,{-100646890,1}
|
---|
229 | ,{-100646890,1}
|
---|
230 | ,{22,0}
|
---|
231 | ,{235388950,221185}
|
---|
232 | ,{20,0}
|
---|
233 | ,{20,0}
|
---|
234 | ,{16406,0}
|
---|
235 | ,{24598,0}
|
---|
236 | ,{22,0}
|
---|
237 | ,{24598,0}
|
---|
238 | },{
|
---|
239 | {1,22,0,1}
|
---|
240 | ,{0,20,0,1}
|
---|
241 | ,{0,20,0,1}
|
---|
242 | ,{0,20,0,1}
|
---|
243 | ,{0,20,0,1}
|
---|
244 | ,{0,20,0,1}
|
---|
245 | },{
|
---|
246 | {0,1,9,1,0,0,0}
|
---|
247 | ,{0,1,9,1,0,0,0}
|
---|
248 | ,{0,1,9,1,0,0,0}
|
---|
249 | ,{0,1,9,1,0,0,0}
|
---|
250 | },{0,0,0,0,0,0,0,0}
|
---|
251 | /*fin_reglage*/
|
---|
252 |
|
---|
253 | },{
|
---|
254 |
|
---|
255 | /*debut reglage 2 */
|
---|
256 | {31,76,9,0},
|
---|
257 | {0
|
---|
258 | ,-14
|
---|
259 | ,-31
|
---|
260 | ,-63
|
---|
261 | ,-83
|
---|
262 | ,-103
|
---|
263 | ,-122
|
---|
264 | ,127
|
---|
265 | ,1
|
---|
266 | ,97
|
---|
267 | ,14
|
---|
268 | ,-32
|
---|
269 | ,-93
|
---|
270 | ,-87
|
---|
271 | ,-72
|
---|
272 | ,-80
|
---|
273 | ,-101
|
---|
274 | ,-112
|
---|
275 | ,-113
|
---|
276 | ,-121
|
---|
277 | },{
|
---|
278 | {22,100663296}
|
---|
279 | ,{1040629782,204800}
|
---|
280 | ,{1040834582,221184}
|
---|
281 | ,{22,0}
|
---|
282 | ,{-100450282,2}
|
---|
283 | ,{22,253952}
|
---|
284 | ,{-100458474,2}
|
---|
285 | ,{22,0}
|
---|
286 | ,{-100442090,2}
|
---|
287 | ,{-100253674,253954}
|
---|
288 | ,{22,0}
|
---|
289 | ,{303013910,221184}
|
---|
290 | ,{20,0}
|
---|
291 | ,{20,0}
|
---|
292 | ,{9238,0}
|
---|
293 | ,{24598,301989888}
|
---|
294 | ,{22,0}
|
---|
295 | ,{24598,0}
|
---|
296 | ,{0,0}
|
---|
297 | ,{0,0}
|
---|
298 | ,{0,0}
|
---|
299 | ,{0,0}
|
---|
300 | ,{0,0}
|
---|
301 | ,{0,0}
|
---|
302 | },{
|
---|
303 | {-15,-9,-13,-38}
|
---|
304 | ,{-83,-109,-90,-68}
|
---|
305 | ,{-99,-101,-67,-61}
|
---|
306 | ,{-64,-60,-38,-19}
|
---|
307 | ,{-28,-57,-77,-75}
|
---|
308 | ,{-66,-55,-51,-68}
|
---|
309 | },{
|
---|
310 | {31,76,9,0,0,-35,-4643}
|
---|
311 | ,{-55,-77,-69,-55,-44,-43,-12336}
|
---|
312 | ,{-56,-85,-128,99,111,-116,-28030}
|
---|
313 | ,{105,107,101,101,106,111,31615}
|
---|
314 | },{-102,-88,-94,-113,-126,101,73,70}
|
---|
315 | /*fin_reglage*/
|
---|
316 |
|
---|
317 | },{
|
---|
318 |
|
---|
319 | /*debut reglage 3 */
|
---|
320 | {31,76,9,0},
|
---|
321 | {0
|
---|
322 | ,-14
|
---|
323 | ,-31
|
---|
324 | ,-63
|
---|
325 | ,-83
|
---|
326 | ,-103
|
---|
327 | ,-122
|
---|
328 | ,127
|
---|
329 | ,1
|
---|
330 | ,99
|
---|
331 | ,13
|
---|
332 | ,96
|
---|
333 | ,-93
|
---|
334 | ,-87
|
---|
335 | ,-72
|
---|
336 | ,-80
|
---|
337 | ,-101
|
---|
338 | ,-112
|
---|
339 | ,-113
|
---|
340 | ,-121
|
---|
341 | },{
|
---|
342 | {22,100663296}
|
---|
343 | ,{1040629782,204800}
|
---|
344 | ,{1040834582,221184}
|
---|
345 | ,{22,0}
|
---|
346 | ,{-100450282,2}
|
---|
347 | ,{22,253952}
|
---|
348 | ,{-100458474,2}
|
---|
349 | ,{22,0}
|
---|
350 | ,{-100442090,2}
|
---|
351 | ,{-100253674,253954}
|
---|
352 | ,{22,0}
|
---|
353 | ,{303013910,221184}
|
---|
354 | ,{20,0}
|
---|
355 | ,{20,0}
|
---|
356 | ,{9238,0}
|
---|
357 | ,{24598,301989888}
|
---|
358 | ,{22,0}
|
---|
359 | ,{24598,0}
|
---|
360 | ,{0,0}
|
---|
361 | ,{0,0}
|
---|
362 | ,{0,0}
|
---|
363 | ,{0,0}
|
---|
364 | ,{0,0}
|
---|
365 | ,{0,0}
|
---|
366 | },{
|
---|
367 | {-15,-9,-13,-38}
|
---|
368 | ,{-83,-109,-90,-68}
|
---|
369 | ,{-99,-101,-67,-61}
|
---|
370 | ,{-64,-60,-38,-19}
|
---|
371 | ,{-28,-57,-77,-75}
|
---|
372 | ,{-66,-55,-51,-68}
|
---|
373 | },{
|
---|
374 | {31,76,9,0,0,-35,-4643}
|
---|
375 | ,{-55,-77,-69,-55,-44,-43,-12336}
|
---|
376 | ,{-56,-85,-128,99,111,-116,-28030}
|
---|
377 | ,{105,107,101,101,106,111,31615}
|
---|
378 | },{-102,-88,-94,-113,-126,101,73,70}
|
---|
379 | /*fin_reglage*/
|
---|
380 |
|
---|
381 | },{
|
---|
382 |
|
---|
383 | /*debut reglage 4 */
|
---|
384 | {31,76,9,0},
|
---|
385 | {0
|
---|
386 | ,-14
|
---|
387 | ,-31
|
---|
388 | ,-63
|
---|
389 | ,-83
|
---|
390 | ,-103
|
---|
391 | ,-122
|
---|
392 | ,127
|
---|
393 | ,1
|
---|
394 | ,99
|
---|
395 | ,13
|
---|
396 | ,112
|
---|
397 | ,-93
|
---|
398 | ,-87
|
---|
399 | ,-72
|
---|
400 | ,-80
|
---|
401 | ,-101
|
---|
402 | ,-112
|
---|
403 | ,-113
|
---|
404 | ,-121
|
---|
405 | },{
|
---|
406 | {22,100663296}
|
---|
407 | ,{1040629782,204800}
|
---|
408 | ,{1040834582,221184}
|
---|
409 | ,{22,0}
|
---|
410 | ,{-100450282,2}
|
---|
411 | ,{22,253952}
|
---|
412 | ,{-100458474,2}
|
---|
413 | ,{22,0}
|
---|
414 | ,{-100442090,2}
|
---|
415 | ,{-100253674,253954}
|
---|
416 | ,{22,0}
|
---|
417 | ,{303013910,221184}
|
---|
418 | ,{20,0}
|
---|
419 | ,{20,0}
|
---|
420 | ,{9238,0}
|
---|
421 | ,{24598,301989888}
|
---|
422 | ,{22,0}
|
---|
423 | ,{24598,0}
|
---|
424 | ,{0,0}
|
---|
425 | ,{0,0}
|
---|
426 | ,{0,0}
|
---|
427 | ,{0,0}
|
---|
428 | ,{0,0}
|
---|
429 | ,{0,0}
|
---|
430 | },{
|
---|
431 | {-15,-9,-13,-38}
|
---|
432 | ,{-83,-109,-90,-68}
|
---|
433 | ,{-99,-101,-67,-61}
|
---|
434 | ,{-64,-60,-38,-19}
|
---|
435 | ,{-28,-57,-77,-75}
|
---|
436 | ,{-66,-55,-51,-68}
|
---|
437 | },{
|
---|
438 | {31,76,9,0,0,-35,-4643}
|
---|
439 | ,{-55,-77,-69,-55,-44,-43,-12336}
|
---|
440 | ,{-56,-85,-128,99,111,-116,-28030}
|
---|
441 | ,{105,107,101,101,106,111,31615}
|
---|
442 | },{-102,-88,-94,-113,-126,101,73,70}
|
---|
443 | /*fin_reglage*/
|
---|
444 |
|
---|
445 | },{
|
---|
446 |
|
---|
447 | /*debut reglage 5 */
|
---|
448 | {31,76,9,0},
|
---|
449 | {0
|
---|
450 | ,-14
|
---|
451 | ,-31
|
---|
452 | ,-63
|
---|
453 | ,-83
|
---|
454 | ,-103
|
---|
455 | ,-122
|
---|
456 | ,127
|
---|
457 | ,1
|
---|
458 | ,97
|
---|
459 | ,14
|
---|
460 | ,-80
|
---|
461 | ,-93
|
---|
462 | ,-87
|
---|
463 | ,-72
|
---|
464 | ,-80
|
---|
465 | ,-101
|
---|
466 | ,-112
|
---|
467 | ,-113
|
---|
468 | ,-121
|
---|
469 | },{
|
---|
470 | {22,100663296}
|
---|
471 | ,{1040629782,204800}
|
---|
472 | ,{1040834582,221184}
|
---|
473 | ,{22,0}
|
---|
474 | ,{-100450282,2}
|
---|
475 | ,{22,253952}
|
---|
476 | ,{-100458474,2}
|
---|
477 | ,{22,0}
|
---|
478 | ,{-100442090,2}
|
---|
479 | ,{-100253674,253954}
|
---|
480 | ,{22,0}
|
---|
481 | ,{303013910,221184}
|
---|
482 | ,{20,0}
|
---|
483 | ,{20,0}
|
---|
484 | ,{9238,0}
|
---|
485 | ,{24598,301989888}
|
---|
486 | ,{22,0}
|
---|
487 | ,{24598,0}
|
---|
488 | ,{0,0}
|
---|
489 | ,{0,0}
|
---|
490 | ,{0,0}
|
---|
491 | ,{0,0}
|
---|
492 | ,{0,0}
|
---|
493 | ,{0,0}
|
---|
494 | },{
|
---|
495 | {-15,-9,-13,-38}
|
---|
496 | ,{-83,-109,-90,-68}
|
---|
497 | ,{-99,-101,-67,-61}
|
---|
498 | ,{-64,-60,-38,-19}
|
---|
499 | ,{-28,-57,-77,-75}
|
---|
500 | ,{-66,-55,-51,-68}
|
---|
501 | },{
|
---|
502 | {31,76,9,0,0,-35,-4643}
|
---|
503 | ,{-55,-77,-69,-55,-44,-43,-12336}
|
---|
504 | ,{-56,-85,-128,99,111,-116,-28030}
|
---|
505 | ,{105,107,101,101,106,111,31615}
|
---|
506 | },{-102,-88,-94,-113,-126,101,73,70}
|
---|
507 | /*fin_reglage*/
|
---|
508 |
|
---|
509 | },{0
|
---|
510 |
|
---|
511 | /*debut reglage 6 */
|
---|
512 | /*fin_reglage*/
|
---|
513 |
|
---|
514 | },{0
|
---|
515 |
|
---|
516 | /*debut reglage 7 */
|
---|
517 | /*fin_reglage*/
|
---|
518 |
|
---|
519 | } };
|
---|
520 |
|
---|
521 | /* ------------------------------------ corps des fonctions ------------------------------ */
|
---|
522 | /* -------------------------------------------------------------------------------------------- */
|
---|
523 |
|
---|
524 |
|
---|
525 |
|
---|
526 | unsigned long val_long(char x)
|
---|
527 | {
|
---|
528 | unsigned long a,xl;
|
---|
529 | a=x-2; if(x<3) xl=x; else xl=((a&1) + 2)<<(a>>1);
|
---|
530 | return(xl);
|
---|
531 | }
|
---|
532 |
|
---|
533 |
|
---|
534 | double val_double(char x)
|
---|
535 | {
|
---|
536 | unsigned long a,xl;
|
---|
537 | if(x<0) x=-x; a=x; if(!a) xl=0; else xl=((a&1) + 2)<<(a>>1);
|
---|
538 | if(x>0) return(1e-4*(double)xl); else return(-1e-4*(double)xl);
|
---|
539 | }
|
---|
540 |
|
---|
541 | int new_val_dac(int a,char code)
|
---|
542 | {
|
---|
543 | if(code&0x80) a=(code&0x7f) <<5 ;
|
---|
544 | else {
|
---|
545 | if(code&0x40) a+=code&0x3f;
|
---|
546 | else a-=code&0x3f;
|
---|
547 | }
|
---|
548 | return(a);
|
---|
549 | }
|
---|
550 |
|
---|
551 |
|
---|
552 |
|
---|
553 |
|
---|
554 | int calcul_somme_block(block_type_modele* blk,int longueur)
|
---|
555 | {
|
---|
556 | int i,so=0;;
|
---|
557 | for(i=0;i<(longueur/4-4);i++) so^=(int)blk->mot[i];
|
---|
558 | /* somme sur tous les mots internes : on exclus le dbut, les codes et la fin */
|
---|
559 | return((so^(so>>16))&0xffff);
|
---|
560 | }
|
---|
561 |
|
---|
562 |
|
---|
563 |
|
---|
564 |
|
---|
565 | void valide_block(block_type_modele* blk,int type,int block_num)
|
---|
566 | {
|
---|
567 | int somme,longueur;
|
---|
568 | def_long_block
|
---|
569 | longueur=long_block[type];
|
---|
570 | /*printf("valide block adresse %x type %d numblock %d longueur=%d \n" */
|
---|
571 | /* ,(unsigned)blk,type,block_num,longueur);*/
|
---|
572 | blk->debut = debut_block_mesure;
|
---|
573 | blk->code2 = (((long)block_num) & 0xffffff ) | ( (((long)type)<<24)&0xff000000 );
|
---|
574 |
|
---|
575 | blk->mot[longueur/4-4] = fin_block_mesure;
|
---|
576 | somme=calcul_somme_block(blk,longueur);
|
---|
577 | blk->code1 = (((long)longueur)<<16) | somme;
|
---|
578 | }
|
---|
579 |
|
---|
580 |
|
---|
581 | /* Quand on est sur une machine swappee, on ne cherche pas a verifier */
|
---|
582 | /* le checksum, puisqu'on a modifie les blocs, sans swapper par exemple */
|
---|
583 | /* les chars des noms de bolometres et des chaines GPS... */
|
---|
584 | #ifdef __alpha
|
---|
585 | #define SWAP
|
---|
586 | #endif
|
---|
587 | #if defined(Linux) || defined(linux)
|
---|
588 | #define SWAP
|
---|
589 | #endif
|
---|
590 |
|
---|
591 | int verifie_block(block_type_modele* blk)
|
---|
592 | {
|
---|
593 | int type,lg,som;
|
---|
594 | def_long_block
|
---|
595 | if(blk->debut != debut_block_mesure) return(block_debut_erreur);
|
---|
596 | type=type_block(blk); if( (type<0) ||(type>=nb_type_blocks) ) return(block_type_inconnu);
|
---|
597 | lg=longueur_block(blk); if( lg != long_block[type] ) return(block_longueur_erreur);
|
---|
598 | if( blk->mot[(lg/4)-4] != fin_block_mesure) return(block_fin_erreur);
|
---|
599 | #ifndef SWAP
|
---|
600 | som=calcul_somme_block(blk,lg); if( som!= somme_block(blk)) return(block_somme_erreur);
|
---|
601 | #endif
|
---|
602 | return(block_correct);
|
---|
603 | }
|
---|
604 |
|
---|
605 |
|
---|
606 | int verifie_block_printf(block_type_modele* blk)
|
---|
607 | {
|
---|
608 | int type,lg,som;
|
---|
609 | def_long_block
|
---|
610 | def_nom_block
|
---|
611 | if(blk->debut != debut_block_mesure)
|
---|
612 | {
|
---|
613 | printf(" erreur dans le code debut de block \n");
|
---|
614 | return(block_debut_erreur);
|
---|
615 | }
|
---|
616 |
|
---|
617 | type=type_block(blk);
|
---|
618 | if( (type<0) || (type>nb_type_blocks) )
|
---|
619 | {
|
---|
620 | printf(" block de type %d inconnu\n",type);
|
---|
621 | return(block_type_inconnu);
|
---|
622 | }
|
---|
623 |
|
---|
624 | lg=longueur_block(blk);
|
---|
625 | if( lg!=long_block[type] )
|
---|
626 | {
|
---|
627 | printf(" block type %s erreur de longueur (nominal=%d , dans le block=%d \n"
|
---|
628 | ,nom_block[type],long_block[type],lg);
|
---|
629 | return(block_longueur_erreur);
|
---|
630 | }
|
---|
631 |
|
---|
632 | som=calcul_somme_block(blk,lg);
|
---|
633 | if( som!=somme_block(blk) )
|
---|
634 | {
|
---|
635 | printf(" block type %s : erreur de somme (calculee=%d , dans le block=%d \n"
|
---|
636 | ,nom_block[type],som,somme_block(blk) );
|
---|
637 | return(block_somme_erreur);
|
---|
638 | }
|
---|
639 |
|
---|
640 | if(blk->mot[(lg/4)-4] != fin_block_mesure)
|
---|
641 | {
|
---|
642 | printf(" block type %s erreur de code fin de block : trouve %x au lieu de %x \n"
|
---|
643 | ,nom_block[type],(int)blk->mot[(lg/4)-4],fin_block_mesure);
|
---|
644 | return(block_fin_erreur);
|
---|
645 | }
|
---|
646 |
|
---|
647 | return(block_correct);
|
---|
648 | }
|
---|
649 |
|
---|
650 |
|
---|
651 |
|
---|
652 |
|
---|
653 |
|
---|
654 |
|
---|
655 |
|
---|