NI Home > Community > NI Discussion Forums

DIAdem

Showing results for 
Search instead for 
Do you mean 
Reply
Member RSH
Member
RSH
Posts: 66
0 Kudos
Accepted Solution

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

Trusted Enthusiast
Brad_Turpin
Posts: 2,821
0 Kudos

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.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Trusted Enthusiast
Brad_Turpin
Posts: 2,821
0 Kudos

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.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Trusted Enthusiast
Brad_Turpin
Posts: 2,821
0 Kudos

Re: Calulate area under curve: Hystresis

Hi Again RSH,

 

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

 

In case it helps,

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Member RSH
Member
RSH
Posts: 66
0 Kudos

Re: Calulate area under curve: Hystresis

Hi Brad,

 

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            

 

 

Trusted Enthusiast
Brad_Turpin
Posts: 2,821
0 Kudos

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.

 

Do you need help automating loading your entire data set with the Excel Import Wizard?

 

Brad Turpin

DIAdem Product Support Engineer

National Instrumets

Member RSH
Member
RSH
Posts: 66
0 Kudos

Re: Calulate area under curve: Hystresis

Hi Brad,

 

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

Member
jul136nne
Posts: 12
0 Kudos

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

Trusted Enthusiast
Brad_Turpin
Posts: 2,821

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.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Member
jul136nne
Posts: 12
0 Kudos

Re: Calulate area under curve: Hystresis

Hi Brad,

 

Thanks for the reply. Could you please elaborate more on that, because my hysteresis loop consists of 3 cycles of sine waveform of each attribute.

 

Thank you.