Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Scorpion - Demo 1- Label on Syringe Page 1.

Similar presentations


Presentation on theme: "Introduction to Scorpion - Demo 1- Label on Syringe Page 1."— Presentation transcript:

1 Introduction to Scorpion - Demo 1- Label on Syringe Page 1

2 An introduction to Scorpion based on Demo 1 – Label on syringe Scorpion 1.70 16. January 2003 Thor Vollset – TORDIVEL AS

3 Introduction to Scorpion - Demo 1- Label on Syringe Page 3 Label system description Scorpion Vision Software Industrial PC (IPC) One industrial camera Lighting Host Communication

4 Introduction to Scorpion - Demo 1- Label on Syringe Page 4 Task - Label Measure –Label position on syringe Resolution 1/100 mm Tolerance 5/100 mm Check –Position is between 3.6 and 3.85 mm.

5 Introduction to Scorpion - Demo 1- Label on Syringe Page 5 Setup Image shows syringe with label. The syringe is illuminated with a diffuse lighting with a dark background. This reduces reflections and ensures edge contrasts. To measure the label position it is necessary to constructs a reference line defined by the two edgepoints where the syringe starts to get smaller. The image is captured with an industrial Sony b/w camera XC-75, 760 x 570 pixels and 256 gray levels

6 Introduction to Scorpion - Demo 1- Label on Syringe Page 6 Scorpion in Operation

7 Introduction to Scorpion - Demo 1- Label on Syringe Page 7 System Requirements Regional Settings –English US

8 Introduction to Scorpion - Demo 1- Label on Syringe Page 8 Operation Screen Operation consists of –Image with visualization –Indicator panel –State panel –Web page – custom user interface Statistics User configuration

9 Introduction to Scorpion - Demo 1- Label on Syringe Page 9 Label block diagram

10 Introduction to Scorpion - Demo 1- Label on Syringe Page 10 Starting Scorpion Starting Scorpion is normally executed from the Scorpion program group

11 Introduction to Scorpion - Demo 1- Label on Syringe Page 11 Automatic start using a shortcut A shortcut is defined by setting the path: –..\scorpion.exe system= In the label demo the following is defined: –...\scorpion.exe system=.\label

12 Introduction to Scorpion - Demo 1- Label on Syringe Page 12 Profile selection dialog If no path is specified on the Scorpion command line the profile selection dialog is activated The following operations is supported from the dialog: –Start profile –Create / delete and copying of profiles –Create shortcuts

13 Introduction to Scorpion - Demo 1- Label on Syringe Page 13 Creating label test profile Precondition –Scorpion 1.70 installed –Demo 1 – Label installed Create shortcut to Scorpion.exe Create test profile –Start Scorpion –Press New in profile selection dialog Name profile Test –Select Default profile Press Copy to transfer profile to test –Start Test profile by pressing OK

14 Introduction to Scorpion - Demo 1- Label on Syringe Page 14 System log Error messages and events are collected in the System log There are five levels of messages System log operation is supported from a popup menu. It is an important source of information under operation and configuration. Hint 1 – If nothing happens or you do not understands what happens – take a look at the system log. Hint 2 – It is always save to restart Scorpion. The profile is always persistent.

15 Introduction to Scorpion - Demo 1- Label on Syringe Page 15 Password protected profiles Scorpion has three modes of operation: –Operation –Settings –Service Password to service and settings are: –911 –1234 Press Service –911 OK opens Service Mode

16 Introduction to Scorpion - Demo 1- Label on Syringe Page 16 Service mode In service mode gives the user access to profile configuration Main modules are –General –Scheduler –Actions –Toolbox –Camera –Communication

17 Introduction to Scorpion - Demo 1- Label on Syringe Page 17 Camera Setup – Service.Camera In this profile we grab images from a directory –Camera driver is FireGrab.dll It is easy to switch from live camera to file –File simulation is turn on/off by Image Settings.Simulate Hint : Live video is also supported

18 Introduction to Scorpion - Demo 1- Label on Syringe Page 18 Camera Setup Add a new camera –Or choose an existing camera Select grabber and port in Camera Setup –Port must be unique Select camera type ”Advance” opens the camera property pages –Documentation from camera vendor

19 Introduction to Scorpion - Demo 1- Label on Syringe Page 19 Camera Support All cameras are activated from Device Manager is available in Scorpion WDM-Drivers and documentation is normally provide by the camera vendor Scorpion is based on DirectShow and support all cameras with WDM-driver Scorpion is tested with FireWire cameras from Sony, Unibrain, Imaging Source in addition to web cameras from Logitech

20 Introduction to Scorpion - Demo 1- Label on Syringe Page 20 File simulation Activate simulation under service/camera/image settings Press Edit to change simulation directory –Set Image Name = Syringe –Directory selection – next page –A file filter is supported –Scorpion supports standard bitmap files in simulation mode

21 Introduction to Scorpion - Demo 1- Label on Syringe Page 21 Choose simulation directory Active Simulate under Service.Camera.Image Settings Press Edit –Choose directory... \Label\Images –Press OK –Close Image Configuration Verify image directory by pressing Snapshot –Image of the Syringe is shown on the left hand side of Scorpion

