Reputation: 1
I inherited a model factory which is programmed using codesys. Between the steps I have bool conditions which are dictated by sensor values in the factory. For my project I need to extract the time stamps for when the sensor is triggered. How can I do this? PS. I have no experience with codesys but need this data to feed into an AI training Pipeline My main problem is data retrieval itself; so I have 2 timestamps I want to save which I have implemented with the following code:
VAR
tStarted, tElapsed : TIME;
END_VAR
fbR_TRIG(CLK := xStart);
IF (fbR_TRIG.Q) THEN
tStarted := TIME();
END_IF;
tElapsed := TIME() - tStarted;
So I would like to extract total runtime during the event as well as the time between events. I tried to do this with retain variables, but copying all the timestamps by hand is rather tedious and propably not the best way to do that.
Unfortunatly I cannot find any recources that explain how data can be stored; (Storage would ideally be in the form of a csv file for later retrieval) If any of you know where I can find such recources I would be very thankfull
Tldr. How do I extract timestamps for transitions in codesys
I cannot use IIoT Library SL as I have no funds allocated to my project
Upvotes: 0
Views: 388
Reputation: 3
Codesys is typically used in A Industrial (OT) environment. Usually a SCADA or MES package is running above the Codesys software. The SCADA retrieves the data from Codesys with a driver (OPC-UA) for example. And that’s where the storage usually takes place (most of the drivers already cover the timestamp). The moral of the story is Codesys is meant for running a machine that cannot go down, and is usually not running on powerful hardware. Retain memory is usually only used to store installation settings (how much pressure a compressor should produce for example). However if your Codesys is running in an Linux environment there are packages that you can use to open en close files, you then have to make the logic that opens the file, stores the logic and closes it again. https://help.codesys.com/webapp/qBzGsePyFn_QWi7j72m_JXWech4%2Ffld-CAA-File;product=CAA%20File;version=3.5.17.0 afterwards you can open this file from any system you prefer But keep in mind don't uses Codesys for storing large amounts of data.
Upvotes: 0