AdvancedHMI Software

General Category => Open Discussion => Topic started by: Shark13 on July 28, 2022, 11:30:55 AM

Title: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on July 28, 2022, 11:30:55 AM
I am trying to setup a test to connect my TwinCat plc program and a test AHMI solution. I have the TwinCat program running on a Beckhoff IPC, and I have the AHMI solution running on a separate laptop. I'm connected via ethernet. I have a route established in-between the laptop and the IPC. I set the IP address on the Beckhoff IPC side to 192.168.100.99 and matched that with the AHMI TwinCAT com1. When I go to do a live test or debug on the AHMI side and I go to click on my button, I get an error which says "The write failed, the given key was not present in the dictionary"

What am I missing?

My test button on the PLC side is called "TestButton" which is in a routine called "Test".
On the AHMI side I have tried the variable for PLC click as "Test.TestButton" I have also tried "TestButton" both produce the same result. Do I not have the variable addressed correctly?

Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on July 28, 2022, 11:34:43 AM
The AdvancedHMI TwinCAT driver does not play well with TwinCAT being installed on the same PC. It will be necessary to uninstall TwinCAT from your laptop or at least stop the TwinCAT system.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on July 29, 2022, 12:12:47 PM
Ok thank you for the information.

In case anyone here is interested in an alternative solution the future. There is a way around this hang up by using the TwinCat.Ads reference in MS Visual Studio. Using this will allow you to be able to run TwinCat on the programming machine, as well as the PLC and still be able to utilize AHMI at the same time. That being said it will require a little extra background code work for each and every event on your HMI.

Regards
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on July 29, 2022, 12:28:57 PM
V3.99y Beta has a second TwinCAT driver that used the ADS dll. I haven't used it for quite a while, so I can't say how well it works with TC3
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on July 29, 2022, 12:38:16 PM
Good to know, thank you! Love what you are doing!
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 16, 2022, 10:49:11 AM
Archie,

I am continuing my testing to get this TwinCat com and TwinCat program communicating together.

I now have a separate brand new PC dedicated to be able to run the AHMI solution file, it has never had any Beckhoff applications installed on it.

I am running the TwinCat program on a Beckhoff IPC. I am able to ping from the Dell PC to the Beckhoff IPC. However when I try to run my solution file on the Dell I get an error "WriteData2b. ADS Error (GetSymbolInfo)"

I have attached my TwinCat com settings. Which match what the Beckoff IPC is using. How can I get the communication working properly?
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 16, 2022, 11:16:52 AM
Are you writing to a variable when the error occurs?
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 16, 2022, 12:05:10 PM
Yes. I am using a test button to write a bool variable of true to the TwinCat side when the button is pressed.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 16, 2022, 12:54:21 PM
What do you have in the PLCAddressWrite property?
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 16, 2022, 01:06:04 PM
I am trying to write to a bool variable called TestButton in a POU called Test.

I have it writing to Test.TestButton on click action.

Do I need to be writing to a Global Variable? Or can I read and write from a POU variable as well as a GVL variable?

Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 16, 2022, 02:52:08 PM
I think what you have is correct, but try it in a global variable. Try the variable alone, then also try it with a period preceding it.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 18, 2022, 01:21:56 PM
I tried all those methods, and still getting the ADS error unfortunately. Any other ideas?
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 18, 2022, 02:38:49 PM
Can you do Wireshark capture and post it here?
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 23, 2022, 09:59:14 AM
I'm getting it installed today on the PC that will be running the AHMI solution file. I have never used this software, do you have a procedure or set of instructions to get the exact capture you are looking to see? Thanks.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 23, 2022, 10:57:06 AM
Once you get it installed, you will see it is very easy and intuitive. Just start the capture, then start AdvancedHMI. After you get the error, you can stop the capture and save the file.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 23, 2022, 11:38:04 AM
Let's see if this works.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 23, 2022, 12:17:38 PM
I see Target Port 801 not found. I'm quite sure TC3 should be set to port 851 in the driver settings
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 23, 2022, 12:42:13 PM
I changed the port number to 851 on the AHMI side. You are right it should have been 851.
I still got the same Error code from before though unfortunately. ADS Error. Attached is capture after port 851 set correctly.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 23, 2022, 02:16:47 PM
The ADS error is not longer there. I see a couple variables:

.TESTBUTTONSTOP
.TESTBUTTON
.TESTDISPLAY2

Packets 222 and 223 seem to show a successful write of 1 to the variable

I don't remember all the ADS addresses, so I am going to look further into it to decipher the packets.
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 23, 2022, 02:19:49 PM
I went back and looked at my variables. Changed them back to global variables.
I was able to get the variables to read and write with bools that way! Will test further and see if I can read and write other data types next!
Thanks for your help!  ;D 8)
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Archie on August 23, 2022, 03:52:27 PM
I made a test setup and what I found was that I had to include the global variable file name. My variable name was:

GVL.TestButton
Title: Re: Setting up connection between TwinCat3 and AHMI
Post by: Shark13 on August 26, 2022, 02:50:20 PM
That is what I have found as well.
Thank you!