Author Topic: Basicdatalogger2 not recording in real time  (Read 2136 times)

rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Basicdatalogger2 not recording in real time
« on: March 29, 2017, 05:19:56 PM »
Hello,
I have two basicdatalogger2 running. One of them reads 3 tags from the PLC, the second one reads 27 tags.
When AHMI is running without PLC connection both files are updated with zero values, of course, but OK.
When the PLC is connected, the first datalogger2, the one that only reads 3 tags, works fine.
The second one doesn't record anything. The values are shown on the screen, but they are not recorded by the basicdatalogger.
Any thoughts??
Thank you.


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Basicdatalogger2 not recording in real time
« Reply #1 on: March 29, 2017, 05:32:10 PM »
Is the ComComponent Property in both of them the same? Is PauseLogging set to False?

rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Basicdatalogger2 not recording in real time
« Reply #2 on: March 29, 2017, 06:24:48 PM »
Same ComComponent.
PauseLogging is set to False. Using TimeInterval

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Basicdatalogger2 not recording in real time
« Reply #3 on: March 29, 2017, 07:11:27 PM »
- In Solution Explorer, expand down the AdvancedHMIControls project
- Expand down the \Components folder
- Right Click BasicDataLogger2.vb and select View Code
- Go down to line 233 and insert a breakpoint
- Add another breakpoint at line 241
- Run the application to see if it stops at either breakpoint

rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Basicdatalogger2 not recording in real time
« Reply #4 on: March 29, 2017, 07:48:43 PM »
It does stop at breakpoint.
I tried with no PLC connected. Cannot have it online now.
The weird thing is that it does work fine for the first basicdatalogger instance.
Is there any limit on the number of tags in the Collection list?

rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Basicdatalogger2 not recording in real time
« Reply #5 on: March 29, 2017, 08:02:21 PM »
I remembered that I replaced this:
StringToWrite &= "," & item.LastValue
by this:
StringToWrite &= "," & CDbl(item.LastValue).ToString("0.0")

That's what you suggested to get the result with one decimal point.

rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Basicdatalogger2 not recording in real time
« Reply #6 on: March 29, 2017, 08:04:52 PM »
So I had the lines shifted.
I placed the breakpoint now at lines 234 and 242 and ran the program.
It didn't stop at any breakpoint.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Basicdatalogger2 not recording in real time
« Reply #7 on: March 29, 2017, 08:32:00 PM »
I was hoping that was going to take us to an exception. The next question is whether the StoreValue is being executed. To check this, we are going to have to remove your working DataLogger in order to easily isolate the non-working logger, so you may want to make a copy of your project to work with.

- Remove the working BasicDataLogger2
- In BasicDataLogger2.vb add a break point at line 222 (If Not m_PauseLogging Then)
- Run the application to see if it hits the breakpoint.
- If so, step through the code with F10
- If not, add a BreakPoint at line 191

rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Basicdatalogger2 not recording in real time
« Reply #8 on: March 29, 2017, 08:36:42 PM »
It looks the problem lies in the list of Items in the Collection.
I have a couple of bits N7:0/6 and N7:0/7 in the list and it seems they are not accepted.
When I add one of those to the working Collection list, it does not get recorded any more. No matter in what position they are in the list.
As soon as I remove them the basicdatalogger works as  a charm.
If that is the case, how can I include the status of those bit in the list?

rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Basicdatalogger2 not recording in real time
« Reply #9 on: March 29, 2017, 08:46:25 PM »
In the datalogger I replaced this line :

StringToWrite &= "," & CDbl(item.LastValue).ToString("0.0")

with the original one:

StringToWrite &= "," & item.LastValue

And everything works OK.
Something needs to be added to the first line to avoid the True/False values from being treated as numbers, if I want to keep my numeric values with just one decimal point.


rmac

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Basicdatalogger2 not recording in real time
« Reply #10 on: March 29, 2017, 09:50:54 PM »
Archie,
I added a few lines to the basicdatalogger and it does work now with the True/False values from N7:0/x in the Collection List.
See below.
THANK YOU VERY MUCH FOR YOUR PATIENCE!!!

For Each item In PLCAddressValueItems
                    If item.ScaleFactor = 1 Then
                        If item.LastValue = "True" Or item.LastValue = "False" Then
                            StringToWrite &= "," & item.LastValue
                        Else
                            StringToWrite &= "," & CDbl(item.LastValue).ToString("0.0")
                        End If

                    Else
                            Try
                            StringToWrite &= "," & (item.LastValue * item.ScaleFactor)
                        Catch ex As Exception
                            StringToWrite &= "," & "INVALID-Check scale factor-" & item.LastValue
                        End Try
                    End If
Next