Hello and welcome to a new guide on how to best use Movicon.NExT™.
In this technote, we are going to show you how to visualize the
historical of a tag’s values coming from a PLC by using the Historian
Viewer object.
Historical data visualization
Movicon.NExT offers several graphical objects to display and view
the history of tag values stored on a database with the Historian
module or the Data Logger module. These objects include:
The Data Analysis Trend.
Historian Viewer for tags stored with the Historian module.
Data Logger Viewer for tags stored with the Data Logger module.
Example
In the following example you will see how to visualize the trend of a tag from a PLC Modbus TCP simulator by using the Historian Viewer object. The procedure to display stored data in the Data Logger object is similar to this one.
The simulator used in this example is the ModRS_Sim, which is available and offered free of charge on the internet.
Start up the Modbus simulator by double-clicking on its icon and then load a script to simulate the values.
If you do not have any scripts ready, you can use the following code saved on a file with the .vbs extension:
dim x
dim n
n=0
for n=0 to 240
x = getregistervalue(3,n)
SetRegisterValue 3, n, x+1
next
How to insert and configure the driver
After having started Movicon.NExT up in development mode and created, or loaded, a project:
Open the I/O Data Server located in the Project Explorer window resource tree.
Select the Drivers tab to add the Modbus TCP-IP driver.
Once the Drivers tab is opened, right-click on the workspace and select Add New Driver from the menu that appears.
Search for and select the Modbus TCP-IP driver from the list. Click on the arrow to go ahead and configure it.
Leave all settings set for default in the Driver's General Settings window and proceed by clicking the arrow to go on to the next step.
Insert the IP address of your PLC in the Driver’s Channel configuration. In our example, we have the Modbus simulator on the same device in which Movicon.NExT is installed, therefore, we shall insert the local loopback IP address which is 127.0.0.1. Leave the other properties set as default and continue with the configuration.
Leave all the properties set for default in the Driver’s Station configuration window.
Click Finish to terminate the configuration and insert the Driver on the Drivers List.
How to create the tag
We shall now define an Int16 type tag to connect to the PLC simulator. To do this:
Open the I/O Data Server located in the project tree in the Project Explorer window.
Access the Tags List by selecting the corresponding I/O Data Server’s tab.
Right-click on the workspace and select the Add New Tag option from the menu that opens.
Configure the tag by using its properties window in the following way:
Name
MbtcpTag
Model Type
Variable
Data Type
Int16
Click on the Accept Changes button on the tag’s properties window to toolbar.
Search for the Physical I/O Address option the tag’s Execution properties and click on the three dotted button on the right to open the PLC address configuration window.
In the popup that appears, leave the properties set for default and only configure the station, if not already done so, by using the combobox.
Click Ok to confirm.
Confirm the changes by clicking on the Accept Changes button on the tag’s properties window toolbar.
Now that you have finished configuring the tag, save the project by clicking on the Save All button on the Movicon.NExT Editor’s toolbar at the top.
How to create the Historian
Now that the driver and tag have been instantiated, you can proceed with creating the Historian and assigning the MbtcpTag tag to it. To do this, open the I/O Data Server and then:
Open the Historians tab.
Right-click on the workspace and select the Add New Historian option from the menu that appears to add and start configuring the new Historian in the project.
Set the Historian as needed by changing the values of the options in its Properties Window.
To assign the MbtcpTag tag to the newly created Historian:
Select and right-click it.
Select the Assign Tag option from the menu that appears.
Select the MbtcpTag tag from the list that appears and click the OK button to confirm.
How to create the screen
Now, we will need to create a screen:
Look for the Screens resource in the project's tree structure in the Project Explorer window and select it.
Right-click it and select the New option from the menu which opens
A New Screen popup will appear through which you can set the screen's main properties. Configure the screen as follows:
Width:
1920
Height:
1080
Name:
Main
Click the OK button to confirm the configuration.
Once the screen has been created, you can then change the project's properties by inserting the screen as the project's Main screen which will show when the project starts up. To do this:
Select the name of the project from the application's tree structure.
Open the Properties window.
Change the following project properties in this way:
Startup Page Type: Main Screen
Startup Screen Name: Main
Once you have finished configuring the project startup page, click on the Save All icon located on the toolbar at the top to save the project.
Now, open the Main screen and click on the Toolbox tab, which is located on the far right of the editor window, next to the properties window, to open the Toolbox library provided by Movicon.NExT.
Select and drag the Display and Historian Viewer objects on screen. These objects are found in the Displays and Historian Data Viewers folders, respectively.
Assign the MbtcpTag tag to the Display object in this way:
Select the Display object on screen and open its Properties Window.
Go to the Tag property and enter the MbtcpTag tag name in the textbox to assign it to the object.
Save the changes by clicking on the Accept Changes button on the tag’s properties window toolbar at the top.
We shall now configure the grid to display the data in table format:
Select the Historian Viewer that you previously inserted on screen and open its Properties Window.
Go to the Historian Name property and use the combobox to select the historian we created and configured beforehand.
Save the project by clicking on the Save All button on the Movicon.NExT Editor’s toolbar at the top.
Runtime Test
Now test everything in runtime mode by clicking the Start Runtime icon.
As soon as the configured Modbus TCP IP Driver starts reading data coming from the PLC simulator at runtime, you will see the current tag value in the Display object and see the grid populated with data from the database. To update this data, click on the object’s Refresh button.
The Historian Viewer object allows you to export the data displayed in various formats (CSV, HTML, XLS, PDF). To export data, simply select the format desired from the combobox and then click the Export button.