Campbell-scientific CR800 and CR850 Measurement and Control Systems Instrukcja Użytkownika Strona 227

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
Przeglądanie stron 226
Section 7. Installation
227
'Declarations
Public rTime(9) As Long '(or Float)
Public rTime2(7) As Long '(or Float)
Dim x
DataTable(SecondTable,True,-1)
DataInterval(0,5,Sec,10)
Sample(1,rTime,NSEC)
Sample(1,rTime2,NSEC)
EndTable
'Program
BeginProg
Scan(1,Sec,0,0)
RealTime(rTime)
For x = 1 To 7
rTime2(x) = rTime(x)
Next
CallTable SecondTable
NextScan
EndProg
CRBasicExample46. NSEC—ConvertTimestamptoUniversalTime
'Application: the CR800 needs to display Universal Time (UT) in human readable
'string forms. The CR800 can calculate UT by adding the appropriate offset to a
'standard time stamp. Adding offsets requires the time stamp be converted to numeric
'form, the offset applied, then the new time be converted back to string forms.
'These are accomplished by,
'1) reading Public.TimeStamp into a LONG numeric variable.
'2) store it into a type NSEC datum in final data storage.
'3) sample it back into string form using the TableName.FieldName notation.
'Declarations
Public UTTime(3) As String * 30
Dim TimeLong As Long
Const UTC_Offset = -7 * 3600 '-7 hours offset (as seconds)
DataTable(TimeTable,true,1)
Sample(1,TimeLong,Nsec)
EndTable
'Program
BeginProg
Scan(1,Sec,0,0)
'1) read Public.TimeStamp into a LONG numeric variable.
TimeLong = Public.TimeStamp(1,1) + UTC_Offset
'2) store it into a type NSEC datum in Final Data Storage.
CallTable(TimeTable)
Przeglądanie stron 226
1 2 ... 222 223 224 225 226 227 228 229 230 231 232 ... 565 566

Komentarze do niniejszej Instrukcji

Brak uwag