22 Introduction to Scorpion - Demo 1- Label on Syringe Page 22 Image operations By using the image menu on can perform operation on the active image The following operations are available by right clicking the mouse on an image Cursor position with intensity Distance measurement Copy/Store images with or without overlay graphics Image zoom Polygon construction

23 Introduction to Scorpion - Demo 1- Label on Syringe Page 23 Image processing - Toolbox The image processing is defined under Service.Toolbox The image processing consists of a sequential list of user created and configured tools. Scorpion has a number tool categories: –Basic, Data, Edge, Reference and Advanced tools All tools can be activated / deactivated by the user or by using guards reflecting the image processing state A tool is connected to an image and a reference tool

24 Introduction to Scorpion - Demo 1- Label on Syringe Page 24 Help - Toolbox All tools has a Help button By pressing the help button context sensitive help is activated

25 Introduction to Scorpion - Demo 1- Label on Syringe Page 25 Image processing steps Image processing typically divided in the following steps: Define reference system Declare external data Locate object Image Processing Classification Prepare data for host communication

26 Introduction to Scorpion - Demo 1- Label on Syringe Page 26 Creating the Reference System Activate Service.Toolbox.New to create MMReference of ScaleReference type Set x and y scale to 24.8 Active Results tab –Set unit for pixel resolution to mm by using the popup menu Note that an image must be captured for Results.pixel resolution to be defined

27 Introduction to Scorpion - Demo 1- Label on Syringe Page 27 Defining the reference system With Scorpion reference systems are defined with a family reference tools. In the label case MMReference of type ScaleReference is used to transform pixels to mm. With x and y scale of 24.8 the pixel resolution is 0.04 mm Check MMReference.Results The scalefactor was defined by using a ruler.

28 Introduction to Scorpion - Demo 1- Label on Syringe Page 28 External Data The three tools Lowtolerance, Distance_Low and Distance_High of type ExternalScalar is set from the PLC using the user defined actions Mode_Lowtolerance og Mode_Hightolerance The data tools are later used to set boundary values for the corresponding Logic Tools Distance Cannot Measure is defined to capture values obvious wrong

29 Introduction to Scorpion - Demo 1- Label on Syringe Page 29 Data Tools Active Service.Toolbox.New to create the following tools: –ExternalScalar Distance_Low Distance_High Distance Cannot Measure –ExternalLogic Low tolerance

30 Introduction to Scorpion - Demo 1- Label on Syringe Page 30 Limit values Two modes are defined: Sample test – Lowtolerance Operation Sample test limits are Low = 3.60 mm and High = 3.85 mm Operation mode limits are Low = 3.40 and High = 4.00 mm Distance Cannot Measure are 1.00 mm – The assumption is that all values less than 1.00 mm is erroneous and thus are classified Cannot Measure

31 Introduction to Scorpion - Demo 1- Label on Syringe Page 31 Setup Distance_Low Open Service.ToolBox Update Distance_Low by selecting this tools and pressing Edit Active the Setup tab Turn on Make external changes permanent – Scorpion will remember this value after restart Initial value to 3.40 This is the Operation Mode limit Hint : Limit values for sample mode is set by user defined actions

32 Introduction to Scorpion - Demo 1- Label on Syringe Page 32 Define precision and unit The user defines a result’s precision and unit manually by activating a tools results tab and right clicking the actual result. Set Distance_Low precision to two decimals and the unit to mm. Repeat the same for Distance_High and Distance Cannot Measure For Lowtolerance set precision to 0 and unit to [bool]

33 Introduction to Scorpion - Demo 1- Label on Syringe Page 33 Setup External Data Set the following values:: Distance_High –Initial value = 4.00 mm Distance Cannot Measure –Initial Value = 1.00 Low tolerance –Initial Value = 1 –1 means operation mode

34 Introduction to Scorpion - Demo 1- Label on Syringe Page 34 Backup of profile Activate Service.Maintenance Press Backup –Add comment –Press OK Hint : Profile Backup ensures simple restore of a working profile

35 Introduction to Scorpion - Demo 1- Label on Syringe Page 35 Locate syringe The following steps are performed to locate the syringe: Calculates blob threshold with Lightmeter Finds course location of syringe with blob - FindSyringe Establishes SyringeReference using three edge finders: –Left Edge –Upper Left Edge and Upper Right Edge

36 Introduction to Scorpion - Demo 1- Label on Syringe Page 36 Locate Syringe - LightMeter Activate Service.Toolbox Create LightMeter – IntensityTool. Set MMReference as reference. Using LightMeter an adaptive threshold for the blob Find Syringe is calculated. The LightMeter ROI is defined in a narrow band across the syringe. The LightMeter’s 70 % percentil is a good candidate for the Find Syringe threshold. Using this threshold makes Find Syringe robust to light variations. The LightMeter’s ROI is in a narrow band across the syringe.

