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

Pages: [1]
1
Support Questions / Copying 2 dimensional array from plc to another plc
« on: October 01, 2021, 12:27:24 PM »
I am trying to send data from one plc to another plc, eventually it will be multiple. This is the code I have now, but I know that there has to be a better way to process this much data, hopefully a faster way as well. I have seen subscriptions used, but am unsure how to implement. Any ideas would be appreciated.

Code: [Select]
  Private Sub SendDataToController1()
        loading.Show()
        Dim i1, i2, As Integer
        Try
            For i1 = 1 To 15
                For i2 = 1 To 8
                    Group00SchDataFromMain(15, 8) = MainShopController.Read("Group00ScheduleData[" & i1 & "," & i2 & "]")
                    Group01SchDataFromMain(15, 8) = MainShopController.Read("Group01ScheduleData[" & i1 & "," & i2 & "]")
                    Group02SchDataFromMain(15, 8) = MainShopController.Read("Group02ScheduleData[" & i1 & "," & i2 & "]")
                    Group03SchDataFromMain(15, 8) = MainShopController.Read("Group03ScheduleData[" & i1 & "," & i2 & "]")
                    Group04SchDataFromMain(15, 8) = MainShopController.Read("Group04ScheduleData[" & i1 & "," & i2 & "]")
                    Group05SchDataFromMain(15, 8) = MainShopController.Read("Group05ScheduleData[" & i1 & "," & i2 & "]")
                    Group06SchDataFromMain(15, 8) = MainShopController.Read("Group06ScheduleData[" & i1 & "," & i2 & "]")
                    Group07SchDataFromMain(15, 8) = MainShopController.Read("Group07ScheduleData[" & i1 & "," & i2 & "]")
                    Group08SchDataFromMain(15, 8) = MainShopController.Read("Group08ScheduleData[" & i1 & "," & i2 & "]")
                    Group09SchDataFromMain(15, 8) = MainShopController.Read("Group09ScheduleData[" & i1 & "," & i2 & "]")
                    Group10SchDataFromMain(15, 8) = MainShopController.Read("Group10ScheduleData[" & i1 & "," & i2 & "]")
                    Group11SchDataFromMain(15, 8) = MainShopController.Read("Group11ScheduleData[" & i1 & "," & i2 & "]")
                    Group12SchDataFromMain(15, 8) = MainShopController.Read("Group12ScheduleData[" & i1 & "," & i2 & "]")
                    Group13SchDataFromMain(15, 8) = MainShopController.Read("Group13ScheduleData[" & i1 & "," & i2 & "]")
                    Group14SchDataFromMain(15, 8) = MainShopController.Read("Group14ScheduleData[" & i1 & "," & i2 & "]")
                    Group15SchDataFromMain(15, 8) = MainShopController.Read("Group15ScheduleData[" & i1 & "," & i2 & "]")
                    Controller1.Write("Group00ScheduleData[" & i1 & "," & i2 & "]", Group00SchDataFromMain(15, 8))
                    Controller1.Write("Group01ScheduleData[" & i1 & "," & i2 & "]", Group01SchDataFromMain(15, 8))
                    Controller1.Write("Group02ScheduleData[" & i1 & "," & i2 & "]", Group02SchDataFromMain(15, 8))
                    Controller1.Write("Group03ScheduleData[" & i1 & "," & i2 & "]", Group03SchDataFromMain(15, 8))
                    Controller1.Write("Group04ScheduleData[" & i1 & "," & i2 & "]", Group04SchDataFromMain(15, 8))
                    Controller1.Write("Group05ScheduleData[" & i1 & "," & i2 & "]", Group05SchDataFromMain(15, 8))
                    Controller1.Write("Group06ScheduleData[" & i1 & "," & i2 & "]", Group06SchDataFromMain(15, 8))
                    Controller1.Write("Group07ScheduleData[" & i1 & "," & i2 & "]", Group07SchDataFromMain(15, 8))
                    Controller1.Write("Group08ScheduleData[" & i1 & "," & i2 & "]", Group08SchDataFromMain(15, 8))
                    Controller1.Write("Group09ScheduleData[" & i1 & "," & i2 & "]", Group09SchDataFromMain(15, 8))
                    Controller1.Write("Group10ScheduleData[" & i1 & "," & i2 & "]", Group10SchDataFromMain(15, 8))
                    Controller1.Write("Group11ScheduleData[" & i1 & "," & i2 & "]", Group11SchDataFromMain(15, 8))
                    Controller1.Write("Group12ScheduleData[" & i1 & "," & i2 & "]", Group12SchDataFromMain(15, 8))
                    Controller1.Write("Group13ScheduleData[" & i1 & "," & i2 & "]", Group13SchDataFromMain(15, 8))
                    Controller1.Write("Group14ScheduleData[" & i1 & "," & i2 & "]", Group14SchDataFromMain(15, 8))
                    Controller1.Write("Group15ScheduleData[" & i1 & "," & i2 & "]", Group15SchDataFromMain(15, 8))
                Next
            Next
        Catch ex As Exception
            MsgBox("Failed to read or write PLC Data")
        End Try
        loading.Close()
    End Sub   

