Data Logging without Datalink

Hi

I would like to log the data of my epic I/O without using FTP and Optodatalink.

Is there any possibles?

Welcome to the forums!

Can you give us a little more information? What your application is, what you are trying to do.

You don’t have to use FTP or OptoDataLink at all, so thats no problem.
What data are you trying to move, is it a file that PAC Control has made?

Just a little more information to help us help you…

Hello,
Thanks for replying…
My application is that i have to log the data of epic’s analog card…
Store that data into epic and finally fetch that data to pc…

EPIC has a few different ways to do any one thing. We just need to figure out the best way for your application…

How do you want to “fetch that data to pc”?

Do you want to map EPIC as a network drive and move your data like that?
Do you want to use the RESTful interface we provide and get the data like that?
Do you have shell/ssh access on your EPIC? Are you comfortable in shell in Linux?
Do you have any MQTT experience?
Do you have any Python experience?

How can i fatch that data by creating network drive or by restful api??

First thing is that how can i log analog input data??

Are you using a PAC Control strategy to configure the analog input card?

Yes i am using pac control strategy

Ok, cool.
So the thing to do then would be to use a comm handle to the file area and write your data to a file as often as you need.
You get to construct the file any way you like, so you can have a ‘timestamp,data’ format if you like.

There are some sample code on the forums to do this.
Here is one example; Convert Integer 32 to Timestamp String - #2 by mstjohn
Here is another; Requesting Code Sample - Writing to Text file in OptoScript

Lets know if you need any assistance to get the file created.

Hi Beno,

Thanks for info.
But,how can i store that data in groov epic?
After that can i retrieve that data ?

Lets just start with getting the data into the EPIC first.

Open a comm handle and write a test file.
Go to groov Manage and from the home page, click on System -> Files -> Unsecured.
You should see your test file there.

Then tweak the PAC Control strategy to write your analog input data to a CSV (for example) file.
Be sure you can view that file from groov Manage before we go any further.

Ok beno…
I will do that first…
Do you have any documents that shows these steps??

Take a look from page 273 on wards in the PAC Control Users Guide.

That, in conjunction with the posts I linked to in this thread should get you up and running.

PAC control Writing to Text file is very Handy:

Pre Requisite:

  1. Define an empty communication handle: chFileW
  2. nNumHeader = i
  3. a header string table: st_Header[i]
  4. a data string table: st_Write_Data[i] (you need to convert desired data from float to string)
  5. Other variables are self-explanatory (Please compile and create unknown variable accordingly)

s_CRLF = chr(13) + chr(10);

// Assign Filename (this is for epic file directory)
sFilename = “~/unsecured/filename.csv”;

// Assign No of Headers (or columns)
nNumHeader = 29;

//----------------------
// Check if File Exist
//----------------------
//
// Assign File Command
sFileCmd = “file:r,”;

// file exist flag
nFileExist = 0;

// Read File
sFilename1 = sFileCmd + sFilename;
SetCommunicationHandleValue(sFilename1, chFileW);

// open file for reading
ns_chFileWO = OpenOutgoingCommunication(chFileW);
if(ns_chFileWO==0) then
// EPIC always returns 0, even if file exist (bug maybe?)
nFileExist = 1;
endif
// close file
ns_chFileWC = CloseCommunication(chFileW);

//----------------------

// force file exist = 1, because of bug maybe (change to 0 or 1 manually)
nFileExist = 1;

//-----------------------------------------
// If file does not exist, create new file with header else append file
//-----------------------------------------

if(nFileExist==0) then
// Assign File Command
sFileCmd = “file:w,”;

// create new file
sFilename1 = sFileCmd + sFilename;
SetCommunicationHandleValue(sFilename1, chFileW);

// open file
ns_chFileWO = OpenOutgoingCommunication(chFileW);
if(ns_chFileWO==0) then
    st_Header[0]  = "Date_Time_Started";
    st_Header[1]  = "Date_Time_Ended";
    st_Header[2]  = "Param_1";
    st_Header[3]  = "Param_2";
    st_Header[4]  = "...";
    SetEndOfMessageTerminator(chFileW, ',');
    ns_write = TransmitStrTable(nNumHeader,0,st_Header,chFileW);
    ns_write = TransmitString(s_CRLF, chFileW);
endif
// close file
ns_chFileWC = CloseCommunication(chFileW);

endif

//---------------------------------
// Set Communication Handle to Append
//---------------------------------

// Assign File Command
sFileCmd = “file:a,”;

// Append to file
sFilename1 = sFileCmd + sFilename;
SetCommunicationHandleValue(sFilename1, chFileW);

// open file
ns_chFileWO = OpenOutgoingCommunication(chFileW);

if(ns_chFileWO==0)then
SetEndOfMessageTerminator(chFileW, ‘,’);
ns_write = TransmitStrTable(nNumHeader,0,st_Write_Data,chFileW);
ns_write = TransmitString(s_CRLF, chFileW);
endif

DelayMsec(100);

ns_chFileWC = CloseCommunication(chFileW);

2 Likes

Its working very good.
Thank you guys for guidance.

Can i Create only one note pad file in a day with time interval of data log is one minute?

Not sure I totally follow your question…
You can create as many files as you need, just give each one a different file name.
You can log data at what ever interval you need, 1 minute or faster.

I want to log data into a single text file…
Exatly my question is…