Page 1 of 1

Plotter-Addin: How to reduce datapoints in a Plot?

Posted: Wed 23. May 2012, 15:29
by franz
Hello everybody,

I work in a compagny which made electric vehicle prototypes and we use pcanexplorer 5 for CAN data access...

Today, the "plotter" is a wonderful tooI to carried out CAN data logging but I have some problem to adjust an appropriate data logging rate. Maybe someone could help me.

At the moment, I can log data in the millisecond range but this create too important data in my ".csv" file, especially when I have to make recording during several hours!

I would like to increase the update interval of the plotter to at least 1 seconde or more, but it seems that it's not "directly" possible. My local peak system supplier told me that first I need to create a virtual variable which will have the refresh rate that I want. Then, I need to create a macro which will be used in the plotter in order to log the data that want with the rate that I desire. Is that right?

Does anyone have already made this kind of operation? I don't know the virtual basic language and I don't really know how I can link the virtual var to the marcro and then the macro to the plotter...

Thank you very much for your help

Re: Plotter logging rate

Posted: Wed 23. May 2012, 16:35
by M.Maidhof
Hi,

yes, you can handle that with the help of a virtual variable and a simple VBmacro.

So here is an example symbol file with a virtual variable:

Code: Select all

FormatVersion=5.0 // Do not edit!
Title="franz"

{SENDRECEIVE}

[mySymbol]
ID=111h
DLC=8
Var=myVariable unsigned 0,8

{VIRTUALVARS}
Var=VirtualVar1 unsigned
and here is a VBmacro, to update the VirtualVar1 only every second:

Code: Select all

'------------------------------------------------------------------------------
'FILE DESCRIPTION: Macro to reduce Data in plot file
'------------------------------------------------------------------------------
Sub ReduceLoggingRate()
  Dim var, virt_var

  Set var = Signals("myVariable")
  Set virtvar = Signals("VirtualVar1")

  While True
    virtvar.Value = var.Value
    Wait(1000)	' Update each 1000ms, so that you have a Plotter point only every second.
  Wend

End Sub
Please apply the symbol file and the Macro then start the ReduceLoggingRate Macro in the Macro List. Then use the VirtualVar1 in your Plotter, instead of your normal signal/variable.
Take care to uncheck the Auto Update Intervall in the Plotter properties (Plotter->General-> Auto Update), to have only one plot point each second.

regards

Michael

Re: Plotter logging rate

Posted: Thu 31. May 2012, 14:50
by franz
Thank you for your answer! However, I still have questions :D

I can understand that this virtual variable will be logg each seconde but it don't represent anything...
I had 3 signals to logg (voltage, SOC and current which is in a different CAN message than the two others). I suppose that I need to link these CAN messages to one or maybe three virtual variables? Right?

How can I do that?

Thank you

Re: Plotter logging rate

Posted: Thu 31. May 2012, 15:04
by PEAK-Support
Yes, you are right. You need than 3 virtual Variables that "pick" every second the Value of your real CAN Signal.