DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Integration between a range within a channel

Solved!
Go to solution

Afternoon,

 

I'm trying to integrate some data but rather than integrate a whole channel of data as the Integrate function appears to do is it possible to specify a start and end reference within the channel so it just integrates a certain section of the data?

 

This will form part of a larger script so I'm happy for it to be a script solution if that helps. 

 

Thanks

0 Kudos
Message 1 of 3
(1,235 Views)
Solution
Accepted by topic author DTS_PBO

I think you cannot directly do it, but I was thinking of a 2-step process that could do the job.

 

Basically:

  • First you create a channel that is equal to 0 outside the integration range, and it is equal to your channel inside
  • Then you integrate this channel

Imagine you want to integrate the Example/Speed channel from T=5 to T=30.

You can create a channel Speed_W with ChnEventCreateFilteredTrueChn function, then integrate it.

 

Below the code. Hope it will help.

 

ChnEventResultList = ChnEventFind("(A>5) and (A<30)", Array("A"), Array(Data.GetChannel("Example/Time")))
Call ChnEventCreateFilteredTrueChn("Example/Speed_W", ChnEventResultList, "Example/Speed", 0)
Set ChnResult = ChnIntegrate("Example/Time", "Example/Speed_W", "Example/Speed_W_Int", "TrapezoidalRule", 0, False, 0)

 

Message 2 of 3
(1,227 Views)

Thanks! This approach worked nicely.

0 Kudos
Message 3 of 3
(1,190 Views)