DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

finding trigger in one channel to offset another

Hello,

I have many sets of just 2 channels (force vs Displacement)

I need to find the displacement value at 5 newton's so I can offset the displacement channel to zero. normally I would just delete what I don't need and offset it. but I will have 50 sets to do at a time. I know once I get this part figured out I can just replicate it for the rest of my channels

Capture.PNG

0 Kudos
Message 1 of 8
(3,146 Views)

Hi RIahna,

 

Can you post a sample of the X-Channel: Displacement and Y-Channel: Force that you're using in TDM?

 

You could start with ChnFind() command, this "determines the first row in a data channel that meets a specified condition. The ChnFindfunction searches a data channel from the beginning to the end" based on the index. Your expression would be to find when Force >= 5, that will return the index of this value. Then, assuming Force and Displacement are the same length, you can use that index number to get the displacement value for that channel and offset everything to 0.

 

Best,

Chris D. | Applications Engineer | National Instruments

0 Kudos
Message 2 of 8
(3,130 Views)

Here is a sample set

0 Kudos
Message 3 of 8
(3,101 Views)
Dim force: force = 5
Dim row: row = ChnFind("Ch(""data/X1 4 Force"") > " & force & "", 0)
Call DataBlDel(Data.Root.ChannelGroups("data").Channels("X1 4 Deflection"), 1, row)

I loaded the example file into DIAdem and did this.  Was that what you were looking for?

0 Kudos
Message 4 of 8
(3,087 Views)

this looks like it should work to me,

but I'm getting an error

"Error message from DIAdem command kernel:

Cannot execute calculation because the input channel "CH(data/X1 4 Force)" is unknown."

 

using 2014 32bit

I will try it again here in a bit, have to set up some other testing.

0 Kudos
Message 5 of 8
(3,084 Views)

snips.PNGThis is how my data portal looks like.  The command works because I have the "data" group and the "X1 4 Froce" channel in that group.  If your data portal looks differently ("data1/X1 4 Force") then you either have to modify your code or your group/channel naming.  If you have a large set of channel groups, you'd need to use this setup in a loop to address each group. 

0 Kudos
Message 6 of 8
(3,082 Views)

 

Yea, Im thinking maybe I have it copied wrong?

code.PNG

I tired both groupings below. same out come.
data.PNGdata1.PNG

0 Kudos
Message 7 of 8
(3,076 Views)

Try [1]/X1 4 Force ?

 

Dim force: force = 5
Dim row: row = ChnFind("Ch([1]/X1 4 Force) > " & force & "", 0)
Call DataBlDel(Data.Root.ChannelGroups("data").Channels("X1 4 Deflection"), 1, row)
0 Kudos
Message 8 of 8
(3,071 Views)