Skip to content

SiemensIndustrialEdgeITA/edge-sharefile-unified

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edge-sharefile-unified

Node-RED image for Unified Comfort Panel, containing basic nodes for reading filedirectory SMB, e-mail and database.

Table of Contents

Requirements

This application example comes with pre-builded nodered_smb_fs_mail_sql_x.x.x.app package that can be installed specifically on Unified Comfort Panels that run SIMATIC Edge Runtime.

Before loading this application, check if the requirements below are satisfied by the selected Edge Device for installation.

In order to run this Edge App, the selected Edge System need to satisfy the following requirements:

Description
Available Working Memory (RAM) >= 768 MB

Hardware Requirements

  • The nodered_smb_fs_mail_sql app is only compatible with WinCC Unified Panels devices that have SIMATIC Edge functionality enabled. For details on how to enable Edge functionality see chapter Edge Enablement on Unified Comfort Panels.

Software Requirements

  • The nodered_smb_fs_mail_sql app requires 768MB of RAM to run. The current limit of RAM available to Industrial Edge applications on WinCC Unified Panels devices is 768MB and for this reason no other Edge application can be running in parallel with the edge-node-red-smb-unified application.
  • The nodered_smb_fs_mail_sql app requires an active and properly configured WinCC Unified project present on the WinCC Unified Panel device. For details on how to integrate the edge-node-red-smb-unified app into a new WinCC Unified project see chapter WinCC Unified Configuration.
  • WinCC Unified and the nodered_smb_fs_mail_sql app require to use the Engineering software TIA Portal V17 - SIOS download link.
  • Firmware update v17 is required to be installed on the WinCC Unified Panel - SIOS download link.

Node-RED App

The nodered_smb_fs_mail_sql app can be downloaded in .app format using this secure Google Drive link:

App download and installation

To load the app on Unified Comfort Panels:

  1. Copy the downloaded nodered_smb_fs_mail_sql_x.x.x.app file to your Developer PC.
  2. Open the Industrial Edge Management Web Page of UCP on https://<ucp-address>.
  3. Import the .app file using the Import Offline button.

app-installation-1

app-installation-2

  1. Wait until the app is installed on the device.

app-installation-3

Run the App

Once the app has been installed the Docker service starts running immediately.

You can access the app web interface by clicking on the nodered_smb_fs_mail_sql app icon in Edge Device Web Page or through endpoint. The app has two HTTPS Endpoints configured with SIMATIC Edge Reverse Proxy function:

  • https://<ied-address>/edge-node-red : this endpoint opens up the Node-RED editor interface. This is the default endpoint.
  • https://<ied-address>/edge-node-red-ui : this endpoint opens up the Node-RED Web Dashboard.

To open the Node-RED editor a user must be logged.Below the default Login credentials:

  • user: edge
  • password: edge

node-red-login

A user must be logged on Edge Device in order to open Reverse Proxy App endpoints. If no user is logged the endpoint URL will give Error 503 on load.

If you need, is it possible to access the app Endpoints also by using the following direct URLs with mapped ports:

  • https://<ied-address>:41880 : this endpoint open the Node-RED editor interface.
  • https://<ied-address>:41880/edge-node-red-ui : this endpoint open the Node-RED Web Dashboard.

Extra nodes in package.json

This App is based on the official Node-RED Docker Image. On Node-RED Documentation Website you can find more information on How to Run Node-RED Docker and how to generate Image Variation for own customization.

In fact, Node-RED comes with a core set of useful nodes, but there are many more available from both the Node-RED project as well as the wider community. You can search for available nodes in the Node-RED library.

To add any extra nodes on Node-RED Docker base image it is necessary to insert them into the original package.json file available from node-red-docker Repository and build a new docker image.

The following snippets of package.json file lists all the extra nodes installed in this Node-RED App:

{
  ...
  ...
    "dependencies": {
        "node-red": "1.3.5",
        "node-red-hmi-subscribe-alarms": "file:hmi-runtime-subscribe-alarms",
        "node-red-hmi-subscribe-tags": "file:hmi-runtime-subscribe-tags",
        "node-red-hmi-write-tags": "file:hmi-runtime-write-tags",
        "node-red-hmi-read-tags": "file:hmi-runtime-read-tags",
        "node-red-hmi-read-alarms": "file:hmi-runtime-read-alarms",
        "node-red-contrib-ftp": "*",
        "node-red-node-base64": "*",
        "node-red-node-msgpack": "*",
        "node-red-node-random": "*",
        "node-red-node-suncalc": "*"
    }
}

You can also install nodes directly within the editor by selecting the Manage Palette option from the main menu to open the Palette Manager.

On Node-RED Documentation Website you can find more information on how to Add nodes to the palette.

Application example

Overview

