Hello,
I try to use the DLOG_STORE_FILE_CSV function to write some log to disk on Raspberry Pi device with Codesys V3. ERROR_T and ERROR_C have '0' in them but no file is written to disk.
Here is a part of my code:
x1(X:= X, FMT:= '#A-#D-#H-#N:#R:#T', COLUMN:= 'Timestamp');
x2(X:= X, STR:= log_text, COLUMN:= 'Message');
x3(X:= X, STR:= 'INFO', COLUMN:= 'Category');
x4(X:= X, STR:= strProjectName, COLUMN:= 'Project');
x5(X:= X, STR:= strAppName, COLUMN:= 'POU');
dLOG_CSV(
X:= X,
ENABLE:= ENABLE,
TRIG_M:= TRUE,
//TRIG_T:= 1,
FILENAME:= 'log.csv',
DTI:= curTimeDT,
SEP:= 44,
ERROR_C=> ERROR_code,
ERROR_T=> ERROR_type);
I tried '/root/log.csv' it also doesn't work. I already created the file log.csv with 777 permissions at '/root' directory where Codesys Control works.
Does anybody have any example of DLOG_STORE_FILE_CSV usage?
I find out the problem: it writes after collect 4090 bytes in buffer only.
I cannot understand why. I use TRIG_T:=1 and TRIG_M:=TRUE.
Hello community,
I have a similar problem with my project. At the moment I am only running the PLC in simulation mode. Everything seems to be OK. The only thing is, that I do not see any file written to the disc. By the way… where can I find the file if no folder is specified?
Here is my small test program:
Declarations:
PROGRAM PLC_PRG
VAR
a:REAL:=1;
f_sin:REAL;
f_cos:REAL;
b_EnableStoreCSV:BOOL:=TRUE;
b_SetRTC:bool;
fb_StoreCSV:OSCAT_NETWORK.DLOG_STORE_FILE_CSV;
st_DLogData:OSCAT_NETWORK.DLOG_DATA;
Log_Sin:OSCAT_NETWORK.DLOG_REAL;
Log_Cos:OSCAT_NETWORK.DLOG_REAL;
c_RealTimeClock:OSCAT_BASIC.RTC_2;
t_DateTime:DT;
END_VAR
Programm:
f_sin:=90*SIN(a);
f_cos:=90*COS(a);
a:=a+0.001;
c_RealTimeClock(SET:=b_SetRTC,
SDT:=DT#2016-02-22-09:00:00,
UDT => t_DateTime);
Log_Sin(VALUE:=f_Sin,
N:=2,
D:=,
COLUMN:='Sin_Value',
DELTA:=,
X:=st_DLogData);
Log_Cos(VALUE:=f_Cos,
N:=2,
D:=,
COLUMN:='Sin_Value',
DELTA:=,
X:=st_DLogData);
fb_StoreCSV(ENABLE:=b_EnableStoreCSV,
TRIG_M:=,
TRIG_T:=1,
FILENAME:='TestCSV.csv',
DTI:=t_DateTime,
SEP:=44,
ERROR_C:=,
ERROR_T:=,
X:=st_DLogData);
can you see an error code (ERROR_C , ERROR_T)
it may be that no files can be written in the simulation ?????
(Un)fortunately no error codes... I've also been thinking that it may not work in simulation mode. I will test it on the raspberry when I find some time for that.