LoggerAPI

Supported hardware and firmware

Cloud Logging using the LoggerAPI is supported on the x500 in firmware 3.7 and up. Please upgrade your firmware if you are running an older version.

Activate Cloud Logging

Please first activate Cloud Logging (or start the 30 day free trial) if you haven't already.

The Second step in Cloud Logging is setting up a data source. This is done by selecting a communication protocol and defining the variables. This article shows you how to do this for communication via the LoggerAPI protocol.

Select a communication protocol

You first have to select a communication protocol. This is the protocol that the x500 will use to communicate with the PLC.

  • Go to the Fleet Manager app, which is accessible from the Apps menu in the top right corner if you are currently in a different X4 Remote app.
  • Open the Main menu, go to Devices, and select the concerning device.
  • Click on the Add a service icon in the left menu, select [Data source], and then select [LoggerAPI].
  • Enter the requested information (details below) and click on [Add].
Field Description
Name Enter a name for the data source.
Identifier The identifier ensures that every data source remains unique, even if they share the same name.
IP address

Enter the IP address of your PLC.

Password Choose a password, you will need this later on.
Polling sleep time Leave this field to “None”.

Add variables

Once you’ve added a data source and selected a communication protocol, you can start adding variables. You can do this by following the steps below:

  • Expand the Data source service and go to [Variables].
  • You can now choose to:
    • Manually add new variables
    • Import variables from a file (or device)

Manually add new variables

  • Click on [Add variable] in the bottom right corner.
  • Enter the requested information (details below) and click on [Add].
Field Description
Name Enter a name for the variable.
Identifier The identifier ensures that every variable remains unique, even if they share the same name.
Type Select the variable’s data type (bool, int, float, etc).
Address Choose an address for this variable (e.g. b1 or TemperatureZone6), you will need this later on.
Factor Multiplies the value (leave empty if the data type is boolean).
Unit Displayed text behind the value.

You have now made the changes in X4 Remote, but these are not yet active in your device. You will need to push your changes to your device for them to take effect. During this next step, your device may temporarily disconnect and LAN communication may be temporarily interrupted . This may take a minute.

  • Click [Push config to device] in the top right corner.

Next step
Now that you've added the variables, you can send data to the x500 and test if everything is configured correctly.

Import variables from a file (or device)

You can easily and effortlessly copy variables from one device to another by exporting the concerning variables (view the “Manage variables” part of this article) and then importing them in your new device. Alternatively, you can manually prepare your variables in the required CSV format to load them all at once into your configurator. The CSV file structure is explained in our Import variables article.

  • Click on [Import from CSV-file] in the top right corner of the screen.
  • Select a CSV file to import and click on [Open].

You have now made the changes in X4 Remote, but these are not yet active in your device. You will need to push your changes to your device for them to take effect. During this next step, your device may temporarily disconnect and LAN communication may be temporarily interrupted . This may take a minute.

  • Click [Push config to device] in the top right corner.

Next step
Now that you've added the variables, you can send data to the x500 and test if everything is configured correctly.

Connect to the x500 and send data

The x500 is now listening and waiting for data. From the connected PLC you’ll now need to connect to the x500 and then send the data at the moments you want to log them.

LoggerAPI is a line based protocol where each line is terminated by a newline (\n), carriage return (\r), or a combination. Newlines are not allowed in arguments unless escaped. Arguments may be separated by several spaces, though recommended is the absolute minimum; no spaces if another separator was used, or one space if the space is the separator.

We also have a brief overview of possible errors you may encounter:

Connect to the x500

The x500 is listening on port 9230 for a TCP connection. The exact steps on how to establish a TCP connection from your PLC may differ per manufacturer. If you’re unsure whether your PLC support this, or how you can do this, please contact your manufacturer.

  • Establish a TCP connection from your PLC to the x500’s LAN IP address on port 9230. For example, using netcat:
            netcat 192.168.140.1 9230

If all went well, you should see the x500’s reply “HELO”.

Now that you have a TCP connection, you need to connect to the data source that you created. To do so you’ll need to know the IP address and password you entered when you created the data source.

  • Establish a connection to the data source, using the IP address and password you entered for the data source earlier, using the following syntax:
            DEVC <data source IP addres> <data source password>

    For example:

            DEVC 192.168.140.10 1234

If all went well, you should see the x500’s reply “DEVC OK”.

Send data to the x500

Now that you’re connected, you can start sending data. To do so, you’ll need to know the variable’s address that you chose when you created the variable in X4 Remote.

  • Send data to the x500 using syntax:
            @<address>=<value>

The syntax of <value> differs per data type. An overview including examples is shown below.

Data type Details and example
Boolean t=True
f=False
Example:
        @bool=f
Integer Numeral value. Example:
        @int=153
Float Point separated value. Example:
        @float=152.7
String String length separated from the string value by a comma. Example:
        @string=6,Halted

Close the connection

To close the connection you can use the EXIT command:

 

EXIT

 

Common errors

Below is an overview of common errors that you may encounter accompanied by a description.

Error Description
EROR <message> A general error response. The message should contain a readable explanation of what went wrong. The message may contain spaces, everything that comes after EROR will be the message.
TGNF @<address> The tag with the given address was not found. The PLC should stop sending data values for this address or the address should be added in X4 Remote data source and pushed to the x500.
INVL <message> The value received by the x500 does not match the variable definition as it is configured in X4 Remote data source. The PLC should stop sending invalid data values for this address.

Next step
Now that you can send data to the x500, you can test if everything is configured correctly.

Test variables

The test utility is used to check if all the added variables are set correctly. It displays each variable’s current value if everything is configured correctly and the PLC sends data to the x500. If not, the values will stay empty. The test utility will attempt to update values every 0.5 seconds, regardless of how often it’s actually being logged (this does not count towards your license’s dps/hr). Please follow the steps below to test your variables.

  • Expand the Data source service, go to [Variables], and click on [Run test] at the top.

A connection will now be set up to stream the data directly to your computer, using:

Port Transport protocol Application protocol
443 TCP WebSocket

You will see live values of all variables, if the configuration is set up correctly and the PLC sends data to the x500, otherwise the values will stay empty.

Unexpected result?

If the test utility shows unexpected values, please check if the addresses and data types of all variables are entered correctly. If you get no data at all, please also check that the above listed port and protocols are not being blocked by your computer's or company's firewall.

Next step
Now that you've tested the variables, you can view our "Configure data tags" guide to start logging.

Manage variables

You can view all defined variables on the variables page:

  • Expand the Data source service and go to [Variables].

You can [Edit] individual variables, [Remove] individual or a selection of variables, and export all or a selection of variables.

Variables can be selected by clicking the checkbox on the left, or you can select them all by clicking the checkbox at the top.

 

Kontaktní formulá?