Author Topic: Troubleshooting DataLogger with no PLC  (Read 1834 times)

kyleriege

  • Newbie
  • *
  • Posts: 5
    • View Profile
Troubleshooting DataLogger with no PLC
« on: November 19, 2019, 06:46:18 PM »
Can I 'trick' the data logger into believing there is a successful subscription the the PLC so that I can troubleshoot without being next to the PLC?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Troubleshooting DataLogger with no PLC
« Reply #1 on: November 19, 2019, 08:46:48 PM »
Is there a simulator you could possibly use instead (what PLC are you connecting to)?

kyleriege

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Troubleshooting DataLogger with no PLC
« Reply #2 on: November 20, 2019, 11:21:21 AM »
I can look into that. I am using a AB ControlLogix

Phrog30

  • Guest
Re: Troubleshooting DataLogger with no PLC
« Reply #3 on: November 20, 2019, 02:56:03 PM »
If you have emulate you can create a topic in Linx and use OPC driver to test.  I find this clunky but doable if you don't have a PLC.

kyleriege

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Troubleshooting DataLogger with no PLC
« Reply #4 on: November 21, 2019, 11:16:08 AM »
Unfortunately I am new to this, and don't really understand what a 'topic in linx' is or an OPC driver. Do you have a link to another forum thread, or a writeup that goes into more detail on that?

Phrog30

  • Guest
Re: Troubleshooting DataLogger with no PLC
« Reply #5 on: November 21, 2019, 01:09:45 PM »
Since you are new it's best to start this post over again.  What exactly are you wanting to test without a PLC?  If you plop buttons on a form and want to see those work, you need something to talk to, whether it's a PLC or simulator.  Being new, you NEED a PLC.  If you are wanting to test code, there are ways, but you have to be specific as Archie turned off ESP mode on this forum.

kyleriege

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Troubleshooting DataLogger with no PLC
« Reply #6 on: November 21, 2019, 02:09:44 PM »
Specifically, I am trying to troubleshoot the DataLogging Functionality, and the creation of the file. I am using DataLogger2.

I have found where the file is created, and modified it slightly to write a header row based on the PLCAddressValueItems Collection. I have to create two datalog files as I have two PLCs I am connecting to, and I cannot figure out how to merge them - a problem for another time. I have added controls on my main HMI screen to update the Log Interval and Save Path for the log files, and that is what I want to test.

I basically want the datalogger to think it has connected to a PLC so that it creates the log files.

Code: [Select]

'* When the subscription with the PLC succeeded, setup for logging
    Protected Overrides Sub OnSuccessfulSubscription(e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs)
        MyBase.OnSuccessfulSubscription(e)

        '* create the timer to log the data
        If m_LogTriggerType = TriggerType.TimeInterval Then
            If LogTimer Is Nothing Then
                LogTimer = New Timer
                If m_LogInterval > 0 Then
                    LogTimer.Interval = m_LogInterval
                Else
                    LogTimer.Interval = 1000
                End If
                AddHandler LogTimer.Tick, AddressOf LogInterval_Tick

                LogTimer.Enabled = True
            End If
        End If

        '* Create the file for logging data
        Try
            If sw Is Nothing Then
                sw = New System.IO.StreamWriter(m_FileFolder & "\" & m_FileName, True)
                'sw.WriteLine("TIME, KW, KVAR, VAB, VBC, VCA, IA, IB, IC, HZ, ") 'write header column
                Try
                    Dim StringToWrite As String = m_Prefix
                    If m_TimeStampFormat IsNot Nothing AndAlso (String.Compare(m_TimeStampFormat, "") <> 0) Then StringToWrite &= Date.Now.ToString(m_TimeStampFormat)

                    For Each item In PLCAddressValueItems
                        StringToWrite &= "," & item.Name
                    Next
                    sw.WriteLine(StringToWrite)
                    sw.Flush()
                Catch ex As Exception
                End Try
            End If
        Catch ex As Exception
            OnComError(New MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs(-101, ex.Message))
        End Try
    End Sub


Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Troubleshooting DataLogger with no PLC
« Reply #7 on: November 21, 2019, 04:09:26 PM »
Since that's all you want to do, here is what you can try:

1) Consider using updated BasiDataLogger2 from this topic:
        https://www.advancedhmi.com/forum/index.php?topic=2519.0
2) Download MODRSsim2 simulator from the Internet or possibly use the one from this topic:
        https://www.advancedhmi.com/forum/index.php?topic=765.msg15122#msg15122
3) Use a fresh AdvancedHMI project, add a ModbusTCP driver and set its IPAddress to 127.0.0.1, add a BasiDataLogger2 and set the logging options as you wish and also add a few BasicLabel controls which you can point to Modbus addresses like 00001, 00002, 40001, 40002 ... (put the same address in PLCAddressValue and PLCAddressKeypad)
4) Start the simulator and make sure it is using TCP connection and then start the AHMI.

The simulator will allow you to change values just by clicking the BasicLabel controls and using the keypad.


kyleriege

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Troubleshooting DataLogger with no PLC
« Reply #8 on: November 22, 2019, 03:42:14 PM »
Thank you for your help!