Skip to content
PDF

S7 Client to cloud for visualization

This example demonstrates how to read data from an S7 demo server that provides temperature, revolutions and active digital inputs of a motor connected to an S7 PLC. The data is then visualized with the Central Data Services in the Management System.

The instructions below cover the following steps:

  • Provisioning an S7 demo server as a Docker workload
  • Deploying the provisioned Docker workload to the target node
  • Configuring the Data Services Gateway
  • Central data visualization in the Management System

Provisioning and deploying an S7 demo server at the node

First, the S7 demo server must be deployed to the node as a Docker workload. Download the Data Services S7 demo server found under Example Applications from the Nerve Software Center. This is the Docker image that is required for provisioning the demo server as a Docker workload.

  1. Log in to the Management System. Make sure that the user has the permissions to access the Data Services.
  2. Provision a Docker workload by following Provisioning a Docker workload. This example uses s7-demo as the workload name. Use the following workload version settings:

    Setting Value
    Name Enter any name for the workload version.
    Release name Enter any release name.
    DOCKER IMAGE Select Upload to add the Docker image of the S7 demo sensor that has been downloaded from the Nerve Software Center.
    DOCKER SPECIFIC INFO Select New port and enter the following settings:
    • Protocol: TCP
    • Host Port: 102
    • Container Port: 102
    Container name tttech-s7-server-demo
    Network name bridge
  3. Deploy the provisioned Docker workload by following Deploying a workload.

    Note

    Remember the node name and serial number of the target node. They are needed for the JSON configuration.

Configuring the Data Services Gateway

The configuration defines the S7 demo server that was deployed above as a data input and the NerveDB in the Management System as a data output. The S7 client will periodically read data from the S7 demo server and send it to the Management System. The temperature of the motor is stored in the datablock 0 with offset 0 and data type float. The number of revolutions of the motor is stored in the merker with offset 0 and data type uint32. Eight digital inputs from the demo server are also read as eight different boolean values.

  1. Access the Local UI on the node. This is Nerve Device specific. Refer to the table below for device specific links to the Local UI. The initial login credentials to the Local UI can be found in the customer profile.

    Nerve Device Physical port Local UI
    MFN 100 P1 http://172.20.2.1:3333
    Kontron KBox A-150-APL LAN 1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Kontron KBox A-150-APL chapter of the device guide.
    Kontron KBox A-250 ETH 2 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Kontron KBox A-250 chapter of the device guide.
    Maxtang AXWL10 LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Maxtang AXWL10 chapter of the device guide.
    Siemens SIMATIC IPC127E X1 P1 http://172.20.2.1:3333
    Siemens SIMATIC IPC427E X1 P1 http://172.20.2.1:3333
    Supermicro SuperServer E100-9AP-IA LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Supermicro SuperServer E100-9AP-IA chapter of the device guide.
    Supermicro SuperServer 1019D-16C-FHN13TP LAN3 http://172.20.2.1:3333
    Supermicro SuperServer 5029C-T LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Supermicro SuperServer 5029C-T chapter of the device guide.
    Toshiba FA2100T-700 First rear port http://172.20.2.1:3333
    Vecow SPC-5600-i5-8500 LAN 1 http://172.20.2.1:3333
    Winmate EACIL20 LAN1 <wanip>:3333

    To figure out the IP address of the WAN interface, refer to Finding out the IP address of the device in the Winmate EACIL20 chapter of the device guide.
  2. Select the arrow next to Data to expand the Data Services sub menus in the navigation on the left.

  3. Select Gateway.
  4. Select the Edit configuration icon on the right to enter editing mode.

    !Edit configuration

  5. Create a JSON file out of the following Gateway configuration:

    {
        "inputs": [
            {
                "type": "S7_CLIENT",
                "name": "s7_client_on_node",
                "serverUrl": "127.0.0.1",
                "port": 102,
                "connectionType": "PG",
                "pollingInterval_ms": 1000,
                "connectors": [
                    {
                        "name": "s7_demo_connector",
                        "datablocks": [
                            {
                                "name": "motor_temperature",
                                "datablock": 0,
                                "offset": 0,
                                "type": "float"
                            }
                        ],
                        "merkers": [
                            {
                                "name": "motor_revolutions",
                                "offset": 0,
                                "type": "uint32"
                            }
                        ],
                        "inputs": [
                            {
                                "name": "motor_input",
                                "offset": 0,
                                "quantity": 8,
                                "type": "bool"
                            }
                        ]
                    }
                ]
            }
        ],
        "outputs": [
            {
                "type": "NERVE_DB",
                "location": "CENTRAL",
                "connectors": [
                    {
                        "tableName": "s7_data"
                    }
                ]
            }
        ],
        "connections" : [
            {
                "name" : "s7_client_to_cloud",
                "input": { "index" : 0, "connector" : 0 },
                "output": { "index" : 0, "connector" : 0 }
            }
        ]
    }
    
  6. Select the Import button.

    !Import configuration

  7. Add the JSON configuration file containing the code above from the file browser.

  8. Select the Deploy button. A success message pops up in the upper-right corner.

    !Deploy configuration

The configuration is now deployed. The graphical configuration tool now reflects the contents of the JSON file. Exit editing mode by selecting the arrow on the left. Details of each input and output can be opened by selecting the magnifying glass symbol next to each input and output.

Select the Logs tab to view the Gateway logs for more information.

!Gateway logs

Central data visualization in the Management System

To visualize the motor temperature data in the Management System, open the central visualization element through the Data Services UI in the Management System.

  1. Select Data in the navigation on the left. The Grafana UI will open.

    Note

    Note that the navigation on the left collapses when Data is selected. Select the burger menu in the top-left to expand the navigation again.

  2. Select + > Dashboard in the navigation on the left. A box will appear.

    !Create dashboard

  3. Select Add Query in the New Panel box.

    !Add query

  4. Select the data source from the drop-down menu. The name of the data source is the name and serial number of the node, formatted as <nodename> (<serialnumber>).

    Note

    Note that multiple data sources can be selected in the Grafana instance in the Management System, depending on the number of nodes that are registered. Make sure to remember the serial number of the node that was used for workload deployment before.

    !Select data source

  5. Fill in the following query information:

    Setting Value
    FROM s7_data

    Time column: "timestamp"
    SELECT Column: motor_temperature
    Format as Time series
  6. Select the save icon in the upper-right corner to save the dashboard.

    !Save dashboard

The dashboard can be accessed from the Grafana home menu.

!Home menu access