This example shows how to archive five tags into a CSV file. The CSV file will be stored in the Application Volumes of Node-RED application cyclically, and will be then be copied periodically into a shared folder of a Windows PC and then sent by email.

Shared folder settings

From version 1709 of Windows 10, folder sharing via SMB protocol is disabled by default. The operations described in this paragraph allow to define a shared folder with correct settings and accesses.

shared-folder-setting

To access the folder, you need to create a new Windows user with a certain username and password. Please note that, in order to activate the new account, the PC must be restarted.

new-user

Once restarted the PC, set the remote access rights to the folder for the new user, as shown below.

rights-access-new-user

Check if the folder is reachable via \\IPAddress\SharedFolder.

shared-folder-connection

In case of access problems, check the following settings: File sharing setting and network discovery.

file-sharing-and-network

Check the allowed accesses as follows.

verify-access

WinCC Unified TIA Portal Project Upload

The included TIA Portal project is provided as an archive with a .zap17 extension. Therefore, it will be necessary to unarchive it.

  1. Use the provided archived project file edgetest.zap17. You can open the file with TIA Portal by double-clicking it.
  2. Upon opening you will be prompted for the save path of the retrieved TIA Portal project. Choose the folder of interest.
  3. Navigate to the Project View and in the Devices and Networks section configure the Unified Comfort Panel named "HMI_1" according to your network and hardware.
  4. Once you have adapted the project for your Unified Comfort Panel device, download the project using the Download button.
  5. Start the project on the Unified Comfort Panel device.

Below the HMI tags used and stored in this application example.

hmi-tags

Data processing in Node-RED

For HMI tags saving into a CSV file and for sending it by email, the following flows in Node-RED are used. For each flow used, below a brief explanation is presented.

  1. This first flow creates a file directory and sets the header of the CSV file that will contain the data points of the HMI tags values. CSV file creation is triggered daily and the file is newly created if not already present in the defined file directory.

flow-directory-creation-and-file

In this application example the considered file path is data/test/, which is already configured in Node-RED application. Eventually, if needed, the path can be changed.

flow-set-path

The header variable contains the structure of the CSV file. In this example the first column of the CSV file will be the timestamp (date and time of the acquired data), followed by one column for each variable name. In the configuration node, all CSV column names must be separated by a comma, as shown in the figure below for header variable.

HMI tag names are instead listed in taglist variable, separated by a space.

flow-set-header

The Generate Filename function node below takes care of decomposing the date and time of the panel so as to use them for the name of the generated CSV file. The file name will therefore be of the following type: logfile_2021_12_31.csv.

If necessary, it is possible to modify the names of the CSV files by changing the Javascript function defined within this node.

flow-generate-filename

  1. The second flow of this application example cyclically reads the HMI tags selected and save them into the CSV file.

flow-csv-file-writing

More in details, in the node highlighted below, the name of the HMI tag used as trigger must be written. This trigger is used to manually launch other HMI tags archiviation for a single read operation.

flow-read-command

In the following flow, HMI tag attivaLoggingContinuo is instead used as a trigger to activate a cyclic reading of the HMI tags.

flow-hmi-tag-archiviation

HMI tags are read and stored every 5 seconds. This parameter is configurable inside the inject node below:

flow-read-command

As for the node highlighted below, the following parameters need to be configured:

  • user: username;
  • pw : password;
  • smb = "//IP/sharedfolder".
  • smb_path = "/subfolder".

smb variable is the path of the shared folder, specified by using the IP address. smb_path is instead the name of the subfolder inside the shared folder.

flow-smb-path

  1. The flow below cyclically reads the Unified Comfort Panel folder and gives as an output the list of the filenames contained. Through the defined user credentials, all files are copied from the Unified Comfort Panel folder to the Windows shared folder.

flow-copy-files-to-shared-folder

  1. Last flow of this application example, reads the files in the directory, filters for CSV files only and, if any, sends them to the configured email address.

flow-csv-file-send-via-email

In details, the inject node above, triggers the email sending every Friday at 23:59.

flow_email_trigger

In Generate Email node, the email body must be specified, together with the recipient and the subject of the email.

  • msg.topic: email subject.
  • msg.payload: email body.
  • msg.to: email recipient.

flow_generate_email

For email sending to the recipient specified, the Node-RED node uses the following settings:

  • Server: smtp server of the provider.
  • Port: port 25 for non encrypted emails, ports 465 o 587 with TLS.
  • UserId: email address of sender.
  • Password: password of email account. In case of Gmail, check the following link. It might be necessary to authorize the access for external devices, as described in this link.

flow_email_node_settings

Documentation

You can find further documentation and help about Industrial Edge in the following links:

Contribution

Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.

License & Legal Information

Please read the Legal Information.

About

Node-RED image for Unified Comfort Panel, containing basic nodes for reading filedirectory smb, e-mail and database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published