# Formula Using A Tag - How To Do It

## Recommended Posts

Hi !

I have a tag for ambient air temperature: LJ_1.V01_C() and, one for releative humidity: LJ_1.V06_RH()

I need to use it in the following formula and display the answer - how is this done ?

Saturated vapor pressure = es = 6.107 * 10 ^ [ (7.5 * T) / ( 237.7+* T) ], where T = LJ_1.V01_C()

Also;

Actual vapor pressure = ea = RH * es / 100, where RH = LJ_1.V06_RH()

##### Share on other sites

Basically exactly how you wrote it, except with (), and replacing the power (^) with Math.pow(). These are pure javascript expressions, the syntax available anywhere on the web:

Math.pow(6.107 * 10,((7.5 * LJ_1.V01_C()) / (237.7 + LJ_1.V01_C()))

For the second one you'll need to replace es as well.

Note if you want to trend this, you'll need to use math.pow() instead of Math.pow().

##### Share on other sites

Thanks,

but I think you'll find this works:

Saturated vapor pressure = 6.107 * Math.pow(10,((7.5 * LJ_1.V01_C()) / (237.7 + LJ_1.V01_C())))

##### Share on other sites

Next:

I have a control (my tag is VPD for vapour pressure deficit) to display changing numeric value and it's Control ID: AutoGenID_30.

It has the expression:

(6.107 * math.pow(10,((7.5 * LJ_1.V01_C()) / (237.7 + LJ_1.V01_C()))))-((LJ_1.V06_RH()*(6.107 * math.pow(10,((7.5 * LJ_1.V01_C()) / (237.7 + LJ_1.V01_C())))))/100)

I set up a trace but it won't display anything whether I use the expression directly or use AutoGenID_30 () ?

Help !

##### Share on other sites

Oops, sorry, you have it right. The 6.107 should be outside the pow().

As for your trend, did you try just trending LJ_1.V01_C()? AutoGenID_30 is not a tag and can't be trended. Its actually a CSS ID for the control on the webpage, which probably doesn't mean anything to you, but to any web developer would mean something. Most likely you have a typo, but start simple, with just a tag, then add to it.

##### Share on other sites

• 5 years later...

Hi,

I tried the below using just a virtual channel in scripting

V. aa = Math.pow(4, 3)

But this doesn't result anything in scripting while V.aa = 10 then the V.aa results 10.

##### Share on other sites

DAQFactory or DAQConnect?  I'm assuming you mean DAQFactory, where as the rest of this post is about DAQConnect.  In DAQConnect, it is math.pow() as DAQConnect runs in JavaScript.  DAQFactory scripting is completely different, and much similar.  To do 4 raised the third power, you would just do:

V.aa = 4 ^ 3

##### Share on other sites

• 2 weeks later...

Thanks. Yes. Its Daqfactory.

#### Archived

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