Jump to content

How to automate writing to a csv file or something similar


cbing

Recommended Posts

Hello,

Our customer wants us to write certain values to a text file on their network as a part of the cycle of our project. More specifically, they have enabled file sharing on their system such that if you were to open File Explorer on Windows and go down to  "Networks," you would be able to see their device and parse through folders they've made public. The txt file we want to write to is in such a folder.

I'm aware of Unilogic's ability to capture values from a DTI and write them to a .csv file, the problem is that there doesn't seem to be a way to automate this (put it in ladder logic). Is there another way to accomplish writing to a .txt file on another network from within the ladder logic? Thanks. 

Link to comment
Share on other sites

  • MVP 2023

File operations in UniStream are limited to interacting with the local SD card.  You can't tap a network drive with it by design; imagine how quickly a PLC could become an IT nightmare if it could go out and sniff the network and commit various shenanigans.

Your option is to write data to the SD card and enable the ftp server.  It will be up to you or the customer to put a script on their system somewhere that will get the file off the SD card via ftp and deposit it where they want it.

Joe T.

 

Link to comment
Share on other sites

To a .txt not that I know of, to a .csv which can be opened in a text editor, yes.  The way I've handled this in the past is to:

FTP receive (go grab the original .csv file) 

Convert CSV to UDTF

Load DTI from file

Make whatever changes in the data with PLC DTI functions

Store DTI to file with .csv (Convert back to .csv)

FTP send (send it back to the network folder)

Also you can setup a Webserver on the PLC to edit table values and follow the same flow as above after making changes to update the (original) file on the network.  

I usually have the PLC go grab the network file at Power on, and also have a button on the HMI and webserver to go grab the network file that way we can make changes to the data and re-fresh it on the PLC remotely. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.