DAS  3.1.6 - 18/09/2017
Load.c
Go to the documentation of this file.
1 #include <windows.h>
2 #include <stdio.h>
3 #include <io.h>
4 #include <fcntl.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <time.h>
10 #include "mgui.h"
11 #include "bil.h"
12 #include "DAS_Spatram.h"
13 #include "DOAS.h"
14 #include "dil.h"
15 
23 //cpl CPL; //Control Panel
24 paramini PARAM; //Param.ini
25 //stepm STEPM; //Stepper Motors
26 d_geo DGEO; // geographical coordinates structure
29 //omu OMU;
31 
34 
35 
36 
37 int MaskedPix[100][6];
38 int MaskedCol[100][6];
39 int MaskedRow[100][6];
41 
42 /***************************************/
43 /* Key Words definition for CCD defect correction*/
44 char *ccdCorrKC[] = {{"DREM"}, {"PIX"}, {"PITM"}, {"COL"}, {"CITM"}, {"ROW"}, {"RITM"}, {"DEND"}};
45 /***************************************/
46 
47 /****************************/
48 char *Istruction;
49 char IsFile[16];
50 long IsCnt;
51 long IsSiz;
52 
53 
54 void FlushLine(char *buf, int nc, FILE *f)
55 {
56  int t = 0;
57  unsigned char ch;
58  do
59  {
60  buf[t] = (unsigned char)ch;
61  ch = getc(f);
62  t++;
63  }while (ch != 10);
64 
65 }
66 /*
67 void FlushLine(char *buf, int nc, FILE *f)
68 {
69  fgets(buf, nc, f);
70 }
71 */
72 void ReadLine(char *buf, int nc, FILE *f)
73 {
74 
75  fgets(buf, nc, f);
76 }
77 
78 
79 void E_DREM(void)
80 {
81  // Flush stringa
82 // if(ExeREM)
83  while(Istruction[IsCnt++] != 10);
84 }
85 
86 
87 int DFetch()
88 {
89  //Legge le parole chiave
90  char cmd[10];
91  int c;
92  sscanf(&Istruction[IsCnt], "%s", cmd);
93  for(c = 0; c < CLEN; c++)
94  if(strcmp(cmd, ccdCorrKC[c]) == 0)
95  break;
96 
97  if(c == CLEN)
98  return 0;
99  return(c + 1);
100 }
101 
102 
103 void E_Pix()
104 {
105  E_DREM();
106 }
107 
108 void E_PItm()
109 {
110  int i, a, b, c, d, e, f;
111 
112  IsCnt += 4;
113  sscanf(&Istruction[IsCnt], "%d", &PItem);
114  E_DREM();
115  for (i=0; i<PItem;i++)
116  {
117 
118  sscanf(&Istruction[IsCnt], "%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
119  MaskedPix[i][0] = a;
120  MaskedPix[i][1] = b; //(int) (b / DAS.Paramini.VBin);
121  MaskedPix[i][2] = c;
122  MaskedPix[i][3] = d;
123  MaskedPix[i][4] = e;
124  MaskedPix[i][5] = f;
125  E_DREM();
126  }
127 
128 }
129 
130 void E_Col()
131 {
132  E_DREM();
133 }
134 
135 void E_CItm()
136 {
137  int i, a, b, c, d, e;
138 
139  IsCnt += 4;
140  sscanf(&Istruction[IsCnt], "%d", &CItem);
141  E_DREM();
142  for (i=0; i<CItem;i++)
143  {
144 
145  sscanf(&Istruction[IsCnt], "%d%d%d%d%d", &a, &b, &c, &d, &e);
146  MaskedCol[i][0] = a;
147  MaskedCol[i][1] = (int) (b / DAS.Paramini.VBin);
148  MaskedCol[i][2] = (int) (c / DAS.Paramini.VBin);
149  MaskedCol[i][3] = d;
150  MaskedCol[i][4] = e;
151  E_DREM();
152  }
153 
154 }
155 void E_Row()
156 {
157  E_DREM();
158 }
159 void E_RItm()
160 {
161  int i, a, b, c, d, e;
162 
163  IsCnt += 4;
164  sscanf(&Istruction[IsCnt], "%d", &RItem);
165  E_DREM();
166  for (i=0; i<RItem;i++)
167  {
168 
169  sscanf(&Istruction[IsCnt], "%d%d%d%d%d", &a, &b, &c, &d, &e);
170  MaskedRow[i][0] = a;
171  MaskedRow[i][1] = b;
172  MaskedRow[i][2] = (int) (c / DAS.Paramini.VBin);
173  MaskedRow[i][3] = d; //(int) (d / DAS.Paramini.VBin);
174  MaskedRow[i][4] = e; //(int) (e / DAS.Paramini.VBin);
175  E_DREM();
176  }
177 }
178 
179 
180 
181 
182 int LoadDB_DefectPixel(char *buff)
183 {
184 
185  int fs;
186  long siz;
187 // char str[80];
188  int exit = 1;
189  int ccdCommand =0;
190 
191  //fs = open("CONFIG\\CCD_DEFECT_DANBO.COR", O_RDONLY);
192  fs = open(buff, O_RDONLY);
193  if(fs < 0) return 1;
194  siz = filelength(fs);
195 
196  Istruction = malloc(siz);
197  read(fs, Istruction, siz);
198 
199  close(fs);
200 
201  IsCnt = 0;
202  IsSiz = siz;
203 
204 
205  do
206  {
207  ccdCommand = DFetch();
208  if(ccdCommand)
209  {
210  // Lista delle procedure attivabili
211  switch(ccdCommand)
212  {
213  case DREM: ccdCommand = 0; E_DREM(); break; // 1
214  case PIX: ccdCommand = 0; E_Pix(); break; // 2
215  case PITM: ccdCommand = 0; E_PItm(); break; // 3
216  case COL: ccdCommand = 0; E_Col(); break; // 4
217  case CITM: ccdCommand = 0; E_CItm(); break; // 5
218  case ROW: ccdCommand = 0; E_Row(); break; // 6
219  case RITM: ccdCommand = 0; E_RItm(); break; // 7
220  case DEND: ccdCommand = 0; exit=0; break; // 8
221 
222  }
223 
224  }
225 
226  }while(exit);
227 
228  free(Istruction);
229 
230 
231  return 0;
232 
233 }
235 {
236 
237  FILE *fs;
238  char str[80], dpath[_MAX_PATH], buff[255];
239  int i, ni;
240 // struct doas *pd;
241 // pd = &DOAS.wlc[0];
242 
243  //BIL.DFILEM.CONFIGDIREQUIPMENT
244  //Set Data Directory
245  //sprintf(dpath, "%s\\%s", BIL.DFILEM.HOMEDIRECTORY, "DOAS\\Sys\\DispCoeff.INI" );
246  sprintf(dpath, "%s\\%s", BIL.DFILEM.CONFIGDIREQUIPMENT, "DispCoeff.INI" );
247 
248  fs = fopen(dpath, "r");
249 
250 
251  if(fs == NULL)
252  {
253  sprintf(buff,"File: %s\nNOT FOUND\nPlease check the existence of this file", dpath);
254  MMessageDialog("DAS Inf.", buff,"OK", NULL);
255  return 1;
256  }
257 
258  ReadLine(str, 80, fs); // ##############################################
259  ReadLine(str, 80, fs); // # Grating Dispersion Parameters #
260  ReadLine(str, 80, fs); // ##############################################
261  ReadLine(str, 80, fs); // #--------------------------------------------#
262  ReadLine(str, 80, fs); // # PLEASE DO NOT MODIFY #
263  ReadLine(str, 80, fs); // #--------------------------------------------#
264  ReadLine(str, 80, fs); // # Number of Item #
265 
266  fscanf(fs, "%d", &ni);
267 
268  FlushLine(str, 80, fs);
269  ReadLine(str, 80, fs); // # Wl K1 K2 #
270 
271  for (i=0;i<ni;i++)
272  {
273  fscanf(fs, "%d%lf%lf%lf%d", &DOAS.wlc[i], &DOAS.k1[i], &DOAS.k2[i], &DOAS.wlref[i], &DOAS.pixref[i]);
274 // fscanf(fs, "%d%lf%lf%lf%d", &pd->wlc[i], &pd->k1[i], &pd->k2[i], &pd->wlref[i], &pd->pixref[i]);
275  FlushLine(str, 80, fs);
276 
277  }
278 
279  ReadLine(str, 80, fs); // ##############################################
280 
281  fclose(fs);
282 
283  return 0;
284 }
285 
286 int LoadFTPSetting(void)
287 {
288 
289  FILE *fs;
290  char str[255];
291 
292  char buff[_MAX_PATH];
293 
294  sprintf(buff, "%s\\FTP.INI", BIL.DFILEM.CONFIGDIREQUIPMENT);
295 
296  fs = fopen(buff, "r");
297 
298  if(fs == NULL) return 1;
299 
300  ReadLine(str, 80, fs); // ####################################################
301  ReadLine(str, 80, fs); // # Configuration file for FTP Setting. #
302  ReadLine(str, 80, fs); // ####################################################
303  ReadLine(str, 80, fs); // # FTP Server Address #
304  fscanf(fs, "%s", DFTP.ftpserver);
305 
306  FlushLine(str, 80, fs);
307  ReadLine(str, 80, fs); // # FTP User Name #
308 
309  fscanf(fs, "%s", DFTP.ftpuser);
310 
311  FlushLine(str, 80, fs);
312  ReadLine(str, 80, fs); // # FTP pwd #
313 
314 
315  fscanf(fs, "%s", DFTP.ftppwd);
316  FlushLine(str, 80, fs);
317  ReadLine(str, 80, fs); // ####################################################
318 
319  fclose (fs);
320 
321  return 0;
322 }
323 /********************************************/
324 
325 char *ERR_Option(int ercode)
326 {
327  static char *erroption[] = {{"NULL"},
328  {"File OPTION.INI Not Found"},
329  {"Error in Saving Mode Option"},
330  {"Error in File Name Option"},
331  {"Error in Image Type Option"},
332  {"Error in Pixel Correction Option"},
333  {"Error in Averaging Mode Option"},
334  {"Error in Fixed Number of Measurement for Average Option"},
335  {"Error in Total Exposure Time for Average Option"},
336  {"Error in Dark Remove Option"},
337  {"Error in Dark Source Option"},
338  {"Error in Set CCD Temperature Flag"},
339  {"Error in Plot Scale Flag"},
340  {"Error in Plot Display Flag"},
341  {"Error in Plot Y Scale Flag"},
342  {"Error in SZAMax Parameter"},
343  {"Error in Hidden Lines in Plot Before the Central one Option"},
344  {"Error in Hidden Lines in Plot After the Central one Option"},
345  {"Error in Display Blind Pixel Flag"},
346  {"Error in Perform FTP Back-UP Option"},
347  {"Error in Reference temperature for OMU Thermo-Regulation Option"},
348  {"Error in OMU Thermo-Regulation mode"},
349  {"Error in Mirroring CCD Image along X axis Option"},
350  {"Error in Mirroring CCD Image along Y axis Option"},
351  {"Error in AMS Option - Stepper motor Positioning mode"},
352  {"Error in AMS Option - Display Progression Bars"},
353  {"Error in Autorange before Average Option"},
354  {"Error in MIGE Linked Parameter"},
355  {"Error in MIGE Type Parameter"},
356  {"Error in MIGE Operating mode Option"},
357  {"Error in Shutter Connection Option"},
358  {"Error in Shutter Type Option"},
359  {"Error in DeltaSZA Flag"},
360  {"Error in DeltaSZA Value"},
361  {"Error: MinSZA < 0"},
362  {"Error: MaxSZA < 0 "},
363  {"Error: MinSZA > MaxSZA Value"},
364  {"Error in the Defective pixel file"}};
365 
366  return erroption[ercode];
367 
368 }
369 
370 
371 char *CodeEq2Name(int code)
372 {
373 
374  static char *EqName[] = {{"SPATRAM"},
375  {"TROPOGAS"},
376  {"LIS"},
377  {"SPATRAMPLUS"},
378  {"GASCODNG1"},
379  {"GASCODOFAX"},
380  {"GASCODNG2"},
381  {"GASCODNG3"},
382  {"GASCODNG4"},
383  {"SPATRAM2"},
384  {"SPATRAM3"}};
385 
386  return EqName[code];
387 
388 }
389 
390 int LoadDB_Options(void)
391 {
392  FILE *fs;
393  char str[80];
394  char buff[_MAX_PATH];
395  char CARAT[16];
396  int numlines = 0;
397  int NUMLINESGOOD = 107;
398 
399 
400  sprintf(buff, "%s\\OPTIONS.INI", BIL.DFILEM.CONFIGDIREQUIPMENT);
401  //Open file
402  fs = fopen(buff, "r");
403  // If file not found return 1
404  if(fs == NULL) return 1;
405  //Check the lenght of the Option.ini file (counts lines)
406  //**********************************************
407  while (!feof(fs))
408  {
409  numlines++;
410  ReadLine(str, 80, fs);
411 
412  }
413  //Close file
414  fclose(fs);
415 
416 
417  //*****************************************************
418  //check if the first character of the last line is "#"
419  sprintf(CARAT, "%c", str[0]);
420 
421  if ( (strcmp(CARAT, "#") == 0) && (numlines == NUMLINESGOOD) )
422  {
423  //Re-Open file
424  fs = fopen(buff, "r");
425  // If file not found return 1
426  if(fs == NULL) return 1;
427  //Read file and assign values to parameters
428  ReadLine(str, 80, fs); // ####################################################
429  ReadLine(str, 80, fs); // # Configuration file for OPTIONS Setting. #
430  ReadLine(str, 80, fs); // # By DanBo 10/12/2003 at 20.00.00 #
431  ReadLine(str, 80, fs); // ####################################################
432  ReadLine(str, 80, fs); // # All these flags can be modified on line #
433  ReadLine(str, 80, fs); // # in the CONFIG --> OPTION tabs #
434  ReadLine(str, 80, fs); // #--------------------------------------------------#
435  ReadLine(str, 80, fs); // # Please DO NOT Exange the order of the parameters #
436  ReadLine(str, 80, fs); // #--------------------------------------------------#
437  ReadLine(str, 80, fs); // # Saving Mode: 0 = ASCII, 1 = Binary #
438 
439  fscanf(fs, "%d", &DAS.DOption.savingmode);
440  // check option value
441  if (DAS.DOption.savingmode < 0 || DAS.DOption.savingmode > 1)
442  return 2; // Error in Saving Mode Option
443 
444  FlushLine(str, 80, fs);
445  ReadLine(str, 80, fs); // # File Names:0 = free, 1 = automatic file names #
446  fscanf(fs, "%d", &DAS.DOption.filename);
447  // check option value
448  if (DAS.DOption.filename < 0 || DAS.DOption.filename > 1)
449  return 3; // Error in File Name Option
450 
451  FlushLine(str, 80, fs);
452  ReadLine(str, 80, fs); // # Image Type:0=Mono, 1 = RGB #
453  fscanf(fs, "%d", &DAS.DOption.imgtype);
454  // check option value
455  if (DAS.DOption.imgtype < 0 || DAS.DOption.imgtype > 1)
456  return 4; // Error in Image Type Option
457 
458  FlushLine(str, 80, fs);
459  ReadLine(str, 80, fs); // # CCD Pix Correction: 0=NOT Corrected, 1=Corrected #
460  fscanf(fs, "%d", &DAS.DOption.pixcorr);
461  // check option value
462  if (DAS.DOption.pixcorr < 0 || DAS.DOption.pixcorr > 1)
463  return 5; // Error in Pixel Correction Option
464 
465 
466  FlushLine(str, 80, fs);
467  ReadLine(str, 80, fs); // # File Name for CCD Pix Correction #
468  fscanf(fs,"%s",&DAS.DOption.DEFPIXFILENAME);
469  sprintf(buff, "%s\\%s", BIL.DFILEM.CONFIGDIREQUIPMENT, DAS.DOption.DEFPIXFILENAME);
470  if(!DI_FileExist(buff)) // DI_FileExist --> Return: 1 if PATH exist, else return 0
471  return 37;
472 
473  FlushLine(str, 80, fs);
474  ReadLine(str, 80, fs); // # Measuring Mode:0 = Single, 1 = Averaged #
475  fscanf(fs, "%d", &DAS.DOption.measmode);
476  // check option value
477  if (DAS.DOption.measmode < 0 || DAS.DOption.measmode > 1)
478  return 39; // Error in Measuring Mode Option
479 
480 
481  FlushLine(str, 80, fs);
482  ReadLine(str, 80, fs); // # Averaging Mode:0 = fixed number, 1 = fixed time #
483  fscanf(fs, "%d", &DAS.DOption.avgmode);
484  // check option value
485  if (DAS.DOption.avgmode < 0 || DAS.DOption.avgmode > 1)
486  return 6; // Error in Averaging Mode Option
487 
488  FlushLine(str, 80, fs);
489  ReadLine(str, 80, fs); // # Avg Mode fixed Number of measurements #
490  fscanf(fs, "%d", &N_AVG);
491  // check option value
492  if (N_AVG < 1 || N_AVG > 200)
493  return 7; // Error in Fixed Number of Measurement for Average Option
494 
495  FlushLine(str, 80, fs);
496  ReadLine(str, 80, fs); // # Avg Mode fixed Time Exposure [sec] #
497  fscanf(fs, "%d", &TOTTEXP);
498  // check option value
499  if (TOTTEXP < 0 || TOTTEXP > 100)
500  return 8; // Error in Total Exposure Time for Average Option
501 
502  FlushLine(str, 80, fs);
503  ReadLine(str, 80, fs); // # Remove Dark?: 0 = No, 1 = Yes #
504  fscanf(fs, "%d", &DAS.DOption.darkremove);
505  // check option value
506  if (DAS.DOption.darkremove < 0 || DAS.DOption.darkremove > 1)
507  return 9; // Error in Dark Remove Option
508 
509  FlushLine(str, 80, fs);
510  ReadLine(str, 80, fs); // # Dark source: 0 = Blind Pixels, 1 = Full Frame #
511  fscanf(fs, "%d", &DAS.DOption.darksource);
512  // check option value
513  if (DAS.DOption.darksource < 0 || DAS.DOption.darksource > 1)
514  return 10; // Error in Dark Source Option
515 
516  FlushLine(str, 80, fs);
517  ReadLine(str, 80, fs); // # CCD Temp: 0 = Fixed, 1 = variation vs SZA #
518  fscanf(fs, "%d", &FLAG.settempvar);
519  // check option value
520  if (FLAG.settempvar < 0 || FLAG.settempvar > 1)
521  return 11; // Error in Set CCD Temperature Flag
522 
523  FlushLine(str, 80, fs);
524  ReadLine(str, 80, fs); // # Plot X Scale: 0 = Pixel #, 1 = Wl[A], 2 = wl[nm] #
525  fscanf(fs, "%d", &FLAG.Wl);
526  // check option value
527  if (FLAG.Wl < 0 || FLAG.Wl > 2)
528  return 12; // Error in Plot Scale Flag
529 
530  FlushLine(str, 80, fs);
531  ReadLine(str, 80, fs); // # Plot display: 0 = NO, 1 = Yes #
532  fscanf(fs, "%d", &DAS.Flag.plotW);
533  // check option value
534  if (DAS.Flag.plotW < 0 || DAS.Flag.plotW > 1)
535  return 13; // Error in Plot Display Flag
536 
537  FlushLine(str, 80, fs);
538  ReadLine(str, 80, fs); // # Plot Y Scale: 0 = FullRange(0-65535), 1 = min/max#
539  fscanf(fs, "%d", &FLAG.plotYRange);
540  // check option value
541  if (FLAG.plotYRange < 0 || FLAG.plotYRange > 1)
542  return 14; // Error in Plot Y Scale Flag
543 
544  FlushLine(str, 80, fs);
545  ReadLine(str, 80, fs); // # Measurements performed for SZA <= SZAMax #
546  fscanf(fs, "%d", &SZAMax);
547  // check option value
548  if (SZAMax < 0 || SZAMax > 180)
549  return 15; // Error in SZAMax Parameter
550 
551  FlushLine(str, 80, fs);
552  ReadLine(str, 80, fs); // # Hidden Lines in Plot - Before and After Cent.line#
553  fscanf(fs, "%d", &DAS.DOption.hlinebefore);
554  // check option value
555  if (DAS.DOption.hlinebefore < 0 || DAS.DOption.hlinebefore > 128)
556  return 16; // Error in Hidden Lines in Plot Before the Central one Option
557 
558  FlushLine(str, 80, fs);
559  fscanf(fs, "%d", &DAS.DOption.hlineafter);
560  // check option value
561  if (DAS.DOption.hlineafter < 0 || DAS.DOption.hlineafter > 128)
562  return 17; // Error in Hidden Lines in Plot After the Central one Option
563 
564  FlushLine(str, 80, fs);
565  ReadLine(str, 80, fs); // # Display Blind Pixel: 0 = NO, 1 = Yes #
566  fscanf(fs, "%d", &FLAG.DispBlindPix);
567  // check option value
568  if (FLAG.DispBlindPix < 0 || FLAG.DispBlindPix > 1)
569  return 18; // Error in Display Blind Pixel Flag
570 
571  FlushLine(str, 80, fs);
572  ReadLine(str, 80, fs); // # Perform FTP Back-UP: 0 = NO, 1 = Yes #
573  fscanf(fs, "%d", &DAS.DOption.ftpbackup);
574  // check option value
575  if (DAS.DOption.ftpbackup < 0 || DAS.DOption.ftpbackup > 1)
576  return 19; // Error in Perform FTP Back-UP Option
577 
578  FlushLine(str, 80, fs);
579  ReadLine(str, 80, fs); // # Reference temperature for OMU Thermo-Regulation: #
580  ReadLine(str, 80, fs);// # 0 = AVG Internal Peltier; 1 = Optic; 2 = Grating #
581  fscanf(fs, "%d", &DAS.DOption.refertemp);
582  // check option value
583  if (DAS.DOption.refertemp < 0 || DAS.DOption.refertemp > 2)
584  return 20; // Error in Reference temperature for OMU Thermo-Regulation Option
585 
586  FlushLine(str, 80, fs);
587  ReadLine(str, 80, fs); // # OMU Thermo-Regulation mode: #
588  ReadLine(str, 80, fs); // # 0 = Cold Only; 1 = Heat only; 2 = Cold/Heat #
589  fscanf(fs, "%d", &OMUTHR.TRType);
590  // check option value
591  if (OMUTHR.TRType < 0 || OMUTHR.TRType > 2)
592  return 21; // Error in OMU Thermo-Regulation mode
593 
594  FlushLine(str, 80, fs);
595  ReadLine(str, 80, fs); // # Mirroring CCD Image along X axis #
596  ReadLine(str, 80, fs); // # 0 = NO Mirroring; 1 = Mirror image #
597  fscanf(fs, "%d", &DAS.DOption.mirrorimg[XAX]);
598  // check option value
599  if (DAS.DOption.mirrorimg[XAX] < 0 || DAS.DOption.mirrorimg[XAX] > 1)
600  return 22; // Error in Mirroring CCD Image along X axis Option
601 
602  FlushLine(str, 80, fs);
603  ReadLine(str, 80, fs); // # Mirroring CCD Image long Y axis #
604  ReadLine(str, 80, fs); // # 0 = NO Mirroring; 1 = Mirror image #
605  fscanf(fs, "%d", &DAS.DOption.mirrorimg[YAX]);
606  // check option value
607  if (DAS.DOption.mirrorimg[YAX] < 0 || DAS.DOption.mirrorimg[YAX] > 1)
608  return 23; // Error in Mirroring CCD Image along Y axis Option
609 
610  FlushLine(str, 80, fs);
611  ReadLine(str, 80, fs); // # AMS Option - Stepper motor Positioning mode #
612  ReadLine(str, 80, fs); // # 0 = Sequential; 1 = Simultaneous #
613  fscanf(fs, "%d", &DAS.DOption.smposmode);
614  // check option value
615  if (DAS.DOption.smposmode < 0 || DAS.DOption.smposmode > 1)
616  return 24; // Error in AMS Option - Stepper motor Positioning mode
617 
618  FlushLine(str, 80, fs);
619  ReadLine(str, 80, fs); //"# AMS Option - Stepper motor Positioning mode #
620  ReadLine(str, 80, fs); //"# 0 = Sequential; 1 = Simultaneous #
621  fscanf(fs, "%d", &DAS.DOption.amsprogbar);
622  // check option value
623  if (DAS.DOption.amsprogbar < 0 || DAS.DOption.amsprogbar > 1)
624  return 25; // Error in AMS Option - Display Progression Bars
625 
626  FlushLine(str, 80, fs);
627  ReadLine(str, 80, fs); //# Autorange before Average #
628  ReadLine(str, 80, fs); //# 0 = NO Autoranging, 1 = Autoranging #
629  fscanf(fs, "%d", &DAS.DOption.avgautor);
630  // check option value
631  if (DAS.DOption.avgautor < 0 || DAS.DOption.avgautor > 1)
632  return 26; // Error in Autorange before Average Option
633 
634  FlushLine(str, 80, fs);
635  ReadLine(str, 80, fs); //# MIGE Platform connection #;
636  ReadLine(str, 80, fs); //# 0 = NOT Connected, 1 = Connected #;
637  fscanf(fs, "%d", &DAS.MIGE.linked);
638  // check option value
639  if (DAS.MIGE.linked < 0 || DAS.MIGE.linked > 1)
640  return 27; // Error in MIGE Linked Parameter
641 
642  FlushLine(str, 80, fs);
643  ReadLine(str, 80, fs); //# MIGE Platform Type #;
644  ReadLine(str, 80, fs); //# 0 = AltAz V 0.5, 1 = MIGE V. 3 #;
645  fscanf(fs, "%d", &DAS.MIGE.type);
646  // check option value
647  if (DAS.MIGE.type < 0 || DAS.MIGE.type > 2)
648  return 28; // Error in MIGE Type Parameter
649 
650  FlushLine(str, 80, fs);
651  ReadLine(str, 80, fs); //# Alt AzPlatfor operating mode #
652  ReadLine(str, 80, fs); // # 0 = Sun Track, 1 = AntiSunTrack, 2 = FreePos #
653  fscanf(fs, "%d", &DAS.DOption.aaopmode);
654  // check option value
655  if (DAS.DOption.aaopmode < 0 || DAS.DOption.aaopmode > 2)
656  return 29; // Error in MIGE Operating mode Option
657 
658  FlushLine(str, 80, fs);
659  ReadLine(str, 80, fs); //#EMShutter #
660  ReadLine(str, 80, fs); // #0 = NOT installed, 1 = Installed #
661  fscanf(fs, "%d", &DAS.DOption.emshutter);
662  // check option value
663  if (DAS.DOption.emshutter < 0 || DAS.DOption.emshutter > 1)
664  return 30; // Error in Shutter Connection Option
665 
666  FlushLine(str, 80, fs);
667  ReadLine(str, 80, fs); //# Shutter Type #
668  ReadLine(str, 80, fs); //# 0 = VS25, 1 = ROTSHUT, 2 = TORQUEM #
669  fscanf(fs, "%d", &DAS.DOption.shuttertype);
670  // check option value
671  if (DAS.DOption.shuttertype < 0 || DAS.DOption.shuttertype > 2)
672  return 31; // Error in Shutter Type Option
673 
674  FlushLine(str, 80, fs);
675  ReadLine(str, 80, fs); //# Measurements driven by SZA #
676  ReadLine(str, 80, fs); //# Format: a, b, c, d where: #
677  ReadLine(str, 80, fs); //# a = Flag; 0 = NOT Active, 1 = Active #
678  ReadLine(str, 80, fs); //# b = DeltaSZA, value of Delta SZA (x.x deg) #
679  ReadLine(str, 80, fs); //# c = MinSZA, value of Min SZA (xx deg) #
680  ReadLine(str, 80, fs); //# d = MaxSZA, value of Max SZA (xx deg) #
681  fscanf(fs, "%d %lf %lf %lf", &DAS.Flag.DeltaSZA, &SZADelta.DeltaSZA, &SZADelta.MinSZA, &SZADelta.MaxSZA);
682  // check option value
683  if (DAS.Flag.DeltaSZA < 0 || DAS.Flag.DeltaSZA > 1)
684  return 32; // Error DeltaSZA Flag
685  // check option value
686  if (SZADelta.DeltaSZA < 0 || SZADelta.DeltaSZA > 45)
687  return 33; // Error DeltaSZA Value
688  // check option value
689  if (SZADelta.MinSZA < 0)
690  return 34; // Error: MinSZA < 0
691  // check option value
692  if (SZADelta.MaxSZA < 0)
693  return 35; // Error: MaxSZA < 0
694  // check option value
696  return 36; // Error: MinSZA > MaxSZA Value
697 
698  FlushLine(str, 80, fs);
699 
700  ReadLine(str, 80, fs); //# Filter Wheel type
701  ReadLine(str, 80, fs); //# 0=simple, 1= double, 2= simple +TorqueM
702  fscanf(fs, "%d", &DAS.DOption.filtertype);
703  // check option value
704  if (DAS.DOption.filtertype < 0 || DAS.DOption.filtertype > 2)
705  return 32; // Error in Filter Wheel Type Option
706 
707  FlushLine(str, 80, fs);
708 
709  ReadLine(str, 80, fs); //#PID Parameters #
710  ReadLine(str, 80, fs); //#PID_kp PID_ki PID_kd #
711  fscanf(fs, "%f %f %f", &OMUTHR.PID_kp, &OMUTHR.PID_ki, &OMUTHR.PID_kd);
712 
713  FlushLine(str, 80, fs);
714 
715 
716  //RESET PARAMETERS
717  ReadLine(str, 80, fs); //#DAS/Windows Reset: Enabled = 1, Disabled = 0 #
718  fscanf(fs, "%d", &DAS.DOption.resetEnabled);
719  FlushLine(str, 80, fs);
720 
721  //RESET Type
722  ReadLine(str, 80, fs); //#Reset Type: Hourly = 0, Daily= 1 #
723  fscanf(fs, "%d", &DAS.DOption.resetType);;
724  FlushLine(str, 80, fs);
725  //RESET Frequency
726  ReadLine(str, 80, fs); //#Reset frequency: Hourly=1 to 23, Daily=1 to 365 #
727  fscanf(fs,"%d", &DAS.DOption.resetFreq);
728  FlushLine(str, 80, fs);
729 
730  //AUTORANGING MAX VALUE
731  ReadLine(str, 80, fs); //#AUTORANGING MAX VALUE ( < 63000) #
732  fscanf(fs,"%d", &DAS.DOption.maxlvlar);
733  FlushLine(str, 80, fs);
734 
735 
736 
737 
738  ReadLine(str, 80, fs); // ####################################################
739 
740 
741  fclose(fs);
742 
743  return 0;
744  }
745  else
746  return 999;
747 
748 }
749 
750 
751 
752 int LoadDFONT(void)
753 {
754  return 0;
755 }
756 
758 {
759 
760 }
761 
762 void LoadDefaultDPAL(void)
763 {
764 
765  DPAL.DB_Sel[0] = 190;
766  DPAL.DB_Sel[1] = 190;
767  DPAL.DB_Sel[2] = 190;
768 
769  DPAL.DB_UnSel[0] = 255;
770  DPAL.DB_UnSel[1] = 255;
771  DPAL.DB_UnSel[2] = 255;
772 
773  DPAL.DB_BG[0] = 0;
774  DPAL.DB_BG[1] = 0;
775  DPAL.DB_BG[2] = 0;
776 
777  DPAL.DB_BG_Albl[0] = 0;
778  DPAL.DB_BG_Albl[1] = 0;
779  DPAL.DB_BG_Albl[2] = 0;
780 
781  DPAL.DB_FG_Albl[0] = 255;
782  DPAL.DB_FG_Albl[1] = 255;
783  DPAL.DB_FG_Albl[2] = 255;
784 
785  DPAL.DB_BG_Plbl[0] = 0;
786  DPAL.DB_BG_Plbl[1] = 0;
787  DPAL.DB_BG_Plbl[2] = 0;
788 
789  DPAL.DB_FG_Plbl[0] = 255;
790  DPAL.DB_FG_Plbl[1] = 255;
791  DPAL.DB_FG_Plbl[2] = 255;
792 
793  DPAL.DB_BG_lblUP[0] = 255;
794  DPAL.DB_BG_lblUP[1] = 255;
795  DPAL.DB_BG_lblUP[2] = 255;
796 
797  DPAL.DB_FG_lblUP[0] = 0;
798  DPAL.DB_FG_lblUP[1] = 0;
799  DPAL.DB_FG_lblUP[2] = 0;
800 
801  DPAL.DB_BG_RButt[0] = 0;
802  DPAL.DB_BG_RButt[1] = 0;
803  DPAL.DB_BG_RButt[2] = 0;
804 
805  DPAL.DB_FG_RButt[0] = 255;
806  DPAL.DB_FG_RButt[1] = 255;
807  DPAL.DB_FG_RButt[2] = 255;
808 
809 }
810 
811 int LoadDasSysCol(void)
812 {
813 
814  FILE *fs;
815  char str[80];
816  char buff[_MAX_PATH];
817 
818  sprintf(buff, "%s\\DASSysColor.INI", BIL.DFILEM.CONFIGDIREQUIPMENT);
819  fs = fopen(buff, "r");
820 
821  if(fs == NULL) return 1;
822 
823  ReadLine(str, 80, fs); //###########################################
824  ReadLine(str, 80, fs); //# DAS Default Color #
825  ReadLine(str, 80, fs); //# by DanBo #
826  ReadLine(str, 80, fs); //###########################################
827  ReadLine(str, 80, fs); //# All these values can be modified, but #
828  ReadLine(str, 80, fs); //# DO NOT Exchange the order #
829  ReadLine(str, 80, fs); //###########################################
830  ReadLine(str, 80, fs); //# Selected Buttons #
831 
832  fscanf(fs, "%d%d%d", &DPAL.DB_Sel[0], &DPAL.DB_Sel[1],&DPAL.DB_Sel[2]);
833 
834  FlushLine(str, 80, fs);
835  ReadLine(str, 80, fs);
836 
837 
838  fscanf(fs, "%d%d%d", &DPAL.DB_UnSel[0],&DPAL.DB_UnSel[1],&DPAL.DB_UnSel[2]);
839 
840  FlushLine(str, 80, fs);
841  ReadLine(str, 80, fs);
842  fscanf(fs, "%d%d%d", &DPAL.DB_UnSelFG[0], &DPAL.DB_UnSelFG[1],&DPAL.DB_UnSelFG[2]);
843 
844  FlushLine(str, 80, fs);
845  ReadLine(str, 80, fs);
846 
847  fscanf(fs, "%d%d%d", &DPAL.DB_BG[0], &DPAL.DB_BG[1], &DPAL.DB_BG[2]);
848 
849  FlushLine(str, 80, fs);
850  ReadLine(str, 80, fs);
851 
852  fscanf(fs, "%d%d%d", &DPAL.DB_BG_Albl[0],&DPAL.DB_BG_Albl[1],&DPAL.DB_BG_Albl[2]);
853 
854  FlushLine(str, 80, fs);
855  ReadLine(str, 80, fs);
856 
857  fscanf(fs, "%d%d%d", &DPAL.DB_FG_Albl[0],&DPAL.DB_FG_Albl[1],&DPAL.DB_FG_Albl[2]);
858 
859  FlushLine(str, 80, fs);
860  ReadLine(str, 80, fs);
861 
862  fscanf(fs, "%d%d%d", &DPAL.DB_BG_Plbl[0],&DPAL.DB_BG_Plbl[1],&DPAL.DB_BG_Plbl[2]);
863 
864  FlushLine(str, 80, fs);
865  ReadLine(str, 80, fs);
866 
867  fscanf(fs, "%d%d%d", &DPAL.DB_FG_Plbl[0],&DPAL.DB_FG_Plbl[1],&DPAL.DB_FG_Plbl[2]);
868 
869  FlushLine(str, 80, fs);
870  ReadLine(str, 80, fs);
871 
872  fscanf(fs, "%d%d%d", &DPAL.DB_BG_lblUP[0],&DPAL.DB_BG_lblUP[1],&DPAL.DB_BG_lblUP[2]);
873 
874  FlushLine(str, 80, fs);
875  ReadLine(str, 80, fs);
876 
877  fscanf(fs, "%d%d%d", &DPAL.DB_FG_lblUP[0],&DPAL.DB_FG_lblUP[1],&DPAL.DB_FG_lblUP[2]);
878 
879  FlushLine(str, 80, fs);
880  ReadLine(str, 80, fs);
881 
882  fscanf(fs, "%d%d%d", &DPAL.DB_BG_RButt[0],&DPAL.DB_BG_RButt[1],&DPAL.DB_BG_RButt[2]);
883 
884  FlushLine(str, 80, fs);
885  ReadLine(str, 80, fs);
886 
887  fscanf(fs, "%d%d%d", &DPAL.DB_FG_RButt[0],&DPAL.DB_FG_RButt[1],&DPAL.DB_FG_RButt[2]);
888 
889  FlushLine(str, 80, fs);
890  ReadLine(str, 80, fs);
891 
892 
893  fclose(fs);
894 
895  /**********************************************************************************/
896  // Set the message dialog color and font format
897  MSetMessageDialogRGB(DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
898  MSetMessageDialogFgRGB(DPAL.DB_FG_Albl[0],DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
900  MSetInputPromptRGB(DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
901  MSetInputPromptFgRGB(DPAL.DB_FG_Albl[0],DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
903  /**********************************************************************************/
904 
905 
906  return 0;
907 }
908 int LoadTestPalette(char *nf)
909 {
910 
911  FILE *fs;
912  char str[80];
913  int c, dr=0,dg=0,db=0;
914  fs = fopen(nf, "r");
915 
916  if(fs == NULL) return 1;
917 
918 
919 
920  for(c = 0; c < 256; c++)
921  {
922  fscanf(fs, "%d%d%d", &MTCL.dr[c],&MTCL.dg[c],&MTCL.db[c]);
923  fgets(str, 80, fs);
924 
925  MTCL.Color[c] = MAllocColor(MTCL.dr[c],MTCL.dg[c],MTCL.db[c]);
926  MTCL.PLColor[c] = MTCL.Color[c];
927  }
928 
929  fclose(fs);
930 
931  MTCL.black = MBlackColor();
932  MTCL.white = MWhiteColor();
933  MTCL.yellow = MAllocColor(255, 255, 0);
934 
935  BIL.DPLOT.DrawBG = MAllocColor(220, 220, 220);
936 
937  MTCL.PLColor[256] = MTCL.black;
938  MTCL.PLColor[257] = MTCL.white;
939  MTCL.PLColor[258] = MTCL.yellow;
940 
941  IDY = 256;
943 
944 
945  return 0;
946 }
947 
949 {
950 
951  FILE *fs;
952  char str[80];
953  int c, dr=0,dg=0,db=0;
954  char buff[_MAX_PATH];
955 
956  sprintf(buff, "%s\\PALETTES\\DANBOMAP1.MAP", BIL.DFILEM.HOMEDIRECTORY);
957  fs = fopen(buff, "r");
958 
959  if(fs == NULL) return 1;
960 
961 
962 
963  for(c = 0; c < 256; c++)
964  {
965  fscanf(fs, "%d%d%d", &MTCL.dr[c],&MTCL.dg[c],&MTCL.db[c]);
966  fgets(str, 80, fs);
967 
968  MTCL.Color[c] = MAllocColor(MTCL.dr[c],MTCL.dg[c],MTCL.db[c]);
969  MTCL.PLColor[c] = MTCL.Color[c];
970  }
971 
972  fclose(fs);
973 
974  MTCL.black = MBlackColor();
975  MTCL.white = MWhiteColor();
976  MTCL.yellow = MAllocColor(255, 255, 0);
977 
978  BIL.DPLOT.DrawBG = MAllocColor(220, 220, 220);
979 
980  MTCL.PLColor[256] = MTCL.black;
981  MTCL.PLColor[257] = MTCL.white;
982  MTCL.PLColor[258] = MTCL.yellow;
983 
984 
985 
986 
987  return 0;
988 }
989 
990 int AssignParam(int mod)
991 {
992 
993  char str[80];
994  int i, k, tmp;
995 
996  if ((DAS.Flag.exemode == TEMPORIZED) | (DAS.Flag.exemode == PRGFILE) | (DAS.Flag.exemode == TESTAD)
997  | (DAS.Flag.exemode == MANUAL) | (DAS.Flag.exemode == TESTCCD) | (DAS.Flag.exemode == TESTAMS)
998  | (DAS.Flag.exemode == MANUAL) | (DAS.Flag.exemode == TESTCCD) | (DAS.Flag.exemode == DBDEMO)
999  | (DAS.Flag.exemode == SZAMASTERM) | (DAS.Flag.exemode == SZAMODE) )
1000  {
1001 
1002  //writing on the appropriate labels
1003  //CCD and OMU Parameters
1004  sprintf(str, "%.1lf", DAS.Paramini.ITemp);
1005  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[0], str);
1006 
1007  sprintf(str,"%.1lf%%",(double)DAS.Paramini.CoolPw / 10);
1008  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[1], str);
1009 
1010  sprintf(str,"%.1lf", DAS.Paramini.TPelt);
1011  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[2], str);
1012 
1013  sprintf(str,"%.1lf%%",(double)OMUTHR.PCPower / 10);
1014  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[10], str);
1015 
1016  sprintf(str,"%d", DAS.Paramini.ccdXoff);
1017  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[5], str);
1018 
1019  sprintf(str,"%d", DAS.Paramini.ccdYoff);
1020  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[6], str);
1021  sprintf(str,"%d", DAS.Paramini.ccdWx);
1022  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[7], str);
1023  sprintf(str,"%d", DAS.Paramini.ccdWy);
1024  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[8], str);
1025  sprintf(str, "%d", DAS.Paramini.VBin);
1026  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[9], str);
1027 
1028  for (i=0;i<DAS.StepM.NAMS; i++)
1029  {
1030  for (k=0;k<2; k++)
1031  {
1032  tmp = DAS.StepM.power[i][k];
1033  DAS.StepM.cop_perc[i][k] = int2perc(i, DAS.StepM.power[i][k]);
1034  sprintf(str, "%.1f%%", DAS.StepM.cop_perc[i][k]);
1035  MObjectSetText(DAS.Gui.ContrPanel.power[i][k], str);
1036 
1037  val2fraz(i, k, DAS.StepM.step[i][k]);
1038  MObjectSetText(DAS.Gui.ContrPanel.step[i][k], DAS.StepM.step_fraz[i][k]);
1039 
1040  sprintf(str, "%d", DAS.StepM.slope[i][k]);
1041  MObjectSetText(DAS.Gui.ContrPanel.slope[i][k], str);
1042 
1043  DAS.StepM.speed_Hz[i][k] = int2hertz(i, DAS.StepM.speed[i][k]);
1044  sprintf(str, "%.3lf", DAS.StepM.speed_Hz[i][k]);
1045  MObjectSetText(DAS.Gui.ContrPanel.speed[i][k], str);
1046 
1047 
1048  }
1049 
1050  }
1051 /* if (DAS.Paramini.EqType == TROPOGAS)
1052  {
1053  for (i=0;i<6; i++)
1054  {
1055  DAS.StepM.cop_perc[i] = int2perc(i, DAS.StepM.cop[i]);
1056  sprintf(str, "%.1f%%", DAS.StepM.cop_perc[i]);
1057  MObjectSetText(DAS.Gui.ContrPanel.cop[i], str);
1058  val2fraz(i, DAS.StepM.step[i]);
1059  MObjectSetText(DAS.Gui.ContrPanel.step[i], DAS.StepM.step_fraz[i]);
1060  sprintf(str, "%d", DAS.StepM.slope[i]);
1061  MObjectSetText(DAS.Gui.ContrPanel.slope[i], str);
1062  DAS.StepM.speed_Hz[i] = int2hertz(i, DAS.StepM.speed[i]);
1063  sprintf(str, "%.3lf", DAS.StepM.speed_Hz[i]);
1064  MObjectSetText(DAS.Gui.ContrPanel.speed[i], str);
1065  }
1066  }
1067  else
1068  {
1069  for (i=0;i<4; i++)
1070  {
1071  DAS.StepM.cop_perc[i] = int2perc(i, DAS.StepM.cop[i]);
1072  sprintf(str, "%.1f%%", DAS.StepM.cop_perc[i]);
1073  MObjectSetText(DAS.Gui.ContrPanel.cop[i], str);
1074  val2fraz(i, DAS.StepM.step[i]);
1075  MObjectSetText(DAS.Gui.ContrPanel.step[i], DAS.StepM.step_fraz[i]);
1076  sprintf(str, "%d", DAS.StepM.slope[i]);
1077  MObjectSetText(DAS.Gui.ContrPanel.slope[i], str);
1078  DAS.StepM.speed_Hz[i] = int2hertz(i, DAS.StepM.speed[i]);
1079  sprintf(str, "%.3lf", DAS.StepM.speed_Hz[i]);
1080  MObjectSetText(DAS.Gui.ContrPanel.speed[i], str);
1081  }
1082  }
1083  */
1084  }
1085 
1086  return 0;
1087 }
1088 
1089 int LoadEquipment(void)
1090 {
1091  FILE *fs;
1092  char str[80];
1093  int c;
1094  char buff[_MAX_PATH];
1095 
1096  sprintf(buff, "%s\\Equipment.ini",BIL.DFILEM.CONFIGDIRCOMMON);
1097 
1098 
1099  fs = fopen(buff, "r");
1100  if(fs == NULL) return 1;
1101 
1102  ReadLine(str, 80, fs); //###############################################
1103  ReadLine(str, 80, fs); //# Equipment.INI #
1104  ReadLine(str, 80, fs); //# Configuration file setting equipment type #
1105  ReadLine(str, 80, fs); //###############################################
1106  ReadLine(str, 80, fs); //# 0 = SPATRAM, 1 = TROPOGAS, 2 = LIS #
1107  ReadLine(str, 80, fs); //# 3 = SPATRAMPLUS, 4 = GASCODNG1, 5=GASCOD/OA #
1108  ReadLine(str, 80, fs); //# 6 = GASCODNG2, 7 = GASCODNG3, 8 = GASCODNG4 #
1109  ReadLine(str, 80, fs); //# 9 = SPATRAM2 #
1110  ReadLine(str, 80, fs); //###############################################
1111 
1112  fscanf(fs, "%d", &DAS.Paramini.EqType); // Instrument Type(0 = SPATRAM, 1 = TROPOGAS, 2 = LIS, 3 = SPATRAMPLUS, 4 = GASCODNG1)
1113  FlushLine(str, 80, fs);
1114 
1115  c= DAS.Paramini.EqType;
1116  switch (c)
1117  {
1118  case 0:
1119 // DAS.Paramini.EqType = 0; //SPATRAM;
1120  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAM",BIL.DFILEM.CONFIGDIRCOMMON);
1121  break;
1122  case 1:
1123 // DAS.Paramini.EqType = 1; //TROPOGAS;
1124  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\TROPOGAS",BIL.DFILEM.CONFIGDIRCOMMON);
1125  break;
1126  case 2:
1127 // DAS.Paramini.EqType = 2; //LIS;
1128  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\LIS",BIL.DFILEM.CONFIGDIRCOMMON);
1129  break;
1130  case 3:
1131 // DAS.Paramini.EqType = 3; //SPATRAMPLUS;
1132  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAMPLUS",BIL.DFILEM.CONFIGDIRCOMMON);
1133  break;
1134  case 4:
1135 // DAS.Paramini.EqType = 4; //GASCODNG1;
1136  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG1",BIL.DFILEM.CONFIGDIRCOMMON);
1137  break;
1138  case 5:
1139 // DAS.Paramini.EqType = 5; //GASCODOffAxis;
1140  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODOA",BIL.DFILEM.CONFIGDIRCOMMON);
1141  break;
1142  case 6:
1143 // DAS.Paramini.EqType = 6; //GASCODNG2;
1144  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG2",BIL.DFILEM.CONFIGDIRCOMMON);
1145  break;
1146  case 7:
1147 // DAS.Paramini.EqType = 7; //GASCODNG3;
1148  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG3",BIL.DFILEM.CONFIGDIRCOMMON);
1149  break;
1150  case 8:
1151 // DAS.Paramini.EqType = 8; //GASCODNG4;
1152  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG4",BIL.DFILEM.CONFIGDIRCOMMON);
1153  break;
1154  case 9:
1155 // DAS.Paramini.EqType = 9; //SPATRAM2;
1156  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAM2",BIL.DFILEM.CONFIGDIRCOMMON);
1157  break;
1158  case 10:
1159 // DAS.Paramini.EqType = 10; //SPATRAM3;
1160  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAM3",BIL.DFILEM.CONFIGDIRCOMMON);
1161  break;
1162  default:
1163  return c;
1164  }
1165 
1166  return 0;
1167 
1168 }
1169 
1170 int LoadHardware(void)
1171 {
1172  FILE *fs;
1173  char str[80];
1174  int c;
1175  char buff[_MAX_PATH];
1176 
1177  sprintf(buff, "%s\\Hardware.ini",BIL.DFILEM.CONFIGDIREQUIPMENT);
1178 
1179 
1180  fs = fopen(buff, "r");
1181  if(fs == NULL) return 1;
1182 
1183 
1184  ReadLine(str, 80, fs); //###############################################
1185  ReadLine(str, 80, fs); //# HARDWARE.INI #
1186  ReadLine(str, 80, fs); //###############################################
1187  ReadLine(str, 80, fs); //# Type of motherboard installed #
1188  ReadLine(str, 80, fs); //# 0 = NOVA7892; 1 = NOVA6612; 2 = NOVA945GSE #
1189  ReadLine(str, 80, fs); //###############################################
1190 
1191 
1192  fscanf(fs, "%d", &DAS.Nova.type);
1193 // FlushLine(str, 80, fs);
1194 
1195  c= DAS.Nova.type;
1196  switch (c)
1197  {
1198  case 0:
1199  DAS.Nova.DigOut = 0;
1200  DAS.Nova.DigIn = 0;
1201  break;
1202  case 1:
1203  DAS.Nova.DigOut = 0;
1204  break;
1205  case 2:
1206  DAS.Nova.DigOut = 15;
1207  DAS.Nova.DigIn = 15;
1208  break;
1209  }
1210 
1211  return 0;
1212 
1213 }
1214 
1215 int LoadParam(void)
1216 {
1217  FILE *fs;
1218  char str[80];
1219 // int c;
1220 
1221  char buff[_MAX_PATH];
1222 
1223  sprintf(buff, "%s\\PARAM.ini",BIL.DFILEM.CONFIGDIREQUIPMENT);
1224 
1225 
1226 
1227  fs = fopen(buff, "r");
1228  if(fs == NULL) return 1;
1229 
1230  // CCD and OMU Parameters
1231  ReadLine(str, 80, fs); //###############################################
1232  ReadLine(str, 80, fs); //# Param.INI #
1233  ReadLine(str, 80, fs); //# Main configuration file for SPATRAM #
1234  ReadLine(str, 80, fs); //# equipment #
1235  ReadLine(str, 80, fs); //###############################################
1236  ReadLine(str, 80, fs); //# ------------------------------------------- #
1237  ReadLine(str, 80, fs); //# by DanBo Date at Time #
1238  ReadLine(str, 80, fs); //# ------------------------------------------- #
1239 
1240 
1241 
1242 
1243  ReadLine(str, 80, fs); //# CCD Temp (°C) #
1244  fscanf(fs, "%lf", &DAS.Paramini.ITemp); //CCd Temp
1245  FlushLine(str, 80, fs);
1246 
1247  ReadLine(str, 80, fs); // # CCD Peltier Init Power (X 10-ie 15% --> 150) #
1248  fscanf(fs, "%d", &DAS.Paramini.CoolPw); //CCD Peltier initial Power
1249  FlushLine(str, 80, fs);
1250 
1251  ReadLine(str, 80, fs); // # Optical Unit Target Temperature #
1252  fscanf(fs, "%lf", &DAS.Paramini.TPelt);
1253  FlushLine(str, 80, fs);
1254 
1255 
1256  ReadLine(str, 80, fs); //# OMU Peltier Init Power X 10 (500 = 50.0%) #
1257  fscanf(fs, "%d", &OMUTHR.PCPower);
1258  FlushLine(str, 80, fs);
1259 
1260  ReadLine(str, 80, fs); // # CCD Window (xstart ys xend ye) #
1261  fscanf(fs,"%d%d%d%d" , &DAS.Paramini.ccdXoff, &DAS.Paramini.ccdYoff, &DAS.Paramini.ccdWx, &DAS.Paramini.ccdWy);
1262  FlushLine(str, 80, fs);
1263 
1264  ReadLine(str, 80, fs);// # Vertical Binning #
1265  fscanf(fs, "%d", &DAS.Paramini.VBin);
1266  FlushLine(str, 80, fs);
1267 
1268  ReadLine(str, 80, fs);//"# Max Exposure Time s (=0 --> free exposure) #
1269  fscanf(fs, "%lf", &DAS.Paramini.maxtexp);
1270  FlushLine(str, 80, fs);
1271 
1272 
1273 
1274 /*
1275  //Stepper motors Parameters
1276  //SM1
1277  ReadLine(str, 80, fs);//# Input Mirror Stepper Motor - SM1 #
1278  ReadLine(str, 80, fs);//# SM1 Power (0 = 0A - 76 = 1.52A) #
1279 
1280  fscanf(fs, "%d", &DAS.StepM.cop[0]);
1281 
1282  FlushLine(str, 80, fs);
1283  ReadLine(str, 80, fs);//# SM1 Step (0=400s/r, 1=800s/r,2=1000/sr) #
1284 
1285  fscanf(fs, "%d", &DAS.StepM.step[0]);
1286 
1287  FlushLine(str, 80, fs);
1288  ReadLine(str, 80, fs);//# SM1 Slope (0 - 255) #
1289 
1290  fscanf(fs, "%d", &DAS.StepM.slope[0]);
1291 
1292  FlushLine(str, 80, fs);
1293  ReadLine(str, 80, fs);//# SM1 Speed Hz (PS = 125*(n+1), n=0,1..255) #
1294 
1295  fscanf(fs, "%d", &DAS.StepM.speed[0]);
1296  FlushLine(str, 80, fs);
1297 
1298  //SM2
1299  ReadLine(str, 80, fs);//# Grating Stepper Motor - SM2 #
1300  ReadLine(str, 80, fs);//# SM2 Power (0 = 0A - 76 = 1.52A) #
1301 
1302  fscanf(fs, "%d", &DAS.StepM.cop[1]);
1303 
1304  FlushLine(str, 80, fs);
1305  ReadLine(str, 80, fs);//# SM2 Step (0=400s/r, 1=800s/r,2=1000/sr) #
1306 
1307  fscanf(fs, "%d", &DAS.StepM.step[1]);
1308 
1309  FlushLine(str, 80, fs);
1310  ReadLine(str, 80, fs);//# SM2 Slope (0 - 255) #
1311 
1312  fscanf(fs, "%d", &DAS.StepM.slope[1]);
1313 
1314  FlushLine(str, 80, fs);
1315  ReadLine(str, 80, fs);//# SM2 Speed Hz (PS = 125*(n+1), n=0,1..255) #
1316 
1317  fscanf(fs, "%d", &DAS.StepM.speed[1]);
1318  FlushLine(str, 80, fs);
1319 
1320  //SM3
1321  ReadLine(str, 80, fs);//# filter wheel Stepper Motor - SM3 #
1322  ReadLine(str, 80, fs);//# SM3 Power (0 = 0A - 76 = 1.52A) #
1323 
1324  fscanf(fs, "%d", &DAS.StepM.cop[2]);
1325 
1326  FlushLine(str, 80, fs);
1327  ReadLine(str, 80, fs);//# SM3 Step (0=400s/r, 1=800s/r,2=1000/sr) #
1328 
1329  fscanf(fs, "%d", &DAS.StepM.step[2]);
1330 
1331  FlushLine(str, 80, fs);
1332  ReadLine(str, 80, fs);//# SM3 Slope (0 - 255) #
1333 
1334  fscanf(fs, "%d", &DAS.StepM.slope[2]);
1335 
1336  FlushLine(str, 80, fs);
1337  ReadLine(str, 80, fs);//# SM3 Speed Hz (PS = 125*(n+1), n=0,1..255) #
1338 
1339  fscanf(fs, "%d", &DAS.StepM.speed[2]);
1340  FlushLine(str, 80, fs);
1341 
1342  //SM4
1343  ReadLine(str, 80, fs);//# filter wheel Stepper Motor - SM3 #
1344  ReadLine(str, 80, fs);//# SM3 Power (0 = 0A - 76 = 1.52A) #
1345 
1346  fscanf(fs, "%d", &DAS.StepM.cop[3]);
1347 
1348  FlushLine(str, 80, fs);
1349  ReadLine(str, 80, fs);//# SM3 Step (0=400s/r, 1=800s/r,2=1000/sr) #
1350 
1351  fscanf(fs, "%d", &DAS.StepM.step[3]);
1352 
1353  FlushLine(str, 80, fs);
1354  ReadLine(str, 80, fs);//# SM3 Slope (0 - 255) #
1355 
1356  fscanf(fs, "%d", &DAS.StepM.slope[3]);
1357 
1358  FlushLine(str, 80, fs);
1359  ReadLine(str, 80, fs);//# SM3 Speed Hz (PS = 125*(n+1), n=0,1..255) #
1360 
1361  fscanf(fs, "%d", &DAS.StepM.speed[3]);
1362  FlushLine(str, 80, fs);
1363 
1364  //SM5
1365  ReadLine(str, 80, fs);//# filter wheel Stepper Motor - SM3 #
1366  ReadLine(str, 80, fs);//# SM3 Power (0 = 0A - 76 = 1.52A) #
1367 
1368  fscanf(fs, "%d", &DAS.StepM.cop[4]);
1369 
1370  FlushLine(str, 80, fs);
1371  ReadLine(str, 80, fs);//# SM3 Step (0=400s/r, 1=800s/r,2=1000/sr) #
1372 
1373  fscanf(fs, "%d", &DAS.StepM.step[4]);
1374 
1375  FlushLine(str, 80, fs);
1376  ReadLine(str, 80, fs);//# SM3 Slope (0 - 255) #
1377 
1378  fscanf(fs, "%d", &DAS.StepM.slope[4]);
1379 
1380  FlushLine(str, 80, fs);
1381  ReadLine(str, 80, fs);//# SM3 Speed Hz (PS = 125*(n+1), n=0,1..255) #
1382 
1383  fscanf(fs, "%d", &DAS.StepM.speed[4]);
1384  FlushLine(str, 80, fs);
1385 
1386  //SM6
1387  ReadLine(str, 80, fs);//# filter wheel Stepper Motor - SM3 #
1388  ReadLine(str, 80, fs);//# SM3 Power (0 = 0A - 76 = 1.52A) #
1389 
1390  fscanf(fs, "%d", &DAS.StepM.cop[5]);
1391 
1392  FlushLine(str, 80, fs);
1393  ReadLine(str, 80, fs);//# SM3 Step (0=400s/r, 1=800s/r,2=1000/sr) #
1394 
1395  fscanf(fs, "%d", &DAS.StepM.step[5]);
1396 
1397  FlushLine(str, 80, fs);
1398  ReadLine(str, 80, fs);//# SM3 Slope (0 - 255) #
1399 
1400  fscanf(fs, "%d", &DAS.StepM.slope[5]);
1401 
1402  FlushLine(str, 80, fs);
1403  ReadLine(str, 80, fs);//# SM3 Speed Hz (PS = 125*(n+1), n=0,1..255) #
1404 
1405  fscanf(fs, "%d", &DAS.StepM.speed[5]);
1406  FlushLine(str, 80, fs);
1407 
1408  // Legge gli offset dei vari stepper
1409  // ad oggi 9 valori
1410 
1411  ReadLine(str, 80, fs);
1412  ReadLine(str, 80, fs);
1413  for(c = 0; c < 9; c++)
1414  fscanf(fs,"%d" , &DAS.Paramini.Offset[c]);
1415  FlushLine(str, 80, fs);
1416 
1417  ReadLine(str, 80, fs);
1418  ReadLine(str, 80, fs);
1419 
1420  for(c = 0; c < 6; c++)
1421  fscanf(fs,"%d" , &DAS.StepM.hometype[c]);
1422  FlushLine(str, 80, fs);
1423 
1424 */
1425  ReadLine(str, 80, fs);
1426  fclose(fs);
1427 
1428  return 0;
1429 }
1430 
1431 
1432 int LoadGeoDB(void)
1433 {
1434  FILE *fd;
1435  char str[80];
1436  char buff[_MAX_PATH];
1437 // int i;
1438 
1439  sprintf(buff, "%s\\GeoDB.ini", BIL.DFILEM.CONFIGDIREQUIPMENT);
1440  fd = fopen(buff, "r");
1441  if(fd == NULL) return 1;
1442 
1443  DAS.DGeo.nitem =0;
1444 
1445  fgets(str, 80, fd); // Read Header
1446  fgets(str, 80, fd); // Read Header
1447  fgets(str, 80, fd); // Read Header
1448  fgets(str, 80, fd); // Read Header
1449 
1450  //fscanf(fd, "%d", &DAS.DGeo.nitem);
1451  //fgets(str, 80, fd);
1452 
1453  //for (i=0; i<DAS.DGeo.nitem; i++)
1454  do
1455  {
1456 
1457 // fscanf(fd, "%hs",DAS.DGeo.news_name[i]);
1458 // fscanf(fd, "%lf %lf %lf %d", &DAS.DGeo.newlatitude[i],
1459 // &DAS.DGeo.newlongitude[i],&DAS.DGeo.newalititude[i],&DAS.DGeo.newtimezone[i]);
1460  fscanf(fd, "%hs",DAS.DGeo.news_name[DAS.DGeo.nitem]);
1461  fscanf(fd, "%lf %lf %lf %d", &DAS.DGeo.newlatitude[DAS.DGeo.nitem],
1462  &DAS.DGeo.newlongitude[DAS.DGeo.nitem],&DAS.DGeo.newalititude[DAS.DGeo.nitem],&DAS.DGeo.newtimezone[DAS.DGeo.nitem]);
1463 
1464 
1465  DAS.DGeo.nitem++;
1466  }while (!feof(fd));
1467  DAS.DGeo.nitem--;
1468 
1469  fclose(fd);
1470 
1471  return 0;
1472 }
1473 
1474 
1475 
1476 
1477 int LoadGeoCoord(void)
1478 {
1479  FILE *fd;
1480  char str[80];
1481  char buff[_MAX_PATH];
1482 
1483  sprintf(buff, "%s\\GeoCoord.INI", BIL.DFILEM.CONFIGDIREQUIPMENT);
1484  fd = fopen(buff, "r");
1485  if(fd == NULL) return 1;
1486 
1487  fgets(str, 80, fd); // Read Header
1488 
1489  fscanf(fd, "%hs", &DAS.DGeo.s_name);
1490  fgets(str, 80, fd);
1491 
1492  fscanf(fd, "%lf", &DAS.DGeo.latitude);
1493  fgets(str, 80, fd);
1494 // sprintf(str, "%.2lf", DGEO.latitude);
1495 // MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[0], str);
1496 
1497  fscanf(fd, "%lf", &DAS.DGeo.longitude);
1498  fgets(str, 80, fd);
1499 // sprintf(str,"%.1lf%%",(double)DAS.Paramini.CoolPw / 10);
1500 // MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[1], str);
1501 
1502 
1503  fscanf(fd, "%lf", &DAS.DGeo.alititude);
1504  fgets(str, 80, fd);
1505 // sprintf(str,"%.1lf", DAS.Paramini.TPelt);
1506 // MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[2], str);
1507 
1508  fscanf(fd, "%d", &DAS.DGeo.timezone);
1509  fgets(str, 80, fd);
1510 
1511  fclose(fd);
1512 
1513  return 0;
1514 }
1515 
1516 
1517 int LoadParamLog(void)
1518 {
1519  FILE *fs;
1520  char str[80];
1521  int c;
1522  fs = fopen("LOG\\Paramini.LOG", "r");
1523  if(fs == NULL) return 2;
1524 
1525  fscanf(fs, "%d", &c);
1526  fgets(str, 80, fs);
1527 
1528  fclose(fs);
1529 
1530  return c;
1531 }
1532 
1533 
1534 int LoadExec(char *fname)
1535 {
1536  int fs;
1537  //unsigned int siz;
1538 // char buff[2048];
1539  long siz;
1540 
1541  fs = open(fname, O_RDONLY );
1542  if(fs < 0) return 0;
1543  siz = filelength(fs);
1544  if(Program)
1545  free(Program);
1546  Program = malloc(siz);
1547  read(fs, Program, siz);
1548  close(fs);
1549  PrgCnt = 0;
1550  PrgSiz = siz;
1551 
1552  return 1;
1553 }
1554 
1555 
1556 void Status(char *tit)
1557 {
1558  char lb[1024];
1559 
1560  sprintf(lb, "%s", tit);
1562 }
1563 
1564 
1565 /* Pauses for a specified number of milliseconds. */
1566 void sleep( clock_t wait )
1567 {
1568  clock_t goal;
1569  goal = wait + clock();
1570  while( goal > clock() )
1571  ;
1572 }
1573 
flag FLAG
Definition: CreateForms.c:84
short DB_BG_lblUP[3]
Background Capital Letters Labels Color UP.
stepm StepM
Stepper motors parameters structure.
int LoadGeoCoord(void)
Load Geographic Coordinate of the station. Procedure that load the Geographic Coordinate of the stati...
Definition: Load.c:1477
double k2[20]
k2 dispersion parameter -slope (x stretch2
Definition: DOASdef.h:23
mtcl MTCL
Definition: 2DPlot.c:30
gui Gui
Graphic User Interface Structure.
int LoadEquipment(void)
Load the type of Equipment. {homedir}/config/param.ini.
Definition: Load.c:1089
Definition: DOASdef.h:16
MOBJECT speed[AMSMAX][2]
Active Control Panel Labels for Stepper Motors "speed".
void MSetInputPromptRGB(int r, int g, int b)
short DB_FG_Plbl[3]
Foreground PASSIVE Label Colors.
optionini DOption
Options for DAS execution.
int LoadTestPalette(char *nf)
Load a test palette. Procedure that load a test palette.
Definition: Load.c:908
void sleep(clock_t wait)
Pauses for a specified number of milliseconds. .
Definition: Load.c:1566
int savingmode
Flag to set saving mode: 0=ASCII, 1=Binary.
int LoadTruePalette(void)
Load the palette map. Procedure that load the palette map from file {homedir}/Palettes/Danbomap1.map.
Definition: Load.c:948
double alititude
Station altitude.
MTColor MBlackColor(void)
#define TESTCCD
execution for testing CCD Camera
dsza SZADelta
Definition: DAS_Spat.c:76
long IsSiz
Definition: Load.c:51
int MaskedRow[100][6]
Masked rows array.
Definition: Load.c:39
int NAMS
Number of AMSs Devices.
int TRType
Type of thermo regulation (0=TRTCOOL, 1 = TRTHEAT, 2= TRTBOTH)
#define PIX
Pixel identifier.
double newlatitude[20]
New Station latitude.
double newlongitude[20]
New Station longitude.
int PCPower
Power to the Peltier for Cooling.
int Wl
Flag for the units on the X scale plot.
int plotW
Flag for the plot display.
MTColor DrawBG
Definition: bildef.h:184
int LoadFTPSetting(void)
Load FTP Setting for daily back-up.
Definition: Load.c:286
das structure (contain all the previous structures) .
MTColor black
int ccdWx
CCD X End.
MTColor yellow
Control Panel and push buttons colors .
void MSetMessageDialogFonts(MTFont text_font, MTFont buttons_font)
double latitude
Station latitude.
MTColor white
flag Flag
Structure for different flags.
int darkremove
Flag to set Dark Removal from measurements; motors0 = No Dark Removal, 1 = Dark Removal.
structure for FTP setting
int AssignParam(int mod)
Assign parameters to the CP labels. .
Definition: Load.c:990
char HOMEDIRECTORY[_MAX_PATH]
Definition: bildef.h:200
int filtertype
type of installed filter module: 0=Simple-SM3, 1=Double-SM3+SM4, 2=simpleplus-SM3+TM) ...
dftp DFTP
Definition: Load.c:28
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
#define DBDEMO
execution in demo mode
void E_Row()
Definition: Load.c:155
void MSetInputPromptFonts(MTFont text, MTFont edit, MTFont btn)
void MSetInputPromptFgRGB(int r, int g, int b)
#define XAX
X Axis.
int MaskedCol[100][6]
Masked column array.
Definition: Load.c:38
int LoadGeoDB(void)
Definition: Load.c:1432
long IsCnt
Definition: Load.c:50
unsigned short DigOut
Digital Output.
void E_DREM(void)
Definition: Load.c:79
int slope[AMSMAX][2]
Stepper Motors Slope.
int ccdXoff
CCD X Start.
MOBJECT step[AMSMAX][2]
Active Control Panel Labels for Stepper Motors "step".
MOBJECT lbl_Par[11]
Parametric Labels of the Control Panel.
short DB_Sel[3]
Selected Buttons Colors.
#define COL
Column identifier.
void MSetMessageDialogFgRGB(int r, int g, int b)
geographical coordinate structure .
int type
int avgautor
autoranging for averaged measurement, 0 = NO AutoR before average; 1 = AutoR before average; ...
int MD_CreateBRowShell(int nrows)
Create windows of buttons. During the plotting of the measurements, create a shell of buttons if the ...
Definition: Spat_Plot.c:1625
int RItem
number of Pixel, Column, Row Item
Definition: Load.c:40
#define TEMPORIZED
execution driven by MASTER file
void MSetMessageDialogRGB(int r, int g, int b)
#define SZAMASTERM
execution driven by MASTERSZA file ( there is the possibility to distinguish between AM and PM measur...
double wlref[20]
reference wavelength
Definition: DOASdef.h:20
void MObjectSetText(MOBJECT obj, const char *text)
int SZAMax
Maximum SZA for performing measurements.
Definition: DAS_Spat.c:116
static double ch
Definition: SOLPOS.C:120
short DB_BG_RButt[3]
Background Radio Buttons.
int LoadParam(void)
Load the exe parameters. Procedure that load the parameters for CCD, Stepper Motors and Peltier from ...
Definition: Load.c:1215
d_geo DGeo
struct for Station location
void FlushLine(char *buf, int nc, FILE *f)
Flush line of file f read a maximum of nc character since when the read char is different from ch(10)...
Definition: Load.c:54
MOBJECT slope[AMSMAX][2]
Active Control Panel Labels for Stepper Motors "Slope".
MTColor Color[264]
int dg[256]
int pixref[20]
reference pixel
Definition: DOASdef.h:21
int ccdWy
CCD Y End.
int LoadDasSysCol(void)
Load system colors. Procedure that load the DAS colors in the file {homedir}/config/DASSysColor.INI.
Definition: Load.c:811
long PrgSiz
Size of the PRG file.
Definition: DAS_Spat.c:94
d_geo DGEO
geographical coordinates structure
Definition: Load.c:26
int hlinebefore
Number of HiddenLines before the central line in Plot.
char * Program
buffer for the PRG file
Definition: DAS_Spat.c:90
char * Istruction
Definition: Load.c:48
int timezone
Station timezone.
char s_name[4]
Station name.
#define PITM
Number of Pixel items identifier.
float PID_ki
d_fileman DFILEM
Definition: bildef.h:257
int avgmode
Flag to set Averaging mode: 0 = Repeat measurements for fixed number, 1 = Repeat measurements for fix...
omuthr OMUTHR
Definition: Load.c:33
das DAS
DAS structure.
Definition: Load.c:32
long PrgCnt
Counter for the position in the PRG file.
Definition: DAS_Spat.c:93
#define CLEN
d_view DPLOT
Definition: bildef.h:254
#define HELV_SMALL
Definition: Mguidefs.h:881
int LoadDB_Options(void)
Load Options. Procedure that load the Options in the file {homedir}/config/Options.INI.
Definition: Load.c:390
int VBin
CCD Vertical Binning.
paramini structure . It contains some of the parameters defined in the file PARAM.INI .
int CoolPw
CCD Init Power.
void E_CItm()
Definition: Load.c:135
#define FIXED_SMALL
Definition: Mguidefs.h:878
palette DPAL
Definition: Load.c:27
char CONFIGDIREQUIPMENT[_MAX_PATH]
Definition: bildef.h:208
double MaxSZA
Maximum SZA.
int emshutter
Presence of the CCD Shutter, emshutter = 1 –> Shutter IS Installed, = 0 –> Shutter NOT Installed...
mige MIGE
#define ROW
Row identifier.
int LoadExec(char *fname)
Load file for automatic execution. Procedure that load the file for automatic execution.
Definition: Load.c:1534
MTColor MAllocColor(int r, int g, int b)
double DeltaSZA
DeltaSZA.
int DeltaSZA
= 1 Delta SZA measurements activated, = 0 Continous measurements
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
char ftpuser[32]
FTP server users.
int plotYRange
0 –> full range; 1 –> min/max
int resetFreq
frequency of DAS/Windows Reset
#define PRGFILE
execution driven by *.prg file
short DB_BG_Plbl[3]
Background PASSIVE Label Colors.
double int2hertz(int mod, int k)
double k1[20]
k1 dispersion parameter - intercept (x stretch1)
Definition: DOASdef.h:22
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
double cop_perc[AMSMAX][2]
Stepper Motors Power percent.
int newtimezone[20]
Station timezone.
void E_Col()
Definition: Load.c:130
char news_name[20][4]
New Station name.
int TOTTEXP
Total Exposure time in Averaging mode.
Definition: DAS_Spat.c:115
void E_RItm()
Definition: Load.c:159
double newalititude[20]
New Station altitude.
int amsprogbar
display/hide prograssion bar, 0 = Hide, 1 = display
char ftpserver[32]
FTP server address.
#define _MAX_PATH
Definition: Dildef.h:202
void ReadLine(char *buf, int nc, FILE *f)
Read Line on a file Read one record of nc character on the file f.
Definition: Load.c:72
int hlineafter
Number of HiddenLines after the central line in Plot.
int MMessageDialog(const char *t, const char *msg, const char *btn1, const char *btn2,...)
int linked
int nitem
Number of items of the GeoDB.ini.
#define YAX
Y Axis.
short DB_BG[3]
Default Background Color.
int PItem
Definition: Load.c:40
short DB_FG_RButt[3]
Foreground Radio Buttons.
nova Nova
NOVA structure.
MOBJECT Albl_Status
Active Control Panel Labels for Status.
double int2perc(int mod, int k)
translate the AMS digit unit in text. The power assigned to the motor trough the AMS, is translated in text
Function prototypes.
#define SZAMODE
execution driven by SZAPRG file
bil BIL
Definition: 2DPlot.c:28
int LoadDB_DefectPixel(char *buff)
Load Defective pixel mask. Procedure that load the Defective pixel mask in the file {homedir}/config/...
Definition: Load.c:182
int mirrorimg[2]
Flag to set the mirroring of the CCD image: 0 = NO Mirroring, 1= YES Mirroring (element 0 for X axis;...
int CItem
Definition: Load.c:40
char step_fraz[AMSMAX][2][6]
Stepper Motors Step fraction.
void val2fraz(int id, int sn, int val)
Decimal value to ratio value Similar to listval2fraz The decimal value indicating the fractioning of ...
int MaskedPix[100][6]
Masked pixel&#39;s array.
Definition: Load.c:37
int LoadDB_DispCoeff(void)
Load dispersion parameters. Procedure that load the dispersion parameters from file {homedir}/DOAS/Di...
Definition: Load.c:234
int pixcorr
Flag to set defective pixel correction: 0=NOT Corrected, 1=Corrected.
MTColor PLColor[264]
int wlc[20]
Central wavelength.
Definition: DOASdef.h:19
controlpanel ContrPanel
Control Panel Structure.
int ftpbackup
Flag to set back up: 0 = NO FTP Back-UP; 1 = Perform FTP Back-UP.
int DFetch()
Definition: Load.c:87
#define DREM
text after this is a comment
int imgtype
Flag to set Image type: 0=MONOINT, 1=RGB.
MTColor MWhiteColor(void)
double longitude
Station longitude.
int measmode
measuring mode: 0 = Single; 1 = Averaged
#define RITM
Number of Rows items identifier.
void E_Pix()
Definition: Load.c:103
short DB_UnSelFG[3]
Unselected Buttons Colors.
int dr[256]
paramini PARAM
Param.ini.
Definition: Load.c:24
int settempvar
int speed[AMSMAX][2]
Stepper Motors Speed.
float PID_kp
int step[AMSMAX][2]
Stepper Motors Step.
void LoadDefaultDFONT(void)
Load Default Fonts. Procedure that load the DAS fonts if the file {homedir}/config/DASFonts.ini is not present.
Definition: Load.c:757
short DB_UnSel[3]
Unselected Buttons Colors.
char * CodeEq2Name(int code)
code Equipment to Name
Definition: Load.c:371
double speed_Hz[AMSMAX][2]
Stepper Motors Speed [Hz].
double maxtexp
Maximum exposure time (used in Autorange())
int aaopmode
operation mode for the Alt Az Platform, 0 = solar Traxker; 1 = Anti-Solar Tracker; 2 = Free Positioni...
char ftppwd[32]
FTP server pwd.
void E_PItm()
Definition: Load.c:108
int smposmode
positioning mode for stepper , 0 = sequential mode; 1 = simoultaneous mode
#define CITM
Number of Columns items identifier.
int filename
Flag to set file name mode 0=Free choice, 1 = Automatic.
char * ccdCorrKC[]
Definition: Load.c:44
int EqType
Spectrometer Type.
int db[256]
#define TESTAD
execution for testing PC 104 AD converter
int LoadHardware(void)
Definition: Load.c:1170
char * ERR_Option(int ercode)
Alerts for OPTION.INI errors Creates a message window reporting the reasons for the error...
Definition: Load.c:325
#define DEND
End of File.
char CONFIGDIRCOMMON[_MAX_PATH]
Definition: bildef.h:206
unsigned char DigIn
Digital Input.
int N_AVG
Number of measurements for Averaging mode in fixed number of meas. mode.
Definition: DAS_Spat.c:113
int darksource
Flag to set Dark source: 0 = Blind Pixels, 1 = Full Frame.
int resetEnabled
DAS/Windows reset option (1 = Enabled; 0 = disabled)
int refertemp
Flag to set the reference temp for thermo-regulation: 0 = AVGPINT; 1 = OPTIC; 2 = GRATING...
C_DEF int DI_FileExist(char *tit)
int type
type of NOVA monoboard used (7892 or 945GSE)
int resetType
type of period for DAS Reset: 0=Hours, 1=Days
int DispBlindPix
Display Blind Pix: 0 = NO, 1 = Yes.
int ccdYoff
CCD Y Start.
int shuttertype
type of installed shutter: 0 = VS25, 1 = Rotating Shutter, 2 = TorqueMotor
void Status(char *tit)
Writes information&#39;s on the Status label .
Definition: Load.c:1556
double ITemp
CCD Target Temperature.
unsigned int maxlvlar
maximum level of autoranging (max 65000)
MOBJECT power[AMSMAX][2]
active Control Panel Labels for Stepper Motors "power"
int LoadDFONT(void)
Load Fonts. Procedure that load the DAS fonts from {homedir}/config/DASFonts.ini AVAILABLE for Releas...
Definition: Load.c:752
int exemode
Set the Execution MODE (Execution modes)
double TPelt
OMU Target Temperature.
OMU Thermoregulation structure .
double MinSZA
Minimum SZA.
#define TESTAMS
execution for testing AMS&#39;s devices
short DB_FG_lblUP[3]
Foreground Capital Letters Labels Color UP.
int LoadParamLog(void)
Load file for CCD status. Procedure that load the file {homedir}/config/paramlog.ini, for the actual status of the CCD.
Definition: Load.c:1517
#define MANUAL
execution in manual mode (for lab use)
void LoadDefaultDPAL(void)
Load Default system colors. Procedure that load the DAS colors if the file {homedir}/config/DASSysCol...
Definition: Load.c:762
char DEFPIXFILENAME[_MAX_PATH]
defective pixel filename with path
int power[AMSMAX][2]
Stepper Motors Power.
float PID_kd
doas DOAS
Definition: Load.c:30
char IsFile[16]
Definition: Load.c:49
paramini Paramini
structure for the parameters defined in param.ini configuration file
______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:44:09 for DAS - Rel. 3.1.6 - 18/09/2017.