Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between Vision Builder AI 3.6.1 and Siemens 1200 PLC

Solved!
Go to solution

Hello, I am using Vision Builder AI 3.6.1 to perform an inspection of black colored sealant at the back of a vehicle in the production line of an automotive company. The camera that I'm using for the inspection is a Basler scout camera (scA1000).When the inspection is complete, I require it to send a signal to a Siemens 1200 PLC that I'm using. If the inspection has passed it should send a signal to the PLC that will in turn power up a a green ligth, indicating that the inspection has passed. When the inspection has failed, a signal should be sent to the PLC that should power up a red light. Can anyone please advise me on this? 

 

Thank you.

0 Kudos
Message 1 of 15
(8,838 Views)

Vision Builder AI offers multiple ways of communicating with PLCs.

- You can use IO lines, if you have a DAQ card, or run Vision Builder on a  Compact Vision System or Embedded Vision System.

- Standard TCP or Serial communication using the TCP or Serial I/O step)

- Ethernet/IP (VBAI 3.6.1 support unconnected messaging)

- Modbus

- Serving data using OPC (which is common with Siemens PLCs)

 

Look at the different options in the Communicate tab. Once you choose your option, I can give you more information on the protocol chosen.

 

Hope that helps,

 

Best regards,

 

-Christophe

0 Kudos
Message 2 of 15
(8,835 Views)

Hello Christophe,

 

Thank you for the reply.

I thoroughly went through the options that you mentioned in your reply.

I found that the OPC server option is probably the best since some of the other options require some sort of hardware. Siemens has an OPC server (SIMATIC NET OPC) that they used for their older PLC's (s7 200). It apparently works for their newer 1200 PLC's aswell, even though it is not officially supported by Siemens 1200 PLC. However, in the examples that are available on their website, they only show how to access data on the PLC. What I want to do is read data to the PLC from Vision Builder. I'm not really sure how OPC servers work, but can I achieve this?

 

Thank you again

 

Xavier

0 Kudos
Message 3 of 15
(8,819 Views)

Hi,

 

Does your PLC also comes with a OPC client? I am asking because Vision Builder can communicate with both OPC clients and OPC Servers, but the method to communicate with OPC Servers requires to buy from NI a run-time engine that is not free.

 

You did not specify if you were running Vision Builder AI on a PC, or remote system, like a Compact Vision System (CVS), or Embedded Vision System. Procedures are different whether you run Vision Builder on a PC or on a remote target. I am going to assume that you are running Vision Builder on a PC.

 

Communicating with an OPC Client

 

If your PLC comes with an OPC client, here is the free method to share data:

Simply create Shared System Variables for each data you want to share (Tools>>Variable Manager, System Variable tag). Add each variable and make sure to check the option "Publish on Network).

Within your inspection, use the Set Variable step (Use Additional Tools tab) to set the value of these variables.

From you PLC OPC Client software, connect to the "National Instruments.Variable Engine" OPC Server, which is Vision Builder AI's OPC Server. The variables you created will be listed as tags under National Instruments.Variable Engine>>Vision Builder AI.

 

Communicating with an OPC Server

 

It is possible for Vision Builder AI to communicate with OPC Servers. Assuming you're running Vision Builder AI on a PC, here are the instruction to share data between Vision Builder AI and the OPC server.

 

1) Using your PLC OPC Server software, create tags for each data you want to share with Vision Builder AI.

 

2) Download and install the NI Distributed System Manager, which is a free utility.

https://www.ni.com/en/support/downloads/software-products/download.distributed-system-manager.html

 

3) You will need the DSC Run-time System to communicate with OPC Servers.

https://www.ni.com/en-us/shop/product/labview-datalogging-and-supervisory-control-module.html?partNu...

Unfortunately, this Run-time is not free, but you can check with you NI customer service representative, to see if you can get an eval version to see if that works for you.

Install it.

 

4) Launch the Distributed System Manager.

Right click on localhost (located under My Systems). Then select "Add Process"

