Jscript Tutorial Wolfgang Unger and Tobias Sommer



Yüklə 0,62 Mb.
Pdf görüntüsü
səhifə20/21
tarix07.11.2018
ölçüsü0,62 Mb.
#78679
1   ...   13   14   15   16   17   18   19   20   21

var ttotal = 100000;

// total integration time

var sOS = 10000;

// number of offset scans

var tOS = 3;

// offset integration time in ms

var tDC = 20000;

// dark current integration time

var sat = 3000;

// saturation level(max 4095)

var tNap = 600000;

// break between two offset mesurements(ms)

var waitscan = 150;

// break after scan

var waitmotor = 500;

var BasicPath = "D:\\MAXDOAS_Amundsen08\\Amundsen\\080312\\";

var MFCPath = BasicPath + "specMFC";

var OSDCPath = BasicPath + "specOSDC";

var specPath;

var OS0 = BasicPath + "TestAnDS\\offset2";

// create an Ocean Optics spectrograph object

var specOOI = new DoasCore.Device.OceanOptics();

specOOI.USBSerial = "USB" + serialUSB2000;

var Tcold, Tdet;

// current temp, set temp

var currentelevation;

var ADCVal = new Array();

var SolarValues;

var SZALongitude = -Longitude;

// create files to log data

var outfile=dispFileSystem.OpenTextFile(BasicPath + "DOASlogfile.txt",8, true);

var DoasLog=dispFileSystem.GetFile(BasicPath + "DOASlogfile.txt");

outfile.Close();

var outfile=dispFileSystem.OpenTextFile(BasicPath + "ADClogfile.txt",8, true);

var AdcLog=dispFileSystem.GetFile(BasicPath + "ADClogfile.txt");

outfile.Close();

var f, i, j, k, l, m, n, o, time, CurrentDate, CalAnswer, TempAnswer, fullname;

var newspec, measspec, offset0, offset1, offset2, dark1, dark2;

// ************** main() function ************************************************

function main()

{

dispIO.Silent = true;



WriteToLog(AdcLog,"UBatt [V]; USteuer [mV];

TCold [C]; TWarm [C]; TSet [C]; IPelt [A]; ");

// initialise the Hoffmann controllers

InitHMTUSB();

// check if script was aborted by pressing the stop button in the Script window

StopCheck();

// MakeSpec() creates empty spectra in the Specbar

offset0 = MakeSpec("OOoffset0");

offset1 = MakeSpec("OOoffset1");

offset2 = MakeSpec("OOoffset2");

dark1

= MakeSpec("OOdark1");



dark2

= MakeSpec("OOdark2");

dispTools.CurrentSpectrum = offset0;

for (j=0;j

76



{

straylight[j] = MakeSpec(AngleSeries[j].toString());

}

while (!window.CheckStop())



{

// calculate the solar zenith angle

SolarValues = aurinko(Latitude,SZALongitude);

StopCheck();

// only measure during day time

if (SolarValues.SZA < SZAnight)

{

WriteToLog(DoasLog, "Started MAX routine");



MotorMoveHome();

StopCheck();

for (j=0;j

{

StopCheck();



for (k=0;k

{

StopCheck();



{

StopCheck();

SolarValues = aurinko(Latitude,SZALongitude);

WriteToLog(DoasLog, "SZA = "

+parseInt(SolarValues.SZA*1000)/1000+"

"



+"SAA = "+parseInt(SolarValues.SAZ*1000)/1000+"

");



// calculate integration time and measure spectrum

TakeSpectrum(AngleSeries[j])

}

}

}



}

// during night time record offset and dark current

else if (SolarValues.SZA > SZAnight)

{

MotorMoveToPos(MotorOSDCPosition);



WriteToLog(DoasLog, "Started Offset and DC routine");

TakeOffsetDarkCurrent();

StopCheck();

}

}



WriteToLog(DoasLog, "Stopped");

}

// ********* End of main() function *********************************************



// ********* Declare the individual functions called in the main() routine ******

// Initialize device

function InitHMTUSB()

{

window.Status = "Initializing USB device " + serialHMT + "/"



+serialUSBHMT + " ...";

77



dispHMTUSB.SetSerial(serialHMT + "/" + serialUSBHMT);

if (!dispHMTUSB.IsDevicePresent())

{

WriteToLog(DoasLog, "Device not found - sleep 1 min.");



window.Sleep(60000);

StopCheck();

}

else window.Status = "Device found!";



dispHMTUSB.UndervoltageDetection == false;

if(!(dispHMTUSB.UndervoltageDetection))

window.Status = "Low battery warning is turned off!";

else


{

WriteToLog(DoasLog, "Low battery warning could not be turned off");

return;

}

dispHMTUSB.SetMotorMode(1, 2);



// half step mode

dispHMTUSB.SetMotorFreq(1, MotorFrequency);

// frequency

MotorMoveHome();

// check Temp settings

dispHMTUSB.Temperature = Tini;

WriteToLog(DoasLog, "Temperature set to " + Tini + " deg C!");

return;


}

// similar function as InitHMTUSB()

function InitHMT()

{

window.Status = "Initializing USB device " + serialHMT + "/"



+ serialUSBHMT + " ...";

dispHMTUSB.SetSerial(serialHMT + "/" + serialUSBHMT);

if (!dispHMTUSB.IsDevicePresent())

{

WriteToLog(DoasLog, "Device not found - sleep 1 min.");



window.Sleep(60000);

StopCheck();

}

else window.Status = "Device found!";



dispHMTUSB.UndervoltageDetection == false;

if(!(dispHMTUSB.UndervoltageDetection))

window.Status = "Low battery warning is turned off!";

else


{

WriteToLog(DoasLog, "Low battery warning could not be turned off");

return;

}

dispHMTUSB.SetMotorMode(1, 2);



//half step mode

dispHMTUSB.SetMotorFreq(1, MotorFrequency);

//frequency

MotorMoveHome();

}

// calculate solar zenith angle



// computer time must be set to GMT!!!

78



Yüklə 0,62 Mb.

Dostları ilə paylaş:
1   ...   13   14   15   16   17   18   19   20   21




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə