Skip to content

Copying .csv files from one controller to other controller

Hello,

I have a setup of a Base station and a Remote site. The Remote site is logging sensor data to .CSV files locally.
A VPN and modbus connection is already functional and running between the two, but I would like have the .CSV files available for co-workers on request in the HMI (download via browser) at the Base station side.
Does anyone have an idea how to copy the .CSV files to the Base station?

Oh yes, the Remote site is connected over a 4G router so it would be nice only to retrieve the files on HMI request only (to save some data).

Summary currently installed:
Base station - AXC F 2152 With
- HMI for user to access view live values and download .CSV logfiles.
- VPN connection to remote site
- Modbus connection over VPN to remote site for live data on request from HMI.

Remote site - AXC F 2152 With
- data logging to .CSV files
- VPN connection to base station
- Modbus connection over VPN to Base station.

Michel van der Lugt

Comments

  • Hello Michel,

    actually there is a multitude of possibilities.

    First of all some questions:

    What are your security requirements should authentication and encryption be part of the filetransfer?
    How do you want to copy it ftp, sftp, scp?
    Maybe this is not very important because of your VPN setup?


    Do you want to work with IEC 61131, C# or C++?

    Do you want to copy data to always the same PLC or does it differ per configuration or application?
    Is the copying done in a fixed intervall or maybe is it application related?

    Maybe you want to synchronise specific files between two PLCs no matter what happens in the application? 

    Are you comfortable with the Linux shell or do you prefer working in IEC 61131?

    kind regards,
    Oliver

  • Hi Oliver,

    Thanks for your response,

    I understand that there are a lot of questions, please see below what we like to achieve.

     

    First of all some questions:

    What are your security requirements should authentication and encryption be part of the filetransfer?
    How do you want to copy it ftp, sftp, scp?
    Maybe this is not very important because of your VPN setup?

    Indeed no encryption or authentication is required as the VPN takes care of the encryption.


    Do you want to work with IEC 61131, C# or C++?

    I rather use a Function Block that is ready made.


    Do you want to copy data to always the same PLC or does it differ per configuration or application?
    Is the copying done in a fixed intervall or maybe is it application related?

    Destination PLC is always the same, but the source PLC will differ when multiple clients will be installed.



    Maybe you want to synchronise specific files between two PLCs no matter what happens in the application? 

    Are you comfortable with the Linux shell or do you prefer working in IEC 61131?


    The file transfer should be event based, when a file request is done on the HMI.

    Michel.

     

  • Hey Michel,

    as you only need to display the file in the eHMI.

    A easy Solution might be  extending the nginx config with a new location (where the file is stored).

    And place a button at your Controllroom PLCs eHMI that does a "open URL on click" dynamic.

    Then you can add "{IP}/NewFolder/yourFile.log"

    As the URL. and whenever you open or refresh this page it will load the File into the Browser.

    What this does is redirect the traffic from one PLC to the other.
    So PLC_1 does not have to do any work at all processing the files. 
    Your browser will download it directly from PLC_2.

    Browser -> PLC_1_with_HMI  
    Browser   ------  > PLC_2_with log.csv

    So like this you can view the files of PLC_2 but you can not edit it.


    If you need to modify the File or you want to display it inside the PLC_1 eHMI (not in a seperate window) you can take this approach further.
    1.Download the file from the PLC_2 on click, through a IEC application
    2. Process  the contents into Structs or arrays
    3. Display those  structs in a Symbol List on the eHMI.

    Depending on the Browser / or Pannel displaying the eHMI of PLC_1 you might have to take this approach.


    If you do not want to modify the nginx.conf there are other approaches:

    • Continuously stream the Data from PLC_2 to PLC_1 to have it ready for display
    • setup FTP Server on the PLC_2
    • do a SCP access on the File for example through a C++ Program
    • use "rsync" to synchronise the files
    • regularly pull the file using a cronjob
    • .....

    I hope this gives you some ideas how to go about it try it out and come back to me if you have any more questions.


    kind regards,
    Oliver.

  • Hi Oliver,

    Thanks for the explanation!
    For now the Nginx option worked for what I needed!
    The logfiles of PLC_2 are now available for download via browser trough the eHMI of PLC_1.

    For other readers of this forum below the settings to achieve this.
    On PLC_2:

    - Open Putty en login als Root user

    - Type "nano /etc/nginx/nginx.conf" add the following to the file and save:

    "location /opt {

    alias /opt/plcnext;          

                     autoindex on;

    }"

    On PLC_1:

    Add button to the HMI page and add the dynamic like in this screenshot:

    2019 12 17 08 56 54

    With kind regards,

    Michel van der Lugt

Sign In or Register to comment.