Creating Persistent Display Beyond Channel History

Recommended Posts

Our application collects load cell data from multiple sensor channels, offsets and scales it, then displays the maximum pound force to date in a Variable Value Component named AllStrapsMax.

The data is processed in this Sequence:

(((max(StrapLeftHead[0h, systime()]) - 1.250) / (0.00375375 * 201)) + ((max(StrapLeftShoulder[0h,systime()]) - 1.250) / (.003928 * 201)) + ((max(StrapLeftHip[0h,systime()]) - 1.250) / (0.003969 * 201)) + ((max(StrapLeftKnee[0h,systime()]) - 1.250) / (0.00394988 * 201))) * 1000

(Yes, the constant calculations could be pre-calculated to increase efficiency.)

The displayed maximum value reverts to a lower LBF once the peak data has passed through the channel histories, whereas we need that maximum to persist in another Variable Value Component (MaxPersistent) until some Control action occurs, such as clearing the Log.

We need some way to conditionally copy the AllStrapsMax value to MaxPersistent (perhaps using the evaluate(component.myComponent.strExpression) technique you educated me about a year ago), but this needs to trigger each time the AllStrapsMax value changes, or at worst after each set of channel samples.

Can you provide some guidance?

Link to comment
Share on other sites

First, precalcing the constants is going to do next to nothing to the efficiency of the calculation.  Its much better to use a formula that makes sense and maybe has a few extra numbers in it.  

As for your question, I would put the formula in a V channel, maybe call it AllStrapsMax.  Then in your component the expression would just be:


Then, in say a sequence, or perhaps in the Event of one of those four channels, you should check V.AllStrapsMax against MaxPersist and if its bigger, update MaxPersist with V.AllStrapsMax.  MaxPersist would likely be a global variable, but you could also use a Test D to A channel with Persist = History ( = 1 probably) so that the value persists between DAQFactory restarts.  To reset the max, just set MaxPersist to 0 and the next iteration of the sequence or event will update it.

The use of a V channel in this way makes it so you don't have to enter the formula in more than one place.  The formula is only evaluated when the V channel is referenced.  Its not acting as a variable, but as a sort of shorthand for the formula.

Link to comment
Share on other sites

  • 2 months later...

There are now Load Cell Channels defined, connected to transducers, and working for Strap0 through Strap3, History=1000 (known working because graph is displaying correctly and application is exporting log results into a usable dataset on command).

There is on the Page MonitorLog the Component VariableValue named MaxPersistent, with Propeties set to show a 2-decimal float value.

There is a Virtual Channel VAllStrapsMax defined with Expression: (((max(Strap0[0h, systime()]) - 1.250) / (0.00375375 * 201)) + ((max(Strap1[0h,systime()]) - 1.250) / (.003928 * 201)) + ((max(Strap2[0h,systime()]) - 1.250) / (0.003969 * 201)) + ((max(Strap3[0h,systime()]) - 1.250) / (0.00394988 * 201))) * 1000.

Setting the MaxPersistent Expression to:

MaxPersistent = iff((V.VAllStrapsMax[0] > MaxPersistent), V.VAllStrapsMax[0], MaxPersistent)

results in the 'pinkeye' ExpressionEditorBox regardless of how much qualification is done on the Component(e.g., Page.MonitorLog.)

HAVE pored over manual.pdf, HAVE queried forum, cannot find reference or example pointing out what simple error(s) I'm overlooking.

Can you advise?

Thanks for your consideration!

Link to comment
Share on other sites

Timely response - thanks!

Even with that silly mistake corrected, still get pinkeye, error message:  C1070: Not enough parameters for the given operator

I've been too spoiled by spell-checkers, syntax checkers, and other lazy-making tools - can't figure out which operator is meant, the " or >, and why some parameter is not valid.

Link to comment
Share on other sites


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