;// ;// DTS Delay procedure for PV-WAVE ;// ;// Copylight 2002.11 NIFS-LABCOM ;// ;// ver.1.0 2002/11 PRO dtsDelay,IPAddress,shotNumber,subShotNumber,channelNumber,dataArray if ( N_PARAMS(0) ne 5 ) then begin print,'Usage:' print,'dtsDelay,IPAddress,shotNumber,subShotNumber,channelNumber,dataArray' print, 'Input Parameters:' print, ' > IPAddress - VME''s IP address (''133.75.175.100'',.., etc.)' print, ' > shotNumber - Shot number' print, ' > subShotNumber - Sub shot number' print, ' > channelNumber - Channel number' print, 'Output Parameters:' print, ' < dataArray - Data array' dataArray = 0L retall endif if ( channelNumber ge 1 ) and $ ( channelNumber le 8 ) then begin endif else begin print,'Error! Channel number is from 1 to 8.' dataArray = 0L retall endelse strShotNumber = string(shotNumber) strSubShotNumber = string(subShotNumber) strChannelNumber = string(channelNumber) henv = ODBC_INIT() hcon = ODBC_CONNECT( henv, "postgreSQL", "guest/guest") sql_command = "select delaytimebases8,pulsewidthbasesec,repetitiontimebasesec," + $ "delaytime,pulsewidth,repetitioncount,repetitiontime,startchannel from dts" + $ " where shotno=" + strShotNumber + $ " and subshot=" + strSubShotNumber + $ " and hostname='" + IPAddress + "'" + $ " and channelnumber=" + strChannelNumber result = ODBC_SQL( hcon, sql_command) if ( N_TAGS(result) eq 0 ) then begin print, 'Error! There is no data.' dataArray = result retall endif delayarr = { delay, delaytimebases8:double(0), pulsewidthbasesec:double(0), repetitiontimebasesec:double(0), $ delaytime:long(0), pulsewidth:long(0), repetitioncount:long(0), repetitiontime:long(0), startchannel:long(0) } delayarr.delaytimebases8 = result.delaytimebases8 delayarr.pulsewidthbasesec = result.pulsewidthbasesec delayarr.repetitiontimebasesec = result.repetitiontimebasesec delayarr.delaytime = result.delaytime delayarr.pulsewidth = result.pulsewidth delayarr.repetitioncount = result.repetitioncount delayarr.repetitiontime = result.repetitiontime delayarr.startchannel = result.startchannel dataArray = delayarr ODBC_DISCONNECT, hcon ODBC_EXIT, henv END