Page 1 of 1
Display Cycle Time in Graph
Posted: Wed 11. May 2016, 15:23
by Heiko
Hi together!
is there a way to display the cycle time of a certain CAN-ID I am receiving in a graph (for example in a line writer file or in a plotter file)? The goal is to measure and display cycle time stability.
I am new to the PEAK Explorer - every help is very appreciated!
Cheers
Heiko
Re: Display Cycle Time in Graph
Posted: Tue 17. May 2016, 09:36
by PEAK-Support
You need to wrote a small VB Script in PE5 and measure the time between the incomming CAN Message. Then store this information in a virtual signal. This signal could then be used like any other signal in PE5 and so could aslo be shown inside the Plotter or Linewriter.
Re: Display Cycle Time in Graph
Posted: Tue 3. Jan 2017, 09:45
by T. Eggers
Hello,
that is exactly what I am trying to do. But I am having problems with going to milliseconds resolution.
My signal is supposed to be received every 10ms. And I want to plot the variation on that time.
I can get the time stamp of my signal,
BUT only to the resolution of seconds.
Code: Select all
Dim dow
Set dow = Signals("X")
PrintToOutputWindow dow.ValueChangeTime ' prints 03.01.2017 08:37:01
PrintToOutputWindow datepart("s",dow.ValueChangeTime) ' prints secounds
The documentation mentions the ValueChangeTimeString property and that would give me access to milliseconds and even microseconds,
BUT that property does not exist for a signal object.
Greatings
Eggers
Re: Display Cycle Time in Graph
Posted: Wed 4. Jan 2017, 12:53
by PEAK-Support
In the VB script use a layer 2 client - receice the raw message. In the CAN Message Structure you have a timestamp that you could use.
But it is always only the time between the 2 incomming CAN Messages...you will NEVER know when the signal was realy changed - this is not possible..only if the sending node does only send out the CAN Message if the signal is changed..but what happened with other signals in the same CAN Frame ?!
Re: Display Cycle Time in Graph
Posted: Wed 4. Jan 2017, 14:27
by T. Eggers
Thank you
with that information and the WaitForID100() example i have my plot up and running.
Is there a way I can plot this information without having to load a .sym file to get a virtual variable?
Or a way to load more than one .sym file?
Re: Display Cycle Time in Graph
Posted: Thu 5. Jan 2017, 09:31
by PEAK-Support
If you want, you could generate a Signal/Symbol at "runtime" - so no need for a SYM File
Her a small sample.
This Macro will use the 2 Signals Voltage and Current from the Symbol file , but generate the Signal Power dynamicly if not available. Like this you could also generate own Signals without a SYM File.
Code: Select all
Sub CalculatePower()
Dim voltage, current, power
Set voltage = Signals("Voltage")
Set current = Signals("Current")
Set power = Signals("Power")
If power Is Nothing Then
' Signal not found, create and initialize new one
Set power = Signals.Add("Power")
power.DataType = peDataTypeFloat
End If
While True
power.Value = voltage.Value * current.Value
Wait(10) ' Prevent 100% CPU load
Wend
End Sub