Choose for example "Vision Builder AI OPC Client" as the Process Name.

Now, right click on Vision Builder AI OPC Client.

Select Add I/O Server. Choose an OPC Client I/O Server.

In the configuration dialog, you should see your PLC OPC Server. Select it. Click OK.

 

5) In Vision Builder AI, create network Variables (Tools>>Variable Manager - Network Variable tab), for each tag you want to access from Vision Builder AI.

When you create the network variable, click the Browse Network path button. Select your computer from the tree on the left, then expand the Vision Builder AI OPC Client. You should see the list of all the tags published by the OPC Server.

Select the tag you want to link the variable to.

Click OK.

 

6) Within your inspection, use the Set Variable step (Use Additional Tools tab) to set the value of these variables.

 

Hope this helps.

 

Best regards,

 

-Christophe

Message 4 of 15
(8,808 Views)

Very interesting !

 

Sami.

Sami Fathallah
ALLIANCE VISION
HW and SW Components for Scientific Imaging and Machine Vision
http://www.alliancevision.com
0 Kudos
Message 5 of 15
(8,792 Views)
0 Kudos
Message 6 of 15
(8,758 Views)

Hello Christophe,

 

Thank you for the replies. I'm happy to say that I've successfully managed to establish a connection between Vision Builder and the Siemens 1200 PLC. I'm able to let the PLC know when an inspection has passed. However, there are some irregularities with this process.

I ran the Spray Bottle Inspection that Vision Builder have in one of its examples and added a Set Variable step at the end of the inspection state. I set the operation the variable to "Set to Set Inspection Status". Now, according to this, a signal is supposed to be sent to the PLC telling it the result of the inspection, i.e power green light when inspection passed, etc.  

The PLC does, however, operate the way it should but it occasionally does not receive signals when the inspection has passed.

 

What could be the problem? I tried increasing the scan rate of the of the OPC server. Or perhaps "Set to Set Inspection Status" is not the correct operation to use in the Set Varialble step???

 

Xavier   

0 Kudos
Message 7 of 15
(8,734 Views)

Are you using VBAI as the client, connecting to a third party server using Network variable?

0 Kudos
Message 8 of 15
(8,729 Views)

One thing to know about shared variables is that up till Vision Builder AI 2010, the write is asynchronous, meaning there is no garantee that the variable is written when the Set Variable step is called. We send the command to write the variable in the step, but the Shared Variable Engine writes the variable asyncronously. If you're running an inspection with a fast loop rate, it is possible to experience what you are seeing.

Starting in Vision Builder AI 2010, we added a flush function to the Set Variable step, which forces the shared variable engine to write the variable when the Set Variable Step is called.

I am sorry I don't have a better suggestion other than to updating to a newer version of VBAI and try to see if that solves the problem.

You can download the latest version (2011) for evaluation here

https://www.ni.com/en/support/downloads/software-products/download.vision-builder-for-automated-insp...

If you try it out, make sure that you make a copy of your inspection, as it will open fine in 2011, but there is no way to convert inspection back to previous versions.

 

-Christophe

0 Kudos
Message 9 of 15
(8,725 Views)

Hello Christophe,

 

I want to thank you again for the information you supplied me with, it was very very helpful. I managed to get my application working with Vision Builder 3.6 rather that the newer 2011 version. At first there were problems caused by asyncronous writing but I slowed down the loop rate, so the accuracy of the application is much better now. However, there is an additional problem that just came up. I'm not sure how familiar you are with Basler CCD cameras, but the application that I'm running uses a Basler scA1000-30fm camera. In the image in the attachement there's a Devices box that shows which cameras are connected to the PC. Currently, the name of the Basler camera is in the box. At first there were two icons in this box; the one seen in the image and another with a different name and icon. When the one that is not in the box were selected, there was an option available in the Attributes tab that alowed triggering configuration. The one currrently in the box, however, does not allow this.

 

Can you point me in the right direction to solve this problem?

Thank You!

0 Kudos
Message 10 of 15
(8,652 Views)