09-14-2009 01:07 PM
I am new to diadem and really don't have a clue what i'm doing. I have a log file with a time and voltage in it. I would like to calculate the time the voltage is high. the file only contains one transition from low to high and back to low.
I have attached my data file. I have figured out how to graph the data and to find the points manually but it takes quit a while to do it.
09-14-2009 06:53 PM
Hello Chandler,
A small Script or formula calculation can help you automate this task:
Copy this into the Script editor:
Dim i,j
i = ChnFind("Ch(""[1]/Voltage"") > 6")
msgbox(chd(i,"Time"))
j = (chd(i,"Time"))
msgbox(Str(RTT(j),"mm/dd/yyyy hh:nn:ss.ffff"))
Explanation by line:
Let me know if that answered your question,
Otmar
09-15-2009 09:17 AM
Hi chandler,
Did you mean the initial time at the rising edge (which Otmar addressed), or did you mean the duration of time that the signal remained high?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
09-15-2009 01:15 PM
09-15-2009 03:27 PM
Hello Chandler,
Here is the code used to determine the duration. There are a few unnecessary message boxes, but I left them for better understanding of the code and results. This will calculate the glitch duration for the "Voltage" channel - since the signal is so noisy I used 8 and 0 as my limits. This would be better used on the "Smoothed" channel, but it is easily changed to work on that channel.
Dim i,j,k,m,ni = ChnFind("Ch(""[1]/Voltage"") > 8")
msgbox(chd(i,"Time"))j = (chd(i,"Time"))
msgbox(Str(RTT(j),"mm/dd/yyyy hh:nn:ss.ffff"))k = ChnFind("Ch(""[1]/Voltage"") < 0",i)
m = (chd(k,"Time"))n = m - j
msgbox(Str(RTT(n),"mm/dd/yyyy hh:nn:ss.ffff"))
I hope this helps ...
Otmar