06-28-2016 06:13 PM
Hello everyone,
I am very new to DIAdem. I am trying to create a template with a list of channels that is essentially standardizd accross the board in terms of the files that will be imported into DIAdem and ultimately analyzed. What I am trying to generate is a simple metric that will go through my list of signals and read the data and if one of the signals fails based on a given condition, I want a counter to add one to the till. So for example, a signal fails: Failed_Signals = Failed_Signals + 1
Once all of the signals have been checked, a view will be presented showing:
Example
Failed Signals: 5
Can someone please get me on the right track and approach here?
Much Appreciated!
06-29-2016 04:58 AM
i.e. the condition is <0.6 and you check ch(1)
dim i, j
j = 1
for i = 1 to chnlength(1)
if chdx(i,1) < 0.6 then
j = j + 1
end if
next
msgbox("Failed Signals: " & j)
06-29-2016 12:40 PM
Hi Kyle,
If you have DIAdem 2014 or later, then you could use the ChnEvent...() functions to count such events. This will run much faster than an explicit VBScript loop. Of course, if your data channels are small to medium in size, there's nothing wrong with the direct approach Traderhans provided.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
06-30-2016 12:26 PM
This is what I had in mind and the counter process makes sense but how do I reference my channel list so that the signals individuall get checked? My range for failure is betweein -90 and -100 by the way.
Once again, I appreciate the help here.
07-01-2016 03:35 PM
Hi Kyle,
What DIAdem version are you using? The syntax is different in 2014 and 2015 and beyond.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-01-2016 05:56 PM
It's the 2015 version
07-02-2016 07:56 PM
Hi Kyle,
If you just want to see if ever a given channel enters the failure range and count the number of such channels in a particular group, here's what I mean:
LimLo = -100 LimHi = -90 Set Group = Data.Root.ChannelGroups(1)
FOR Each Channel In Group.Channels EventList = ChnEventDetectionWindow("", Channel, LimLo, LimHi) IF ChnEventCount(EventList) > 0 THEN j = j + 1 : Names = Names & vbCRLF & Channel.Name Next ' Channel MsgBox "Failed Signals = " & j & vbCRLF & String(20, "-") & Names
Or you can use the numeric result of the ChnEventCount() fuunction to keep track of how many different times a given channel enters the failure window.
Brad Turpin
DIAdem Product Support Engineer
National Instruments