SourceForge Logo

Data logging

see also: Modules


In your visual.cfg file,Provide a line like the following:

logger: myinst.dri /visual/data/
Meaning of this line:
logger:tells the loader what type of module comes here
log_bin.somodule name
myinst.drifilename of instruction listin your project directory
/visual/data/module dependent datahere: data storage directory

Available data logger modules:

ModuleData storageUsage
log_bin.soBinary filesTrend graph generation,large amounts of data
log_mysql4.soMySQL databaseGeneral, data export to office applications
log_text.soText filesGeneral,protocol printing


On startup, the logger module marks all cells given in the .dri-file. If one of them changes, the modules callback procedure is invoked with coordinate and value as parameters. The callback procedure stores the data and returns.

Binary data logger:


The binary data logger is intended to store more data sets, when values change quickly, thus providing higher resolution when "something happens" and saving space when "not much happens". Therefore, the logger internally stores time and value of last record for each data source. When it is invoked again on data from this source, it calculates differences of time and relative value. Both differences are then referenced to (divided by) the given values signiTime and signiValue (given in record instruction). This gives a distance in time and value. A combined difference is then calculated as the square root of the sum of squares of the differences. If the combined distance is greater or equal to one,a new record is written.

The record Instruction gives 300 (seconds, =5 minutes) for signiTime and 0.01 (1 percent) for signiValue.
The last data recorded was 100.0 at 10:00:00
Data with the same or minimal greater timestamp be written, if value>=101.0 or <= 99.0
Data with the same value 100.0 will be written, if time >=10:05:00
For any other case imagine a circle. Imagine the scale of x and y axis so that the circle crosses the x-axis at 5 minutes and the y-axis at 1 percent. New data can be represented by a point in the plane. Data that outside the circle is regarded a "significant change" and recorded. Data that falls into the circle is discarded.

File format:

For each data source, a file is created. A data record is made up of the following fields:
double timethis is seconds since Jan 1st, 1970, fractional part provides microsecond resolution.
coord cSource coordinate
int sheetSource data sheet
double vThe value
int stateFrom status flags, marks data that may not be reliable
int resReserved, fills it up to 32 byte
A data file begins with this header:
char nlLength of name (like PASCAL string)
char Name[255]Name, taken from source coordinates Label
double Signi_valueAmount of relative change in value, that is considered interesting
double Signi_timeAmount of change in time, that is considered interesting.
int reserved[12]Reserved, fills it up to 256+64 byte

Instruction format:

object tagcommentsheetsource coordinatesource coordinate'Time dist.value dist.closing object tag
<RECORD>'This will record B1 from sheet 1'1'B1''B1'180.00.01</RECORD>

MySQL data logger:

Instruction format:

object tagcommentSQL+parameterssheettypemaximum rowssource coordinateclosing object tag
<RECORD>'All my data''"insert into ww_bzstd values(from_unixtime(%12.0f),%3.0f,%3.2f,%3.2f,%3.2f,%3.2f,%3.2f,%3.2f,%3.2f)",E9,I8,L6,L1,L2,L3,L4,L7,L8100'I7'</RECORD>
<RECORD>'Get my recipe data''"select * from recipes where id=%3.0f",R1,S1,T1,U1,V1'115R1</RECORD>
comment:an arbitrary text
SQL+parameters:The SQL statement to execute.
Parameters are used like with the printf() function
sheet: Number of used spreadsheet
type:0 for INSERT type (stores data), 1 for SELECT type (reads data)
max.rows:Maximum number of rows to copy to sheet for SELECT type statements
source coord:A change of value in this cell causes invokation of callback function
1.This (specially select) is under development. Expect changes here!
2.max.rows does NOT limit the amount of rows FETCHED from MySQL database. It limits only the number of rows which are copied into subsequent rows of the spreadsheet. Use SQL's LIMIT keyword to put a limit to the result set.
3.As with all external data, NO cells are created. You must provide them before by manually inserting data of the respective type.

Text data logger: