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.


Topics - FuzyDragon

Pages: [1]
1
Support Questions / Testing PLC connection without using a ping command
« on: February 09, 2016, 08:47:50 AM »
Hello all,

I am running into issues with my current project when it comes to checking the connection state of my PLC. I am currently using the ping command to ping the IP address of the PLC but that just checks if the PLC is on the network, not if the PLC is actually online and ready to send/receive data. Obviously, this causes exceptions as I currently have reads and writes happen only when the PLC is on the network. Is there a way through AdvancedHMI to check if a PLC is ready for data as opposed to if it is connected to a network? Here is a sample of what I currently use just for reference.

If My.Computer.Network.Ping(plcIP) = True Then
            outputDataReals = EthernetIPforCLXCom1.Read("HMIIO.Input[0]", 500)
            inputDataReals = EthernetIPforCLXCom1.Read("HMIIO.Output[0]", 500)
            outputDataBits = EthernetIPforCLXCom1.Read("HMIIO.InputBits[0]", 500)
            inputDataBits = EthernetIPforCLXCom1.Read("HMIIO.OutputBits[0]", 500)

            outputDataRealsBuffer = EthernetIPforCLXCom1.Read("HMIIO.Input[0]", 500)
            outputDataBitsBuffer = EthernetIPforCLXCom1.Read("HMIIO.InputBits[0]", 500)
        Else
            plcStatus = "Connection Lost"
            Label1.Visible = True
            Label1.Text = plcStatus
            Label1.BackColor = Color.Red
        End If

Thank you in advance for any help or advice,

Fuzydragon

2
Support Questions / EthernetIP Read Array of Strings
« on: February 04, 2016, 08:57:26 AM »
Hello All,

I was curious if the EthernetIPforCLXCom1.Read command could read string values stored in arrays inside the PLC. I'm trying to compose different kinds of emails depending on different situations using the read command and the most I'm getting are numbers like 21516. I am currently using AdvancedHMI v 399a. Thanks in advance for any help.


Fuzydragon

3
Support Questions / Show Historical Data with ChartBySampling
« on: December 08, 2015, 09:43:37 AM »
Hello all,

I have a ChartBySampling up and running in my code and it works just fine with the PLC addresses I have put into it. However, whenever I close the form that has the graph in it and reopen it, the data that was previously collected was gone and it started over from scratch again. I need to keep that data in the graph because we need to see days worth of data on this graph. Is there a way to have the graph open and close while still having it record data for however long the graph is open?

4
Open Discussion / Adding and Removing PLC Addresses in ChartBySampling
« on: December 07, 2015, 11:02:49 AM »
I am trying to write code for a real time data chart for a large array of Thermocouples (120 to be exact). I want to show the temperatures that they are reading separately but the catch is that I don't want to show data for PLC Addresses that may not have a thermocouple input. For example, if there are only 25 thermocouples plugged in, I only want to show the first 25 as they will show real data, the rest will be some weird other number.

Is there a way to run an If loop or some form of logic to have something look at the value of all 120 PLC address and if it's in a certain range add it into the collection? I've tried using the ChartBySample1.PLCAddressItems.Add command but I don't think I'm entering the right arguments for it.

Thanks in advance for any help or advice you can give.


5
Open Discussion / Creating a label to show real time data
« on: November 10, 2015, 09:56:21 AM »
I am currently working on a screen that will show data being captured in real time (or as close to that as I can get). What I have so far is a List box that contains all of the Addresses and a function that changes a Label based on which address is chosen. I also have a timer running to update the read every second. I am using the EthernetIPforMicro800Com driver set to the IP of the test PLC. The generic label text works fine but I can't get the variable holding the real time data to show.  Though I'm not entirely sure where the issue is, I believe I'm running into an issue with my code reading my PLC Addresses. I will paste what I have below. Thank you in advance for any help or advice.

Public Class ThermocoupleScreen
    Public ThermoData(140) As String
    Public Sub ThermocoupleScreen_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim StringToAdd As String
        For count As Integer = 1 To 120
            StringToAdd = "DAQThermocouples[" + count.ToString + "]"
            ListBox1.Items.Add(StringToAdd)
        Next
        For x As Integer = 1 To 120
            EthernetIPforMicro800Com1.BeginRead("DB.CURRENT.dataPoints[" & x.ToString & "]", 1)
        Next
    End Sub


    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Timer1.Interval = 1000
        Label2.Text = "Ticking"
        For y As Integer = 1 To 120
            EthernetIPforMicro800Com1.Read("DB.CURRENT.dataPoints[" & y.ToString & "]", 1)
        Next

    End Sub


    Private Sub EthernetIPforMicro800Com1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforMicro800Com1.DataReceived
        If e.PlcAddress = "DB.CURRENT.dataPoints[1]" Then
            ThermoData(0) = e.Values(0)
        End If
        If e.PlcAddress = "DB.CURRENT.dataPoints[2]" Then
            ThermoData(1) = e.Values(0)
        End If
        If e.PlcAddress = "DB.CURRENT.dataPoints[3]" Then
            ThermoData(2) = e.Values(0)
        End If
    End Sub


    Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
        For z As Integer = 0 To 119
            Label1.Text = ListBox1.SelectedItem.ToString + " is " + ThermoData(z) + " Deg. C"
        Next

    End Sub
End Class

6
I'm currently working on a way to read multiple PLC Addresses in a single call as opposed to individually stating each Address (because I have a lot of addresses to read). The code I have so far looks like this: Inside a ButtonClick trigger I have the driver read the addresses and create the array

 For x As Integer = 1 To 120
            EthernetIPforMicro800Com1.BeginRead("DAQThermocouple[" & x.ToString & "].in1", 120)
            EthernetIPforMicro800Com1.BeginRead("DAQThermocouple[" & x.ToString & "].in2", 120)
            EthernetIPforMicro800Com1.BeginRead("DAQThermocouple[" & x.ToString & "].in3", 120)
            EthernetIPforMicro800Com1.BeginRead("DAQThermocouple[" & x.ToString & "].out1", 120)
            EthernetIPforMicro800Com1.BeginRead("DAQThermocouple[" & x.ToString & "].out2", 120)
            EthernetIPforMicro800Com1.BeginRead("DAQThermocouple[" & x.ToString & "].out3", 120)
 Next

Then when data is received I use this piece of code

 Private Sub EthernetIPforMicro800Com1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforMicro800Com1.DataReceived

        For x As Integer = 1 To 120
            If e.PlcAddress = "DAQThermocouple[" & x.ToString & "].in1 " Then
                For index As Integer = 0 To 119
                    CalDataToLog(index) = e.Values(index)
                Next
            End If

            If e.PlcAddress = "DAQThermocouple[" & x.ToString & "].in2" Then
                For index As Integer = 131 To 250
                    CalDataToLog(index) = e.Values(index)
                Next
            End If

            If e.PlcAddress = "DAQThermocouple[" & x.ToString & "].in3" Then
                For index As Integer = 262 To 381
                    CalDataToLog(index) = e.Values(index)
                Next
            End If

            If e.PlcAddress = "DAQThermocouple[" & x.ToString & "].out1" Then
                For index As Integer = 393 To 512
                    CalDataToLog(index) = e.Values(index)
                Next
            End If

            If e.PlcAddress = "DAQThermocouple[" & x.ToString & "].out2" Then
                For index As Integer = 524 To 643
                    CalDataToLog(index) = e.Values(index)
                Next
            End If

            If e.PlcAddress = "DAQThermocouple[" & x.ToString & "].out3" Then
                For index As Integer = 655 To 774
                    CalDataToLog(index) = e.Values(index)
                Next
            End If
        Next
End Sub

None of this actually catches the data though. I think it may be a problem with reading the PLC Addresses initially but I'm not sure.

Thanks in advance for any advice or help

7
Support Questions / Email Client With Multiple Addresses
« on: October 06, 2015, 08:00:51 AM »
I have been working on trying to send multiple emails using Advanced HMI on the event of an alarm bit changing. I saw Archie's post about how to send a single email through a bit change so I started with that and modified it to stream read from two .ini files. One has the email list I want to iterate through and the other has the STMP email server name we will be utilizing. The code I have runs fine but only sends an email to the first person on the list. Any ideas on how to properly iterate through to send emails to everyone on the list?

8
I am currently working on calibrating multiple channels by passing a single variable upon loading a form but I'm stuck with how to make the PLC Addresses actually change and add into the data subscriber. Am I on the right track with this.


