Jump to content

copy files to SD card over network( whitout SD CARD EXPLORER)


Recommended Posts

Is there a way to use a FTP server to get files to the SD card (I already looked at examples and seems that only works for uploading files)

 

I need to mantain potencially a lot of recipes for near 200 PLCS and altough SD explorer is handy, I dont want to spend hours updating files manually.

 

I know that I potentially could use MODBUS and a datatable to store the recipe in the background and use the PLC functions to save the parameters on the SD card, but it will require some extra work  and some sort of 2 side actions (Generate the values on the computer, acces to modbus server in PLC , writte and then from PLC using some trigger to create the files... its not feasible with more than 4 recipes and near 200 devices)  for me to do it and more ig is task that should be simple with a FTP server wich the PLC IS capable to reach, right?

I could just mantain the source files on a network folder and make periodical checks to retrive the most recent version of recipe withouth actually sending the file to each PLC .

 

Its possible or am I asking too much for v570 and v700 PLCS?...Maybe will be easier to automate SD card explorer with some kind of bot?  😅

Link to comment
Share on other sites

Just fot the record I ended programing a macro to run the SD card explorer, I just add a list of the IP numbers and let it run while it goes one by one oppening, browsing for the dessired folder, and then deleting all the content, next upload the new recipes and then starts from the beegining with the new IP and PLC name.

Its kind of slow buecause I needed to ad time outs and detect some specific pictures in order to take control of the mouse, but it works unnatended, wich is the point.

Link to comment
Share on other sites

  • 3 months later...

So...,  now that I have mroe time I  decided to try the FTP,  and it  kind of works!!,

I set it up an FTP server on a computer and I was able to succesfully retrieve (at least in form of a vector of MIs filled with data) a file from the FTP server.

But in order to do this periodically and mantain the latest versions of the files (automatically),  I need to know the conten  of the FTP server itself,  wich seems posible using the LIST command ,  but I am stuck in this part.

(I used wireshark to siniff the data going thru PLC and PC)

This is a file being retrived form the PLC in chunks:

 image.thumb.png.36ede7e482e1a3fad8a193f4a5f0104a.png

This is the  information on the DATA line in form of ASCII characters, the response of LIST command : 

image.thumb.png.bd98ce7e0bef2b2c13c7eb41211c387f.png

Does any one knows how to make tha  from the  FTP-DATA line ASCII text response to be stored to an MI?

I am using TCP RAW/SCAN to get the file, but  TCP RAW /SCAN does not detects any of that stream of bytes (the ASCII text response from LIST command). I already tried TCP protocol, wich works great for the FTP CONTROL line, but not for this:

image.thumb.png.edc7f1404e4c2da90e07bebd7dce2a0f.png

 

I feel like I am missing some concept of how FTP works,

Thank you in advance

Link to comment
Share on other sites

17 hours ago, Ausman said:

Are you getting any error messages into your status MI in your attempts?  This can be confusing because 0 is OK. 

If testing something I manually alter it to allow a shift back to 0 to be observed.

yes, it was 0 (Ok) but with the ASCII mode data connection it showed nothing on TCP RAW scan function,  DATA ARRIVED MB wasn't even triggered.

19 hours ago, Fernando Castro said:

I feel like I am missing some concept of how FTP works,

However seems that @Fernando Castro was on the right track, the issue is on how FTP works as protocol, now  I was able to listen that ASCII Stream of characters:

image.thumb.png.8a1295fd7c53bbc9ac199c61d795f555.png

 

so Itook the time to read in depth  the  RFC959 standard,  and I found out that needed to change the default mode of data transfer before scanning  for that line text ( ASCII data) 

so first need to send the commands as follows:

TYPE A T

MODE B

PASV

NLST or any  other commands that responds on text commands over FTP- DATA.

image.thumb.png.8e40bb56f66c1acc99349d28d719186f.png

 

By the way, while searching for this on the forum saw a lot of post over FTP but nothing about succesfuly retrieving data from a FTP server to the PLC. 

... I was even thinking on implementing a self updating program for my PLC, in theory I can create the clone file for the SD card and run it from the PLC itself, is that right?

So based on a schedule retrive latest version released, and if  it is different from the current installed I can download that file and upgrade the machine while being down. 🤔

Link to comment
Share on other sites

  • MVP 2021
2 minutes ago, Fernando Castro said:

... I was even thinking on implementing a self updating program for my PLC, in theory I can create the clone file for the SD card and run it from the PLC itself, is that right?

