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 Mon Sep 16, 2019 3:25 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 9 posts ] 
Author Message
 Post subject: codesys3 data logger
PostPosted: Sat Oct 27, 2018 11:57 pm 
Offline

Joined: Sat Oct 27, 2018 2:53 am
Posts: 1
I am trying to create a codesys3 data logger, any recommendations?
The library AC_DataLog may be useful but can't find how to use it examples.
still struggling importing OSCAT Network library 1.2.1.1. I have it in the library manager but the compiler doesn't allow me to use it yet. I can see the data type ex "DLOG_DATA" in the library but shows, as not defined when I try to, used it.


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Wed Oct 31, 2018 10:17 am 
Offline
Frequent User
Frequent User

Joined: Fri Feb 23, 2018 3:41 pm
Posts: 151
Actually, to datalog, I use a simple FIFO in a huge array of whatever. (usually one or more value and a timestamp in a structure).

If the datalog has to be huge, you may save CPU time using rotating start/end index instead of moving data.


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Wed Oct 31, 2018 9:56 pm 
Offline

Joined: Wed Dec 28, 2016 11:00 pm
Posts: 72
I am also very interested in a generic datalogging solution!
A store and forward combined with an RTC generated timestamp (of that old event) in combination with OPC UA is prefered.


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Sun Nov 04, 2018 8:20 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3447
Hi,
this should point you in the right direction I guess:
https://help.codesys.com/webapp/ac_dlm_ ... n=3.5.13.0
For using the AC-data logger no extra license is needed.
You could choose to log into an csv file or sqlite db.

BR
Edwin


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Tue Jul 09, 2019 1:31 pm 
Offline

Joined: Mon Feb 04, 2019 2:11 pm
Posts: 35
hi i am interested by the datalog functions too,
but i do not understand how to add my logging variables


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Wed Jul 10, 2019 1:54 pm 
Offline

Joined: Mon Jun 17, 2019 10:44 pm
Posts: 1
I marked variable by {ac_datalog[:=DataLogChannel]}, but this didn't work. Has anyone have example how to use AC_DataLog?


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Wed Jul 10, 2019 2:53 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3447
Hi,

attached an example project:

Code:
PROGRAM PLC_PRG
VAR
    timer : Standard.TON;
    {attribute 'ac_datalog_hysteresis' := '1.745'}
    {attribute 'ac_datalog' := 'DataLogChannel'}
    iLogVar : INT;
    {attribute 'ac_datalog' := 'DataLogChannel'}
    rLogVar : REAL;
    {attribute 'ac_datalog' := 'DataLogChannel'}
    {attribute 'ac_datalog_hysteresis' := '0.745'}
    sLogVar : STRING := 'Hallo';
    //{attribute 'ac_datalog' := 'DataLogChannel'}
    arLogArray : ARRAY[0..4] OF REAL;
   
    {attribute 'ac_datalog_set_default_group' := 'DataLogChannel'}
    instStruct : LogStruct;
   
    {attribute 'ac_datalog_union_set_representant' := 'uiLog'}
    {attribute 'ac_datalog' := 'DataLogChannel_1'}
    instUnion : LogUnion;

    {attribute 'ac_datalog' := 'DataLogChannel_1'}
    {attribute 'ac_persist' := 'PersistenceChannel'}
    instFB : POU_Log;   
   
    {attribute 'ac_datalog' := 'DataLogChannel_1'}
    iLogVar2 : INT;
END_VAR

Code:
timer(IN := TRUE, PT:=T#5S);
IF timer.Q THEN
    iLogVar := iLogVar + 1;
    iLogVar2 := iLogVar;
    timer(IN := FALSE);
    rLogVar := arLogArray[2];
    instStruct.bLog := instStruct.bNoLog;
    instFB.Prop_Log := instFB.Prop_Log + 1;
END_IF


Keep in mind that extensive cyclic data writings will kill your storage device ( so handle with care what and where to save these data)

Cheers
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Wed Jul 10, 2019 7:40 pm 
Offline

Joined: Wed Dec 28, 2016 11:00 pm
Posts: 72
Nice,

The attached project works like a charm. Thanks!!

This brings ups some questions;
* Can the PLC itself now visualise the stored Sqlite db / CSV information? So showing the contents of the db/csv in a trend or trace by design with a local history :D
* Ideally the PLC pushes the stored information after some trigger to a "consumer". Is there a way to facilitate this?
If not, any other ideas on achieving such a scenario are very welcome!

I would like to hear any thoughts on this, as the example shows how to save the data in a neat way but it does not show how to retrieve or send it.


Top
   
 Post subject: Re: codesys3 data logger
PostPosted: Thu Jul 11, 2019 9:21 am 
Offline

Joined: Mon Feb 04, 2019 2:11 pm
Posts: 35
is this datalogger can be used for 100ms data log ?


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 7 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:  
cron
Powered by phpBB® Forum Software © phpBB Limited