DAFNEStatWrite.c
Il File ha QUATTRO ingressi
Il primo ingresso è dato dall'argomento della funzione elaborate, che viene chiamata dallo Storer.
elaborate(char* what).
La composizione di questa stringa di input, è quindi piena responsabilità dello Storer Labview.
La funzione elaborate prima di tutto acquisisce i dati della stringa, interpretandoli.
I dati che acquisisce sono descritti da questa porzione di codice.
strcpy(dafne[0,0] ,b0); /* UNIX format */ strcpy(dafne[0,1] ,b1); /* e- current */ strcpy(dafne[0,2] ,b2); /* e+ current */ strcpy(dafne[0,3] ,b3); /* IP1 lum */ strcpy(dafne[0,4] ,b4); /* IP1 limInt */ strcpy(dafne[0,5] ,b5); /* IP2 lum */ strcpy(dafne[0,6] ,b6); /* IP2 lumInt */ strcpy(dafne[0,7] ,b7); /* bumch 1-32 */ strcpy(dafne[0,8] ,b8); /* bunch 33-64 */ strcpy(dafne[0,9] ,b9); /* bunch 65-96 */ strcpy(dafne[0,10],b10); /* bunch 97-120 */ strcpy(dafne[0,11],b11); /* timing word */ strcpy(dafne[0,12],b12); /* acc pulse */ strcpy(dafne[0,13],b13); /* L0 IP1 */ strcpy(dafne[0,14],b14); /* I0 e+ IP1 cur */ strcpy(dafne[0,15],b15); /* I0 e- IP1 cur */ strcpy(dafne[0,16],b16); /* L0 IP2 */ strcpy(dafne[0,17],b17); /* I0 e+ IP2 cur */ strcpy(dafne[0,18],b18); /* I0 e- IP2 cur */ strcpy(dafne[0,19],b19); /* tick count */ strcpy(dafne[0,20],b20); /* RF frequency */ strcpy(dafne[0,23],b21); /* KLOE field */ strcpy(dafne[0,24],b22); /* BPMEL204 X */ strcpy(dafne[0,25],b23); /* BPMEL204 Y */ strcpy(dafne[0,26],b24); /* BPMEL205 X */ strcpy(dafne[0,27],b25); /* BPMEL205 Y */ strcpy(dafne[0,28],b26); /* BPMEL206 X */ strcpy(dafne[0,29],b27); /* BPMEL206 Y */ strcpy(dafne[0,30],b28); /* BPMEL207 X */ strcpy(dafne[0,31],b29); /* BPMEL207 Y */ strcpy(dafne[0,32],b30); /* DHSTB001 Amp */ strcpy(dafne[0,33],b31); /* DHSTB001 Pola */ strcpy(dafne[0,34],b32); /* DHSTB002 Amp */ strcpy(dafne[0,39],b33); /* DHRTB101 Amp */ strcpy(dafne[0,52],b46); /* 4TEM1001 [C] */ strcpy(dafne[0,53],b47); /* 4TEM1002 [C] */ strcpy(dafne[0,54],b48); /* 4TEM1003 [C] */ strcpy(dafne[0,55],b49); /* 4TEM1004 [C] */ strcpy(dafne[0,56],b50); /* BPMEL202 X */ strcpy(dafne[0,57],b51); /* BPMEL202 Y */ strcpy(dafne[0,58],b52); /* BPMEL203 X */ strcpy(dafne[0,59],b53); /* BPMEL203 Y */
fillfile = "/u2/data/temp/dafnefill.dat"
Successivamente il codice intende scrivere "newdafne.stat" : il file testuale che leggiamo tramite la CU
All'interno della funzione di scrittura però i progettisti "inopinatamente" leggono gli altri quattro input. Tutti da file
Il file è composto da una riga di questo tipo:
265413 7 103 FFF00007 FFFFFFFF FFFFFFFF FFFFFF00 103 FFF00007 FFFFFFFF FFFFFFFF FFFFFF00
I dati riempiono le seguenti variabili
fillnumber,laststatus, nbunche,bunch1e,bunch2e,bunch3e,bunch4e, nbunchp,bunch1p,bunch2p,bunch3p,bunch4p
QUESTO FILE VIENE SCRITTO dalla stessa procedura, che legge i dati vecchi, li modifica e li riscrive aggiornati.
currfile = "/u2/data/temp/current.dat"
Questo file viene usato nel calcolo del lifetime, sempre all'interno della procedura che dovrebbe soltanto scrivere.
1627403116 0.30 0 -0.45 0
1627403131 0.30 0 -0.45 0
1627403146 0.29 0 -0.45 0
machinefile = "/u2/data/temp/machineStatus.dat"
Il file è composto da un solo valore, ed è fermo al 2006
1
Il dato finisce nella variabile generalStatus.
OUTPUT
textfile = "/u2/data/temp/dafne.txt"
Questo file è un output generato dalla stessa routine. Se non lo legge nessuno, può essere eliminato.