37 Introduction to Scorpion - Demo 1- Label on Syringe Page 37 Find Syringe Create Find Syringe – BlobTool. Set MMReference as reference. Find Syringe requires that the light area of the syringe is greater than 10 mm2. The ROI is around the syringe. The size defines how large variation in syringe position the system can tolerate. Hint : All values are in mm. This is defined by the reference MMReference

38 Introduction to Scorpion - Demo 1- Label on Syringe Page 38 Verify – Find Syringe Verify –Press Start Check that Blob locates syringe on all images –Press Stop to terminate Activate Find Syringe.Visualization –Turn off all elements except MaxContour and Center Of Gravity Turn off Show graphics on LightMeter.Visualization Hint : A tool can be examined in detail using Visualization – this only

39 Introduction to Scorpion - Demo 1- Label on Syringe Page 39 State – Syringe Present Create the Lag logic state Syringe Present - LogicTool Open Syringe Present and activate the Setup tab. Add a new condition pressing New Set Find Syringe.Total blob area greater than 40 mm2. Set Syringe Present to false if condition is undefined. In this case this means that Find Syringe has failed.

40 Introduction to Scorpion - Demo 1- Label on Syringe Page 40 Locate Syringe Using edge finders the upper left edges of the syringe is located. The following edge finder – LineEdgeFinderTool is used: Find Left Edge Find Upper Left Edge Find Upper Right Edge Tracecomb Find Upper Left Edge

41 Introduction to Scorpion - Demo 1- Label on Syringe Page 41 Setup Find Left Edge Create a tool – LineEdgeFinderTool named Find Left Edge Set Find Syringe as reference –Press Apply –Turn on visualizations – trace lines –Activate Show Info – Image Menu Position mouse at left edge to find center of ROI Hint – All values are in mm

42 Introduction to Scorpion - Demo 1- Label on Syringe Page 42 Advances setup LineEdgeFinderTool Differentiation = 1 –This means that seek peaks where the derivative is at it’s maximum. This is robust and handles light variations. Smooth base and counter = 4 and 2 –Means that the trace combs is filtered to remove noise Fit-tolerance = 0,08 –This means that all points used in the curve fitting is in a band of 0.08 mm – approx 2 pixels Good-fraction = 12 points –This means that more than 12 of the trace combs has edges for the fitted line to be accepted

43 Introduction to Scorpion - Demo 1- Label on Syringe Page 43 Verify Find Left Edge Activate Find Left Edge.Results Hint : Press Start and run live inspections – the results are updated continuously Check the Gradient against Setup.Threshold –Gradient should be minimum 1.5 – 2 time the threshold Line-fit 0.0247 means that the points on the calculated line has a noise approximately half a pixel –The edgeline has a greater accuracy than half a pixel –The LineEdgeFinderTool has sub-pixel resolution

44 Introduction to Scorpion - Demo 1- Label on Syringe Page 44 Find Upper Right Edge Activate Service.Toolbox Select Find Left Edge Open mouse menu –Press Copy Open mouse menu –Press Paste Select Copy of Find Left Edge Name Find Upper Right Edge Select Find Upper Right Edge –Press Edit Move Find Upper Right Edge ROI to the right side of the syringe – see image –Remember to rotate trace comb

45 Introduction to Scorpion - Demo 1- Label on Syringe Page 45 Finn Upper Left Edge Activate Service.Toolbox Select Find Upper Right Edge Open mouse menu –Press Copy Open mouse menu –Press Paste Select Copy of Find Upper Right Edge Name Find Upper Left Edge Select Find Upper Left Edge –Press Edit –Move ROI to left side of syringe

46 Introduction to Scorpion - Demo 1- Label on Syringe Page 46 Locate – Reference Line Create Reference Line - LineFromPoints Reference Line is defined by the Find Upper Left and Find Upper Right Edge center points.

47 Introduction to Scorpion - Demo 1- Label on Syringe Page 47 Locate – Syringe Reference Create Syringe Reference – PointLineReference Set the reference to MMReference Reference Line and Find Left Edge defines a reference system that handles syringe rotation and translation. The rest of the image analysis benefits from this. It is important that Reference Line is defined as the first tool in PointLineReference because the first points handles rotation.

48 Introduction to Scorpion - Demo 1- Label on Syringe Page 48 Syringe Width Create Syringe Width- LineEdgeCaliper –Purpose measure width of syringe in mm LineEdgeCaliper has two trace combs – see image. Select Syringe Reference as reference. Using Syringe Reference means that the tool is relatively positioned and all parameters and results are in mm inherited from MMReference. Set Trace line start and end point to 2 and 6 – remember to set the angle and threshold Remember to set fit-tolerance in mm. A good starting point is 0.04 mm – equal to the pixel size. Set number of trace lines to 21 Set unit and precision of the width and line fit results to mm and two and four decimals. Nominal width is 8.90 mm

49 Introduction to Scorpion - Demo 1- Label on Syringe Page 49 Measure label position Using two edge finders the left edge and the left slope edge is found. The intersection of these lines defines where the syringe bends. The same applies to the right side of the syringe. The two bends points is used to construct a Label Reference Line. Using a blob Find Marker and an edge finder the upper edge of the upper marker is located precisely. The label position is defined as the distance between the Label Reference Line and the Upper Marker Edge. The distance is classified and is presented in mm i the state panel.

