DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation definition

Hello,

I have a set of groups, all including the same channel structure (and names). I would like to define a calculation that I define once, but which can run in every group the same way.

 

More specifically:

My groups are named F00 to F14, and my channels in each group are named 00-00, 00-90, 90-90, 90-00, Ref00-00, Ref00-90, Ref90-90, Ref90-00

In each group I would like to get the following new channels:

Norm00-00 = 00-00/(Ref00-00^2)

Norm00-90 = 00-90/(Ref00-90^2)

Norm90-90 = 90-90/(Ref90-90^2)

Norm90-00 = 90-00/(Ref90-00^2)

 

I manage to get a calculation defined to do this in a single group, but how can I define the input/output references in the calculation not to be group specific?

If I do provide a group reference, only the last group is processed.

 

Best regards,

Mathieu

0 Kudos
Message 1 of 4
(3,346 Views)

Hello,

 

Thank you for posting on National Instruments forum's.

 

Can you give me the software you use? And Do you have an example of your application?

 


Brice S.
National Instruments France

0 Kudos
Message 2 of 4
(3,325 Views)

Hello,

Thank you for your message. I got the trouble sorted out with a script:

 

Dim iGroupCount
For iGroupCount = 1 to GroupCount
    Call Calculate("ch(""[" & iGroupCount & "]/Normalized 00-00"") = ch(""[" & iGroupCount & "]/00-00"") /(ch(""[" & iGroupCount & "]/J3-05 00-00"")*ch(""[" & iGroupCount & "]/J3-05 00-00""))",CurrSymbols,CurrValues,"")
    Call Calculate("ch(""[" & iGroupCount & "]/Normalized 00-90"") = ch(""[" & iGroupCount & "]/00-90"") /(ch(""[" & iGroupCount & "]/J3-05 00-90"")*ch(""[" & iGroupCount & "]/J3-05 00-90""))",CurrSymbols,CurrValues,"")
    Call Calculate("ch(""[" & iGroupCount & "]/Normalized 90-90"") = ch(""[" & iGroupCount & "]/90-90"") /(ch(""[" & iGroupCount & "]/J3-05 90-90"")*ch(""[" & iGroupCount & "]/J3-05 90-90""))",CurrSymbols,CurrValues,"")
    Call Calculate("ch(""[" & iGroupCount & "]/Normalized 90-00"") = ch(""[" & iGroupCount & "]/90-00"") /(ch(""[" & iGroupCount & "]/J3-05 90-00"")*ch(""[" & iGroupCount & "]/J3-05 90-00""))",CurrSymbols,CurrValues,"")
Next

 

I just had to get familiar with DIAdem 2010.

Best regards,

Mathieu

0 Kudos
Message 3 of 4
(3,322 Views)

Hi this is Koby from NI Japan and here is some suggestions for your code.

 

The first suggetstion is to use this script that makes easy to debug.

 

Data.Root.Clear

DataFileLoad("PAHT TO YOUR DATA HERE")
For i = 1 to GroupCount
  Call GroupDefaultSet(i)
  L1 = CNo("[" & i & "]/00-00")
  L2 = CNo("[" & i & "]/Ref00-00")
  Call Calculate("ch(""/Norm00-00"") = ch(L1) / ch(L2)^2")
Next

 

Setting your 00-00 to L1 and Ref00-00 to L2, then calculate them till the number of Groups.

In order to do the other calculations for 00-90, 90-90, and 90-00, copy the script above and replace the string with corresponding channels.

 

 

The second suggestion is not to use the script but you can do all the calculations at once using the calculation manager.

Download the attached file called "Customer0000.zip" and unzip the file and there should be a file called "Customer0000.tca".

Go to ANALYSIS tab and open the calculation manager where the button is located above in tool bar.

Click Open and select the downloaded file Customer0000.tca.

You would see four calculations with their names normalization #.

Click where the button says "..." on the right, it will open up the settings for the calculations.

The formula is set to Norm = Raw/Ref^2.

Click the "Extended" button on the right, it shows the cycle is set to "GroupCount" so the this calculation runs up to the number of Groups you have in data portal.

Also notice that the input reference is set to [@@CCR@@]/00-00, this means that it runs with the current cycle number, so if your cycle is 2, then the input channle will be [2]/00-00.

Close this dialog and click the calculation group, hit the "Excute" button and it will calculates all at the same time and you should see all your 12 channels in your data portal.

 

Regards,

 

Atsuo "Koby" Kobayashi

Systems Engineering - Team Leader - TDM

National Instruments Japan

Message 4 of 4
(3,298 Views)