12-05-2012 09:01 AM - edited 12-05-2012 09:02 AM
Hello,
I am interested in developing a DIAdem script that can look at a trigger value on a specific channel within a file and remove all prior data on all channels before the trigger index.
As an example, the data file below contains a trace of a pump activation. I would like to trigger off of the moment that the voltage to the motor (Motor Voltage) starts to rise from zero (this would be t=0 for all waveforms).
This could be done in the Labview software that acquires the data, but I would rather do this in DIAdem in the post processing of the data.
I looked for a similar example on the discussion forums and sample code but could not find anything. If there is a similiar script that I can base this off of, that would be great.
Any input would be appreciated.
Thanks
Solved! Go to Solution.
12-06-2012 02:50 AM - edited 12-06-2012 02:59 AM
.
12-06-2012 02:53 AM - edited 12-06-2012 02:59 AM
..
12-06-2012 02:58 AM
Hello CVFactor,
never try to send an answer too quickly. Here is the correct display of the curve which shows that the curve doesn't drop down to 0. I had in fact displayed the data using a percentage scaling.
So let me repeat my question: Where would you expect to see the trigger ?
Andreas
12-06-2012 10:33 AM
Hi Andreas,
Sorry that data file does not show the motor voltage, so instead I would like to trigger off of the motor current as an example (the green channel in the picture below).
I'm actually in a DIAdem advanced training class right now so I will probably learn how to do this when I finish this class.
Thanks for the help
12-06-2012 10:37 AM
Hello CVFactor,
OK, I'll provide an example for the motor current channel. Is the DIAdem class the one currently taking place in Aachen ?
Andreas
12-06-2012 10:40 AM
No, the class is in Livonia Michigan. It is pretty informative so far so I would recommend.
12-06-2012 10:53 AM
Hello CVFactor,
enjoy the class. Glad to hear that you like it. Here is a possible solution for what you are trying to achieve. Hope its helps
Andreas
'------------------------------------------------------------------------------- ' '------------------------------------------------------------------------------- Option Explicit Dim TriggerIndex,oChnTrigger,oList,K Dim dThreshold ' The following 2 lines are for testing only: ' (I have converted the file to TDM ) Call Data.Root.Clear() Call DataFileLoad("E:\Customer_Requests\DF_Start_from_Trigger\Start_from_Trigger.tdm","","") ' Search Trigger: Set oChnTrigger = Data.Root.ChannelGroups(1).Channels("Motor Current - SA0113 - Rack2") ' The values at the beginning of teh channel are not exactly 0 ' Define numeric value which should be exceeded to define start of desired data dThreshold = 1.0 TriggerIndex = ChnFind("Ch("""&oChnTrigger.GetReference(eRefTypeIndexName) &""") > "&str(dThreshold ,"d.ddd",1)) Call DataBlDel(Data.Root.ChannelGroups(1).Channels,1,TriggerIndex-1,True) ' The following is optional ' Correct time channel to start with 0 Call ChnOffset("[1]/Time (s)","/Time (s)",0,"first value offset") ' Make channels waveforms Set oList = Data.CreateElementList For K = 1 To Data.Root.ChannelGroups(1).Channels.Count Call oList.Add(Data.Root.ChannelGroups(1).Channels(K)) Next Call oList.Remove(2) ' Exclude time channel from the list Call ChnToWfChn("[1]/Time (s)",oList,1,"WfXRelative")
12-06-2012 01:10 PM
Hi Andreas,
I just had Brad Turpin from NI look at this and he created this script in about 10 seconds. I will have to tweak it a little, but it looks good.
Im sure yours will work also and I will take a look at that when I get back to work.
Thanks for the help.
12-10-2012 07:48 AM
The code above seemed to work fine in the training class, but when I got back to the office and tried it I get the error shown below. I'm uising DIAdem 11.1 and in the class
we were using Diadem 2011. I'm not sure this is part of the problem. Any ideas would be appreciated.