50 Introduction to Scorpion - Demo 1- Label on Syringe Page 50 Find Left Slope Create Find Left Slope – LineEdgeFinderTool Make a copy of Find Left Edge Paste Find Left Slope Select Find Left Slope Set Syringe Reference as reference Activate image menu Show Info Set ROI center and correct angle Hint : By activating Visualization.Tracelines one can see where the trace comb hits the edge

51 Introduction to Scorpion - Demo 1- Label on Syringe Page 51 Find Lower Left Edge Create Find Lower Left Edge – LineEdgeFinderTool Copy Find Left Slope Paste Find Lower Left Edge Select Find Lower Left Edge Activate image menu Show Info Set new roi center and correct angle Hint – Gradient is lower on this edge and threshold must be lower on this tool. The edge detection can be improved by smoothing or increasing the number of trace lines.

52 Introduction to Scorpion - Demo 1- Label on Syringe Page 52 Right side edgefinders The easiest way to configure Find Right Slope and Find Lower Right Edge is to copy the corresponding left edge finders After copying –Change ROI Center and angle –Turn on trace line visualization to see where the trace comb is located –Verify edge polarity and threshold Hint – When moving a copied tool it is very convenient to activate Visualization.this only

53 Introduction to Scorpion - Demo 1- Label on Syringe Page 53 Verify edgefinders Press Start –Verify that the edge finders located all edge for all test images –On failure Verify threshold and position The number of trace lines increases the image processing time but also the probability to locate an edge Hint : By stopping the continuous inspection it is possible to select images from the history list and reprocess interactively until the edges are located. By pressing Inspection image processing is performed on user request.

54 Introduction to Scorpion - Demo 1- Label on Syringe Page 54 Construct intersections Create Left intersection – PointFromLines. Select Find Left Slope.Line and Find Lower Left Edge.Line Copy Left Intersection Paste Right Intersection Select Find Right Slope.Line and Find Lower Right Edge.Line

55 Introduction to Scorpion - Demo 1- Label on Syringe Page 55 Marker Reference Line Create Marker Reference Line using LineFromPoints Select Right Intersection and Left Intersection as points The constructed line defines a zero position for the marker label. The Marker Reference Line has to be constructed. It is not possible to measure due to missing contrast and varying reflection from the syringe.

56 Introduction to Scorpion - Demo 1- Label on Syringe Page 56 Locate label marker The next step is to locate the label marker. This is done by using a Marker LightMeter and the blob Find Marker. The blob threshold is set dynamically using a python script.

57 Introduction to Scorpion - Demo 1- Label on Syringe Page 57 Marker LightMeter Create Marker LightMeter of type IntensityTool. Set the reference to Syringe Reference. Press Apply. Active Marker LightMeter.Visualization.this only Activate Image.Show Info to set the center of the lightmeter roi. Verify that the lightmeter roi is placed on the syringe and handles both syringe rotation and translation.

58 Introduction to Scorpion - Demo 1- Label on Syringe Page 58 Find Marker Threshold Create Find Marker Threshold of type PythonScript The Find Marker blob’s dynamic threshold is calculated using the following script: min = GetTagValue('Marker LightMeter.Min'); #LightMeter.Min is a result of Marker LightMeter SetTagValue('Find Marker Threshold.Value',min+25) #Sets the threshold to itself Hint : Activate Parameters The parameter dialog is available to find the name of the results in the Scorpion tag database.

59 Introduction to Scorpion - Demo 1- Label on Syringe Page 59 Find Marker Create Find Marker of BlobTool Set reference to Syringe Reference Set the roi equal to Marker LightMeter Set Area Search - thresholds Minimum = 0 Maximum = Find Marker Threshold.Value Set minimum area to 0.2 mm2 Verify that the marker is found for all images by pressing Start.

60 Introduction to Scorpion - Demo 1- Label on Syringe Page 60 Find Marker Upper Edge Create Find Marker Upper Edge – LineEdgeFinderTool Copy Find Lower Right Edge Paste Find Marker Upper Edge Set reference to Find Marker Set roi x and y to zero. Activate Visualization.Show Graphics Use Image.Show Info to select position and correct angle Adjust and verify threshold for all test images Verify that the upper edge is found by pressing Start. Hint : Increase smooth base and count if the edge of the label is detected.

61 Introduction to Scorpion - Demo 1- Label on Syringe Page 61 Marker Distance Create Marker Distance – NearestPointOnLine Set reference to MMReferanse Select Find Marker Upper Edge.Center to point and select Marker Reference Line.Line to line. The marker distance is equal to the Marker Distance.Distance result. The dimension is in mm given by the MMReference reference tool. Set the unit and the precision for the Marker Distance.Distance result.

62 Introduction to Scorpion - Demo 1- Label on Syringe Page 62 Classification - States Create the following LogicTools Distance High Distance OK Distance Low Cannot Measure These tools defines the classification state. Set external data tools, e.g. Distance_High, to set limits for MarkerDistance.Distance State when undefined measured values is False for all states except Cannot Measure which is set to True Classification states are important when defining system states and to show results in the indicator panel.

