Author Topic: Importing forms from one project into the AdvancedHMI Solution  (Read 3101 times)

busarider29

  • Newbie
  • *
  • Posts: 18
    • View Profile
Importing forms from one project into the AdvancedHMI Solution
« on: January 21, 2015, 03:00:37 PM »
I am new to Visual Studio and TwinCAT 3.  I have already started on my HMI in VS2012 and have quite a bit of it done and working already (on the HMI side of things).  I want to add the Advanced HMI stuff to my solution but from my understanding, I can't take stuff from the AdvancedHMI solution and drop into my project?  So, what is the way to import my forms and code from my Solution into the AdvancedHMI solution, then rename the solution/project?  Thank you.  By the way, I'm glad I found this site.  A lot of good info and support here for what I'm working on.  Will be helpful in the coming months as I work on this project. 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Importing forms from one project into the AdvancedHMI Solution
« Reply #1 on: January 21, 2015, 03:31:08 PM »
To import existing forms into an AdvancedHMI project:

- Right click AdvancedHMI in Solution Explorer
- Select Add->Existing
- Browse to the .vb files for your existing forms


A note about the TwinCAT driver. Version 3.97 of AdvancedHMI has a TwinCAT driver that was completely rewritten, so there still may be some bugs. A new version of V3.97d will be posted later tonight that includes a few bugs uncovered in the driver.

Another important detail to know about the TwinCAT driver is that it does not use the AMS router. The side effect of this is that you cannot run the HMI on the PC that was used to program TwinCAT. If the HMI is run on a PC that was used to program, then the TwinCAT runtime will reroute the message to the incorrect port, therefore AdvancedHMI will never receive it's replies.

The driver was written like this for two reasons, the first being a licensing conflict with distributing the DLLs from Beckhoff. The second reason is because the goal is to keep AdvancedHMI pure .NET so it can run on Linux and Max iOS platforms.

busarider29

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Importing forms from one project into the AdvancedHMI Solution
« Reply #2 on: January 21, 2015, 03:49:28 PM »
Thanks Archie.

Okay, so maybe I'll just keep writing my HMI in my own solution and then import the files into the AdvancedHMI at a later time when the newer version is posted.  What about the Solution name?  Am I to assume there's a bunch of steps in renaming the solution?  Also, I want to better understand the AdvancedHMI solution and the benefits that it may give me.  I know it has the standard HMI controls with the buttons, indicators, meters, etc.  But if I don't plan on using any of that, are there any benefits to me using the AdvancedHMI solution for my TwinCAT project?  Am I understanding it correctly in stating that the AdvancedHMI solution is TwinCAT ready as far as communications drivers, etc for my project (once the new TC drivers are up to date)?  If that is true, then yes I will plan on using it as its ready to go and less headaches for me trying to establish comms between the TC PLC project and VS HMI project. 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Importing forms from one project into the AdvancedHMI Solution
« Reply #3 on: January 21, 2015, 04:25:51 PM »
Renaming the AdvancedHMI solution can sometimes break references and get a little hairy.

If you are not using any of the visual controls in AdvancedHMI, then you must be writing code for all of the communications. AdvancedHMI drivers are easier to use than the ADS/AMS communication library from Beckhoff, but it does have the limitation of not being able to communicate to TwinCAT if it is running on the same PC. All of the applications I develop for TwinCAT always run on a dedicated touch screen PC just for the HMI, so it never even gets TwinCAT installed. When I want to test the HMI on my laptop, I have TwinCAT running in a virtual machine and Visual Studio running on the main desktop. This allows me to be online with TwinCAT and also run the HMI from the same laptop.

So if it were me and I was not using any of the AdvancedHMI controls, I would probably stick with the Beckhoff drivers.

busarider29

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Importing forms from one project into the AdvancedHMI Solution
« Reply #4 on: January 08, 2016, 01:56:20 PM »
Okay, revisiting this thread after a year now.  I am in the process of commissioning a machine with Beckhoff PC and HMI written in VS.  That machine is not using AdvancedHMI, so yes, I wrote the code for the communications.  The HMI and TwinCAT are on the same machine, which is a CX2040.  I am beginning to already code for the next machine, but wanted to revisit AdvancedHMI first and see if it will be easier/faster that way.  However, from re-reading this thread here, I can't run the HMI program on the same PC that TwinCAT is running on?  So what that means is that if I were to use AdvancedHMI on this next project, I would need to have another dedicated PC for the HMI in addition to the embedded PC (CX2040) that TwinCAT PLC will run on??  Is this still the case? 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Importing forms from one project into the AdvancedHMI Solution
« Reply #5 on: January 08, 2016, 02:04:28 PM »
However, from re-reading this thread here, I can't run the HMI program on the same PC that TwinCAT is running on?  So what that means is that if I were to use AdvancedHMI on this next project, I would need to have another dedicated PC for the HMI in addition to the embedded PC (CX2040) that TwinCAT PLC will run on??  Is this still the case?
This continues to be the case. AdvancedHMI uses a driver written from scratch that does not rely on the DLL from Beckhoff. The AdvancedHMI driver directly uses the TCP/IP and does not pass through the AMS router. If TwinCAT is on the same machine, for some reason it rejects packets that do not pass through the router.

I had spoken to Beckhoff several times about this and could never receive a good solution.

In all situations we use AdvancedHMI with TwinCAT, we always use a separate panel PC to run the HMI. I have found by using a CX controller with WinCE and a separate HMI has been a more reliable solution and the cost is not much different since a TwinCAT run-time for CE is much lower in cost than a run time on full Windows.

busarider29

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Importing forms from one project into the AdvancedHMI Solution
« Reply #6 on: January 08, 2016, 04:45:31 PM »
Bummer.  I would like to use AdvancedHMI simply because the communications is simpler to deal with it seems without having to write the code line by line for everything that needs to be communicated back to the UI.  I will need to re-evaluate what hardware I would require if not using full Windows then.  I guess its not that big of a deal and I could still use a CX2040 with full Windows and just use a cheap Dell PC that we have laying around for the HMI program? This is an in-house machine so we don't need anything new and shiny for HMI, as long as its fully functional.  I don't require a touch screen either.  In fact, mouse and keyboard are probably more appropriate for my application. 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Importing forms from one project into the AdvancedHMI Solution
« Reply #7 on: January 08, 2016, 05:24:45 PM »
If you are not running any other applications besides TwinCAT on the CX, then it is truly better to use WinCE for several reasons. It boots in about a quarter of the time, not susceptible to viruses, lower in cost, it does not require a special formatted flash card, and image updates from the Beckhoff ftp does not require you to get a password.

The last I checked it was almost $300 more for an Windows 7 image. If you're talking a cheap PC, that $300 saved would buy one. You can run AdvancedHMI on a very low end PC since it is quite efficient.