Sign in to follow this  
kedi

Completely stopping history.

Recommended Posts

I am monitoring 72 channels for 12 hours. I am trying to display a value from each channel every 3 hours in a table for each channel. This works in a way. Each cell in the table displays the history of the channel at 10800 sample intervals. But due to the way history updates, it only displays properly at the 12 hour mark. All 4 cells display the voltage at that point in history. But then the history continues to update and push the values out of sync. I'm okay with it being out of sync until hour 12. But I want the values to be left unchanged after that. So people can see the results at any time after the run.

So. Is there a way to completely stop history from updating after 43200 samples? Limiting the history to 43200 does not work. It just starts overwriting the history.

Share this post


Link to post
Share on other sites

Your best bet is to capture the desired values and either put them in a different channel, or more likely into a variable.  That way you have control over when it updates and can avoid the overwriting the history of the input channel issue you are seeing.  How to do this depends a little on how you want to capture the data.  You say every 3 hours, do you want the average of 3 hours data, or just a snapshot of the data?  Is this an experiment or batch that runs for 12 hours that you want to start with a button press for example?

Share this post


Link to post
Share on other sites

I went the variable route. Unfortunate with so many channels, but it works. I did want the voltage at that time, not averages. Seeing as I was doing all that messing about I made graphs for all the channels as well. In case the boss wanted a more detailed look. ( he usually does ). The idea is to have voltages at 3 hour intervals to judge how badly a battery failed. They are lithium ion with series parallel cells, so you can gain some information of the failure mode with snapshots of voltages. The graphs will help even more. The thermal management of the rig was fun too. 72 batteries at about 1.4 amps 14.8 volts.

This situation of being able to easily grab a point in history made me think that dual history lists might be nice. One that starts at one or zero and increments, as well as or instead of one that adds a 0 base record and shifts all the rest up. I see the benefits of record zero always being now, but also benefits the other way. If it adds records instead of shifting, you can grab history at X seconds and it will always remain the same. Unless it has gone so long as to cause overwrite.

Share this post


Link to post
Share on other sites

It is a batch. I have a start button for the sequence. Been using it as is for years. But need to tighten up the code now.

Share this post


Link to post
Share on other sites

There are actually two ways to add values to an array (ok, there are more, but...).  One is using AddValue()  That will stick the new value at element [0] and shift everything else.  The other is Append().  That will add the value at the end as you described, leaving everything else in its place.

If you have a lot of channels / variables, you should look to name them all in a way that allows you to utilize execute() to update them all at once.  For example, if you named your readings channels "Input0", "Input1" etc, and then the variables with the 3 hour capture "Cap0", "Cap1", etc.  You could write a simple script to update (assuming 72 channels):

private numChans = 72
while(1)
   delay(3600*3) // wait 3 hours
   for (private i = 0, i < numChans, i++)
      execute("Cap" + i + ".append(input" + i + "[0])")
   endfor
endwhile

 

Share this post


Link to post
Share on other sites

It occurs to me that if Azeotech added another column to the history, that incremented from 0 to end of history. Then you could always reference the same row with that number. At least till history overwrites.

Thanks for the loop example. I was going to try to figure that out. But haven't the time right now. The example will help. System is running with the ugly way of doing it.

Share this post


Link to post
Share on other sites

You can always subset by time, which achieves almost the same thing.  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this