Public Class MainForm
    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private NotFirstShow As Boolean
    Public TagInfo(2) As String
    Public PLCAddress As AdvancedHMIDrivers.PLCAddressItem
    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        '* Do not start comms on first show in case it was set to disable in design mode
        If NotFirstShow Then
            AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        Else
            NotFirstShow = True
        End If
    End Sub

    Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles Me.Load
        Me.Text = "Room Name Channel Name"
        Me.Tag = "10.193.114.72,ANALOG_IN.chamberPressure" 'Will be passed from form opening. Both of these values are temporary
        TagInfo = Split(Me.Tag, ",")
        BasicLabel1.Text = "Current A/D Input ="
        BasicLabel2.Text = "Current EU Output ="
        BasicLabel3.Text = "Low"
        BasicLabel4.Text = "Med"
        BasicLabel5.Text = "High"

        BasicLabel7.Text = TagInfo(0)
        Label2.Text = "A/D"
        Label3.Text = "Engineering Units"
        EthernetIPforMicro800Com1.IPAddress = TagInfo(0)
        BasicLabel6.Text = (TagInfo(1) + ".in1")

        'Starts not passing
        PLCAddress.PLCAddress = (TagInfo(1) + ".in1")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".in1")
        'AddHandler DataSubscriber1.DataChanged, AddressOf DataSubscriber_DataChanged

        PLCAddress.PLCAddress = (TagInfo(1) + ".in2")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".in2")

        PLCAddress.PLCAddress = (TagInfo(1) + ".in3")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".in3")

        PLCAddress.PLCAddress = (TagInfo(1) + ".out1")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".out1")

        PLCAddress.PLCAddress = (TagInfo(1) + ".out2")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".out2")

        PLCAddress.PLCAddress = (TagInfo(1) + ".out3")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".out3")

        PLCAddress.PLCAddress = (TagInfo(1) + ".input")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".input")

        PLCAddress.PLCAddress = (TagInfo(1) + ".output")
        DataSubscriber1.CommComponent = EthernetIPforMicro800Com1
        DataSubscriber1.SynchronizingObject = Me
        DataSubscriber1.PLCAddressValue = (TagInfo(1) + ".output")
    End Sub

    Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs)
        If e.PlcAddress = "ANALOG_IN.chamberPressure.input" Then
            BasicLabel1.Text = e.Values(0)
            BasicLabel1.Text = "Current A/D Input =" + "ANALOG_IN.chamberPressure.input"
        End If

        If e.PlcAddress = "ANALOG_IN.chamberPressure.output" Then
            BasicLabel2.Text = e.Values(0)
            BasicLabel2.Text = "Current EU Input =" + "ANALOG_IN.chamberPressure.output"
        End If

        If e.PlcAddress = "ANALOG_IN.chamberPressure.in1" Then
            BasicLabel3.Text = e.Values(0)
            BasicLabel3.Text = "low" + "ANALOG_IN.chamberPressure.in1"
        End If

        If e.PlcAddress = "ANALOG_IN.chamberPressure.in2" Then
            BasicLabel4.Text = e.Values(0)
            BasicLabel4.Text = "Med" + "ANALOG_IN.chamberPressure.in2"
        End If

        If e.PlcAddress = "ANALOG_IN.chamberPressure.in3" Then
            BasicLabel5.Text = e.Values(0)
            BasicLabel5.Text = "High" + "ANALOG_IN.chamberPressure.in3"
        End If

        If e.PlcAddress = " ThenANALOG_IN.chamberPressure.out1" Then
            BasicLabel6.Text = e.Values(0)
            BasicLabel6.Text = "ANALOG_IN.chamberPressure.out1"
        End If

        If e.PlcAddress = "ANALOG_IN.chamberPressure.out2" Then
            BasicLabel7.Text = e.Values(0)
            BasicLabel7.Text = +"ANALOG_IN.chamberPressure.out2"
        End If

        If e.PlcAddress = "ANALOG_IN.chamberPressure.out3" Then
            BasicLabel8.Text = e.Values(0)
            BasicLabel8.Text = "ANALOG_IN.chamberPressure.out3"
        End If
    End Sub

End Class

Pages: [1]