DAS
3.1.6 - 18/09/2017
|
#include <fcntl.h>
#include <process.h>
#include <io.h>
#include <math.h>
#include <sys\stat.h>
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <string.h>
#include <windows.h>
#include <stdlib.h>
#include <errno.h>
#include "mgui.h"
#include "DAS_Spatram.h"
#include "dcl.h"
#include "wsc.h"
#include "dxl.h"
#include "solpos.h"
#include "bil.h"
#include "dil.h"
Go to the source code of this file.
Functions | |
void | D_AutoExecution (void) |
*.PRG Automatic Execution in Automatic Mode More... | |
void | D_FixSZA (void) |
void | D_WaitSZA (void) |
void | E_DeltaSZA (void) |
Re-Start or Stop the execution of the PRG file (depending on the SZA) If the measurements at fixed delta SZA is active, this stop the execution (putting the DAS.Flag.ExeDSZA = 0) if the actual SZA is between the SZAMax and SZAMin. More... | |
void | FileDat (void) |
void | FileLog (char datebuf[9], char timebuf[9]) |
void | FormatData (void) |
trasform mm/gg/aa in gg/mm/aa More... | |
void | FormatDataFile (void) |
int | FTP_Back_UP (char *dirhome, char *dirdata) |
void | MIGEAntiSunTrack (void) |
void | MIGESunTrack (void) |
void | SetWindowsReset () |
void | Task_AutoEx (TIMEOUT_ID id, void *data) |
Automatic Execution Task. . More... | |
void | Task_HomeGrat (TIMEOUT_ID id, void *data) |
Home grating Task. 5) Check for reached end-run of the stepper motor for the grating . More... | |
void | Task_LOG (TIMEOUT_ID id, void *data) |
LOG Task. Write on the LOG file during DAS execution. More... | |
void | Task_Timer (TIMEOUT_ID id, void *data) |
Timer Task. Very useful procedure that: 1) Provide to refresh the clock display 2) Check if daylight saving time is in effect 3) Calculate the Solar Zenith Angle 4) Check the FLAG.sza in order to back-up the daily data via FTP and if all the condition are satisfied the back-up is performed 5) Check for reached end-run of the stepper motor for the grating . More... | |
void | WinRes (void) |
void | WriteInit (const char *sname, char *dateffn, char *timebuff) |
Init the daily LOG file . More... | |
void | WriteStatusD (int w) |
NOT Used . More... | |
void | WriteTitolo (void) |
Variables | |
bil | BIL |
das | DAS |
DAS structure. More... | |
char | ddmmyy [8] |
char | ddmmyyf [6] |
dftp | DFTP |
dlog | DLOG |
DXL_par | DXL |
int | ExeREM |
flag | FLAG |
flags structure More... | |
int | Incr_Read_Temp |
omuthr | OMUTHR |
stepm | STEPM |
Stepper Motors. More... | |
dsza | SZADelta |
void D_AutoExecution | ( | void | ) |
*.PRG Automatic Execution in Automatic Mode
Definition at line 560 of file RTC_Time.c.
References AAMEASURE, AAPOSIT, controlpanel::Albl_Azim, controlpanel::Albl_Elev, controlpanel::Albl_Script, ALMUCANTAR, AUTORNG, AVGCCD, AVGCCDHOR, AZIMUTH, BEGIN, CALIBRA, CHKEXLAMP, ChkMaster(), gui::ContrPanel, D_FixSZA(), D_WaitSZA(), DARKC, flag::DeltaSZA, DFMEASURE, das::DGeo, DIRECTSUN, E_AAMeasure(), E_AAPos(), E_Almucantar(), E_AutoRange(), E_Average(), E_AvgCCDHor(), E_Azimuth(), E_Calibra(), E_ChkExLamp(), E_Dark(), E_DeltaSZA(), E_DFMeasure(), E_DirectSun(), E_Expo(), E_ExtLampOFF(), E_ExtLampON(), E_ExtShutClose(), E_ExtShutOpen(), E_Filter(), E_GetCCD(), E_Hg_Off(), E_Hg_On(), E_HGratCal(), E_HgScan(), E_Home_SM1(), E_Home_SM2(), E_Home_SM3(), E_Home_SM4(), E_Home_SM5(), E_Home_SM6(), E_IRefSun(), E_Label(), E_Lambda(), E_Meashor(), E_Meashor2(), E_Measure(), E_Mirror(), E_NDFilter(), E_Plot(), E_Qj_Off(), E_Qj_On(), E_QjScan(), E_Radio(), E_REM(), E_Save(), E_SetCCDOffSet(), E_SetCCDPow(), E_SetCCDTemp(), E_SetCCDVBin(), E_WAIT(), E_Zenith(), ELAMPOFF, ELAMPON, master::eora, ESHUTCL, ESHUTOP, flag::exec, flag::ExeDSZA, flag::exemode, ExMast, EXPO, Fetch(), FILTER, das::Flag, GETCCD, GetDateTime(), das::Gui, H_AZI, H_FILTER, H_GRAT, H_GRAT_CAL, H_MIRROR, H_NDFW, H_ZEN, HG_OFF, HG_ON, HGSCAN, IREFSUN, LABEL, dsza::LastMSZA, d_geo::latitude, LoadExec(), d_geo::longitude, MainCommand, Master, MEASHOR, MEASHOR2, MEASURE, MIRROR, MMessageDialog(), MObjectSetText(), NDFILTER, on, PLOT, PrgNumExe, PrgNumInM, QJ_OFF, QJ_ON, QJSCAN, RADIO, omuthr::ReachTemp, REM, S_azim, S_zenetr, SAVE, SETCCDOFFS, SETCCDPOW, SETCCDTEMP, SETCCDVBIN, master::sora, Status(), flag::sza, SZACalc(), SZAMASTERM, SZAMODE, TEMPORIZED, TESTSZAMODE, time::ti_hour, time::ti_min, d_geo::timezone, WAIT, WAVELEN, XEND, and ZENITH.
Referenced by Task_AutoEx().
void D_FixSZA | ( | void | ) |
Definition at line 467 of file RTC_Time.c.
References dsza::Dailymaxsza, dsza::Dailyminsza, dsza::DeltaSZA, flag::ExeDSZA, das::Flag, dsza::LastMSZA, dsza::NextSZA, and S_zenetr.
Referenced by D_AutoExecution(), DB_Pause(), and Task_CCD_Temp().
void D_WaitSZA | ( | void | ) |
Definition at line 532 of file RTC_Time.c.
References flag::exec, flag::ExeDSZA, das::Flag, dsza::NextSZA, S_zenetr, and Status().
Referenced by D_AutoExecution().
void E_DeltaSZA | ( | void | ) |
Re-Start or Stop the execution of the PRG file (depending on the SZA)
If the measurements at fixed delta SZA is active, this stop the execution (putting the DAS.Flag.ExeDSZA = 0) if the actual SZA is between the SZAMax and SZAMin.
Definition at line 436 of file RTC_Time.c.
Referenced by D_AutoExecution(), and FTP_Back_UP().
void FileDat | ( | void | ) |
Definition at line 120 of file RTC_Time.c.
void FileLog | ( | char | datebuf[9], |
char | timebuf[9] | ||
) |
Definition at line 111 of file RTC_Time.c.
References FormatDataFile().
void FormatData | ( | void | ) |
void FormatDataFile | ( | void | ) |
Definition at line 77 of file RTC_Time.c.
References ddmmyyf.
Referenced by FileLog().
int FTP_Back_UP | ( | char * | dirhome, |
char * | dirdata | ||
) |
Definition at line 336 of file RTC_Time.c.
References _MAX_PATH, dsza::Dailyminsza, delay(), flag::DeltaSZA, dsza::DeltaSZA, das::DOption, E_DeltaSZA(), flag::ExeDSZA, ExeREM, das::Flag, dftp::ftppwd, dftp::ftpserver, flag::ftpstatus, dftp::ftpuser, spectrumheader::location, dsza::MaxSZA, MMessageDialog(), PrgCnt, S_zenetr, optionini::savingmode, bil::SPH, and Status().
Referenced by Task_Timer().
void MIGEAntiSunTrack | ( | void | ) |
Definition at line 206 of file RTC_Time.c.
References elev, S_azim, S_zenetr, and SD_PosAADev().
Referenced by Task_Timer().
void MIGESunTrack | ( | void | ) |
Definition at line 222 of file RTC_Time.c.
References elev, S_azim, S_zenetr, and SD_PosAADev().
Referenced by Task_Timer().
void SetWindowsReset | ( | ) |
Definition at line 1125 of file RTC_Time.c.
References CELSIUS, DAS_StartDOY, DAS_StartHour, DB_Pause(), DC_SetTemp(), das::DOption, das::Flag, GetDateTime(), RDAY, optionini::resetFreq, optionini::resetType, RHOUR, and flag::WindowsReboot.
Referenced by Task_Timer().
void Task_AutoEx | ( | TIMEOUT_ID | id, |
void * | data | ||
) |
Automatic Execution Task.
.
Definition at line 963 of file RTC_Time.c.
References AUTOEX_TASK_TIME, D_AutoExecution(), and MAddTimeout().
Referenced by LaunchBackTask().
void Task_HomeGrat | ( | TIMEOUT_ID | id, |
void * | data | ||
) |
Home grating Task.
5) Check for reached end-run of the stepper motor for the grating
.
Definition at line 980 of file RTC_Time.c.
References controlpanel::Albl_LS, AMS1, AMS_AzzeraCoord(), AMS_chkbitsts(), AMS_MotorOn_Off(), AMS_ReadStep(), flag::AMSPres, DXL_par::bufrx, gui::ContrPanel, flag::exemode, das::Flag, GRAT_TASK_TIME, ids::GRATHOME, das::Gui, HomeGratingFast(), IDS, MANUAL, MObjectSetText(), MRefreshTimeout(), stepm::postime, PRGFILE, stepm::SM_B, st, Status(), das::StepM, SZAMASTERM, SZAMODE, TEMPORIZED, and TESTAMS.
Referenced by E_Home_SM1(), HomeTrack(), and LaunchBackTask().
void Task_LOG | ( | TIMEOUT_ID | id, |
void * | data | ||
) |
LOG Task.
Write on the LOG file during DAS execution.
Definition at line 246 of file RTC_Time.c.
References controlpanel::Albl_CS, controlpanel::Albl_LS, flag::AMS_H, marconi::CCDTemp, gui::ContrPanel, bil::DFILEM, das::DGeo, dlog::flog, dlog::fsmlog, GetDateTime(), das::Gui, LOG_TASK_TIME, d_fileman::LOGDIR, MAddTimeout(), das::Marconi, MObjectGetText(), dlog::ndate, dlog::ntime, dlog::odate, d_geo::s_name, ShutterOpening(), SZA_FindMin(), and omuthr::Temperature.
Referenced by LaunchBackTask().
void Task_Timer | ( | TIMEOUT_ID | id, |
void * | data | ||
) |
Timer Task.
Very useful procedure that:
1) Provide to refresh the clock display
2) Check if daylight saving time is in effect
3) Calculate the Solar Zenith Angle
4) Check the FLAG.sza in order to back-up the daily data via FTP and if all the condition are satisfied the back-up is performed
5) Check for reached end-run of the stepper motor for the grating
.
Definition at line 1184 of file RTC_Time.c.
References optionini::aaopmode, controlpanel::Albl_Azim, controlpanel::Albl_CS, controlpanel::Albl_Elev, controlpanel::Albl_sunr, controlpanel::Albl_suns, flag::AMS_H, gui::ContrPanel, d_fileman::DAILYDATADIRECTORY, bil::DFILEM, das::DGeo, das::DOption, das::Flag, FTP_Back_UP(), optionini::ftpbackup, flag::ftpstatus, GetDateTime(), das::Gui, d_fileman::HOMEDIRECTORY, d_geo::latitude, controlpanel::lbl_Time, d_geo::longitude, MAddTimeout(), MIGEAntiSunTrack(), MIGESunTrack(), MObjectGetText(), MObjectSetText(), optionini::resetEnabled, S_azim, d_geo::s_name, S_sunrise, S_sunset, S_zenetr, SetWindowsReset(), flag::sza, SZACalc(), SZAMax, TIMER_TASK_TIME, d_geo::timezone, flag::WindowsReboot, and WinRes().
Referenced by DB_ToolsKeyB_CB(), and LaunchBackTask().
void WinRes | ( | void | ) |
Definition at line 1067 of file RTC_Time.c.
References DXL_par::com, D_WriteInitLog(), DB_WriteMode(), DC_Close(), paramini::EqType, das::Flag, GASCODNG1, GetDateTime(), HGFlg, HgLamp(), LookforWl_X(), MGUITerm(), das::Nova, NOVA_Out(), das::Paramini, QJFlg, QjLamp(), SD_Grating(), ShutterOpening(), SioDone(), nova::type, WDT_func(), and flag::WindowsReboot.
Referenced by InitTempAD(), and Task_Timer().
void WriteInit | ( | const char * | sname, |
char * | dateffn, | ||
char * | timebuff | ||
) |
Init the daily LOG file
.
*sname | = Name of the station (3 char) |
*dateffn | = date |
*timebuff | = time |
Definition at line 158 of file RTC_Time.c.
References bil::DFILEM, dlog::flog, dlog::fsmlog, and d_fileman::LOGDIR.
Referenced by MGUIMain().
void WriteStatusD | ( | int | w | ) |
NOT Used
.
Definition at line 1331 of file RTC_Time.c.
void WriteTitolo | ( | void | ) |
Definition at line 191 of file RTC_Time.c.
References dlog::flog.
bil BIL |
Definition at line 30 of file RTC_Time.c.
das DAS |
DAS structure.
Definition at line 34 of file RTC_Time.c.
char ddmmyy[8] |
Definition at line 38 of file RTC_Time.c.
Referenced by FormatData().
char ddmmyyf[6] |
Definition at line 39 of file RTC_Time.c.
Referenced by FormatDataFile().
dftp DFTP |
Definition at line 31 of file RTC_Time.c.
dlog DLOG |
Definition at line 29 of file RTC_Time.c.
DXL_par DXL |
Definition at line 24 of file RTC_Time.c.
int ExeREM |
Definition at line 143 of file DAS_Spat.c.
Referenced by FTP_Back_UP().
flag FLAG |
flags structure
Definition at line 25 of file RTC_Time.c.
int Incr_Read_Temp |
Definition at line 101 of file DAS_Spat.c.
Referenced by D_readtemp(), and Task_LIS_Temp().
omuthr OMUTHR |
Definition at line 36 of file RTC_Time.c.
stepm STEPM |
Stepper Motors.
Definition at line 28 of file RTC_Time.c.
dsza SZADelta |
Definition at line 32 of file RTC_Time.c.