DavidBo - 2020-03-29

I try to figure out how to use ac_datalog to log a value using sqlite as storage. CODESYS creates a file /var/opt/codesys/PlcLogic/ac_datalog/Application_DataLog.sqlite
but as seen here it has no tables. Why?

sqlite> .dbinfo
database page size:  32768
write format:        1
read format:         1
reserved bytes:      0
file change counter: 12
database page count: 2
freelist page count: 1
schema cookie:       12
schema format:       4
default cache size:  0
autovacuum top root: 0
incremental vacuum:  0
text encoding:       1 (utf8)
user version:        0
application id:      0
software version:    3028000
number of tables:    0
number of indexes:   0
number of triggers:  0
number of views:     0
schema size:         0
data version         2
sqlite> .dbinfo
database page size:  32768
write format:        1
read format:         1
reserved bytes:      0
file change counter: 12
database page count: 2
freelist page count: 1
schema cookie:       12
schema format:       4
default cache size:  0
autovacuum top root: 0
incremental vacuum:  0
text encoding:       1 (utf8)
user version:        0
application id:      0
software version:    3028000
number of tables:    0
number of indexes:   0
number of triggers:  0
number of views:     0
schema size:         0
data version         2code

My application is very simple:

PROGRAM PLC_PRG
VAR
    {attribute 'ac_datalog' := 'DataLogChannel_1'}
    {attribute 'ac_datalog_hysteresis' := '0.10'}
    {attribute 'ac_datalog_hysteresis' := '1.10'}
    data:INT:=100;
    down: bool:=FALSE;
END_VAR

IF data >115 OR down THEN
    IF data >115 THEN
        down:=TRUE;
    END_IF
    data:=data-1;
    IF data<85 THEN
        down:=FALSE;
    END_IF
ELSE
    data:=data+1;
END_IF