CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Aug 20, 2019 8:04 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Jun 13, 2019 10:50 pm 
Offline

Joined: Sun Oct 26, 2014 11:20 am
Posts: 29
I am just started to use Codesys v3 on Raspberry pi, and now I got stranded on using DLOG_STORE_FILE_CSV.

My code looks like:
Code:
PROGRAM POU_main
VAR
   b_EnableStoreCSV: BOOL;
   b_SetRTC: BOOL;
   fb_StoreCSV: OSCAT_NETWORK.DLOG_STORE_FILE_CSV;
   st_DLogData: OSCAT_NETWORK.DLOG_DATA;
   Log_test: OSCAT_NETWORK.DLOG_STRING;
   Log_counter: OSCAT_NETWORK.DLOG_DINT;
   t_DateTime: DT;
   counter: DINT;
   dtu_getdt: RTCLK.GetDateAndTime;
   i_count1: DINT;
END_VAR

Code:
b_EnableStoreCSV:= TRUE;

dtu_getdt();
IF i_count1 > 5 THEN
   dtu_getdt.xExecute := TRUE;
   IF dtu_getdt.xDone THEN
      // ohne Fehler abgeschlossen
      t_DateTime := dtu_getdt.dtDateAndTime;
      dtu_getdt.xExecute := FALSE;
      i_count1 :=0;
   END_IF

   IF dtu_getdt.xError THEN
      ; // Fehlerbehandlung
      i_count1 :=0;
      dtu_getdt.xExecute := FALSE;
   END_IF
END_IF
i_count1 := i_count1+1;
   
counter:= counter + 1;

Log_counter (VALUE:= counter,
   COLUMN:= 'Counter',
   DELTA:=,
   X:= st_DLogData);
             
Log_test (STR:= 'test',
   COLUMN:= 'result',
   X:= st_DLogData);

fb_StoreCSV (ENABLE:= b_EnableStoreCSV,
         TRIG_M:= TRUE,
         TRIG_T:= 5,
         FILENAME:= '/home/pi/testfile.csv',
         DTI:= t_DateTime,
         SEP:= 59, // ASCII delimiter
         ERROR_C:=,
         ERROR_T:=,
         X:= st_DLogData);


The code is triggeres every 200 ms in the task configuration, and it do run, but no files is saved anywhere.
When the code is running I can see that triggering is taking place, so is "add data", but my time stamp in DTI is strange, it shows UTC time and not my local time, can this be my problem?
I had try to change this time stamp to reflect the local time zone, but no luck to do so, but there must be a way?
It looks like that DTI is needed to be that correct time, but why? If it is sensitive to the right time stamping it must know the right time already, so why should I supply it with a precision time stamp?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited