Histogram


rlrepoff

Recommended Posts

Hello,

 

I am trying to create a histogram that will be able to seen in real-time.  Here is my situation that I am trying to put together, but I am not exactly sure on how to use the histogram function within DaqFactory to display my histogram.

 

1.  I want to create a histogram for the following calculation:  (CO+CO2)/[(CO+CO2)max]

(CO and CO2 are channels that I have set up to measure the Carbon Monoxide and Carbon Dioxide from a serial device.  They are currently test channels and are receiving data every 2 seconds from the sensors.)

 

-Is there a way to make the histogram with the maximum value being included, even if the maximum value might be changing throughout the whole experiment?

 

-Additionally, I would like to be able to normalize this histogram with the number of points that have been used in the histogram during the experiment (I want this to be real-time, too).  This way, I can get a percentage of the time spent in each of the bins.  This value will be changing (every two seconds) similarly to the maximum value of CO+CO2. 

 

The main concern that I have is that if DaqFactory is doing all of these calculations, it might get bogged down and freeze up.  The length of my test would range up to 2-3 hours at the maximum so we are dealing with about 5400 data points/history for each channel.

 

Do I have to set up V channels for this? And do I have to include any specific packages to be able to use the histogram function within DaqFactory?

 

Thanks for your help and let me know if you need anymore information about my setup!

Link to comment
Share on other sites

The histogram function is described in 4.12.17.  You should be able to do all this on the fly.  Use max() to get the max.  Use seqAdd() to dynamically create the bins if you need it.  Don't worry about DAQFactory getting bogged down.  For one thing 5400 data points is nothing.  Histogram is calced in C and is quite fast.  If it was a million points, it might get a little slow, but not dramatically.  Computers are fast.  Second, if you put this in the graph directly, its calculated with the graph refresh which is done in the idle thread priority of windows.  This means its done when everything else is done with the processor, so even if it did take a long time, all it would do is slow down the refresh of graphs.  The rest of the UI would remain responsive.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.