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 - bob1371

Pages: [1] 2 3
2
Support Questions / Re: EPPLUS .dll error
« on: July 10, 2018, 12:23:57 AM »

Thanks Godra,

Things finally Slowing down tonight so  maybe get a little time to mess with this. I did several projects last year and were working great. I had them running off USB drives and saving data to excel. Others decided they needed the USB drives more than I did and it had the Solution Files on there.
I should have retain some of the work I did but hey I like to make it hard on myself.

3
Support Questions / EPPLUS .dll error
« on: July 09, 2018, 12:01:30 AM »
Hello,


Working on a project and can't seem to get rid of this error.

I've updated the EPPLUS to latest version.
I've looked back through my previous post but still no luck.
If anyone could point me in right direction I would appreciate it.

Working on laptop with Win7 Pro 32 bit.

Thanks.

From Debug output window.
Code: [Select]
Prepare to Read Data
Data Has Been Read
Exception thrown: 'System.ArgumentException' in EPPlus.dll
The thread 0xc70 has exited with code 0 (0x0).
The thread 0x21ec has exited with code 0 (0x0).
The thread 0x27d0 has exited with code 0 (0x0).
The program '[12080] AdvancedHMI.exe' has exited with code 0 (0x0).


Here's everything in the Datasubscriber.

