DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Replicate a sequence of operations -DIAdem

Solved!
Go to solution

Hello Everyone,

 

I am new to DIAdem and I am exploring a method to repeat a standard sequence of operations for 85-90 channel groups. The task goes like this:

 

Every channel group has a set of three channels, in which some 7 - 8 mathematical operations are to be performed like sum of two channels, average, finding the root mean square value and adding/subtracting the results to the actual channels, finding the arc tan value of the results etc.,

 

I need to replicate the same task for 85 - 90 channel groups. I tried using the "Enable Recording Mode" in the Script Window and tried to use the script that it generates and use it in a for loop. But since the recording mode, holds the actual name of the channel instead of a reference, it is difficult to edit the names of the channels individually which makes it more cumbersome than the actual work. Hence I need an alternative way of doing the same.

 

Any help will be much appreciated.

 

-------------------------------------------------------------------------------
Subramanian
LabVIEW Developer


Life may control my car, but I steer it ! !
0 Kudos
Message 1 of 5
(5,569 Views)

Hi Subramanian,

 

Most of those operations can be accomplished with ANALYSIS functions.  I'd recommend you loop over the Groups and in each Group assign object variables for each channel you want to manipulate.  Then you can use those object variables in the parameters of the ANALYSIS functions, like this:

 

iMax = Data.Root.ChannelGroups.Count
FOR i = 1 to iMax
  Set Group = Data.Root.ChannelGroups(i)
  Set Y1Channel = Group.Channels("AmpHr Charging")
  Set Y2Channel = Group.Channels("AmpHr Discharging")
  Set SumChannel = Group.Channels.Add("Sum", DataTypeFloat64)
  Call ChnAdd(Y1Channel, Y2Channel, SumChannel)
NEXT ' i

 

If you find you need to run the Calculator, we can do something similar.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 2 of 5
(5,557 Views)

Hi Brad,

 

 

Thanks for your reply. This seems to be working for simple addition. I want to perform the complex mathematical operations like finding the angle 'Theta = ArcTan(B/A) ' , and complex calculations like Sqrt( A^2+B^2) , cube root of channels etc.,  keeping in mind that each channel contains 5,000,000 samples.  

 

I want to repeat the same set of operation for 85 - 90 channel groups.

 

 

Thanks in advance.

-------------------------------------------------------------------------------
Subramanian
LabVIEW Developer


Life may control my car, but I steer it ! !
0 Kudos
Message 3 of 5
(5,543 Views)
Solution
Accepted by topic author Aventador

Hi Subramanian,

 

You just asked for the additional Calculator code, here it is:

 

iMax = Data.Root.ChannelGroups.Count
FOR i = 1 to iMax
  Set Group = Data.Root.ChannelGroups(i)
  Set AChannel = Group.Channels("AmpHr Charging")
  Set BChannel = Group.Channels("AmpHr Discharging")
  Set RChannel = Group.Channels.Add("Result", DataTypeFloat64)
  Symbols = Array(A, B, R)
  Channels = Array(AChannel, BChannel, RChannel)
  Call Calculate("R = ArcTan(B/A)", Symbols, Channels)
NEXT ' i

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 5
(5,529 Views)

Thanks a lot ! That helps . .

-------------------------------------------------------------------------------
Subramanian
LabVIEW Developer


Life may control my car, but I steer it ! !
0 Kudos
Message 5 of 5
(5,489 Views)