So based on a schedule retrive latest version released, and if  it is different from the current installed I can download that file and upgrade the machine while being down.

Yes you should be able to do this. The function block to run the clone file (or application file - not sure why you need a clone file in this situation) will require a file name (though it can be indirect), so that may be an issue with detecting that the new file is different from the older file.

Link to comment
Share on other sites

  • MVP 2021

I'll stick my neck out, taking into account Flex's answer about name detection problems, and suggest that perhaps this concept might be better completely  initiated and done from the PLC itself.  (Maybe you're suggesting this anyway...I've just misinterpreted) 

If you had the PLC automatically add a number to the file name currently in use, and periodically check (at your optimal time) if the "next" file name exists on the card, that way it could do the update very easily.  No download right then  etc would be needed...it could simply be done by having your macro dump the new file onto the card, and then the plc checks for it.  All naming would have to be a sequential match.  The big advantage would be that all updating would be done at a common time, as the macro has distributed to all units over a period of time beforehand.

cheers, Aus

 

Link to comment
Share on other sites

7 hours ago, Ausman said:

I'll stick my neck out, taking into account Flex's answer about name detection problems, and suggest that perhaps this concept might be better completely  initiated and done from the PLC itself.  (Maybe you're suggesting this anyway...I've just misinterpreted) 

If you had the PLC automatically add a number to the file name currently in use, and periodically check (at your optimal time) if the "next" file name exists on the card, that way it could do the update very easily.  No download right then  etc would be needed...it could simply be done by having your macro dump the new file onto the card, and then the plc checks for it.  All naming would have to be a sequential match.  The big advantage would be that all updating would be done at a common time, as the macro has distributed to all units over a period of time beforehand.

cheers, Aus

 

yes, that was the idea, that is why it was so important to be able to get the ASCII text response of those commands like NLST.
So I can get the list of available files first, and check if the names match the ones that have been previously downloaded on the PLC.
filenames will be changing based on revision.

and yes that task will be running at fixed intervals, but I was thinking only while the machine is on idle mode, since once started there is no way to select another recipe (that is by design).
another way could be to use a Modbus signal that can be broadcasted to all PLCs to let them know that there is a new version available to download
For the program itself, I can use the same conditions over long periods of time, since the revisions take a while to be deployed.
... some changes could have unintended consequences, so I need to test all the system for a couple of RUNS before releasing the new deployed version, and I have revisions that weren't even deployed for the rate of change that we have over here.

 

I am very excited, I am automating myselff out off job 😅. I mean I still need to doevelop the new software versions, but at some point no new features will be required.

 

Link to comment
Share on other sites

  • MVP 2021
18 minutes ago, Flex727 said:

It seems like the better I do my job, the less my customer will need me in the future.

However, this is why you have more customers.  Your high-quality projects show your skills and experience.

Link to comment
Share on other sites

  • 2 months later...
On 11/16/2021 at 12:30 PM, Fernando Castro said:

Is there a way to use a FTP server to get files to the SD card (I already looked at examples and seems that only works for uploading files)

 

I need to mantain potencially a lot of recipes for near 200 PLCS and altough SD explorer is handy, I dont want to spend hours updating files manually.

 

I know that I potentially could use MODBUS and a datatable to store the recipe in the background and use the PLC functions to save the parameters on the SD card, but it will require some extra work  and some sort of 2 side actions (Generate the values on the computer, acces to modbus server in PLC , writte and then from PLC using some trigger to create the files... its not feasible with more than 4 recipes and near 200 devices)  for me to do it and more ig is task that should be simple with a FTP server wich the PLC IS capable to reach, right?

I could just mantain the source files on a network folder and make periodical checks to retrive the most recent version of recipe withouth actually sending the file to each PLC .

 

Its possible or am I asking too much for v570 and v700 PLCS?...Maybe will be easier to automate SD card explorer with some kind of bot?  😅

Replying to myself I found that using the .NET Communication Driver  VisualStudio and Visual Basic as programming language  I could compile a windows program that can make bulk uploads to the SD card inside the PLC.

If someone ever has this need that is a good option, although the documentation for the usage of SD card functions is non-existent, anyone with a decent amount of try and error could do it by himself.

to be honest I'll describe my experience using that .NET driver as "I don't know what I am doing".

image.png.08da45221b0e8551e7706362d48c36fc.png

 

 

 

  • Upvote 1
Link to comment
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...