Code: [Select]
Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        If e.ErrorId = 0 AndAlso e.Values.Count > 0 AndAlso e.Values(0) = "True" Then

            Console.WriteLine(value:="Prepare to Read Data")
            '* Sets MyValues tags equal to PLC Tags
            Dim MyValues0 As String = EthernetIPforCLXCom1.Read("Station1_OperatorLog_Serial")
            Dim MyValues1 As String = EthernetIPforCLXCom1.Read("Station1_OperatorLog_Name")
            Dim MyValues25 As String = EthernetIPforCLXCom1.Read("TimeStamp")
            Dim MyValues8 As String = EthernetIPforCLXCom1.Read("MYD10")

            Console.WriteLine(value:="Data Has Been Read")



            '*Create Excel File & Transfer the Values to Excel

            '*Creates Excel file
            Using ExcelPackage As New OfficeOpenXml.ExcelPackage(New IO.FileInfo("C:\Users\Owner\Desktop\AdvancedHMIv399x\OP1Login.xlsx"))
                ExcelPackage.Workbook.Worksheets.Add(MyValues8)


                Console.WriteLine("ws creation ok")

                '*Writes the Headers in Row 1
                ExcelPackage.Workbook.Worksheets(MyValues0).Cells("A1").Value = "Part Serial Number"
                ExcelPackage.Workbook.Worksheets(MyValues1).Cells("B1").Value = "Operator Name"
                ExcelPackage.Workbook.Worksheets(MyValues25).Cells("C1").Value = "Date / Time Stamp"

                Console.WriteLine("header creation ok")

                ExcelPackage.Workbook.Worksheets(MyValues8).Cells("A1").AutoFitColumns()
                ExcelPackage.Workbook.Worksheets(MyValues8).Cells("B1").AutoFitColumns()
                ExcelPackage.Workbook.Worksheets(MyValues8).Cells("C1").AutoFitColumns()

                '*Loops to write data in correct columns
                For Index = 0 To MyValues0.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues0(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(MyValues8)
                    Dim CellNum As String = "A" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues0(Index)
                Next

                '*For Index = 0 To MyValues1.Length - 1
                '*Console.WriteLine("Element " & Index & "=" & MyValues1(Index))
                '*Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(MyValues8)
                '*Dim CellNum As String = "B" & (Index + 3)
                '*  ws.Cells(CellNum).Value = MyValues1(Index)
                '*Next

                '*For Index = 0 To MyValues25.Length - 1
                '*Console.WriteLine("Element " & Index & "=" & MyValues25(Index))
                '*  Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(MyValues8)
                '*    Dim CellNum As String = "C" & (Index + 3)
                '*      ws.Cells(CellNum).Value = MyValues25(Index)
                '*  Next
                Console.WriteLine("Operator Login OK")



                '*Saves.xlsl file
                ExcelPackage.Save()

            End Using

        End If
    End Sub
End Class


4
Open Discussion / Re: Exception thrown
« on: December 04, 2017, 10:53:59 PM »


Thanks guys.

Using the Try/Catch routine it showed PLC losing connection. I then took my array size down to 700 elements and all working good.

5
Open Discussion / Exception thrown
« on: November 30, 2017, 09:57:34 PM »
Hello,

Working on a new application for data collection. I've tried this a couple different times on 2 different computers and always get the same fault.

From my output screen.
Code: [Select]
About to read the data
Exception thrown: 'MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException' in MfgControl.AdvancedHMI.Drivers.dll

Here is the actual code. I've double checked my tags and looks like I have everything correct.
Any Idea's?
Thanks

Code: [Select]
  Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        If e.ErrorId = 0 AndAlso e.Values.Count > 0 AndAlso e.Values(0) = "True" Then
            Console.WriteLine("About to read the data")

            Dim MyValues0() As String = EthernetIPforCLXCom1.Read("look_doser_sn_pn_array[0]", 999)
            Dim MyValues8 As String = EthernetIPforCLXCom1.Read("MDY10")


            Console.WriteLine("All Data Read")

            '*Transfer the values to Excel

            '*Creates Excel file
            Using ExcelPackage As New OfficeOpenXml.ExcelPackage(New IO.FileInfo("C:\2220\Doser.xlsx"))
                ExcelPackage.Workbook.Worksheets.Add(MyValues8)
                Console.WriteLine("ws creation ok")

                '*Writes the Headers in Row 1
                ExcelPackage.Workbook.Worksheets(MyValues8).Cells("A1").Value = "...................................DOSER.................................."

                Console.WriteLine("header creation ok")

                ExcelPackage.Workbook.Worksheets(MyValues8).Cells("A1").AutoFitColumns()

                '*Loops to write data in correct columns
                For Index = 0 To MyValues0.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues0(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(MyValues8)
                    Dim CellNum As String = "A" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues0(Index)
                Next
                Console.WriteLine("Doser OK")



                '*Saves.xlsl file
                ExcelPackage.Save()

            End Using
        End If
    End Sub


6
Open Discussion / Re: Copy 500 element array to Excel?
« on: November 01, 2017, 12:36:46 AM »

I just had it Autosize the width to fit the headers. As for converting to a number, the team that will be gathering this data for trending will just multiply by 1 when they do the import.


You might look at this and it may lead you in right direction.

worksheet.cells["C2:C5"].style.Numberformat.format = "#,###"

7
Open Discussion / Re: Controlling Excel with EPPLUS
« on: October 19, 2017, 01:57:54 AM »
Thanks Archie,

Made these changes and a couple other things and working great.


8
Open Discussion / Controlling Excel with EPPLUS
« on: October 16, 2017, 03:54:39 AM »


I've been collecting data now for a couple of weeks and all is working good. The current project is copying 7 array (500 elements in each) to the file. I am using a string tag (MyValues20) with mmddyyyy as well as shift "1st" and this is the name of the tab. I  save  this data each shift, clear the array and start over. As long as the value is MyValues20 is different than last it creates a new tab and writes the data. This has been working great.


Code: [Select]
'*Creates Excel file
            Using ExcelPackage As New OfficeOpenXml.ExcelPackage(New IO.FileInfo("C:\Test.xlsx"))
                ExcelPackage.Workbook.Worksheets.Add(MyValues20)
                Console.WriteLine("ws creation ok")


                For Index = 0 To MyValues0.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues0(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(MyValues20)
                    Dim CellNum As String = "A" & (Index + 2)
                    ws.Cells(CellNum).Value = MyValues0(Index)
                Next
                Console.WriteLine("Inspect")

I've moved on to a smaller application only collecting data from 7 tags twice daily.  Instead of creating a new tab I want to just index to the next row and let it run for the month but as long as MyValues20 is same as existing tab i get an exception error.

Do I need to ignore this line "ExcelPackage.Workbook.Worksheets.Add(MyValues20)" if the tab already exist?

Thanks.

9
Application Showcase / Re: System Upgrade with AdvancedHMI Panel PC
« on: October 10, 2017, 03:25:56 AM »

Nice,

I think next project I may work on something with the Cognex Scanners.

10
Open Discussion / Re: Copy 500 element array to Excel?
« on: October 04, 2017, 02:08:13 AM »
I'm running the application off USB drive but storing file to C:\Data.
Changed it to write file to USB drive and working fine.

Thanks.

11
Open Discussion / Re: Copy 500 element array to Excel?
« on: October 02, 2017, 11:00:34 PM »
Archie,

For the projects I am working on I am using Panasonic Tough book with Win 7.

After creating I am loading to Mini PC which is running Win 10. Everything was working fine but when I got the data collection stuff worked out I added the datasubscriber  and copied my code. Everything works but doesn't create the file. I've tried on 2 different computers with Win 10 and same thing. I can run the same application on Win 7 and all is fine.

Any info on why this wouldn't work on Win10?

Thanks.

12
Application Showcase / Re: First project that I just keep adding too.
« on: October 02, 2017, 10:57:05 PM »
Congratulation on your first project!.

If you don't mind some critique for your screen, frankly, it's looks absolutely horrible, one of the worst HMI screens I have ever seen.

May I suggest adding an AAHMI logo screen on the top right hand corner. This beautiful logo when added to the HMI screen will increase its unique beauty and show that it was intelligently designed.

Plus, It shows that you are appreciating Archie's work, he deserve some credits here.

Well noted. I will work that into the next project.

13
Application Showcase / Re: First project that I just keep adding too.
« on: September 30, 2017, 03:29:42 AM »
Forgot to add image.


14
Open Discussion / Re: Copy 500 element array to Excel?
« on: September 30, 2017, 12:31:25 AM »
Figured out this last issue.  I was using Concatenate to build yyyy/mm/dd I changed it to yyyy.mm.dd and working as it should.

15
Open Discussion / Re: Copy 500 element array to Excel?
« on: September 29, 2017, 03:59:43 AM »
I'm Back. LOL


I've modified the code to collect data from all 8 cells with the goal to create the .xlsx file first of the month then write the data to a different tab each day. I'm writing the date as tab name (yyyy mm dd) and headers for the columns I'm using. However when the date rolls over it creates the new tab with the correct date but doesn't write the data to it. I've tried various ways to mess around with this "ExcelPackage.Workbook.Worksheets(1)" but no luck. Can you point me in the right direction???

Also is it possible to get a confirmation bit back to PLC that data was written??

The code and .xlsx file attached.

Thanks.

Code: [Select]
Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged

        If e.ErrorId = 0 AndAlso e.Values.Count > 0 AndAlso e.Values(0) = "True" Then
            Console.WriteLine("About to read the data")
            Dim MyValues0() As String = EthernetIPforCLXCom1.Read("VCell1B_FES_Cycle_Average[0]", 500)
            Dim MyValues1() As String = EthernetIPforCLXCom1.Read("VCell_1A_FES_Cycle_Average[0]", 500)
            Dim MyValues2() As String = EthernetIPforCLXCom1.Read("VCell_2B_FES_Cycle_Average[0]", 500)
            Dim MyValues3() As String = EthernetIPforCLXCom1.Read("VCell_2A_FES_Cycle_Average[0]", 500)
            Dim MyValues4() As String = EthernetIPforCLXCom1.Read("VCell_3B_FES_Cycle_Average[0]", 500)
            Dim MyValues5() As String = EthernetIPforCLXCom1.Read("VCell_3A_FES_Cycle_Average[0]", 500)
            Dim MyValues6() As String = EthernetIPforCLXCom1.Read("Inspect_FES_Cycle_Average[0]", 500)
            Dim MyValues7() As String = EthernetIPforCLXCom1.Read("Repair_FES_Cycle_Average[0]", 500)
            Dim MyValues8 As String = EthernetIPforCLXCom1.Read("MDY5")

            Console.WriteLine(MyValues0.Length & "elements read VCell_1B.")
            Console.WriteLine(MyValues1.Length & "elements read VCell_1A.")
            Console.WriteLine(MyValues2.Length & "elements read VCell_2B.")
            Console.WriteLine(MyValues3.Length & "elements read VCell_2A.")
            Console.WriteLine(MyValues4.Length & "elements read VCell_3B.")
            Console.WriteLine(MyValues5.Length & "elements read VCell_3A.")
            Console.WriteLine(MyValues6.Length & "elements read Inspect.")
            Console.WriteLine(MyValues7.Length & "elements read Repair.")
            Console.WriteLine("All Data Read")

            '*Transfer the values to Excel

            '*Creates Excel file
            Using ExcelPackage As New OfficeOpenXml.ExcelPackage(New IO.FileInfo("C:\Data.xlsx"))
                ExcelPackage.Workbook.Worksheets.Add(MyValues8)
                Console.WriteLine("ws creation ok")

                '*Writes the Headers in Row 1
                ExcelPackage.Workbook.Worksheets(1).Cells("A1").Value = "VCell 1B"
                ExcelPackage.Workbook.Worksheets(1).Cells("C1").Value = "VCell 1A"
                ExcelPackage.Workbook.Worksheets(1).Cells("E1").Value = "VCell 2B"
                ExcelPackage.Workbook.Worksheets(1).Cells("G1").Value = "VCell 2A"
                ExcelPackage.Workbook.Worksheets(1).Cells("I1").Value = "VCell 3B"
                ExcelPackage.Workbook.Worksheets(1).Cells("K1").Value = "VCell 3A"
                ExcelPackage.Workbook.Worksheets(1).Cells("M1").Value = "Inspect"
                ExcelPackage.Workbook.Worksheets(1).Cells("O1").Value = "Repair"
                Console.WriteLine("header creation ok")

                '*Loops to write data in correct columns
                For Index = 0 To MyValues0.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues0(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "A" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues0(Index)
                Next
                Console.WriteLine("Worksheet OK 1B")

                For Index = 0 To MyValues1.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues1(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "C" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues1(Index)
                Next
                Console.WriteLine("Worksheet OK 1A")

                For Index = 0 To MyValues2.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues2(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "E" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues2(Index)
                Next
                Console.WriteLine("Worksheet OK 2B")

                For Index = 0 To MyValues3.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues3(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "G" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues3(Index)
                Next
                Console.WriteLine("Worksheet OK 2A")

                For Index = 0 To MyValues4.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues4(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "I" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues4(Index)
                Next
                Console.WriteLine("Worksheet OK 3B")

                For Index = 0 To MyValues5.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues5(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "K" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues5(Index)
                Next
                Console.WriteLine("Worksheet OK 3A")
                For Index = 0 To MyValues6.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues6(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "M" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues6(Index)
                Next
                Console.WriteLine("Worksheet OK Inspect")

                For Index = 0 To MyValues7.Length - 1
                    Console.WriteLine("Element " & Index & "=" & MyValues7(Index))
                    Dim ws As OfficeOpenXml.ExcelWorksheet = ExcelPackage.Workbook.Worksheets(1)
                    Dim CellNum As String = "O" & (Index + 3)
                    ws.Cells(CellNum).Value = MyValues7(Index)
                Next
                Console.WriteLine("Worksheet OK Repair")

                '*Saves.xlsl file
                ExcelPackage.Save()

            End Using
        End If
    End Sub

Pages: [1] 2 3