[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Drudg patch to prevent losing Tsys
Dear Alet et al.,
I talked with Bob Campbell concerning scheduling and we caught
the problem resulted in loss of Tsys. The problem was in drudg.
Vex file defines scan start time, scan start time and good time
offset with respect to the scan start time. I examined the code
and found that drudg transform vex schedule to sked format
on the fly. It had hard-coded 10 sec calibration time and inserted
firing Tsys measurement 10 sec before the nominal start time.
It started disk recording at the nominal scan start time.
I made a patch for drudg. I added support of option
tos (means Tsys On Source) with optional parameter preob duration.
The option takes effect when with drudg is called in the
non-interactive mode.
Here is an example: drudg /tmp/vf561a.vex HO 3 tos 10
Please find the patch attached. To apply patch one needs execute
cd $DIST/skedall
patch -Np0 -i /tmp/drudg_tos.patch
I took drudg from ftp://gemini.gsfc.nasa.gov/pub/sked/skedall_2017Aug01.tgz
I heard drudg comes with FS as well. I guess my patch will work
with any version of drudg, but I did have a chance to check it.
NB: sked comes without ./configure, so you need to modify
set_misc and drudg/makefile manually. If you need help in compiling
sked, please let me know.
Drudg in Tsys on source mode fires the noise diod
at the start_time + good_time_offset - preob_duration.
Disk recording starts at start_time + good_time_offset
Option preob duration may be negative. Then drudge starts preob
procedure on start_time + good_time_offset and start recording
on start_time + good_time_offset + abs(preob_duration)
Here is an example.
1) VEX file
========
VEX_rev = 1.5;
* SCHED vers: Release 11.4. March 14, 2015
...
scan No0016;
* intent = "OBSERVE_TARGET"
start=2017y167d23h03m40s; mode=v561a_astrom_v2; source=2059-786;
station=Pa: 106 sec: 180 sec: 346.153 GB: : : 1;
station=At: 39 sec: 180 sec: 86.400 GB: 0 : : 1;
station=Mp: 42 sec: 180 sec: 86.400 GB: 0 : : 1;
station=Cd: 63 sec: 180 sec: 216.346 GB: : : 1;
station=Ti: 25 sec: 180 sec: 346.153 GB: : : 1;
station=Ho: 30 sec: 180 sec: 345.600 GB: : : 1;
station=Ke: 0 sec: 180 sec: 346.153 GB: : : 1;
station=Yg: 0 sec: 180 sec: 346.153 GB: : : 1;
station=Ww: 0 sec: 180 sec: 346.153 GB: : : 1;
endscan;
scan No0017;
* intent = "OBSERVE_TARGET"
* start=2017y167d23h06m46s <= original start, modified for tape start.
start=2017y167d23h06m40s; mode=v561a_astrom_v2; source=2142-758;
station=Pa: 29 sec: 110 sec: 369.230 GB: : : 1;
station=At: 12 sec: 110 sec: 92.160 GB: 0 : : 1;
station=Mp: 12 sec: 110 sec: 92.160 GB: 0 : : 1;
station=Cd: 23 sec: 110 sec: 230.769 GB: : : 1;
station=Ti: 7 sec: 110 sec: 369.230 GB: : : 1;
station=Hh: 6 sec: 110 sec: 0.000 GB: : : 1;
station=Ho: 23 sec: 110 sec: 368.640 GB: : : 1;
station=Yg: 6 sec: 110 sec: 369.230 GB: : : 1;
station=Ww: 6 sec: 110 sec: 369.230 GB: : : 1;
endscan;
2) DRUDG without tos option (original): drudg /tmp/v561a.vex HO 3
====================================
" v561a 2017 HOB_MK5 F Ho
" F HOB_MK5 XYEW 8.1937 40.0 2 -999.9 999.9 40.0 2 -999.9 999.9 0.0 Ho
" Ho HOB_MK5 -3950237.35900 2522347.68040 -4311561.87900
" HOB_MK5 Mark5A
" drudg version 2016Dec05 compiled under FS 0.00.00
" Rack=Mark4 Recorder 1=Mark5A Recorder 2=none
scan_name=no0001,v561a,ho,180,180
...
scan_name=no0016,v561a,ho,150,180
source=2059-786,205921.04,-783731.1,1950.0
checkmk5
setup01
!2017.167.23:03:30
preob
!2017.167.23:03:40
disk_pos
disk_record=on
disk_record
!2017.167.23:04:10
disk_pos
data_valid=on
midob
!2017.167.23:06:40
data_valid=off
disk_record=off
disk_pos
scan_name=no0017,v561a,ho,87,110
source=2142-758,214212.85,-755005.9,1950.0
checkmk5
!2017.167.23:06:40
disk_pos
disk_record=on
disk_record
!2017.167.23:07:03
disk_pos
data_valid=on
midob
!2017.167.23:08:30
data_valid=off
disk_record=off
disk_pos
scan_name=no0018,v561a,ho,84,120
3) DRUDG with tos option: drudg /tmp/v561a.vex HO 3 tos
======================
" v561a 2017 HOB_MK5 F Ho
" F HOB_MK5 XYEW 8.1937 40.0 2 -999.9 999.9 40.0 2 -999.9 999.9 0.0 Ho
" Ho HOB_MK5 -3950237.35900 2522347.68040 -4311561.87900
" HOB_MK5 Mark5A
" drudg version 2016Dec05 compiled under FS 0.00.00
" Rack=Mark4 Recorder 1=Mark5A Recorder 2=none
" Tsys on-source option is ON PREOB_DUR= 10 Patch level 2017.09.15
scan_name=no0001,v561a,ho,180,180
source=0537-441,053721.05,-440644.6,1950.0
...
scan_name=no0016,v561a,ho,150,180
source=2059-786,205921.04,-783731.1,1950.0
checkmk5
setup01
!2017.167.23:03:30
preob
!2017.167.23:03:40
disk_pos
disk_record=on
disk_record
!2017.167.23:04:10
disk_pos
data_valid=on
midob
!2017.167.23:06:40
data_valid=off
disk_record=off
disk_pos
scan_name=no0017,v561a,ho,87,110
source=2142-758,214212.85,-755005.9,1950.0
checkmk5
!2017.167.23:06:40
disk_pos
disk_record=on
disk_record
!2017.167.23:07:03
disk_pos
data_valid=on
midob
!2017.167.23:08:30
data_valid=off
disk_record=off
disk_pos
scan_name=no0018,v561a,ho,84,120
4) DRUDG with tos option and negative preob: drudg /tmp/v561a.vex HO 3 tos -10
=========================================
" v561a 2017 HOB_MK5 F Ho
" F HOB_MK5 XYEW 8.1937 40.0 2 -999.9 999.9 40.0 2 -999.9 999.9 0.0 Ho
" Ho HOB_MK5 -3950237.35900 2522347.68040 -4311561.87900
" HOB_MK5 Mark5A
" drudg version 2016Dec05 compiled under FS 0.00.00
" Rack=Mark4 Recorder 1=Mark5A Recorder 2=none
" Tsys on-source option is ON PREOB_DUR= -10 Patch level 2017.09.15
scan_name=no0001,v561a,ho,180,170
source=0537-441,053721.05,-440644.6,1950.0
...
scan_name=no0016,v561a,ho,150,140
source=2059-786,205921.04,-783731.1,1950.0
checkmk5
setup01
!2017.167.23:04:10
preob
!2017.167.23:04:20
disk_pos
disk_record=on
disk_record
data_valid=on
midob
!2017.167.23:06:40
data_valid=off
disk_record=off
disk_pos
scan_name=no0017,v561a,ho,87,77
source=2142-758,214212.85,-755005.9,1950.0
checkmk5
!2017.167.23:07:03
preob
!2017.167.23:07:13
disk_pos
disk_record=on
disk_record
data_valid=on
midob
!2017.167.23:08:30
data_valid=off
disk_record=off
disk_pos
scan_name=no0018,v561a,ho,84,74
.............................
Bob also confirmed that sched message about minimum gap
of 10 sec is a rudiment of tape recording. We should not
worry about it, since we use preob procedure that always
inserts disk_record=off at the end of the scan from one
hand, and scheduling software has gaps between scan_end
and new scan_start > 10 sec from the other hand.
I showed the snp files to Bob and he is OK with such a change.
Stuart, I wonder, can we organize a 20 minutes test at Ww/Wa
to check new drudg? If everything will go well, we can use
updated drudg for the next SOAP experiment.
Sincerely,
Leonid
2017.09.15_13:25:50
==================== Attachment: drudg_tos.patch ===============
Curt and paste to /tmp/drudg_tos.patch starting with line --- skdrincl....
and then run cd $DIST/skedall; patch -Np0 -i /tmp/drudg_tos.patch
--- skdrincl/statn.ftni~ 2017-02-14 16:46:16.000000000 +0100
+++ skdrincl/statn.ftni 2017-09-14 17:47:34.749607483 +0200
@@ -55,6 +55,7 @@
integer iData_mbps(max_stn) !maximum rate data is acquired.
integer iSink_mbps(max_stn) !maximum rate data is absorbed. May be more than data_mbps becuase of buffering.
real BB_BW(max_stn) !Effective Broadband BW per band in Hz (assuming 1-bit sampling)
+ INTEGER*4 PREOB_DUR ! preob procedure duration inseconds
! Integer/logical
@@ -87,7 +88,7 @@
. ibitden_save(max_stn),
. itearl(max_stn),itlate(max_stn),itgap(max_stn),
. ns2tapes(max_stn),
- . klineseg(max_stn),idata_mbps,isink_mbps
+ . klineseg(max_stn),idata_mbps,isink_mbps,PREOB_DUR
! Start of character data.
character*8 cstnna(max_stn) !Position name.
--- skdrut/newscan.f~ 2007-08-08 12:19:01.000000000 +0200
+++ skdrut/newscan.f 2017-09-15 08:47:46.859973031 +0200
@@ -21,6 +21,7 @@
C 000106 nrv Check the year before converting to 2-digit internal year.
C 001030 nrv Need one more space before the flag field.
! 2006Jul17 JMG. Got rid of some holerith. Cleaned up.
+! 2017.09.14 pet: Take calibration duration from PREOB_DUR in statn.ftni
C Input:
integer istn ! first station in this scan
@@ -53,8 +54,8 @@
cbuf=csorna(isor)
nch=trimlen(cbuf)+1
-C Cal time. Define as 10 for now
- ical = 10
+C Cal time. It has default 10 s that can be overridern with the 3rd command line option
+ ical = iabs(preob_dur) ! from statn.ftni
nch = nch + 1 + IB2AS(ICAL,IBUF,NCH+1,3)
C Freq code
NCH = ICHMV(IBUF,NCH+1,LCODE(ICOD),1,2)
--- drudg/proc_vc_cmd.f~ 2016-01-18 20:15:43.000000000 +0100
+++ drudg/proc_vc_cmd.f 2017-09-15 09:46:31.770460168 +0200
@@ -24,6 +24,7 @@
! 2008Feb26 JMG. Write out comment if unused BBCs are present.
! 2010May11 JMG. Changed DRF and DRLO to double precision. In computing rfvc was losing precision.
! 2016Jan18 JMG. Only write out name if cname_vc <> " "
+! 2017.09.15 PET A minor fix: replace .NE. with .NEQV. to prevent gfortran 7.1 throwing an error message
! local variables.
character*80 cbuf2 !temporary text buffer.
@@ -45,7 +46,7 @@
C If both recorders are in use then do the check to see if
C we should do one or both procs
- if((kuse(1).ne.kuse(2).and.kuse(irec)).or.
+ if((kuse(1).neqv.kuse(2).and.kuse(irec)).or.
. ((kuse(1).and.kuse(2)).and.(irec.eq.1.or.
. (irec.eq.2.and.kk4vcab)))) then ! do this
--- drudg/fdrudg.f~ 2016-07-28 18:46:18.000000000 +0200
+++ drudg/fdrudg.f 2017-09-15 08:51:02.133338552 +0200
@@ -218,6 +218,8 @@
! 2015Aug31 JMG. Don't quit on "q"
! 2016May07 WEH. Increased size of crack_type_def, crack_tmp_cap from Char*12-->char*20
! 2016Jul28 JMG. Now also set cfirstrec_def in 'equipment override'
+! 2017.09.15 PET Set up preob procedure duration in PREOB_DUR variatble from statn.ftni . The third option overrides default 10 seconds
+
! Get the version
include 'fdrudg_date.ftni'
call get_version(iverMajor_FS,iverMinor_FS,iverPatch_FS)
@@ -618,7 +620,23 @@
699 continue
if(kvex) then !get the station's observations now
C getting all the scans (needed to generate scan names)
-! This gets in all the scans.
+C This gets in all the scans.
+C
+C Determine duration of the PREOB procedure duration.
+C Default is 10 seconds
+
+ PREOB_DUR = 10
+ READ ( UNIT=COMMAND, FMT='(I6)' ) IFUNC
+ IF ( IFUNC == 3 ) THEN
+ CALL LOWERCASE ( CR2 )
+ IF ( CR1 == 'tos' ) THEN
+C In the "Tsys on source" mode the scan duration in seconds
+C may be specified in the 3rd option
+ IF ( CR2 .NE. '' ) THEN
+ READ ( UNIT=CR2, FMT='(I6)' ) PREOB_DUR
+ END IF
+ END IF
+ END IF
call VOBINP(ivexnum,LUscn,iret,IERR)
if (ierr.ne.0) then
write(luscn,'("FDRUDG02 - Error from vobinp=",i5,",
@@ -894,7 +912,8 @@
CALL POINT(cr1,cr2,cr3,cr4)
c I = nstnx
ELSE IF (IFUNC.EQ.3) THEN
- call snap(cr1)
+ call lowercase(cr2)
+ call snap(cr1,cr2)
ELSE IF (IFUNC.EQ.4) THEN
CALL CLIST(kskd)
ELSE IF (IFUNC.EQ.12) THEN
--- drudg/snap.f~ 2016-08-23 17:29:38.000000000 +0200
+++ drudg/snap.f 2017-09-15 13:07:46.721221948 +0200
@@ -1,4 +1,4 @@
- SUBROUTINE SNAP(cr2)
+ SUBROUTINE SNAP(cr2,cr3)
C
C SNAP reads a schedule file and writes a file with SNAP commands
C
@@ -12,7 +12,7 @@
include '../skdrincl/data_xfer.ftni' !This includes info about
C INPUT
- character*(*) cr2 ! Responses to three prompts for
+ character*(*) cr2, cr3 ! Responses to three prompts for
C 1) epoch 1950 or 2000 <<<<<<< moved to control file
C 2) add checks Y or N <<<< not for S2
C 3) force checks Y or N <<<<<<< removed
@@ -22,7 +22,7 @@
real speed ! functions
integer trimlen ! functions
integer julda
-
+ CHARACTER STR*256
C LOCAL:
C IFTOLD - foot count at end of previous observation
C TSPINS - time, in seconds, to spin tape
@@ -225,7 +225,7 @@
character*12 lsession !filename
double precision speed_recorder ! speed of recorder in this mode.
-
+ LOGICAL fl_tos ! Tsys on source
! counter
integer i,j !counters
logical kdebug
@@ -460,8 +460,14 @@
! 2015Mar31 JMG. More changes to fix issues with phase_reference.
! 2015Apr04 JMG. Removed special handling if same source in consecutive scans.
! 2015Jun05 JMG. Replaced squeezewrite by drudg_write.
+! 2017.09.15 PET Added support of "Tsys on source" option that changes preob and disk_record=on time in order to start preob when the antenna is on source
- kdebug=.false.
+ if ( cr2 == 'tos' ) then
+ fl_tos = .true.
+ else
+ fl_tos = .false.
+ endif
+ kdebug=.false.
kfirst_obs=.true.
klast_obs=.false.
@@ -596,6 +602,11 @@
enddo
call snapintr(1,itime_scan_beg(1))
+ if ( fl_tos ) then
+ write ( lu_outfile, '(a,i4,a)' ) '" Tsys on-source '//
+ > 'option is ON PREOB_DUR= ', preob_dur,
+ > ' Patch level 2017.09.15'
+ end if
DO WHILE (ILEN.GT.0.AND.KERR.EQ.0.and.ierr.eq.0 .AND.
> cbuf(1:1) .ne. "$")
@@ -606,6 +617,10 @@
IOBS = IOBS + 1
if (iobs.le.nobs) then
cbuf_next=cskobs(iskrec(iobs))
+ if(kdebug) then
+ call memcpy ( str, ibuf_next )
+ write ( 6, * ) 'IOBS= ', iobs, ' ibuf_next= ', trim(str)
+ endif
ilen_next=trimlen(cbuf_next)
CALL UNPSK(IBUF_next,ILEN_next,LSNAME_next,ICAL_next,
> LFREQ_next,IPAS_next,LDIR_next,IFT_next,LPRE_next,
@@ -753,7 +768,19 @@
! itime_tape_stop=itime_scan_end+itlate
call TimeAdd(itime_scan_end,itlate(istn),itime_tape_stop)
call TimeAdd(itime_scan_beg,ioff(istnsk),itime_data_valid)
-
+ if ( fl_tos ) then
+c Adjust time tags. PREOB procedure starts preob_dur seconds prior of itime_data_valid
+c NB: preob_dur may be negative, while ical is non-negative
+ itime_cal = itime_data_valid
+ if ( preob_dur .ge. 0 ) then
+ call TimeSub(itime_data_valid,preob_dur,itime_cal)
+ else
+ call TimeSub(itime_data_valid,preob_dur,itime_data_valid)
+ end if
+ itime_early = itime_data_valid
+ itime_scan_beg = itime_data_valid
+ itime_tape_start = itime_data_valid
+ end if
if(kdebug) then
write(*,'("Time_early ",i4,".",i3,".",2(i2.2,"."),i2.2)')
> (itime_early(j),j=1,5)
@@ -1049,9 +1076,10 @@
endif !non-zero scan
C Wait until CAL time. Antenna is on-source as of this time.
- IF (ICAL.GE.1.and. .not.
+ IF ( FL_TOS ) kPhaseRefPrev = .FALSE.
+ IF ( ICAL.GE.1.and. .not.
> (kPhaseRefPrev.or.krunning)) then ! PREOB
- call snap_wait_time(lufile,itime_cal)
+ call snap_wait_time(lufile,itime_cal)
C PREOB procedure
call drudg_write(lufile,cpre)
ENDIF ! cal and preob
@@ -1065,7 +1093,11 @@
continue
else ! do write it
! Write out monitor command.
- call snap_wait_time(lufile,itime_scan_beg)
+ if ( fl_tos ) then
+ call snap_wait_time(lufile,itime_data_valid)
+ else
+ call snap_wait_time(lufile,itime_scan_beg)
+ endif
endif ! don't/do write
!Turn on running if necessary.
kdo_monitor=.true. !indicate that we should issue monitor command before data_valid
Archive of SOuthern Astrometry Project (SOAP) mailing list
Message 00003