cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## Calulate area under curve: Hystresis

I have a force and dispacement values in excel. I want to calulate the hystresis of this.

How can i do this through VBS?? I dont have time channel in that, How can i create it and find the hystresis?

Rsh

Message 1 of 15
(4,327 Views)

## Re: Calulate area under curve: Hystresis

Hi RSH,

I assume you mean you want to calculate the inclosed area between the forward and the reverse parts of the Force-Displacement curve, right?  In that case you calculate the integral of each and subtract the reverse result from the forward result.  You can call ChnIntegrate() in VBScript to run the DIAdem integration function from the ANALYSIS panel, then you can call Sum=CCh(IntegralChannel, 4) in VBScript to return the sum of each resulting integration channel.  Finally, subtract the reverse integration sum from the forward integration sum.

National Instruments

Message 2 of 15
(4,325 Views)

## Re: Calulate area under curve: Hystresis

Hi RSH,

Ignore the above, I wasn't thinking clearly.  I banged out a quick data set and tried it out, and it turns out to be much simpler-- you just need to calculated the integral channel and look at the last value in the channel, like this:

```  i = 1 ' GroupIndex
Call GroupDefaultSet(i)
DispCh = CNo("[" & i & "]/Displacement")
ForceCh = CNo("[" & i & "]/Force")
IntCh = CNo("[" & i & "]/Integral")
IF IntCh > 0 THEN Call ChnDel(IntCh)
Call GroupDefaultSet(i)
Call ChnIntegrate(DispCh, ForceCh, "/Integral")
IntCh = CNo("[" & "]/Integral")
Integral = ChDX(ChnLength(IntCh), IntCh)
Call ChnPropValSet(IntCh, "Integral", Integral)```

The calculated area is put in the "Integral" property of the "Integral" channel in the same group as the "Displacement" and "Force" channels.  In the example I'm attaching, I split the raw hysteresis curve (both forward and return) into its two components and calculated the integral of each, just to make sure that the different in their integrals really was the same as the net integral of the raw data curve-- and it was.

National Instruments

Message 3 of 15
(4,321 Views)
Solution
Accepted by topic author RSH
08-27-2015 04:09 PM

## Re: Calulate area under curve: Hystresis

Hi Again RSH,

This example is more visual but contains about the same content.

In case it helps,

National Instruments

Message 4 of 15
(4,320 Views)

## Re: Calulate area under curve: Hystresis

thats great. This is what i wanted from my data.

I did the same way as u did for my data.

Step 1: I load my excel data from navigator, using step1 and step 2 exel import wizard

step 2: I created a sample.tdm file by creating as group 1: Both : force

Disp

Integrated

Same for other 2 groups, forward and backward

Step 3: I copied the data from strating till row 746 where the data is 11300 and 84.4  in forward group and integrated.

Step 4: copied data from row 747 till end of disp and force to backward group and integrated.

Step 5: When i change the name of tdm file in your script and run that with modified channel names in .tdv the hystersis curve is coming for me.

Can u help me in automating this.

RSH

Message 5 of 15
(4,312 Views)

## Re: Calulate area under curve: Hystresis

Hi RSH,

You don't need to create the Forward and Return groups in the Data Portal, I just did that to double-check that I got the same answer.  All you need is the Both group with all the data in it.

National Instrumets

Message 6 of 15
(4,304 Views)

## Re: Calulate area under curve: Hystresis

Yes I need the script to automate this.

I have done it in excel manually. I am sending it in attachment. comments are attached for reference in excel.

I want to automate the same in Diadem. So that each time my force data is loaded(varies) vs position/Displacement which is always the same(constant), it should calculate the area under that curve.

rsh

Message 7 of 15
(4,301 Views)

## Re: Calulate area under curve: Hystresis

Hello everyone,

I have a hysterisis loop as a waveform and I want to calculate the area of the hysterisis loop. How do I do that?
I'd appreciate it so much, if anyone could help me.

Thanks,

Julian Samangun

Message 8 of 15
(3,960 Views)

## Re: Calulate area under curve: Hystresis

Hi Julian,

Does your hysteresis loop contain exactly one cycle, or does it contain multiple cycles?  If it contains exactly 1 cycle, then you can use the Integrate function in the ANALYSIS panel and look at the last value in the channel it creates.  If your waveform channel contains multiple hysteresis loops, then you will need and explicit X channel in order for the integral to work out correctly.

National Instruments

Message 9 of 15
(3,922 Views)