Vortex: datalog

Additional to the default vortex objects there are some functions which help to read out the state of the datalog.

These are:

  • readRecord(sector_nr,record_nr,advance=True)
    read one log- record
    the driver stores the latest time of an valid log record to detect if new logs are available
    advance the LogHead-Pointer if set to True
  • readLogInfo()
    read info about the log with these fields:
    • LogAddress: vortex 32bit address where the log starts
    • data_size: 2(1) or 4(0) bytes for each log data value
    • Sector Count: max number of sectors for this log
    • Start Sector: first sector
    • RecordSize: size in bytes for one record (depends on data_size)
    • RecordsPerSector: how many a sector can hold
  • readLogHead()
    returns the last written record, given by sector and record number, this can be used to check if new data is available
    returns a list with 2 items
    • [sector_nr, record_nr]
  • readNewRecords(limit=20)
    returns a list of all new records since last call of readNewRecords
    empty list if there are no new records
    the limit parameter sais how many records should be read with this call
  • readRecords(start_sector=None,start_record=None,count=-20) 1)
    • start_sector : first sector to read from, head-sector if no value given
    • start_record : first record in sector, head-record if no value given
    • count : number of records to read, go backwards if negative
  • setCurrentRecordPosition(sector_nr,record_nr)
    force internal record address
  • calcRecordPosition(sector_nr=None,record_nr=None,record_inc=0)
    calc new position
    • record_inc : can be positive or negative

log records

A typical log record looks like this:

{
  'status':    0,
  'timestamp': 1395129487,
  'data':      2320,
  'addr':      [0,10]
}

The meaning of the fields are:

  • status
    • bit[0] : bInvalidRecord : Must be 0 if valid record
    • bit[1] : bDataTimeout : single Log Record on Timeout event
    • bit[2] : bDST : 1 if local time is DST
    • bit[3:7] : spare
  • timestamp : Unix standard time (without DST adjustment)
  • data : log data
  • addr : sector and record number of record

typical use cases

info what is logged

This is defined by NV/source/regIndex and NV/source/type:

read /<driver>/<slave>/vortex/datalog/0/NV/source/regIndex
(None, 23)
read /<driver>/<slave>/vortex/datalog/0/NV/source/type    
(None, [1, 'MB.INPUT'])

read complete log data and poll for new records

This can be done via calling readNewRecords() peridically.

The first calls will return all new records which are normally limited to 20 for each call. The driver tracks the time for each record thus knowing whenever it reaches the end. Then at some point the last call will return less then 20 records and all next calls will return an empty list as long as there is no new log-data available.

The responses could look like this:

> /<driver>/<slave>/vortex/datalog/0/readNewRecords
< [<20 records>] #first block

> /<driver>/<slave>/vortex/datalog/0/readNewRecords
< [<20 records>] #second block

> /<driver>/<slave>/vortex/datalog/0/readNewRecords
< [<20 records>] #third block

> /<driver>/<slave>/vortex/datalog/0/readNewRecords
< [<20 records>] #fourth block

> /<driver>/<slave>/vortex/datalog/0/readNewRecords 
< [<11 records>] #last block with records

> /<driver>/<slave>/vortex/datalog/0/readNewRecords 
< [<0 records>] #no new records

> /<driver>/<slave>/vortex/datalog/0/readNewRecords 
< [<0 records>] #no new records

> /<driver>/<slave>/vortex/datalog/0/readNewRecords 
< [<1 records>] #one new record detected

> /<driver>/<slave>/vortex/datalog/0/readNewRecords 
< [<0 records>] #no new records

> /<driver>/<slave>/vortex/datalog/0/readNewRecords 
< [<0 records>] #no new records
1)
not implemented yet
doc/sdo/drivers/rtd_dsxll_tng/vortex/module/datalog.txt · Zuletzt geändert: 2014.03.21 - 13:51 von 127.0.0.1
 
Copyright 2021, e-design / Alexander Krause