Author Topic: Component to allow logging to .CSV  (Read 9027 times)

qwideman

  • Newbie
  • *
  • Posts: 41
    • View Profile
Component to allow logging to .CSV
« on: August 07, 2013, 05:43:01 PM »
Could a module be made that would contain the history of a data register by sampling it at regular intervals, much like "sampling" on most HMI platforms?
Could a module be made to display a graph of the data from the sampling channel?
Could a module be made to export the sampled data in .CSV format?

I'm not capable of coding this myself at this point. If these can be done, as well as support for email alerts and Multiple Modbus TCP/IP connections: I would be quite interested. If needed, I can probably pay for some of these features...


Thank you,

Quinton Wideman
Rolan Inc.
rolaninc.ca

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Component to allow logging to .CSV
« Reply #1 on: August 07, 2013, 09:25:05 PM »
I do have a SimpleDataLogger component that is also in testing. It simply connects to a single register and can be set to write the data to a text file either on a time interval or on change of data.

The charting of data requires a few lines of code, but is very simple. In the data group of the Toolbox is a Chart control. You add a Chart and a Timer component to your form. Set the interval (milliseconds) on the timer in the properties, then double click the timer to get back to the code. This is an example of code to trend a data point:

Code: [Select]
Dim NewValue as string=ModbusTCPCom1.ReadSynchronous("40001",1)(0)
Chart1.Series(0).points.add(NewValue)

baguinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Component to allow logging to .CSV
« Reply #2 on: August 07, 2013, 09:55:58 PM »
The alarm logging that I am doing can be saved in any format.  I used the .txt, because I had the program running on XP embedded PC and wanted to be able to recall on that PC, but I have tested with the .csv format, and it worked as well.  The coding used for the alarm logic should probably be able to be added to basiclabel code, or could just leave it as stand alone and include all labels you want to record.

qwideman

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Component to allow logging to .CSV
« Reply #3 on: August 08, 2013, 09:39:39 AM »
Thanks guys.

Glad to hear someone's done it. It is VB, so I know stuff is possible...

That code snippet there looks helpful. I'm not stuck on .csv, but it is easy to import into excel.
.txt should work too.


Quinton Wideman
Rolan Inc.

qwideman

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Component to allow logging to .CSV
« Reply #4 on: September 05, 2013, 10:51:17 AM »
I'm saving times and corresponding values in a .csv file. (time, value)  It is working quite well, but I don't see the functionality that I need in the VB chart control.


How would I plot times on the x axis and values on the y?
I would also like a way to display any time and the corresponding value, preferably using the mouse to hover over the graph.
It would be nice to plot up to 10 lines in different colours on the same graph.


Whats the best way to do this?


Quinton Wideman
Rolan Inc.



EDIT: This is the "Feature request" category, so my question was improperly worded. Is there currently a way to do what I asked about, or could a graph like this be included in AdvancedHMI in the future?
« Last Edit: September 05, 2013, 10:54:27 AM by qwideman »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Component to allow logging to .CSV
« Reply #5 on: September 05, 2013, 11:17:37 AM »
I haven't tried this out yet, but it looks like the key is in this:

Chart1.ChartAreas(0).AxisX.LabelStyle.Format = "yyyy/MM/dd hh:mm:ss"
Chart1.Series(0).XValueType = DataVisualization.Charting.ChartValueType.DateTime

qwideman

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Component to allow logging to .CSV
« Reply #6 on: September 05, 2013, 12:07:27 PM »
Thanks Archie,

I'm trying that now. I see now that there are settings in the chart control that allow different types of graphs after opening "series". My mistake.

Quinton

 

viper_lasser

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Component to allow logging to .CSV
« Reply #7 on: October 16, 2013, 08:03:47 AM »
I do have a SimpleDataLogger component that is also in testing. It simply connects to a single register and can be set to write the data to a text file either on a time interval or on change of data.

The charting of data requires a few lines of code, but is very simple. In the data group of the Toolbox is a Chart control. You add a Chart and a Timer component to your form. Set the interval (milliseconds) on the timer in the properties, then double click the timer to get back to the code. This is an example of code to trend a data point:

Code: [Select]
Dim NewValue as string=ModbusTCPCom1.ReadSynchronous("40001",1)(0)
Chart1.Series(0).points.add(NewValue)

Where we can find SimpleDataLogger component ?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Component to allow logging to .CSV
« Reply #8 on: October 16, 2013, 08:06:39 AM »
Where we can find SimpleDataLogger component ?
The SimpleDataLogger is still in testing phase and not yet available for public release yet.

viper_lasser

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Component to allow logging to .CSV
« Reply #9 on: October 17, 2013, 12:13:42 PM »
Is it a chance for testing it ?

R19sr

  • Newbie
  • *
  • Posts: 2
    • View Profile
Component to allow logging t
« Reply #10 on: December 11, 2014, 11:25:41 AM »
the best weve been able to come up with, is to get Component Details the same, but to rename Detail Components to Detail Blocks.

--J

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Component to allow logging to .CSV
« Reply #11 on: December 11, 2014, 01:16:34 PM »
There is now a component in the latest release called a BasicDataLogger