63 Introduction to Scorpion - Demo 1- Label on Syringe Page 63 Classification Verification Activate Operation.Results Add the following results –Distance OK.Value –Distance Low.Value –Distance High.Value –Cannot Measure.Value –Marker Distance.Value Press Start –Verify that only one state is true at the time –Verify that the state corresponds to the correct distance

64 Introduction to Scorpion - Demo 1- Label on Syringe Page 64 Definition of System States Scorpion States are defined under Settings The following states are defined: –Distance OK - green –Distance Low - light red –Distance High - red –Cannot Measure - yellow –No syringe - white

65 Introduction to Scorpion - Demo 1- Label on Syringe Page 65 Creating Distance OK Activate Settings Create Distance OK by pressing New Select Distance OK – press Edit Set background color to green –Click the Condition Colors and the color selection dialog appears Activate Constraints and set the following classification states –Distance OK –Syringe Present

66 Introduction to Scorpion - Demo 1- Label on Syringe Page 66 Defining states Copy Distance OK Paste –Distance High –Distance Low –Cannot Measure Edit –Colors and constraints Create the state No Syringe Test the states and verify that no duplicate states are defined

67 Introduction to Scorpion - Demo 1- Label on Syringe Page 67 Label System States

68 Introduction to Scorpion - Demo 1- Label on Syringe Page 68 User Panels Scorpion has four user configurable panels for display of image processing results: –Indicator Panel –State Panel –Results –Curves

69 Introduction to Scorpion - Demo 1- Label on Syringe Page 69 Configuration of Indicator/State Panels In service mode the indicator / state panel menu is available by right clicking the mouse The menu helps the configurer to configure the panels according to the task

70 Introduction to Scorpion - Demo 1- Label on Syringe Page 70 Display distance in State Panel Activate State Panel Menu –Select General.No of measured values –Set No of measured values to 1 –Set General.caption = State Activate menu by clicking the value –Select Measured Value.Title = Distance –Select Measured Value.Parameter = Marker Distance.Distance –Select Measured Value.Decimals = 2 –Select Measured Value.Unit = mm Set font Condition to size=20 and bold

71 Introduction to Scorpion - Demo 1- Label on Syringe Page 71 Configure the Indicator Panel Activate the Indicator Panel –Activate Service.General –Turn on – Show Indicator Panel Activate Indicator Panel Menu –Set rows = 1 –Set columns = 2 Activate Indicator Panel Menu over column 1 –Set title = Syringe –Set Color True = green –Set Color False = red –Set parameter = Syringe Present.Value Activate Indicator Panel Menu over column 2 –Set title = Distance –Set Color True = green –Set Color False = gray –Set parameter = Find Marker.Distance

72 Introduction to Scorpion - Demo 1- Label on Syringe Page 72 Operation.Results Active Operation.Results Press New and select a set of parameters To the right a selection of parameters are shown

73 Introduction to Scorpion - Demo 1- Label on Syringe Page 73 Operation.Curves All results can be graphed and watched To the right the Marker Distance is displayed Activate the Curve Menu and select parameter –The curve configuration is changed by double clicking the curve. Hint : The curve can only be edited in service mode. Hint 2 : Watch the inspection cycle time is a good way to check the system condition

74 Introduction to Scorpion - Demo 1- Label on Syringe Page 74 Curve Setup – Marker Distance Hint : By capturing N images of a syringe one can establish an estimate for the noise level of measurement by recording the standard deviation

75 Introduction to Scorpion - Demo 1- Label on Syringe Page 75 Communication The Label profile communicates with a PLC over rs-232. Scorpion is a slave of the PLC. The text protocol TDVCmdProtocol is used. TDVCmdProtocol is a simple stateless packet protocol supported by Scorpion for both tcp/ip and rs-232. Using Scorpion and TDVCmdProtocol ensures a very easy and flexible configuration of messages and commands.

76 Introduction to Scorpion - Demo 1- Label on Syringe Page 76 Preparing results for communication with PLC Create Status of type LogicPack. This tools packs the values of Cannot Measure and Distance OK into one status word This word will be transferred to the PLC as a two binary status bits. LogicPack packs classification states into words.

77 Introduction to Scorpion - Demo 1- Label on Syringe Page 77 Distance in 1/100 mm units Create Result of type LinearScaleTool Active Setup Select Find Marker.Distance Set Coefficient = 100 Set Offset = 0 Set the unit of Result.Value to 1/100 mm Hint : The tool converts the distance to mm/100 – this means that the distance can be transferred as a integer value to the PLC

78 Introduction to Scorpion - Demo 1- Label on Syringe Page 78 Alias Scorpion has a cross index – Alias List – where tag value are given an alternative name Service.Advanced.Alias –Keeps this alias list Hint : Alias is useful when reducing the length of a command and to hide the internal tag name.

79 Introduction to Scorpion - Demo 1- Label on Syringe Page 79 Communication Aliases Create the following Aliases: –Distance = Result.Value –Status = Status.Value

