installation manual plcsql link€¦ · · 2014-05-05installation manual plcsql link sql client...
TRANSCRIPT
Installation Manual
PLCSQL link
SQL Client in a
Siemens S7 PLC
Revision date: 2014-03-31 Revised by: Anders Jorsal, Automatic Syd A/S Version: 1.01
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 2 of 18
Contents
INTRODUCTION 3
SOFTWARE REQUIREMENTS 4
SETTING UP PLCSQL LINK 5
LOG VALUES 12
SQL CONTROLLER 14
CHANGE LOG DATA ARRAY LENGTH 16
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 3 of 18
Introduction
You can operate the PLCSQL link with different databases. But in order to get it to work out-of-the-box, it is important to setup the Database, to fit with the design for PLCSQL link.
• Have you chosen to operate the PLCSQL link, together with Microsoft SQL server? You also need to follow tutorial “MS SQL Installation Manual”.
• Have you chosen to operate the PLCSQL link, together with MySQL server? You also need to follow tutorial “MySQL Installation Manual”.
Bot manuals are available for download from www.plcsql-link.com/support
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 4 of 18
Software requirements
This example project is based on following software tools: PLC Program: Siemens Tia Portal V.12 HMI: Siemens Tia Portal V.12
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 5 of 18
Setting up PLCSQL Link
This chapter takes you through the process of creating your own PLC station and HMI interface for setting up PLC link to connect with the SQL database. The HMI is optional and not required for operation, but might help during commissioning to see status and test the system. Start by retrieving the delivered TIA Example project “PLC_SQL_M2.03_V12_SP1”.
Here you’ll find 2 PLC projects, The program of these two stations are identical, and can be used with e.g. S7-1200 or S7-1500 PLC's. Create your own station, with the respective PLC you are going to work with, you might want to create it in a separate project. Set up the hardware configuration, Set IP address for the Ethernet port. Compile it, and download the configuration to the PLC.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 6 of 18
Copy the whole program folder, from one of the example programs and replace the program folder in your new station or continue working on one of the sample stations. Download the blocks to PLC.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 7 of 18
Setup of the PLC is done through the HMI interface, for this we have created 3 example panels. That can help you getting started.
PLCSQL_HMI1200: Is suitable for using the KTP 400 Panels PLCSQL_HMI1500: Is suitable for using the KTP 400 Panels
HMI_1: Is designed for 10" screen panels, MP277.
The pages from these examples can freely be copied into your own user panel. This way, the setup interface for PLCSQL Link, has been created for you. You need to open 2 instances of TIA and copy the PLCSQL-Link under Program Blocks to your own project. The same you need to do under Screens and Tags for HMI, In this case you need to reconnect Tags. In this case we choose to run the application “PLCSQL_HMI1200”, in order to setup the PLCSQL Link. Open “Device Configuration” to setup the IP address for the HMI, to connect HMI to the same network as the PLC.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 8 of 18
After this click “Start Simulation”. You can now run the application in demo mode for commissioning and test.
RT Simulation Start Page: Errors are listed in the Status field.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 9 of 18
Now you need to setup the PLCSQL Link to match the Configured SQL database.
CPU / Memory card Serial number: By clicking Reset, the CPU and MMC card serial number of the actual hardware will be read out.
SQL client license key: By informing Automatic Syd, one of
the above mentioned serial numbers. By mailing Finn C. Nissen: [email protected], or fill out the form at www.plcsql-link.com/order A unique License key is being generated for you to type into the PLC. This License key is pared to the given serial number, and cannot be used on another device.
Type in the received License Key.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 10 of 18
SQL Username: Write the username created in the SQL database. SQL Password: Write the Password for the Username. SQL Database: Write name of the generated SQL Database (PLCSQL). SQL Server IP: Write IP Address of the SQL server. SQL Server port: Write 1433. Time before timeout: Write maximum time before timeout. Maximum retries: Number of retries allowed for the
client before giving up. Recipe SP: Query for receiving data from SQL. Log SP: Query for logging data to SQL.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 11 of 18
NOTE: After entering the communication setup, you need to click “Reset, for the
changes to take effect. Access the page “Main”. On this page status of the connection is displayed. The process can be reset, in order to re-initialize the connection.
It is also possible to see if the specific parameter has been updated in this particular recipe, by using the bit “SQL”.RecipeParm.UpdatedParameters[1..30100], according to the parameter number. NOTE: Following parameters are reserved for system information: 10001: SetCount 15001: SetID 30001: DateTimeStamp.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 12 of 18
Log values
For logging values to SQL, You can link or move the specific parameter numbers from the user program, and into the structured DB1 “SQL”. This is done in FC 462 “SQL_LogValues” For this particular value to be logged, you need to set the according bit “SQL_LogParm”.UpdatedParameters[1..30100] to true, while the log trigger is activated. In this way you can in a flexible way, define what to log, and when. NOTE: Following parameters are reserved for system information: 10001: SetCount 15001: SetID 30001: DateTimeStamp.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 13 of 18
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 14 of 18
SQL Controller
To set up the triggers for executing the querys from the PLC. You need to edit OB1 “Main”. If you choose to move the program blocks, in order to fit into your user program. You also need to change the DB pointers on the SQL_Controller, to the new range.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 15 of 18
To trig a log query, you can replace the “SQL.”LogStart” with your user defined trigger bit.
To get new parameters from SQL. You need to define the recipe name, for the dataset, GetData query should refer to. In SQL. Replace “SQL"RecipeDone”, with your user defined string.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 16 of 18
Change log data array length
The amount of data can be optimized, to fit the needs for your application. This example project is preconfigured to a limited range, in order to reduce unnecessary space obtained in the PLC. But can be expanded according to your needs. For setting up desired length of address arrays, you need to adjust two things. First open FB460146 “SQL_Controller”, where you can adjust the number of parameters assigned, in each datatype. Note: It is important that you only adjust the last number in the array, and that it doesn’t exceed the start number of the next array. This means that you Maximum can assign up to: Real: 9.999 parameters Integer: 4.999 parameters Double integer: 4.999 parameters Bool: 9.999 parameters String: 999 parameters Updated values: Must be able to contain the maximum number of
data, you need to handle in one query.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 17 of 18
Updated parameters: Contains a bit for each parameter, therefore range
must cover the maximum number for paramstring.
Installation Manual: For PLCSQL link with Siemens TIA
Subj. PLCSQL in TIA Document: PLCSQL PLC TIA Installation
Manual_V1_02.docx
Ref. 158397AJO Version 1.02 Revision: 2014-03-31 by FBH
Page 18 of 18
After editing these array lengths, the whole project needs to be saved, compiled and downloaded. In FB460 “SQL_Controller”, Max and Min ranges for each data type must match the ranges.