Instructions
UM-0085-B09 DT80 Range User Manual Page 110
RG
Aborting an Unload
The Q (quit unload) command can be used to abort all current and pending COPYD unloads. It has no effect on unloads
initiated via the Retrieve Data function in dEX.
Note: this command will not prevent queued unload data files from being sent via FTP or email during a communications session. The
only way to prevent transmission of already queued files is to clear the queues using the
SESSION CLEAR command.
Detecting Unload Status
The system variable 29SV can be used to determine the success or otherwise of the last COPYD command.
29SV
Meaning
0
No unloads have been attempted
1
Unload in progress
2
Last unload was successful
-16
File transfer error: could not open destination file (directory or read-only file exists with same name)
-17
File transfer error: could not write to file (disk may be full)
-20
Source store file error: problem accessing file
-21
Source store file error: store file is corrupted
-22
Source store file error: some other problem
-30
Unload output file could not be queued for transmission because communications session queue is full
-99
Unload was aborted by user (Q command)
Any negative value indicates that the unload was unsuccessful. If start=new was specified then the data pointer will
not have been updated so the next unload will contain the data associated with the unsuccessful unload.
Note: For unloads to a remote destination (email/FTP), the unload is considered "successful" once it has been queued for transmission.
In this case 29SV will be set to 2 but this does not
necessarily mean that the data has successfully reached the destination server. The
DT80 will repeatedly attempt to send a queued unload following a server or network outage. For more details, see
Communications
Sessions (P222)
.
Further COPYD Examples
Precise hourly data ranges
The following fragment will unload hourly data to an FTP server with the boundaries of each unload occurring precisely
on the hour. This is achieved by using the
end=-0 option. This time value has a leading minus sign, so it is interpreted
as a relative time. An offset of 0 means "now", but recall that one of the properties of a
COPYD relative time spec is that
the time is rounded down to the start of the smallest specified time interval. In this case only the hours part of the time
has been specified, so the resulting time will be rounded down to the start of the hour.
RA1H DO{COPYD start=new end=-0 dest="ftp://blah.fr/leData.csv"}
Capturing Pre-Trigger Data Using Archive Files
Archive files can be used for applications such as capturing pre-trigger data leading up to some event. For example:
BEGIN"SPARROW"
1..2CV(W)=0
RA(DATA:200R:OV)1S 2V
ALARM(1DS(LM)==0){2CV=1}
1CV(W)=1CV+2CV
IF(1CV>100){1..2CV(W)=0; COPYD format=dbd}
LOGONA
END
In this example, a small store file is declared for schedule A (capacity 200 records). The channel of interest (2V) is
measured and logged once per second, with old values being overwritten. When digital input 1D (
1DS) goes low we
counting samples, accumulating the count in 1CV. After a further 100 samples have been taken schedule A will then
execute the COPYD command, which will create an archive file on the local file system. The end result is that each
archive file that is created will contain 100 samples taken just prior to the trigger event, and 100 samples taken
immediately after.
Note: If data are being logged at a relatively fast rate, the earliest samples may be overwritten before they can be copied into the
archive file, which may result in fewer than expected pre-trigger records being present in the archive file. In the above example there
might be 198 samples in the archive (98 pre-trigger, 100 post-trigger)
If you need to have exactly the right number of samples then you should halt sampling for the duration of the archive
operation, i.e.:
IF(1CV>100){1..2CV(W)=0; HA; COPYD format=dbd; GA}