80 Introduction to Scorpion - Demo 1- Label on Syringe Page 80 Command sequence and States To every State there is a command sequence. Command Sequences are very handy when communicating with a robot or plc. A command can be defined by the system or by the user. There is a help page for every system command. To the right is the help page for SetValue shown.

81 Introduction to Scorpion - Demo 1- Label on Syringe Page 81 Distance OK – Command Sequence Activate Settings –Select Distance OK –Press Edit –Activate Command Sequence –Press New Set name = Send result Set command = RS232Cmd Set Parameter = Result=%3.0fDistance;Status=%2bStatus Press OK –Press Activate –Activate Service.Communication.RS232 Verify log Result=382;Status=01

82 Introduction to Scorpion - Demo 1- Label on Syringe Page 82 Command Sequences for Distance Low and Distance High Copy the Command Sequence from Distance OK to Distance Low and Distance High. Press Start and verify Service.Communication.RS232 displays a kommand for each inspection and that the results are changing result=386;status=11 No message is sent if no value is measured There is no command sequence connected to Cannot Measure or No Syringe Hint : By replacing RS232Cmd by IMCmd the message are transmitted over tcp/ip. To Scorpion it is transparent to use RS232 or tcp/ip. OPC is supported with a corresponding set of commands.

83 Introduction to Scorpion - Demo 1- Label on Syringe Page 83 PLC communication sequence 1.CameraTrigger – sent from PLC to Scorpion CameraTrigger captures an image and performs an inspection before classifying the determining the system state Send result – Scorpion’s answer to CameraTrigger Distance and status is sent - Distance=387;Status=00 Distance is given i mm/100 Status are Pass / Failure and Cannot Measure The PLC can change the mode of operation by sending the commands, at any time, to Scorpion: Mode_Lowtolerance Mode_Hightolerance

84 Introduction to Scorpion - Demo 1- Label on Syringe Page 84 Action – Before Start Activate Service.Actions Press Action.System Events.New –Select Before Start This is event is called before automatic inspection is started. This happens when is pressed. –Select Before Start –Press Action.Command Sequence.....New Set –name = LogMsg –Command = LogMsg –Parameter = msg=Starts profile Press Ok –Select Before Start – Press Execute Verify system log Hint : Before Start is an event defined by Scorpion.

85 Introduction to Scorpion - Demo 1- Label on Syringe Page 85 Action – After Stop Create system event After Stop Add LogMsg – Stops Profile Hint : LogMsg is a command that can be used to verify command sequences and to check task time consumption

86 Introduction to Scorpion - Demo 1- Label on Syringe Page 86 Actions – System Events The following system events are active: Before start After stop Image grab After Image Acquisition Inspection CameraTrigger

87 Introduction to Scorpion - Demo 1- Label on Syringe Page 87 Changing Mode of Operation The PLC sends the user- defined commands: –Mode_Lowtolerance – activates operation mode –Mode_Hightolerance – activate sample mode The commands are specific to the label profile and are define under Service.Actions.System Events

88 Introduction to Scorpion - Demo 1- Label on Syringe Page 88 Mode_Lowtolerance Activate Service.Actions Press Actions.System Events.New –Define Mode_Lowtolerance –Select Mode_Lowtolerance Press Actions.Command Sequence....New –Set Name = Operation mode Command = SetValue Parameter = Distance_Low.Value=3.4; Distance_High.Value=4.0; LowTolerance.Value=1 Press OK Test by pressing Execute

89 Introduction to Scorpion - Demo 1- Label on Syringe Page 89 Mode_Hightolerance Activate Service.Actions Press Actions.System Events.New –Define Mode_Hightolerance –Select Mode_Hightolerance Press Actions.Command Sequence....New –Set Name = Set Sample Mode Command = SetValue Parameter = Distance_Low.Value=3.6; Distance_High.Value=3.85; LowTolerance.Value=0 Press OK Test by pressing Execute

90 Introduction to Scorpion - Demo 1- Label on Syringe Page 90 Testing Mode Commands Activate Service.Advanced.Results –Add the following results Distance_Low.Value Distance_High.Value Lowtolerance.Value Activate Service.Actions –Select Mode_Lowtolerance –Press Execute Verify Service.Advanced.Results –Select Mode_Hightolerance –Press Execute Verify Service.Advanced.Results Hint – Check systemlog for error messages

91 Introduction to Scorpion - Demo 1- Label on Syringe Page 91 Custom Statistics Using Python Scripts and external data tools any requirement for statistics can be met with Scorpion Create the tools – External Scalar with Make external changes permanent On –Error –OK –Total Add the following Aliases under Service.Advanced.Alias –Error = Error.Value –OK = OK.Value –Total = Total.Value

