Project

General

Profile

DBtables.txt

Kyle Hazelwood, 01/15/2015 12:01 PM

 
1
1. Data base tables:
2
#define Q_HDR_TABLE "wu.pa4208_q_hdr"
3
#define Q_SLOT_TABLE "wu.pa4208_q_slot"
4
#define CCALI_SLOT_TABLE "wu.chro_cali_slot"
5
#define GEN_PAR_NAME "wu.pa4208_gen_pars"
6
wu.pa4208_tune_pars
7
wu.pa4208_chro_pars
8
#define C453_CONFIG_TABLE "wu.pa4208_453_conf"
9

    
10

    
11
2. The shared DB tables pa4208_q_hdr, pa4208_q_slot.
12
	- Q_STRUCT(Q_HDR_STRUCT+Q_SLOT_STRUCT) 
13
	- Each file consistes of one hdr rec and a number of slot recs.
14

    
15
	There are 5 tabels(4 for tune and 1 for chromaticity control) that use 
16
	the same DB records' structures using 'tid' in hdr to identify what table, 
17
	and using 'id' column  in slot rec to identify which table hdr the 
18
	slot data 	belong to.  A group of routines provide DB service. 
19

    
20
3. hdr and slot rec structs:
21
typedef struct {
22
   int			tid;
23
   int			cyc;
24
   int			fid;
25
   int			date_saved;
26
   int			date_sent;
27
   char			title[TITLE_LEN];
28
}  __attribute__((packed)) /*Added by the PACKINATOR(tm)*/ Q_HDR_STRUCT;
29

    
30
typedef struct {
31
   int			id;
32
   float		x;
33
   float		dq[2];
34
}  __attribute__((packed)) /*Added by the PACKINATOR(tm)*/ Q_SLOT_STRUCT;
35

    
36
typedef struct {
37
   Q_HDR_STRUCT		hdr;
38
   Q_SLOT_STRUCT	slot[MAX_NUM_TUNE_SLOTS];
39
   int			num_slots;
40
} __attribute__((packed)) /* Added by the PACKINATOR(tm) */ Q_STRUCT;
41

    
42
4. 'tid' identify the 5 tables:
43
#define Q_TID_OP 1
44
#define Q_TID_P_COMP 2
45
#define Q_TID_PDOT_COMP 3
46
#define Q_TID_BEAM_COMP 4
47
#define C_TID_OP 11
48
 
49
  tid = 	1(op-tune) 	- x[t],dq[dq.h,dq.v]
50
         	2(p comp), 	- x[p],dq[dq.h,dq.v] 
51
         	3(pdot comp), 	- x[pdot],dq[dq.h,dq.v] 
52
         	4(beam comp), 	- x[x*E13],dq[dq.h,dq.v] 
53
	11(op-chro),    	- x[t],dq[ch.h,ch.v]
54

    
55
5. The id(key) to slot records.
56
id = tid * 1000000 + cyc * 100 + fid,  merely a key in DB.
57

    
58

    
59
--------------------------------------------------------------------------
60

    
61
For chro calibration data file there is its own DB table: chro_cali_slot
62
It has only slot records, no hdr rec:
63
   
64
typedef struct {
65
   int			fid;
66
   float			i[2];
67
   float			ch[2];
68
   int			fit_flg[2];
69
 }  __attribute__((packed)) /*Added by the PACKINATOR(tm)*/ CCALI_SLOT_STRUCT;
70

    
71
-------------------------------------------------------------------
72
/* pgm parameters */
73

    
74
typedef struct {
75
  int			job;
76
  int			cns;
77
  int			cnsslot;
78
  int			evt;
79
  int			set_64_slots;
80
  int			test_c453;
81
}  __attribute__((packed)) /* Added by the PACKINATOR(tm) */ PGM_PAR_STRUCT;
82

    
83
/* tune parameters. the same data names are used in DB*/
84

    
85
typedef struct {
86
   float	bare_q_h; 	/* design q.h when trombone at 0 currents */
87
   float	bare_q_v; 	/* design q.v when trombone at 0 currents */
88
   int		oq_grp_0;	/* qt grp 0 used for op-tune */ 
89
   int		oq_grp_1;	/* qt grp 1 used for op-tune */
90
   int		oq_tgh_0;	/* table of qt grp 0  for op-tune */
91
   int		oq_tgh_1;	/* table of qt grp 1  for op-tune */
92
   float	oq_share_0;	/* qt grp 0 share of op-tune */
93
   float	oq_share_1;	/* qt grp 1 share of op-tune */
94
   int		p_grp;		/* qt grp used for p-comp */
95
   int		p_tgh;		/* table used for p-comp */
96
   int		p_mdat;		/* MDAT used for p-comp */
97
   int		pdot_grp;	/* qt grp used for pdot-comp */
98
   int		pdot_tgh;	/* table used for pdot-comp */
99
   int		pdot_mdat;	/* MDAT used for pdot-comp */
100
   int		beam_grp;	/* qt grp used for beam-comp */
101
   int		beam_tgh;	/* table used for beam-comp */
102
   int		beam_mdat;	/* MDAT used for beam-comp */
103
   float	beam_rate_h;	/* beam-comp rate in h */
104
   float	beam_rate_v;	/* beam-comp rate in v */
105
} __attribute__((packed)) /* Added by the PACKINATOR(tm) */ TUNE_PAR_STRUCT;  
106

    
107
/* chro parameters. the same data names are used in DB */
108

    
109
typedef struct
110
{
111
   float   	ch_max_h;   	/* maximum ch.h can be specified */ 
112
   float   	ch_max_v;   	/* maximum ch.v can be specified */
113
   float   	ch_min_h;   	/* minimum ch.h can be specified */
114
   float   	ch_min_v;   	/* minimum ch.v can be specified */
115
   float   	ch2i_h_a;   	/* ch2i slope.h */
116
   float   	ch2i_h_b;   	/* ch2i intercept.h */
117
   float   	ch2i_h_c;   	/* spare */
118
   float   	ch2i_v_a;   	/* ch2i slope.v */
119
   float   	ch2i_v_b;   	/* ch2i intercept.v */
120
   float   	ch2i_v_c;   	/* spare */
121
} __attribute__((packed)) /* Added by the PACKINATOR(tm) */ CHRO_PAR_STRUCT;  
122