Industry Automation and Drive Technologies - SCE
Training Manual for Integrated Automation Solutions
Totally Integrated Automation (TIA)
MODULE E12
VISION SENSOR Shape Checking with SIMATIC
Industry Automation and Drive Technologies - SCE
This manual was prepared for training purposes by Siemens AG for the project Siemens Automation Cooperates with Education (SCE).
Siemens AG does not guarantee the contents of this document.
Passing on this document as well as copying it, using and communicating its contents is permitted within public training and continued education facilities. Exceptions require the written permission by Siemens AG (Michael Knust michael.knust@siemens.com).
Violators are held liable to pay damages. All rights
We wish to thank the Michael Dziallas Engineering corporation and the instructors of vocational schools as well as all those who provided support during the preparation of this manual.
Industry Automation and Drive Technologies - SCE
The following symbols serve as a guide through Module E12:
Information
Programming
Sample Task
Notes
Industry Automation and Drive Technologies - SCE
1 PREFACE
Regarding its content, Module E12 is part of the instruction unit ???IT Communication with S7???.
Frequency Converter
at SIMATIC S7
2 to 3 days Modules H
IT Communication with SIMATIC S7
2 to 3 days Modules
E
Objective
In Module E12, the reader learns how networking and data exchange between PLCs and the vision sensor evaluation device VS120 is set up.
As PLC, the CPU
Module E12 shows in principle the procedure for the startup, based on a brief example.
.
Prerequisites
To successfully work through Module E12, the following knowledge is assumed:
???How to handle Windows
???Fundamentals of PLC programming with Step7 (for example, Module A3 ???Startup??? PLC Programming with STEP7)
???Fundamentals of network engineering (for example: Appendix V ??? Basics of Network Engineering)
Industry Automation and Drive Technologies - SCE
Hardware and software required
1PC, operating system Windows XP Professional with SP2 or SP3/Vista 32 Bit Ultimate and Business/Server 2003 SP2 with 600MHz (only XP)/1 GHz and 512MB (only XP)/1 GB RAM, free disk storage approx. 650 to 900 MB, MS Internet Explorer 6.0 and network card
2Software STEP 7 V 5.4
3SPS SIMATIC S7300 with CPU
-Power supply: PS 307 2A
-CPU: CPU
-Digital inputs: DI 16x24VDC
-Digital outputs: DO 16x24VDC/0.5 A
4SIMATIC VS120 evaluation device with sensor head and LED ring lamp
5Ethernet connection between PC, CPU
Industry Automation and Drive Technologies - SCE
2 NOTES ON USING THE CPU
The CPU
-The first interface is a combined MPI/PROFIBUS DP interface that can be used at the PROFIBUS DP as master or slave to connect distributed IO/field devices with very fast reaction time.
In addition, it is possible to program the CPU here by means of an MPI or PROFIBUS DP
-The second interface is an integrated PROFINET interface.
This allows for using the CPU as PROFINET IO controller to operate distributed IO on PROFINET. The CPU can be programmed by means of this interface also!
-Moreover, it is possible to use
Notes:
-In module E12, the CPU
-To run this CPU, a
-The addresses of the input and output modules can be parameterized at this CPU.
3 NOTES ON THE SIMATIC VS120 COMPONENTS
3.1 Product Description
The vision sensor SIMATIC VS120 is used to optically recognize and check objects applying the incident light method. The vision sensor SIMATIC VS120 checks whether the object is the correct one, whether it is intact, and what its position is.
The vision sensor SIMATIC VS120 supplies the following recognition values for object recognition:
???
???
???angle
???Quality values of the object being checked, number of the parts found
This object recognition data is transmitted to evaluation units in automation systems. The data is then processed in the evaluation units of the automation systems.
The vision sensor SIMATIC VS120 is suitable for the following:
???Recognizing parts for sorting tasks
???Determining the position for Pick&Place applications
???Existence check and position check in manufacturing
???Position check for feed engineering; for example, for swing conveyors <<?>>, workpiece carriers, circulation systems and gripper units as well as robots
???Quality control of checked objects
Industry Automation and Drive Technologies - SCE
3.2Performance Features
???Incident light method with LED ring lamp
???Object recognition with object search and object check
???Startup by means of setup support at the PG/PC with installed Internet Explorer
???Up to 20 object checks per second
???Up to 64 objects to be checked can be stored
???To sort the objects to be checked, 2 digital outputs are provided: OK, N_OK
???Operator interface is completely
???Extensive operating and monitoring functions also in the evaluation mode
???Extensive diagnosis functions and logging functions
???Firmware update by means of the operator interface of the Web browser
???Control by means of digital I/O, PROFIBUS DP and PROFINET IO
Result output by means of
???PROFIBUS DP
???PROFINET IO
???RS232 interface of an RS232 Ethernet converter
???TCP/IP connection of the PC/PG
3.3Function
Checking the properties of an object to be checked for correctness
64 models are provided to recognize objects to be checked. The SIMATIC VS120 checks whether the individual characteristics of the object to be checked are shaped as the trained model is.
When specifying the recognition and evaluation area, glossy areas on the objects to be tested are to be avoided.
Recognition principles of edges
To recognize image patterns, edges are used. These edges in the images are transitions from light to dark or vice versa. A model is generated from the sum of edges extracted in the picture, and from their arrangement.
Recognizing and localizing parts
The SIMATIC VS120 recognizes objects to be checked and determines the coordinates including the rotational position and forwards them
Checking a model for completeness
In addition, the SIMATIC VS120 checks the objects in question for completeness. Deviations from the trained model are detected, and the quality values of the evaluation are displayed.
Sorting functions of models in model sets
Depending on the importance of the application, it is possible to group and store 15 model sets for evaluation with 64 possible models. When evaluated with the SIMATIC VS120, the models are sorted
Industry Automation and Drive Technologies - SCE
3.4Recording and Reading Out Recognition Values in a PROFINET IO Environment
???By means of the Ethernet (TCP/IP) and a switch, a PC/PG is connected that is used exclusive for the setup process.
???By means of the Ethernet and a switch, a connection exists to an automation systems with PROFINET IO capability.
???The SIMATIC VS120 is controlled by the automation system.
???The result of the objects to be checked is read out via PROFINET IO to the automation system
Power
Supply
Automation System
Power Supply Cable
Functional Ground Cable
Illumination Cable
Sensor Cable
Sensor Head
Cable DI/DO
LED Ring Light
Conveyor
Conveying Direction
Additional information is provided in Chapter 3 of the operating instructions ???Image Processing Systems Vision Sensor SIMATIC VS120???.
Industry Automation and Drive Technologies - SCE
3.5Setting the Communication Interface of the VS120 to PROFINET
First, switch on the power supply of the evaluation device VS120 for the initial startup.
At the initial startup, "Factory Settings Used" appears on the LCD display.
Confirm with "OK".
The VS120 will then perform a self test:
???Checking the Ethernet connection
Press ESC
???Functional check of the sensor head
Press ESC
After completion of the self test, "Adjust" appears on the LCD display
Press OK to get to the main menu
At any additional start of the SIMATIC VS120, the evaluation device VS120 performs the following self test:
???Checking the stored settings and model data
???Checking the Ethernet connection
???If needed, checking the connection to PROFINET IO
???If needed, checking the Ethernet RS232 converter or TCP server and to the PC/PG <<?>>
???If needed, checking whether it is possible to exchange data from and to PROFIBUS DP
???Function check of the sensor head
???If needed, checking the connection for archiving the model data
If the self test ran without a fault, the following is indicated on the LCD display: the main menu, the display "Adjust", or the RUN menu, depending on the status at the last
You may have to press ESC several times to get to the main menu
In addition, we navigate in the LCD display between the menus, and make entries.
"Main" Menu:
To set the VS120 to PROFINET, we have to get to the ???Connect??? menu.
Place the cursor in front of Connect, and press the OK key.
Industry Automation and Drive Technologies - SCE
"Connect" Menu:
The Ethernet IP mode has to be set to PNIO.
Place the cursor in front of Ports and press the OK button
Place the cursor in front of Ethernet and press the OK button
Place the cursor in front of IP Mode and press the OK button
Place the cursor in front of PNIO and press the OK button
The evaluation device now requests a restart; press the OK button to confirm.
After the restart, the red bus error LED (BF) flashes until communication is established by means of PROFINET between a controller and the VS120.
ESC may have to be pressed several times to get to the main menu.
All additional information for operating the evaluation device is provided in chapters 8.3, 8.4 and 9.2 of the operating instructions
???Image Processing Systems Vision Sensor SIMATIC VS120???.
Industry Automation and Drive Technologies - SCE
4STARTING UP A PROJECT WITH CPU
Below, starting up the VS120 in a project is described.
As SIMATIC
In the CPU???s control program, a data structure has to be generated by means of a function block call (FB1) with data block (DB10).
The data structure looks like this:
Instance DB1
of FB1
All additional information is provided in Chapter 10 of the operating instructions ???Image Processing Systems Vision Sensor SIMATIC VS120???.
Industry Automation and Drive Technologies - SCE
4.1Setting Up a New Project
1.The central tool in STEP 7 is the ???SIMATIC Manager???. It is called here with a double click (??? SIMATIC Manager)
2.STEP7 programs are managed in projects. We are now setting up such a project (??? File ??? New)
3. Now, the project is assigned the ???Name??? ???VS120??? (??? VS120 ??? OK)
Industry Automation and Drive Technologies - SCE
4. Next, highlight your project and insert an ???Industrial Ethernet Subnet???. (??? VS120 ??? Insert ??? Subnet ??? Industrial Ethernet).
5. Now, a ???SIMATIC 300 Station??? is inserted (??? Insert ??? Station ??? SIMATIC300 Station)
Industry Automation and Drive Technologies - SCE
4.2Configuring the Hardware
6.With a double click, open the configuration tool for the ???Hardware???. (??? Hardware)
7. Open the hardware catalog by clicking on the symbol '???. (??? )
Insert the ???Mounting Channel??? with a double click (??? SIMATIC 300 ???
Note:
Then, a configuration table is displayed automatically for setting up Rack 0.
Industry Automation and Drive Technologies - SCE
8.Now, from the hardware catalog select all modules that are also inserted in your actual rack and place them in the configuration table. To this end, click on the name of the respective module, hold the mouse key and drag it to a line in the configuration table.
We start with the power supply ???PS 307 5A??? (??? SIMATIC 300 ???
Note:
If your hardware differs from the one shown here, simply select the corresponding modules in the catalog and insert them in your rack. The order numbers of the individual modules that are also inscribed on the components, are shown in the footer of the catalog.
Industry Automation and Drive Technologies - SCE
9. Next, we drag the ???CPU
The CPU???s order number and the version are provided on the front of the CPU.
(??? SIMATIC 300 ???
10.When entering the CPU, the window below is displayed. In this window, do the following: assign to the CPU
Industry Automation and Drive Technologies - SCE
Notes regarding networking on the Ethernet (additional information is provided in Appendix V of the training manual):
MAC address:
The MAC address consists of a permanent and a variable part. The permanent part ("Basic MAC address") identifies the manufacturer (Siemens, 3COM, ...). The variable part of the MAC address differentiates the different Ethernet stations and should be assigned globally unique. On each module, a MAC address specified by the factory is inscribed.
Value range for the IP address:
The IP address consists of 4 decimal numbers in the value range 0 to 255, separated by a period; for example: 141.80.0.16
Value range for the subnet screen form:
This screen form is used to establish whether a station or its IP address belongs to the local subnet, or can be reached only by means of a router.
The subnet screen form consists of 4 decimal numbers in the value range 0 to 255, separated by a period; for example: 255.255.0.0
The 4 decimal numbers of the subnet screen form have to contain
The values "1" determine the area of the IP address for the network number. The values "0" determine the area of the IP address for the station address.
Example: Correct values:
Incorrect value:
Value range for the address of the gateway (router):
The address consists of 4 decimal numbers in the value range 0 to 255 separated by a period; for example, 141.80.0.1.
Relationship of the IP addresses, router address and subnet screen form:
The IP address and the gateway address must differ only at those positions where a "0" is shown in the subnet screen form.
Example:
You entered the following: for subnet screen form 255.255.255.0; for IP address 141.30.0.5 and for router address 141.30.128.1.
The value for the IP address and the gateway address is to differ only in the 4th decimal number. However, in the example, the 3rd position already differs.
In the example, we have to alternatively change:
-the subnet screen form to: 255.255.0.0 or
-the IP address to: 141.30.128.5 or
-the gateway address to: 141.30.0.1
Industry Automation and Drive Technologies - SCE
11.Next, we drag the input module for 16 inputs to the 4th slot. The module???s order number is inscribed on the front. (??? SIMATIC 300 ???
Note:
Slot 3 is reserved for interface modules and remains empty for that reason. The module???s order number is shown in the footer of the catalog.
Industry Automation and Drive Technologies - SCE
12.Then, we drag the output module for the 16 outputs to the 5th slot. The module???s order number is inscribed on the front. (???
Note:
The module???s order number is shown in the footer of the catalog.
13.Now, we have to change the PROFINET device name to
Industry Automation and Drive Technologies - SCE
14.Then, drag the PROFINET IO System (100) module tier <<?>> toward the right, and from the folder PROFINET IO add the SIMATIC VS100 module VS120 by dragging it to the tier.
If module VS120 should not be available for selection, it has to be added by a data carrier by means of the menu ???Options??? Install GSD files.
15.Double click on the inserted module and change the device name to VS120x120 and the IP address to 192.168.0.120.
Industry Automation and Drive Technologies - SCE
16.Now double click on the control byte of the inserted module and change the address of the inputs to 10 and of the outputs to 20.
Hardware View
17. By clicking on '???, the hardware configuration is stored and compiled.
Industry Automation and Drive Technologies - SCE
4.3Assigning the Device Name
18.Highlight module VS120 and then select, via the menu ???Destination system???, at Ethernet ???Assign device name???.
Note:
A precondition for this is that the PG/PC interface is set to TCP/IP and the network card for the PC is configured correctly. For example, IP address 192.168.0.99, subnet 255.255.255.0 and router address
19. Highlight the VS100 module and then click on the button ???Assign name???. Close the window.
Industry Automation and Drive Technologies - SCE
20.By clicking on '???, we can now load the hardware configuration into the PLC. The operating mode switch should be on Stop! (??? ).
(After the hardware is loaded into the CPU, the red BF LED on the VS120 goes out)
21. Close the hardware configuration.
Industry Automation and Drive Technologies - SCE
4.4Inserting Blocks and FB1 and DB10 into the Project
From the template directory or from the Image Processing System SIMATIC VS120 V2.1 CD from the directory "Function Blocks???,
Add FB1 and DB10 to the block folder of the project.
Close the library.
Note:
Instead of library
4.5Function Block FB1
For a simpler handling of the functions of Vision Sensor SIMATIC VS12, the function block FB1 is provided for IO operations.
FB1 facilitates
Tasks of FB1
???Selecting a model or model set
???Reading the result data and storing it in DB10 (DB10 is included in the documentation package)
???Operating the control and status interface (triggering, result bits, ...)
???Transmitting the delay time of the trigger
???Reading out error indications
Industry Automation and Drive Technologies - SCE
FB1 Input Parameters
Address of the control byte in the SIMATIC VS120 interface that is entered under the Connection Control.
This parameter has to be wired.
Address of the status byte of the SIMATIC VS120 interface that is entered under Connection Control
Start address of the user data interface "Send??? of the
SIMATIC VS120/"Receive??? of the PLC
Start address of the user data interface "Receive??? of the SIMATIC VS120/ "Send??? of the PLC
Model number 1 to 15.
Note: For model changes, the DISA bit has to be set
Disable: disables manual key operation
Reset: Reset error evaluation device or FB error.
Note: Works also without setting the DISA bit
Trigger: Image pickup and starting the evaluation
Delay time: transfer of the trigger delay time to the
SIMATIC VS120 in us (value range: 0 to 9.999.999us).
Note:
The delay value is a multiple of 50us with rounding off limits of 0us or 50us. For example, 49us becomes 0us, 65us becomes 50us..
Receive: Receive area for the result values Permissible are only data block areas and the data type BYTE. This parameter has to be wired and the data block has to be at least as large as the maximum result to be expected.
Notes
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Industry Automation and Drive Technologies - SCE
FB1 Output Parameters
Notes
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Industry Automation and Drive Technologies - SCE
4.6Operating FB1
Model Selection
???To select a model, the DISA bit has to be set to 1.
???The desired model number is set up at FB1 input MODEL.
???The model change is completed when the TRD and RDY bit changes from FALSE to TRUE. The model number that was set up is placed on output MODEL_OUT.
???As long as no model was transmitted, 0 is read out at output MODEL_OUT.
???The output MODEL_OUT changes to 0 as soon as the DISA bit is reset.
???If MODEL = 0, the model that was selected last is retained. 0 is read out at output MODEL_OUT.
Reset
???When errors are reset, SIMATIC VS120 module errors (IN_OP = 0) and the FB1 transmission errors are reset.
Triggering
???With the trigger input at FB1, image evaluation with the SIMATIC VS120 can be activated.
???For mixed operation "Controlling by means of PROFIBUS DP and triggering by means of DI/DO??? the trigger signal can be connected directly to the evaluation device VS120. The FB1 parameter TRG remains free in this case.
Transmitting Delay Time
??? The time delay for hardware oriented trigger delays is set up at the FB1 parameter DELAY. With the delay time parameter, the value for the hardware oriented trigger supply can be specified.
Reading and transmitting result data
???The FB1 is always ready to receive.
???After an OK or N_OK evaluation, the result data is read out.
???The data is valid when bit NDR changes from 0 to 1.
???With the setup support under "Connections - Register Output" we are setting how many
Industry Automation and Drive Technologies - SCE
4.7FB1 Error Information
If an error occurs, ERROR = 1 is set.
The exact cause for the error is indicated in ERRCODE.
Error information
???0000: No error
???1xyz: Internal FB1error
???2xyz: Evaluation device error
???8xyz: Error indications of internal SFCs
Explanation
No error
Impermissible model number (parameter model). The values 1 to 15 are permissible
Impermissible reveive area. Only data type BYTE is permissible
Impermissible data area. Only data blocks are permissble
The receive area does not exist (data block not available)
The receive area is too short
The receive area is write protected
The delay value is outside the permissible range of 0 to 9.999.999us
Selected model number is not trained
Transfer of SFC14 and SFC 15 error indications
No module is configured for the specified logical base address
An access error was detected during the access to the IO
System error at the external PROFIBUS DP interface
4.8Data Block DB10
Tasks of DB10
DB10 is laid out for the structured acceptance/storage of the data from one Main ROI and a maximum of 16
.
Industry Automation and Drive Technologies - SCE
Structure of the DB10
(DB10 has a size of 246 bytes and can accommodate 16 SubROIs)
Industry Automation and Drive Technologies - SCE
4.9Supplementing the Symbol Table
Open the symbol table and enter the following symbol assignments.
Save and close the symbol table.
4.10FC10 Control Program
In FC10, we now generate the control program for the Vision Sensor Module VS120.
Generate FC10.
Industry Automation and Drive Technologies - SCE
The input/output addresses of the VS120 (hardware) have to be entered at the first four input parameters of FB1.
With input I0.0, the command for image pickup and for starting the evaluation is executed. With input I0.1, the error is reset if there is an error.
With input I0.2, operating the VS120 manually is disabled.
At input parameter RECV, DB10 is specified as ANY P#DB10.DBX1.0 BYTE 245.
In DB10, data is entered starting with Byte 1.
By means of the inputs Q4.0 to Q4.6, the VS120 status information is displayed.
FB1 is called on Network 1
Additional information is provided in Chapter 10.6 of the operating instructions "Image Processing System Vision Sensor SIMATIC VS120???.
Industry Automation and Drive Technologies - SCE
4.11Calling FC10 in OB1
Double click on OB1.
Enter symbolic name and symbol comment.
Confirm with OK
Enter Network 1.
Save and close OB1.
We now can load the program into the CPU.
Industry Automation and Drive Technologies - SCE
5.WEB SERVER BASED OPERATOR INTERFACE OF VS120
5.1Setting Up and Evaluating the Model
Open the Internet browser.
As link, enter the IP address 192.168.0.120 of the VS120.
To set the language, click on the German flag.
Industry Automation and Drive Technologies - SCE
Click on Set up Sensor.
On the left of the interface, you will see a selection of tasks in the form of buttons. Activate the desired task with a mouse click on the corresponding button. The associated dialog will then be displayed on the right side of the interface.
The Web server based interface for Vision Sensor SIMATIC VS120 provides the following dialog fields for image evaluation:
???Set up
???Connections
???Training
???Evaluating
???Options
???Info
???Managing
???Stop
A traffic light is located below the task buttons that shows you at a glance the current operating mode of the evaluation device VS120.
The traffic light can display the following states:
Industry Automation and Drive Technologies - SCE
Click on the button Set up.
Here, we specify the parameters for image pickup and image evaluation.
To create patterns that can be recognized, edges
Automatic exposure time should be selected only if the object to be checked is not moving.
Selecting the accuracy is based on the size of the search ranges and on the detectable changes of the object to be checked. Parts in the image are searched for pyramidically.
We start with a rough search with low resolution, and conclude with a detail search with a high resolution.
The accuracy influences the rough and detailed search.
The higher the checking accuracy, the longer the evaluation takes.
Additional information is provided in Chapter 4 of the operating instructions "Image Processing System Vision Sensor SIMATIC VS120???.
Industry Automation and Drive Technologies - SCE
Now click on the button Connections.
Then click on the tab Integration or on the button Continue.
As Trigger, set the source PROFINET IO.
At Connection, set the output, OK/N_OK, and controller PROFINET IO.
Click on Accept.
Next, click on the button Training.
Industry Automation and Drive Technologies - SCE
Then click on the button Continue, set the parameters and draw a circular ROI (Region of Interest) around the part.
Click on the button Continue
Additional information about the parameters is provided in Chapter 4.3 of the operating instructions "Image Processing System Vision Sensor SIMATIC VS120???.
Under the tab Edges, interfering or unimportant edges can be removed.
Industry Automation and Drive Technologies - SCE
Under the tab Test, the trained part is tested.
Click on the button Continue.
Industry Automation and Drive Technologies - SCE
Under the tab Save, save the model with the name Part1.
Now click on the button Evaluate and start the evaluation mode.
Set the CPU to Run and start the image evaluation with "Start??? (I0.0).
Industry Automation and Drive Technologies - SCE
Evaluation result: Faulty part with the Number 1 is too large and milling is crooked.
Evaluation result: Faulty part with Number 16 instead of Number 1
Industry Automation and Drive Technologies - SCE
5.2 Setting Up the Model Set and Evaluating the Model Number
Several models are to be trained and combined into a set.
Train parts 2 to 5.
Industry Automation and Drive Technologies - SCE
Parts 1 to 5 are to be combined into one model set.
Click on the button Options.
In the tab Extras under
Highlight Part1 to Part5.
Save Part1 with the names
Click on the button Accept.
All additional information about operating the Web server based interface is provided in Chapter 9.3 of the operating instructions "Image Processing System Vision Sensor SIMATIC VS120???.
Industry Automation and Drive Technologies - SCE
Now click on the button Evaluate and start the evaluation mode.
Set the CPU to Run and start image evaluation with ???Start??? (I0.0).
The work pieces are recognized.
Industry Automation and Drive Technologies - SCE
Even if the number is faulty, a parts assignment is still made by means of the shape.
Industry Automation and Drive Technologies - SCE
6 RESULTS OF IMAGE EVALUATION IN THE CPU
6.1 Web View of the Evaluation
6.2 DB10 Data View
The result of the image evaluation is stored in DB10
Industry Automation and Drive Technologies - SCE
6.3 Variable Table DB_Values
6.4 Symbol Table