92 Introduction to Scorpion - Demo 1- Label on Syringe Page 92 Statistics - Script Create Statistics – PythonScript. Open Statistics.Setup and add the right hand side script. The script adds simple operation statistics. The script has four steps: –Read counters –Get the inspection result –Update counters –Write counters Hint : All values are available using Scorpion’s command interface Hint 2 : Check System Log to see any script error messages #Read Counters ok_count = GetTagValue('OK') total_count = GetTagValue('Total') error_count = GetTagValue('Error') #Get Inspection State ok = GetTagValue('Distance OK.Value'); #Update counters if (ok): ok_count = ok_count+1 else: error_count = error_count+1 total_count = total_count +1 #Write counters SetTagValue('OK',ok_count) SetTagValue('Total',total_count) SetTagValue('Error',error_count)

93 Introduction to Scorpion - Demo 1- Label on Syringe Page 93 Statistics - Zero Activate Service.Actions Add System Events –Name = Zero Select Zero Statistics –Add new command Name = Zero statistics Command = SetValue Parameter = OK=0;Feil=0;Total=0 Hint : The command requires that the OK, Error and Total aliases are defined.

94 Introduction to Scorpion - Demo 1- Label on Syringe Page 94 Test – Zero Statistics Activate Service.Advanced.Results –Add OK.Value, Error.Value and Total.Value Start inspections –Verify results as they are updated Execute Zero Statistics –All counter are zeroed Stop inspections

95 Introduction to Scorpion - Demo 1- Label on Syringe Page 95 Custom User Interface The following function are implemented: Operation Mode selection System Description Operation Statistics The user interface is implemented using standard web pages and ActiveX controls. The ActiveX controls are a part of the Tordivel Software Solutions.

96 Introduction to Scorpion - Demo 1- Label on Syringe Page 96 Internet Messenger 4.5 InternetMessenger is used to send text to and from Scorpion over tcp/ip. This is easy and the recommended way to communicate with Scorpion. InternetMessengers properties are configured using FrontPage

97 Introduction to Scorpion - Demo 1- Label on Syringe Page 97 Activate the web page Open Windows Explorer –Easy to do from Service.Advanced.General Go to directory.\Label Copy the directory.\label\web Paste the directory to.\test\web Activate the Web Page under Service.General –Activate Show Webbrowser in Operation –Set caption = Description –Set page index to 1 –Open Settings Set directory to.\Test\Web\Setup.htm

98 Introduction to Scorpion - Demo 1- Label on Syringe Page 98 Connecting a web page to Scorpion Scorpion has a Internet Explorer Browser inside Web pages can be displayed by the web browser In a web page can contain scripts and ActiveX controls. Scorpion and the webpage is connected using the ActiveX control Internet Messenger. Commands and messages uses the TDVCmdProtocol format. TDVCmdProtocol is the Scorpion command-language

99 Introduction to Scorpion - Demo 1- Label on Syringe Page 99 ActiveX Components The following ActiveX components from Tordivel Software Solution is used in the example: InternetMessenger4 SimpleStat2X TDropDownList TButtonX Microsoft Frontpage can be used to edit the web pages.

100 Introduction to Scorpion - Demo 1- Label on Syringe Page 100 VBScript in HTML On the following pages the vb script driving the web page shown. This is only for reference. The web page talks with Scorpion using the ActiveX InternetMessenger. –In the event InternetMessenger_Receive messages is received from Scorpion –The methods InternetMessenger.Send sends commands / requests to Scorpion The following Scorpion Scorpion actions are called from the web page: –Zero Statistics –Mode_Lowtolerance –Mode_Hightolerance –SendSetup The webpage accepts the following messages from Scorpion: –Statistics –Setup

101 Introduction to Scorpion - Demo 1- Label on Syringe Page 101 Create SendSetup in Scorpion Activate Service.Actions Create new system event –SendSetup Select SendSetup Create new command –Name = Send Setup –Command = ImCmd –Parameter = destination=localhost:8701: Setup; Lowtolerance=%0.0fLowtolerance.Value; Note : Parameter must end with ; for the web page to parse the command Hint : ImCmd can send message to many tcp/ip servers over tcp/ip destination= : means that the command is sent directly to the specified adress – port number combination Verify command transmittal in Service.Communication.TCP/IP

102 Introduction to Scorpion - Demo 1- Label on Syringe Page 102 Create SendStatistics Activate Service.Actions Create new system event –SendStatistics Select SendSetup Create new command –Name = Send Setup –Command = ImCmd –Parameter = destination=localhost:8701: Statistics; OK=%0.0fOK;Error=%0.0fError; Total=%0.0fTotal; Verify command transmittal in Service.Communication.TCP/IP Webside requires that the Statistics message is terminated by a ;

103 Introduction to Scorpion - Demo 1- Label on Syringe Page 103 Maintain Actions Add the following commands: –Zero Statistics in Before Start Zero statistics for each Start –SendStatistics in Zero Statistics Updates web page when statistics are zeroed –Statistics;cmd=zero in Before Start Zeros state statistics Press Start –Verify Operation Statistics on web page is zeroed Activate Operation.Statistics –Check that period is zeroed

104 Introduction to Scorpion - Demo 1- Label on Syringe Page 104 TCP/IP Communication Log The log Service.Communication.TCP /IP shows the complete dialog n between Scorpion and the web page. Hint : It is possible to activate logging to file. This is useful to provide documentation.

