Command to completely stop history update.


Recommended Posts

Please create a command to stop history update. I have a one time through sequence. After the sequence ends it may be some time till somebody notes the results. But results change even when the sequence has ended. To get around the issues that constant history updating causes, required multiple times the code and complication. Multiplying the chances for mistakes.

Link to comment
Share on other sites

Actually it is pretty simply to implement this.  Use a flag: a global variable named, say "updateHistory" which you set to 1 when you want to update and 0 when not.  Then create a second channel for whichever channels you want to do this with.  Type is "Test", D to A, Timing = 0.  Then, in the Event for the actual channel that is getting data put:

if(updateHistory)
   myTestChannel.AddValue(myChannel[0])
endif

This will cause myTestChannel to get a copy of all values from myChannel, but only when updateHistory is non-zero.  That way you can stop the update of myTestChannel by simply setting updateHistory to 0.

 

Link to comment
Share on other sites

I am dealing with 72 channels. It quickly becomes not simple. To get around the history update scheme now, I have to create 4X72 variables for the particular instance I am dealing with. Then I have to enter those  288 variables into expressions in 72 tables. I have to read the channels into those 288 variables so the data does not shift through. It is working. But the ability to just stop history update would save so much trouble and tricky coding. Also having the option of history increment from 0 instead of inserting at 0 would also be wonderful. With the ability to stop history.

So compare a command like Stop_History, compared to

if(updateHistory)
   myTestChannel.AddValue(myChannel[0])
endif

For 72 channels.

Link to comment
Share on other sites

With that many channels you should simply use a sequence to trigger the reads.  So, give all 72 channels a timing of 0, and put them in a channel group, say "myGroup".  Then create a sequence:

while(1)
   if (updateHistory)
      channel.readGroup("myGroup")
   endif
   delay(1)
endwhile

Then, whenever updateHistory is non-zero, the inputs will be read and the history updated.  When it is 0, no reading will occur and the history will be frozen.

 

Link to comment
Share on other sites

A nice solution in many instances.

I could do that 4 times with a 3 hour delay, to display my voltage snapshots, without them scrolling out. Referencing the history in the tables. It will not be compatible with my desire to graph the channels.

But definitely thanks for the idea.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.