Campbell-scientific CR1000 Measurement and Control System Uživatelský manuál Strana 226

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 588
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 225
Section 7. Installation
226
'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 CR1000 needs to display Universal Time (UT) in human readable
'string forms. The CR1000 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)
Zobrazit stránku 225
1 2 ... 221 222 223 224 225 226 227 228 229 230 231 ... 587 588

Komentáře k této Příručce

Žádné komentáře