02-21-2018 02:40 PM
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
02-21-2018 04:52 PM
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
02-22-2018 06:24 AM
Here is a sample set
02-22-2018 09:31 AM
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?
02-22-2018 09:46 AM
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.
02-22-2018 10:15 AM
This 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.
02-22-2018 10:35 AM
Yea, Im thinking maybe I have it copied wrong?
I tired both groupings below. same out come.
02-22-2018 11:36 AM
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)