Seems like the data collection would work with a python dictionary. For example you set up a dictionary entry for how many ranges they want then each time a board falls inside of a range set by the operator you increment the integer for that dictionary entry.
http://www.tutorialspoint.com/python/python_dictionary.htm http://www.tutorialspoint.com/python/python_basic_operators.htm A simple example. create a dictionary dict = {'range1':0, 'range2':0, 'range3':0} the operator enters the low and high values for each range update the dictionary if measure >= range1_low and measure < range1_high: dict['range1'] += 1; elseif measure >= range2_low and measure < range2_high: dict['range2'] += 1; ... At some triggered point you could append the data to the file using the file I/O and clear the dictionary counter once a successful file write occurred. Also look at the simple example for the winder to see how to make a gladevcp panel and run it with HAL. http://gnipsel.com/linuxcnc/index.html John On 9/14/2012 1:26 AM, Viesturs Lācis wrote: > > Ok, I will try to share some more details: > 1) there are wood planks with some defects somewhere in the middle, > that defect needs to be removed by sawing that particular section out; > that by definition means that the operation will create at least 2 > usable pieces; > 2) I have no influence on the hardware design of the machine, my task > is to set up controls - the length of the piece needs to be displayed > and number of produced parts have to be counted; > 3) and they want not only total number of all parts, but they want to > know, how many parts were 800-950 mm long, how many parts were > 950-1100 mm long etc. (those numbers are just for example, endpoints > of those ranges will be set by operator). > > The measurement of the length will be done by an encoder, attached to > a wheel, which will be turned as material moves under it. Material > will be moved manually (do not yet know, how exactly) by operator. I > already figured out, how to reset encoder position to start measuring > new part, so that is not my concern at the moment. > > What I do not know and where I would appreciate some advice/hints is - > how to save those counted numbers to a file. I have yet to figure, > what is better: > 1) request operator to press "save" button in vcp panel; > 2) update file automatically as soon as any of the counted numbers > have incremented - this is better in terms of "power-failure caused > loss of data" situation; > > But if it saves automatically, I do not want to overwrite previous > files, especially if there have been several times LinuxCNC has been > started in one day - for example, in the morning, then on lunch break > system was shut down and then turned on again later. Or even worse - > some powerfailure or whatever caused unexpected shutdown and then > restarting LinuxCNC and saving to the same file is good as long as it > adds the new data below the existing ones, not overwrite them. OTOH I > think it is mandatory that all the data, counted in one session should > be updated in the same line, not add another line as soon as new part > is done. I was looking at that tutorial, shared by John Thornton, but > I did not yet get it, how exactly does that "writing to a file" > happen. Today I will visit the client (those guys will produce the > machine, I do not have access to enduser), so I will try to find out > more, how all of this is supposed to be set up. > > > John, thank You for the links! > ------------------------------------------------------------------------------ Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users