DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Statistical dispersion of repetitive action

Hi,

 

I have a machine to analyse. I have repeated the same action with the machine 12 times. Now what I want to do is:

 

1. Divide the data taken (which displays the 12 cycles in a row) so that can I run my script (with which I calculate the Torque, Energy, Efficiency etc of the machine) on each cycle.

 

2. Then I would like to carry out the statistical dispersion of my results from these 12 cycle sample data.

 

Can someone help me out in doing this please?

 

I attach a photo of the data recorded.

I attach the I want to run on each Cycle.

 

Thank you very much,

Esberginia.

Download All
0 Kudos
Message 1 of 12
(3,375 Views)

Hi esberginia,

 

I recommend that you extract each cycle into a separate (new) group in the Data Portal.  You can use the Event Search or Pattern Matching functions in the ANALYSIS panel to identify those sections.  There will probably be a few follow up questions before that's all working, and that's fine-- keep asking.

 

After that, you'll want to loop through each of these new cycle-groups and apply the commands in your attached script, BUT you should make some changes to your script first to make that easier.  You have static references to specific groups by index ("[1]/PT2 Sm100") and to the default group ("/PotPT2+"), and these won't work in your loop over the cycle-groups.  You want to derive the channels you use directly from the cycle-group that you're looping over, like this:

FOR Each Group In CycleGroups
  Set XChannel = Group.Channels("PT2 Sm100")
  Set YChannel = Group.Channels("QB242+")
  Set RChannel = Group.Channels("PotPT2+")
  Call ChnMul(XChannel, YChannel, RChannel)
NEXT ' CycleGroup

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 12
(3,352 Views)

Hi Brad,

 

thank you for answering.

 

1. Extract each cycle: I do not understand how will I sepparate the cycles from each other if Event Search works with (A>40) and (B>200). Is there a way to just cut the signal in 12 pieces?

 

2. I do not understand the loop you displayed. Does it search in each group the variable "PT2 Sm100" etc and then multiplicates them having a multiplicated result in each group?

 

Thank you,

Esberginia.

0 Kudos
Message 3 of 12
(3,342 Views)

Hi Esberginia,

 

I think I'm going to need to see a data set from you if I'm going to understand what defines your cycle events.  You talk about (A>40) and (B>200) in your last answer, but the numbers 40 and 200 do not appear in the VBScript you sent.

 

For your second question, my offered pseudo-code is trying to communicate the best way to reference channels in each of the cycle groups, but first we have to create those cycle groups, and for that we have to define channel events for each cycle.  I'm stuck on that first step so far, until I see your data.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 12
(3,332 Views)

Hi,

The (A>40) and (B>200) is thew default operation i get when I select the Event Search function. What i meant is, that i do not know how to divide the data on X axis.

 

i cannot attach the data sinse its a .tdx file.

 

 

0 Kudos
Message 5 of 12
(3,319 Views)

Hi esberginia,

 

You should be able to post the TDX file.  If for some reason that gives you trouble, try zipping it and posting the ZIP file. I will be able to offer DIAdem VBScript code that does what you want on your data, as long as you post me a complete data file to test with.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 12
(3,291 Views)

Hi Brad,

 

Thank you very much.

 

Esber.

0 Kudos
Message 7 of 12
(3,288 Views)

Hi Esber,

 

Here is a VBScript that splits each full cycle of your submitted data file into its own Cycle Group in the Data Portal.  It ignores the partial cycles at the beginning and end of the acquired data.  I made the Ychannel for each cycle a waveform so you can more easily make an overlay plot of all the cycles vs. relative cycle time.

 

OPTION EXPLICIT
Dim a, n, aMax, RawGroup, RawXChannel, RawYChannel, WindowLo, WindowHi, XDelta
Dim P1, Pn, CycleEvents, CycleGroups, CycGroup, CycXChannel, CycYChannel
Set RawGroup = Data.Root.ChannelGroups(1)
Set RawXChannel = RawGroup.Channels(1) : RawXChannel.Name = Trim(Replace(RawXChannel.Name, """", ""))
Set RawYChannel = RawGroup.Channels(2) : RawYChannel.Name = Trim(Replace(RawYChannel.Name, """", ""))
Set CycleGroups = Data.CreateElementList()
XDelta = RawXChannel(2) - RawXChannel(1)
WindowLo = -25
WindowHi = CMax(RawYChannel)
CycleEvents = ChnEventDetectionWindow(RawXChannel, RawYChannel, WindowLo, WindowHi, 10, 10)
aMax = UBound(CycleEvents)
FOR a = 0 TO aMax
  P1 = CycleEvents(a, 0)
  Pn = CycleEvents(a, 1)
  IF RawYChannel(P1) < 0 AND RawYChannel(Pn) < 0 THEN
    n = n + 1
    Set CycGroup = Data.Root.ChannelGroups.Add("Full Cycle " & n)
    Set CycXChannel = CycGroup.Channels.Add(RawXChannel.Name, RawXChannel.DataType)
    Set CycYChannel = CycGroup.Channels.Add(RawYChannel.Name, RawYChannel.DataType)
    Call ChnEventCopyValues(RawXChannel, RawYChannel, CycXChannel, CycYChannel, CycleEvents, a+1)
    Call ChnWfPropSet(CycYChannel, "Time", "s", 0, XDelta)
    Call CycleGroups.Add(CycGroup)
  END IF ' full cycle
NEXT ' a

I'm not sure how to reconcile the TDM file you sent that has only 2 channels with the Calculation.VBS you sent that processes lots of different channels.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 8 of 12
(3,278 Views)

Hi Brad,

 

Thank you very much. I am new to this program, and your code results a bit complicated to me, let see if I figure it out.

 

I executed the code and this popps out: " Error in <NoName(1).VBS> (Line: 27, Column: 5):
Variable is undefined: 'ChnEventCopyValues' ".

 

I have a total of 33 channels to divide, but I only sent 2 as a DEMO.

 

I keep you posted, let's see if finally I can execute the statistical dispersion of the process.

You are being of great help.

 

Esber.

 

 

0 Kudos
Message 9 of 12
(3,268 Views)

Hi Brad,

 

i am trying to run the following loop to vary my data from the internal data portal:

 

Dim a, n, aMax,P1, Pn
aMax = 60000
FOR a = 1 TO aMax
P1 = "[1] PB2 Sm100"(a)
Pn = "[1] PA22 Sm100"(a)
IF P1 < Pn THEN
n = n + 1
Set "[1]PB2 Sm100"(a) = "[1]PA22 Sm100"(a)
END IF
NEXT

 

Can you please tell me what is wrong?

 

Thanks a lot,

Esber.

0 Kudos
Message 10 of 12
(3,252 Views)