Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

08-06-2019 10:28 AM - edited 08-06-2019 10:48 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

HI,

is there a way to compare the data in Diadem channels, like i have this two channels, lets say "ca_Cyl1PressurePeakMeanFiltered_Mpa" and "NewChnZ", i would like to do a comparison where i would like to check if the values of "ca_Cyl1PressurePeakMeanFiltered_Mpa" channel are greater than values of "NewChnZ" channel if so do nothing else flag the index of "ca_Cyl1PressurePeakMeanFiltered_Mpa" and store it to some new channel.

for example:

lets say if the channel "ca_Cyl1PressurePeakMeanFiltered_Mpa" has entries (12.56,12.80,12.66) and the channel "NewChnZ" has entries (12.5,12.5,12.4) then the 3rd entry/index should be flagged and get to stored in to new channel.

Thanks in Advance.

Solved! Go to Solution.

Solution

Accepted by topic author Kandukuri_raghavendra

08-06-2019 10:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

08-06-2019 10:45 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thank you @gsklyr, that's exactly what i was looking for.

08-12-2019 04:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

You can compare the channel values in two ways, one within a script, and another using the Analysis panel channel event search dialog (see http://www.savvydiademsolutions.com/analysis.php?topic=event-search-free-formula).

In a script, use the Calculate() command for the best speed, and always use the numeric comparison functions ValGT, ValEqualGL, ... instead of ">", "=>", etc. with floating point channels. Below is an example.

Dim oGrp, oChnA, oChnB, sFormula

Call Data.Root.Clear()

Set oGrp = Data.Root.ChannelGroups.Add("MyChnGrp1")

Set oChnA = oGrp.Channels.Add("ChnA",DataTypeChnFloat64)

Set oChnB = oGrp.Channels.Add("ChnB",DataTypeChnFloat64)

oChnA.Values(1) = 12.015: oChnB.Values(1) = 12.0

oChnA.Values(2) = 55: oChnB.Values(2) = 56

oChnA.Values(3) = 0.0002359: oChnB.Values(3) = 0.0002360

oChnA.Values(4) = -204.95: oChnB.Values(4) = -205.01

'It is considerably faster to perform a comparision of channels using Calculate()

'You should always use the functions ValGT, ValEqualGT(), .. when you compare real

'(floating point) channel values (datatype DataTypeChnFloat64), otherwise you may

'sometimes get a result you wouldn't expect.

'The formula below assigns a value of one to the new channel R when the condition is met

'(value of oChnA > oChnB), and a value of zero otherwise.

sFormula = "R = IIF(ValGT(A,B),1,0)"

ReDim arrSymbols(2): ReDim arrValues(2)

arrSymbols(0) = "R"

Set arrValues(0) = oGrp.Channels.Add("ChnA_GT_ChnB",DataTypeChnFloat64)

arrSymbols(1) = "A"

Set arrValues(1) = oChnA

arrSymbols(2) = "B"

Set arrValues(2) = oChnB

Call Calculate(sFormula, arrSymbols, arrValues)