Author Topic: Can advancedHMI run as a console application?  (Read 1613 times)

Brandon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Can advancedHMI run as a console application?
« on: September 17, 2015, 01:55:30 PM »
Hello,

This may seem like a silly question, but I'm wondering if I can compile an application to run as a console application without a GUI.  Strictly for the purpose of using the datalogger?
I need to be able to log when certain events occur in my PLC,  and I want to run the application on a Raspberry Pi so its small and compact.

I have the application running on a PI currently, but as a graphical application.  Which requires the Linux GUI to be loaded, and since I don't intend to even have a monitor hooked up to this most of the time.  Being able to run it from console right at startup would be more straight forward.

Does your library support that?
Thanks.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5270
    • View Profile
    • AdvancedHMI
Re: Can advancedHMI run as a console application?
« Reply #1 on: September 17, 2015, 02:06:13 PM »
AdvancedHMI is not tested under these conditions, but there is no reason it would not work. You would have to create all of your object instances in code and set all of the properties.

You can surely give it a try, but we just won't be able to provide much support. You can right click the Solution and add a Console Application to the Solution. Then add these references to the console application:

Projects:
AdvancedHMIControls
AdvancedHMIDrivers

You may also have to add references to:
AdvancedHMIDrivers\support\MfgControl.AdvancedHMI.Drivers.dll
AdvancedHMIControls\support\MfgControl.AdvancedHMI.Controls.dll

Brandon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Can advancedHMI run as a console application?
« Reply #2 on: September 17, 2015, 03:50:55 PM »
Hey Archie,

Thanks for the quick response, you were right, for the most part it does work.
The part I am stuck with currently, is getting the DataSubscriber2 class to work properly.  I believe the issue is with the SyncronizingObject which is normally assigned to the main form, I'm not sure how to provide that same behavior using a console. 

Without requiring a full solution, any suggestions that could point me to how to syncronize the events back onto the main thread?

Thanks


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5270
    • View Profile
    • AdvancedHMI
Re: Can advancedHMI run as a console application?
« Reply #3 on: September 17, 2015, 04:12:48 PM »
The SynchronizingObject should not be a problem because it checks whether it is set to anything. If not, then it raises the event on it's own thread. You can possibly try setting it to "Me"

Another option is to subscribe using code instead of the DataSubscriber:

        SubscriptionID = EthernetIPforCLXCom1.Subscribe("MyTag", 1, 500, AddressOf EthernetIPforCLXCom1_DataReceived)


    Private Sub EthernetIPforCLXCom1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs)
        '* The data will come back in e.values(0)
    End Sub

Brandon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Can advancedHMI run as a console application?
« Reply #4 on: September 17, 2015, 04:32:47 PM »
Yeah I noticed that it should raise the event without the synchronizing object,  but I never received any events at my on my main thread.
I am unable to set it to "Me" because in a console app, its running in a module, and if I made it a singleton, that creates its own issues.

Your second option does work however, only issue here is that it sends me all the tags whether they changed or not.   But that's not a big deal as I'll track and look for changes myself.  So

Thanks!

Awesome framework by the way!  I'm impressed with its internals.