105 Introduction to Scorpion - Demo 1- Label on Syringe Page 105 Get Setup when loading web page The Scorpion setup is request when loading the web page. The answer from Scorpion is to send the Setup message. sub init_web_page() InternetMessenger.Send "SendSetup" end sub

106 Introduction to Scorpion - Demo 1- Label on Syringe Page 106 Receive messages from Scorpion This method decodes all messages from Scorpion. Tow messages are defined: Setup and Statistics sub InternetMessenger_Receive(From,Command) SendDebugMessage(Command) pos = InStr(1,Command,"Setup") if (pos=1) then ProcessSetup(Command) end if pos = InStr(1,Command,"Statistics") if (pos=1) then ProcessStatistics(Command) end if end sub

107 Introduction to Scorpion - Demo 1- Label on Syringe Page 107 Update Statistics ProsessStatistics updates the SimpleStatX counters with counter from the Statistics message – Statistikk;Error=2;OK=10;Total=12; sub ProcessStatistics(Command) SendDebugMessage(Command) str0 = Mid(Command,11) pos = InStr(str0,";") Do While pos ' Inner loop. str1 = Mid(str0,1,pos-1) pos1 = InStr(str1,"=") if (pos1) then name = Mid(str1,1,pos1-1) value = Mid(str1,pos1+1) SendDebugMessage(name + "-" + value) SimpleStatX.Set name,value end if str0 = Mid(str0,pos+1) pos = InStr(str0,";") Loop end sub

108 Introduction to Scorpion - Demo 1- Label on Syringe Page 108 Custom counters - SimpleStat2X SimpleStat2X is a simple way to include custom counters on a web page. SimpleStatX relies on Scorpion holding statistics counter and sending them to the web page –SendStatistics Zero Statistics is sent when the user pushed the Zero button Zero is an ActiveX - TDVButtonX

109 Introduction to Scorpion - Demo 1- Label on Syringe Page 109 Update Operation Mode ProsessSetup decodes the Setup message – Setup;Lowtolerance=1; sub ProcessSetup(Command) str0 = Mid(Command,5) pos = InStr(str0,";") Do While pos str1 = Mid(str0,1,pos-1) pos1 = InStr(str1,"=") if (pos1) then name = Mid(str1,1,pos1-1) value = Mid(str1,pos1+1) SendDebugMessage(name & "-" & value) if ( name = "Lowtolerance" ) then if (value=0) then Mode.ItemName="Sample" else Mode.ItemName="Operation" end if str0 = Mid(str0,pos+1) pos = InStr(str0,";") Loop end sub

110 Introduction to Scorpion - Demo 1- Label on Syringe Page 110 User changing Operation Mode Mode_OnChange is called when the user changes the list control – selects an new Operation Mode. In addition the Statistics are Zeroed sub Mode_OnChange(ItemName) if (ItemName = "Operation") then SetLowTolerance() Zero() else SetHighTolerance() Zero() end if end sub

111 Introduction to Scorpion - Demo 1- Label on Syringe Page 111 Set the Operation Mode Operation Mode is changed in Scorpion by sending the commands: Mode_Hightolerance or Mode_Lowtolerance sub SetHighTolerance() InternetMessenger.Send "Mode_Hightolerance" end sub sub SetLowTolerance() InternetMessenger.Send "Mode_Lowtolerance" end sub

112 Introduction to Scorpion - Demo 1- Label on Syringe Page 112 Send Zero Statistics The Zero_OnClick event is executed when the user click the Zero button. sub Zero_OnClick() Zero() end sub sub Zero() InternetMessenger.Send "Zero Statistics" end sub

113 Introduction to Scorpion - Demo 1- Label on Syringe Page 113 SendDebugMessages sub SendDebugMessage(text) InternetMessenger.Send "destination=localhost:7700:" & text end sub / to the right the test program – IMTdvCmdProtocol5 is shown receiving messages under test / Note the receiving port number = 7700

114 Introduction to Scorpion - Demo 1- Label on Syringe Page 114 Curves - System.Analysis time Using Curves and System.Analysis time it is easy to verify the time used Mean value = 27.15 ms on a portable P4 – 2GHz CPU This means that it is easy to do more than 10 inspections/second

115 Introduction to Scorpion - Demo 1- Label on Syringe Page 115 Summary Label on Syringe Scorpion solved this task by using it’s robust and good edge tools. The edges where detected with a sub-pixel resolution of 5 micrometer. The lines detected are intermediate results but ensures that the label position is measured with at 3 sigma tolerance better than 0.06 mm – this is very good. This means that the customer’s expectations are met without any programming.

116 Introduction to Scorpion - Demo 1- Label on Syringe Page 116 Conclusion This example show some of the possibilities with Scorpion Vision Software and integrated model for implementing optical gauging and robot guiding systems. Scorpion is a tool to configure, operate and maintain vision systems.

117 Introduction to Scorpion - Demo 1- Label on Syringe Page 117


Download ppt "Introduction to Scorpion - Demo 1- Label on Syringe Page 1."

Similar presentations


Ads by Google