Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - seth350

Pages: [1] 2 3 4
1
Feature Request / Re: OPC-UA Driver
« on: August 17, 2018, 09:19:14 PM »
No bites on this?

I have been researching different OPC-UA stacks to add to AdvancedHMI.
I have found one that works out of the box and whose syntax is very similar to AdvancedHMI.
It’s by a company named Traeger.
They offer their sdk as a 14 day trial.
Download it, add two references to AdvancedHMI and off you go.

Code: [Select]
Import OPC.UaFx.Client

Dim client As New OpcClient(“opc.tcp://192.168.16.97:4840”)
client.Connect()
Label1.Text = client.ReadNode(“ns=6;s=::AsGlobalPV:TankTemperature.Actual”)

The sdk allows read/write to one or multiple nodes. Also can subscribe to one or many nodes and will fire an event if one changes.

Bad thing is they are in Germany. Not sure if they sell to USA.

https://www.traeger.de/opc-produkte/net-opc-ua-server-and-client-sdk.html

If anyone else has found something similar or has somehow got the Open OPC-UA sdk to work please let me know.

2
Support Questions / Re: RaspberryPi Debugging CPU Usage
« on: July 21, 2018, 11:45:35 PM »
Thanks EvenChu

I have started looking through the code as I get time. The one thing that I have found is this:

I have a status panel that displays messages and images on the main form.
I set the messages and images by using an event arguments class “StatusEventArgs”.

So if an event is fired that needs to set the status panel message and image, I call a SetStatus method like so:
SetStatus(New StatusArgs(“New Message”, imgNewImage, Color.Green, Color.White)

The colors are setting background color and text color.

I set new messages to this status panel many times. Each time making a call just like above.

Not sure if this would cause my symptoms but it’s one thing that has stood out.

3
Support Questions / Re: RaspberryPi Debugging CPU Usage
« on: June 22, 2018, 11:38:54 PM »
84 degrees C?? 183 F??

Correct.

The next set of RPis I will order will have heatsinks and a fan.

If I didn’t have this usage problem, the temp sits at 50C.

4
Support Questions / Re: RaspberryPi Debugging CPU Usage
« on: June 22, 2018, 10:52:47 AM »
Are you cooling it? Pi's and other SBC an get super hot and then shut down.

No cooling. Temp goes up to 84C and sits. I think it does some throttling based on temp.
I know many people are using RPi with Mono to run AHMI and I can't imagine them all having the same issue as I am. Otherwise there would be more hits on the net.

I wish I could get more debug info about what is actually occurring inside each "Threadpool work" thread.

5
Support Questions / Re: RaspberryPi Debugging CPU Usage
« on: June 21, 2018, 11:01:41 PM »
I thought so Archie.

Godra,
I had not seen that program, thanks for sharing. Still, even if I limit the cpu usage, wouldn’t the application still suffer? The app runs for about a week or two then stops responding or gets really slow. Wouldn’t setting the cpu limit lower just make the app lock up sooner?

I am by means doing any fancy threading in the app. I am using a sound player that plays a small wav file. Depending on how you call it, it will play the file in a separate thread. I am calling it so that it does just that.

The wav file plays when a user has completed scanning all of their parts. A different sound plays if the wrong part is scanned, and another different sound plays on each successful scan.

The sound player is not an AdvancedHMI component, and I can’t remember exactly which one I used.

I would assume that it would handle its threads appropriately though? I wouldn’t need to dispose of the player once it’s finished?

6
Support Questions / RaspberryPi Debugging CPU Usage
« on: June 20, 2018, 10:08:32 AM »
Good morning,

I have been battling high cpu usage for some time now. It seems the app starts out small and grows over time until it locks up. The app is running in Mono.

In the RaspberryPi, you can open a new terminal window and enter the command type in:
Code: [Select]
top
This displays the processes currently running and the system resources. A little trick while in this command is to press Shift + H, this will display all of the threads currently running and their resources.

I wanted to share some screenshots of what my app is doing to try to figure out if its something in MY code, Mono, or if it is something in AdvancedHMI causing this.

Archie,
Are the "Threadpool work" threads apart of AHMI?

Mono Version: 5.2.0.215
AdvancedHMI Version: 3.99x


7
Feature Request / OPC-UA Driver
« on: June 16, 2018, 10:24:24 PM »
I know that the OPC-DA SDK is finicky but I wanted to throw this out there for future consideration.

Now that we are in this calamity of IoT, more and more devices are turning on to OPC-UA. There are some open source projects out there and SDKs to add OPC-UA to a .NET project. I have not attempted to integrate it into AdvancedHMI yet. I haven’t had any downtime to give it a try.

If OPC-UA could be added to AdvancedHMI, that would mean that every single PLC in my plant could be connected to an AdvancedHMI app. As well as newer devices that are coming out.

The OPC-DA driver it has now doesn’t seem to work correctly with all servers. Or at least with a B&R plc.
This PLC can do ModbusTCP, explicit EIP, Powerlink, OPC-DA, and OPC-UA. As well as HTTP and TCP/UDP.

Just a suggestion...

8
Application Showcase / Re: Black Box Install
« on: May 17, 2018, 09:55:56 PM »
Can you give an example of how you are using it? Are you essentially hosting all plc communication on one app and sharing the data across tcp to clients?

9
Tips & Tricks / Re: AdvancedHMI on a Raspberry Pi
« on: May 05, 2018, 10:58:21 PM »
I would suggest that unless you have no other option, not to use a Raspberry and Mono.
Small Windows 10 PCs can be had for not much more money. Not to mention less pain.
Don’t get me wrong, AHMI will run fine on a RPi in Mono. However, Mono has its gotchas and you will be hard pressed to find support for a problem when you run into one.
The Mono community seems too caught up to release the next big update to help users with the current version. Especially if your problem is not “interesting”.

I have three RPis running Mono and AHMI. Out of all the issues, the one I deal with the most and have yet to solve is high cpu usage. It may not show up for a few weeks then one day the cpu will go to 100% and stay there until the app is restarted. This is only on the RPi.

Reminds me of that scene in Jurassic Park. “Nuh-uh-uuh! You didn’t say the magic word!”

10
Open Discussion / Re: 4-20 mA AC output
« on: February 16, 2018, 08:23:23 PM »
Why not a solid state relay?

11
Open Discussion / Re: Event Arguments: Is this wrong?
« on: January 31, 2018, 11:42:33 AM »
If you are looking to optimize your code, Visual Studio has some very good tools. The Performance Analyzer in the Analyze menu can give some very good information, but can also be difficult to decipher. Essentially you run your program for a time period with the performance analyzer, then it can break down what code consumed the most CPU and memory.

Difficult to decipher. Yes. lol

Taking your advice, I ran the profiler and found that this bit of code is using the most memory, or 15%. Seems like using Resource Manager is quite taxing. I will try using direct file paths instead.

Code: [Select]
''' <summary>
    ''' Gets the image that the status image should be set to.
    ''' </summary>
    ''' <returns>Image</returns>
    Public ReadOnly Property Image As Image
        Get
            Select Case _code
                Case 0
                    Return Nothing
                Case 1 'scanning complete
                    Return My.Resources.greenCheck
                Case 2 'invalid scan
                    Return My.Resources.traffic_light_red
                Case 3
                    Return My.Resources.important
                Case 4 'station ready
                    Return My.Resources.traffic_light_green
                Case Else
                    Return My.Resources.gear
            End Select
        End Get
    End Property

12
Open Discussion / Re: Event Arguments: Is this wrong?
« on: January 30, 2018, 08:56:32 PM »
Thank you Archie, I see very well what you mean.
In my mind, I was seeing a new StatusArgs created every time the app verified a scan with potentially the exact same parameters as the last one that was created.

This particular event updates a picture box on the main form and sets the label for it.

 
This is just one of several things that I have looked at when trying to trim some fat in the app and optimize the code. My main concern is to try to resolve a high cpu usage on a Raspberry Pi 3.
Other areas were corrected that were constantly accessing properties of other classes, like inside a For Loop. Instead, I dim’d a local variable to first go grab the property, then use that variable in the For Loop.

It was also mentioned that the PictureBox control was frowned upon in regards to performance. An Image control was preferred unless features of the PictureBox were necessary.

13
Open Discussion / Event Arguments: Is this wrong?
« on: January 30, 2018, 04:11:54 PM »
Good afternoon all,

I have a question regarding event arguments and their correct use.

I have an app that I have created several different EventArgs for different events. Each passing the needed information to the event sub.

The class this sub is located in is declared once from the MainForm. In this sub, I am using StatusArgs as my event argument.
My question is, is it necessary for me to be calling "New StatusArgs" every time I raise an event? Would calling "New StatusArgs" be creating a new instance that eventually uses up resources?

I suppose the real question is, after calling "New StatusArgs" and setting the information in it, does the instance hang out forever in memory?

Would the better option be to create one instance of StatusArgs for the class, and then just set the arguments every time I raise the event? Would doing this essentially overwrite the variables that are stored in the instance?



Code: [Select]
    Public Sub VerifyPart(ByVal scan As String)

        Dim partFound As Boolean = False

        For Each item As ListViewItem In _list.Items
            If scan = item.SubItems.Item(1).Text Then
                If CheckOffItem(item) = True Then
                    RaiseEvent OnPartProcessed(Me, New StatusArgs(0, String.Format("Part# {0} is valid! Please scan the next part.", scan), Color.Green, Color.White))
                    _audio.ValidScan()
                Else
                    RaiseEvent OnPartProcessed(Me, New StatusArgs(2, String.Format("Part# {0} previously scanned!" & vbNewLine & "Verify your quanity and try again.", scan), Color.Red, Color.White))
                    _audio.InvalidScan()
                End If
                partFound = True
            End If
        Next item

        If partFound = False Then
            If scan = "NoRead" Then
                RaiseEvent OnPartProcessed(Me, New StatusArgs(2, "Scanner did not find a bar code. Try again.", Color.Red, Color.White))
                RaiseEvent InvalidLog(Me, New StatusArgs(scan, "Scanner did not find a bar code. No Read."))
            Else
                RaiseEvent OnPartProcessed(Me, New StatusArgs(2, String.Format("Part# {0} is invalid. Please verify your parts.", scan), Color.Red, Color.White))
                RaiseEvent InvalidLog(Me, New StatusArgs(scan, String.Format("Part# {0} was not found in the current parts list.", scan)))
                _audio.InvalidScan()
            End If

        End If

    End Sub

Code: [Select]
''' <summary>
''' Station Status Arguments Class For Passing Information To The Status Panel.
''' </summary>
Public Class StatusArgs
    Inherits EventArgs

    Private _code As Integer
    Private _msg As String
    Private _scan As String
    Private _backclr As Color
    Private _foreclr As Color

    ''' <summary>
    ''' Creates a new instance to pass status arguments to the status panel.
    ''' </summary>
    ''' <param name="code">Determines what the graphic and color is set to. 0=No Change To Image 1=Scanning Complete 2=Scan Invalid 3=General Alarm 4=Ready</param>
    ''' <param name="msg">Text to set the status to.</param>
    ''' <param name="backclr">Specify what color to set backcolor on status panel.</param>
    ''' <param name="foreclr">Specify what color to set the text to.</param>
    Public Sub New(ByVal code As Integer, ByVal msg As String, ByVal backclr As Color, ByVal foreclr As Color)

        _code = code
        _msg = msg
        _backclr = backclr
        _foreclr = foreclr

    End Sub

    ''' <summary>
    ''' Creates new instance of StatusArgs to pass scanned code and message.
    ''' </summary>
    ''' <param name="scan">The scanned bar code to pass.</param>
    ''' <param name="msg">The message to attach.</param>
    Public Sub New(ByVal scan As String, ByVal msg As String)
        _scan = scan
        _msg = msg
    End Sub

    ''' <summary>
    ''' Indicates what status image/color should be displayed.
    ''' </summary>
    ''' <returns>Integer</returns>
    Public ReadOnly Property Code As Integer
        Get
            Return _code
        End Get
    End Property

    ''' <summary>
    ''' Gets the status message.
    ''' </summary>
    ''' <returns>String</returns>
    Public ReadOnly Property Message As String
        Get
            Return _msg
        End Get
    End Property

    ''' <summary>
    ''' Gets the scanned code associated with this event.
    ''' </summary>
    ''' <returns>String</returns>
    Public ReadOnly Property Scan As String
        Get
            Return _scan
        End Get
    End Property

    ''' <summary>
    ''' Gets the image that the status image should be set to.
    ''' </summary>
    ''' <returns>Image</returns>
    Public ReadOnly Property Image As Image
        Get
            Select Case _code
                Case 0
                    Return Nothing
                Case 1 'scanning complete
                    Return My.Resources.greenCheck
                Case 2 'invalid scan
                    Return My.Resources.traffic_light_red
                Case 3
                    Return My.Resources.important
                Case 4 'station ready
                    Return My.Resources.traffic_light_green
                Case Else
                    Return My.Resources.gear
            End Select
        End Get
    End Property

    ''' <summary>
    ''' Gets the back color of the status image and message.
    ''' </summary>
    ''' <returns>Color</returns>
    Public ReadOnly Property BackColor As Color
        Get
            Return _backclr
        End Get
    End Property

    ''' <summary>
    ''' Gets the fore ground color for the status message.
    ''' </summary>
    ''' <returns>Color</returns>
    Public ReadOnly Property ForeColor As Color
        Get
            Return _foreclr
        End Get
    End Property

End Class

 


14
I would like to see some B&R Ethernet drivers. The OpcDa is finicky and it’s no fault of Archie, it just s is what it is. ModbusTcp works with B&R but I am not sure how well reading 92 addresses at once would perform.

I’m sure there are bigger fish to fry but just wanted to throw it in the ring.

15
Additional Components / Re: Mono Serial Drivers - DF1 and ModbusRTU
« on: January 26, 2018, 06:27:10 AM »
Yeah, Archie and I have had the same discussion. I would much rather use a Windows PC but IT says no.

Pages: [1] 2 3 4