02-20-2009 10:41 AM
Hi elwis,
Here are your paraphrased outstanding questions with my answers-- I split your 2 and 3 into two parts because there are two parts to the answers:
1. On the graph I don't have a connected curve but instead disconnected points, because the data channel has NoValues
Check the checkbox entitled "Connect curve points hen NoValues occur" in the configuration dialog for each REPORT curve
2a. I don't know how to split out each of my N cycles into a separate Group of channels
I will look through your latest information on your "Angle" channel, then I hope to post a separate solution to 2a. later today
2b. I don't know how I can calculate an average cycle from all my N cycle Groups
Use the ANALYSIS function in the "Channel Functions" palette entitled "Average Channels"
3a. I want to subtract the average cycle from each of my N cycles
Use the ANALYSIS function in the "Basic Mathematics" palette entitled "Subtract"
3b. I want to calculate the derivative so that I can subtract the slope of the average cycle from the slope of each of my N cycles
Use the ANALYSIS function in the "Basic Mathematics" palette entitled "Differentiate"
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-20-2009 11:47 AM
02-20-2009 11:55 AM
2.a i will be garteful
2.b i found fuction "Channel Functions" palette entitled "Average Channels" but i think first must separated one chanell into many cycle ( this is BIG PROBLEM)
3.a i understand , and i think it will be no problem for me 🙂
3b. it look easy it will be no problem but first i need have average cycle
thanks 😉
02-20-2009 04:19 PM
Hi elwis,
I think I've got it now. I noticed that the Cycle 0 => 1 transitions always occurred at the same row as the Angle 0.5 => 0 transitions, so I am now averaging for each Y Channel all its values in the rows between Angle 0.5 => 0 transitions into one representative value per Y Channel. This results in each Cycle having Angle values between 0 and 359.5.
1) Averaging the duplicate Angle rows together correctly (see above)
2) Calculated the correct starting Angle for Cycle0 so that it ends with 359.5 degrees
3) Scaled the Angle channel so that it starts over at 0 degrees at the start of each Cycle
4) Automatically copied out the rows for each Cycle to its own Group of Channels in the Data Portal
5) Inerted a NoValue row in the overall data Channels in the first Group to avoid horizontal lines on the graphs
6) Automatically loads a VIEW layout and a REPORT layout so you can see exactly what I'm seeing
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-21-2009 01:43 AM
Hi
oh my God it look magneficently. graph look excelent only axic X shoul be from 0 to 720, but i think it isnt problem , when i will angle data multiply x2 it will be good. I need some days to analyzed your scripts, i must understand it and learn make myself. It make realy good impression on me. when i will analyzed everything i will write again. i am very grateful, thank you 🙂
02-21-2009 10:19 AM
hi 🙂
i was try calculate one average cycle, i can use function "average channels" but i have many file with data which have sometimes 140 cycles, sometimes 60, so i was try write in script function which will do it automatically
i was write this:
Call Data.Root.ChannelGroups(1).Channels.Add("average cycle",DataTypeFloat64)
FOR i = 1 TO (iMax-1) 'first and last cycle often are not completely cycles so i dont want care about it'
Call ChnCalculate("Ch(""[1]/average cycle"")=Ch(""[1]/average cycle"")+Ch(""[i]/Channel B Shifted"")") '... FormulaTxt
next ' i
Call
ChnCalculate("Ch(""[1]/average cycle"")=Ch(""[1]/average cycle"") /
(iMax-2)'... FormulaTxt 'i want devide sum of all cycle by quantities
added cycles'
in this way i should have automatically one average cycle but it dont work :/, please tell me where i have mistake in this function.
02-23-2009 06:32 AM
i was analyzed your script. result look good but it isnt accurate result
1 mistake in script
in angle channel every change of value means next 0,5 degree, in your script only chyange from 0,5 to 0 make next 0.5 deegre, but change from 0 to 0,5 make nothing-and it is mistake, this is cause that angle in cycle is in range (0, 360); (good result is (0,720))
2 mistake is very important (your script pass over many data from channel 4 (pressure))
in my data in channel(4) are values of pressure
example:
line ch(2) angle ch(4)
1 0 value1
2 0,5 value2
3 0,5 value3
4 0,5 value4
5 0,5 value5
6 0 value6
7 0 value7
8 0 value8
9 0 value9
10 0 value10
11 0,5 value11
12 0,5 value12
13 0,5 value13
14 0,5 value14
15 0,5 value15
16 0 value16
in line 2 is change in channel2 (from 0 to 0,5), it change mean next 0,5 degree (for example it is begining of cycle and we have now 0,5 deg). So in line2, 3,4, and 5 we havve still 0,5 [deg], result shoul look that:
angle ch(4) pressure
0,5 ( value2+ value3+ value4+ value5)/4 --------it is average of pressure for the same [deg]
in line 6 is change in ch(2) (from 0,5 to 0), it change mean next 0,5 degree (so now we have 1[ deg]). So in line 6, 7,8,9,10,we havve still 1 [deg], result shoul look that:
angle ch(4) pressure
1 ( value6+ value7+ value8+ value9+ value10)/5
in line 11 is change in ch(2) (from 0 to 0,5), it change mean next 0,5 degree (so now we have 1,5 [deg]). So in line 11,12,13,14,15 we havve still 1,5 [deg], result shoul look that:
angle ch(4) pressure
1,5 ( value11+ value12+ value13+ value14+ value15)/5
the same angle sometimes are in 3 lines sometimes in 4 line even 5 and 6 line and i don tknow how i can calculate average pressure for the same angle.
sorry that i am so fussy but it is very important, it will be use to alnalysis many kind of fuel burning in the internal combustion engine.
thankfully
Piotr Papiernik
02-23-2009 11:53 AM
Hi Again Piotr,
OK, I've reworked the application again based on your most recent clarifications:
1) I'm now considering both positive and negative slope Angle events, resulting in 720 degrees per cycle
2) I changed the angle mapping fuction so that it does now average the ChannelA and ChannelB values
3) I'm now automatically calculating and displaying the cycle-averaged shifted ChannelB values in a new Group
4) I made most of the code robuster with variables instead of constants and added labels to the VIEW and REORT sheets
Brad Turpin
DIAdem Product Support Engineer
National Instruments