1
Support Questions / Re: Troubleshooting DataLogger with no PLC
« on: November 22, 2019, 03:42:14 PM »
Thank you for your help!
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.
'* 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