Expression History tag not Holding Value

Hi All,

I am having some anomalies that are causing me problems in my pressure test cell simulator project. Probably due to my lack of Ignition knowledge etc. This is in Vision 8.1, test VM with trial license.

To simulate pressure rising and falling in tags I have created 2 Gateway scripts; one for incrementing a value and one for decreasing a value, both at @ 200ms.
In my project I am using expression tags for pump and product pressure, which on page load I am scripting the change of the expression to be a float of 0.0.
These two tags have history in the default SQLdb.

When we start the test I take a stamped value of the current increasing tag value and write it to a tag, to effectively make a zero point.
I then change the pump pressure tag's expression to
pumpExpression = "{[.]gwTimerInc}-{[.]gwTimerStamp}"
This works well and simulates rising pressure with a pump, which is plotted in an Easy Chart. When the test is finished I write the tag's expression back to "0.0".

However, after a simulated test I am noticing that the value of the product pressure tag bounces around, even with the expression firmly locked at "0.0"? I just cannot see what is driving this as the expression does not change? Any help would be appreciated.

image

Instead of writing a new expression, use a single expression to handle the logic. Something like (if I understand your tag structure correctly):

if({[.]testActive,
   {[.]gwTimerInc}-{[.]gwTimerStamp},
   0)

You might find the ramp() expression function from my (free) Simulation Aids module helpful.

Thanks Jordan.
Rather then force the expression to change there were more stable results by setting the expression to handle the data change scenarios. The tag ended up like -

//control product pressure
if({[.]testActive}&&{[.]productPressureInc}, {[.]pumpPress}*0.995
,if({[.]testActive}&&{[.]productPressureHold}, {[.]productPressStamp}
,if({[.]testActive}&&{[.]productPressureDec}, {[.]productPressStamp}-({[.]gwTimerDecStamp}-{[.]gwTimerDec})
,0.0
)))

But was successful.
Thank you.

Thank you. I have installed this module on the Gateway and have been using some of the tasty goodies in there!! :+1:

1 Like