Jump to content

Saving sampling data with customized file name


Recommended Posts

Hello Everyone, 

New to this software. Many thanks in advance. 

Question 1,

So we've been able to record the data with "Data Sampling". Can someone please tell me how I can control the start and stop of data sampling? Also how may I customized the name of the sampling file, such as in MATLAB people can use the format "date is %d time is %f, DD, TT "

Just so the saved data log is more readable.

Question 2,

How may I save a separated file content just several variables, that each time I hit a button, such as when I hit "start", save the time, date, to a txt file so I can find out when did I hit the button?

Thank you very much!

Yan

Link to post
Share on other sites

1) The Data Sampler struct contains a Start/End Sampling bit, which you can set/reset in ladder or use an HMI Button for example so set that bin when the button is pressed.

Samples file is auto closed and a new file is started when 10,000 (as far as I remember) samples have been sampled.

1.1) The Data Sampler struct contains a Filename member with the description: "The user can set a filename. If left empty, the PLC will select the name". You can use Message Composer or String concatenation/manipulation utilities in order to create a string that represents the filename that you want and then store it in the Filename property.

.When using a message composer, then output is a buffer, so you can use a Copy Buffer to Tag in order to copy the buffer into a string tag (with the correct Encoding. Which is probably ASCII).

The filename is being used (as far as I remember), only when the file is being saved (closed because the user stopped the sampling, or the 10,000 limit was reached).

When you choose the filename, then you need to make sure that you don't accidentally overwrite an already existing file (since you did not change the filename since list time the file was saved).

 

2) I'm not sure if question 2 is related to data sampling, but you can write a row to a Data Table (and increment the row index on each time), and later save the Data Table to a CSV.

Another option is to use the message composer in order to compose a string of your like, and then use the ladder Utility Append buffer to file, which will take the buffer created from the message composer, and write it into a file.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...