From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation Manager Multiple Groups

Solved!
Go to solution

Hi

 

I am trying to perform the same Calculation in several groups, which share the same channel names i.e.

 

  • Group1
    • A
    • B
    • C
  • Group2

    • A
    • B
    • C

...

  • GroupN
    • A
    • B
    • C

The Calculation will be Result = A*B+C for instance. So far I have created a calculation script using the Calculation Manager for 1 of the groups, and I also have been playing with the wildcards but only get 1 result. I would like to know if there is a way using the Calculation Manager with wildcards to perform this calculation for all the available groups and store the result Channel ("Result") in each group

 

  • Group1
    • A
    • B
    • C
    • Result
  • Group2

    • A
    • B
    • C
    • Result

...

  • GroupN
    • A
    • B
    • C
    • Result

Thank you very much

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

Hello,

 

You can use a script like this:

 

Option Explicit  'Forces the explicit declaration of all the variables in a script.

Dim sFormula, aSymbol(1),aValues(1),iLoop
sFormula ="Ch(""[iLoop]/Result"")=Ch(""[iLoop]/A"")*Ch(""[iLoop]/B"")+Ch(""[iLoop]/B"")"
aSymbol(1) = "iLoop"

For iLoop=1 To 3 'You only must change 3 for the number of groups that you have
aValues(1) = iLoop
Call Calculate (sFormula, aSymbol, aValues)
Next

 

You just need to change the number of iteration in for loop, change the number 3 for the number of groups you have.

 

Let me know if this script solve your problem.

 

Regards,

Plínio Costa
Senior Techinical Support Engineer
National Instruments Brazil



0 Kudos
Message 2 of 3
(4,371 Views)
Solution
Accepted by topic author dslemusp

Hi Plinio

 

Thank you for your response.

 

I actually figured it out without the scripting part. To perform the calculation within all the groups (or several) in the data portal, you just have to use the @@CCR@@ Current Cycle Number. So, for the example you have to create two inputs and name them A, B and C, select Channel as a DataType and put [@@CCR@@]/"ChannelName", as is showed in the figure. Then you switch to the extended part and put in the field cycles the number of groups you want to process, in this case all of them (you put GroupCount).

 

And That's it

 

 

1.JPG

 

Give it a try

 

Cheers

 

Daniel

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