2
Open Discussion / Re: Displaying Tag Description
« on: December 01, 2020, 12:54:00 PM »
Can you think of a better way to do this? Or point me in the right direction?

I need to monitor every INput or Output change on a PLC and then log them somewhere.

Thanks!

3
Open Discussion / Displaying Tag Description
« on: December 01, 2020, 10:49:22 AM »
Hello!

I am trying to log some data and would like to include a description along with the tag name and value. I have tried a couple of ways with out any luck.

Currently I am stuck on Error BC30469 Reference to a non-shared member requires an object reference.

Does anyone have a better way to do this?

The text document is formated:

TagName,ScaleFactor,ScaleOfset,Description

Most of this code is from the documentation page under Configuring a DataSubscriber2 with a CSV file.

Code: [Select]
    Private Sub DataSubscriber21_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber21.DataChanged
        DataSubscriber21.BeginInit()
        Using sw As New System.IO.StreamReader("MyConfigFile.txt")
            Dim LineFromFile As String
            Dim Settings() As String
            Dim NewPLCAddressItem As MfgControl.AdvancedHMI.Drivers.PLCAddressItem
            While Not sw.EndOfStream
                LineFromFile = sw.ReadLine
                Settings = LineFromFile.Split(",")
                NewPLCAddressItem = New MfgControl.AdvancedHMI.Drivers.PLCAddressItem
                NewPLCAddressItem.PLCAddress = Settings(0)
                If Settings.Length > 1 Then
                    NewPLCAddressItem.ScaleFactor = CDbl(Settings(1))
                End If
                If Settings.Length > 2 Then
                    NewPLCAddressItem.ScaleOffset = CDbl(Settings(2))
                End If
                If Settings.Length > 3 Then
                    NewPLCAddressItem.Description = Settings(3)
                End If
                DataSubscriber21.PLCAddressValueItems.Add(NewPLCAddressItem)
            End While
        End Using
        DataSubscriber21.EndInit()
        Using sw As New System.IO.StreamWriter("LogFile.txt", True)
            sw.WriteLine(Now & " - " & e.PlcAddress & " " & e.Values(0) & MfgControl.AdvancedHMI.Drivers.PLCAddressItem.Description)
        End Using
    End Sub

Thanks!

4
Open Discussion / Log Data on Value Change
« on: November 17, 2020, 12:58:13 PM »
Hey guys!

I’m looking to keep a log of I/O changes on a compact logic PLC. I have been using the BasicDataLogger2G on 399y Beta 35R1, but it is not exactly what I would like. It currently logs like this:

Date Time, Tag Value, Tag Value, Tag Value

I would like it to be:
Date Time TagName Tag Value

I would like a new line with just the value that has changed. Not every value when just one changes. I’ve tried manipulating the code with no success. Has anyone done this or have any ideas to lead me in the correct direction?

Thanks!

Pages: [1]