DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

timming data from a trigger on channel

Solved!
Go to solution

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

0 Kudos
Message 1 of 11
(6,417 Views)

.

Message 2 of 11
(6,402 Views)

..

0 Kudos
Message 3 of 11
(6,401 Views)

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

Start_from_Trigger.png

0 Kudos
Message 4 of 11
(6,400 Views)

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

sample trace.png

0 Kudos
Message 5 of 11
(6,381 Views)

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

0 Kudos
Message 6 of 11
(6,379 Views)

No, the class is in Livonia Michigan. It is pretty informative so far so I would recommend.

0 Kudos
Message 7 of 11
(6,377 Views)

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")

 

Message 8 of 11
(6,371 Views)
Solution
Accepted by topic author CVfactor

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.

 

Channel Trigger.png

0 Kudos
Message 9 of 11
(6,365 Views)

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.CCh_Error.png

0 Kudos
Message 10 of 11
(6,320 Views)