
Re: Heat Index Calculation
james.arackal Jul 31, 2018 2:39 PM (in response to james.arackal)Hello all,
I got the below formula for excel, can anyone convert for PI attribute formula.
=IF((C5*9/5+32)<=80,C5,IF(AND(E5<13,((C5*9/5+32)>80),((C5*9/5+32)<112)),(((42.379+2.04901523*(C5*9/5+32)+10.14333127*E50.22475541*(C5*9/5+32)*E50.00683783*(C5*9/5+32)*(C5*9/5+32)0.05481717*E5*E5+0.00122874*(C5*9/5+32)*(C5*9/5+32)*E5+0.00085282*(C5*9/5+32)*E5*E50.00000199*(C5*9/5+32)*(C5*9/5+32)*E5*E5)32)*5/9)(((13E5)/4)*SQRT((17ABS((C5*9/5+32)95))/17)),IF(AND(E5>85,((C5*9/5+32)>80),((C5*9/5+32)<87)),(((42.379+2.04901523*(C5*9/5+32)+10.14333127*E50.22475541*(C5*9/5+32)*E50.00683783*(C5*9/5+32)*(C5*9/5+32)0.05481717*E5*E5+0.00122874*(C5*9/5+32)*(C5*9/5+32)*E5+0.00085282*(C5*9/5+32)*E5*E50.00000199*(C5*9/5+32)*(C5*9/5+32)*E5*E5)32)*5/9)+((E585)/10)*((87(C5*9/5+32))/5),(((42.379+2.04901523*(C5*9/5+32)+10.14333127*E50.22475541*(C5*9/5+32)*E50.00683783*(C5*9/5+32)*(C5*9/5+32)0.05481717*E5*E5+0.00122874*(C5*9/5+32)*(C5*9/5+32)*E5+0.00085282*(C5*9/5+32)*E5*E50.00000199*(C5*9/5+32)*(C5*9/5+32)*E5*E5)32)*5/9))))
where C5=A= Temperature
where E5=B= Humidity
Many Thanks

Re: Heat Index Calculation
VasanthakumarR Jul 31, 2018 5:17 PM (in response to james.arackal)Hi James,
You can achieve this calculation in PI analysis expression. Go through the below tutorials that will really help with your requirement.
How to set up the Expression Analysis:
OSIsoft: How to Setup Expression Analyses with PI AF [PI AF 2014 v2.6.0.5843]  YouTube
PI Analysis Service Best Practices:
https://techsupport.osisoft.com/Troubleshooting/KB/KB01641
Asset Analytics Tips & Tricks:
https://techsupport.osisoft.com/Troubleshooting/KB/KB01520/
Regards,
Vasanth.

Re: Heat Index Calculation
yazoob Aug 1, 2018 4:59 PM (in response to james.arackal)Replace C5 and E5 with attributes. It appears you are using an IF THEN statement with on additional nesting. I am not going to parse this into an AF equation but just glancing at it replace the first comma with THEN and the second comma with ELSE and repeat this pattern.

Re: Heat Index Calculation
james.arackal Aug 2, 2018 12:36 PM (in response to yazoob)I tried this , but getting stuckup with an AND operant.

Re: Heat Index Calculation
Dan Fishman Aug 2, 2018 12:41 PM (in response to james.arackal)IF(AND(E5<13,((C5*9/5+32)>80),
In PE syntax: If E5 < 13 and (C5 * 9/5 + 32) > 80 then ...
I would follow Rick Davin's advice! In this case, I find the OSIsoft PE syntax easier to read than Excel formula syntax!



Re: Heat Index Calculation
Rick Davin Aug 1, 2018 7:16 PM (in response to james.arackal)I feel your pain but suggest you give it a try. As I was a customer many years ago, I too had to convert Excel equations into AF Formulas. What I quickly learned is many long, hairy looking Excel equations are mostly doing unit conversions. Your equation does the same. I noticed the expression (C5*9/5+32) appears over 30 times! This tells me your input is in Celsius but the Heat Index requires Fahrenheit. With the Formula DR, unit conversions are super easy on the inputs. You would declare your input attribute, let's call it A, but you would also declare that it should be in degrees Fahrenheit. Then everywhere you see (C5*9/5+32) would now be replaced with a simple A.
If I were using Analytics, I would use a longer variable name of Temperature as it is more meaningful and not limited to a single character.


Re: Heat Index Calculation
rschmitz Jul 31, 2018 2:41 PM (in response to james.arackal)Hi James,
Not that this is really a question about PI, but I did a quick search on Google and found the following on Wikipedia for the Heat Index Formula. All of these formulas are approximations, so take that with a grain of salt.
Cheers,
Rob

Re: Heat Index Calculation
james.arackal Jul 31, 2018 6:10 PM (in response to james.arackal)Hi Thanks for the reply,
my problem is , I already have the formula in excel and how to convert this to pi attribute Calculation . Pi attribute doesn’t recognize coma as used in excel ?

Re: Heat Index Calculation
Dan Fishman Aug 1, 2018 2:25 AM (in response to james.arackal)1 of 1 people found this helpfulCorrect, the PI PE function syntax is not the same as Microsoft Excel function syntax and you have to convert by scripting or manually. Other options, would be to use an AF Tablelookup.
Dan


Re: Heat Index Calculation
Rick Davin Aug 2, 2018 4:49 PM (in response to james.arackal)3 of 3 people found this helpfulHi James,
The adage "Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime." is most applicable here. You are using a very specific, highly customized variation of the standard heat index calculation in the Wikipedia link provided by Robert Schmitz. As your needs are very specific, it is of utmost importance that YOU be the one to finalize and approve of the calculation that you insist on using. Otherwise we are left in a position where you can point the finger at others if something is wrong. Our job here is to educate you and empower you to support your system as you deem fit.
I provide the following as an educational sample. It is provided on an ASIS basis. The core of the formula is based on Wikipedia. As an example of how to check AND conditions, I have included an extra expression at the bottom. There is also the part of the expression ExtraPartForYou that is left to you because it is nonstandard.
CLICK ON IMAGE TO ENLARGE
The above will work as long your input temperature is in Temperature UOM class. If you input a unitless value, understand that it will be considered as degree Fahrenheit, and not converted. If you have unitless temps (i.e. a null UOM), you either need to convert yourself ahead of time, or really the best advice is that you should assign a proper UOM.
The output result would be the AdjustedHI also in degrees Fahrenheit. If you say the output attribute should be in degree Celsius, this is not a problem as AF will automatically perform the conversion for you. Which is to say you don't have to do anything special to the Analysis shown.
The Excel formulas which you insist are gospel are far from perfect. For instance the beginning of your Excel formula:
=IF((C5*9/5+32)<=80,C5,IF(AND(E5<13,((C5*9/5+32)>80),((C5*9/5+32)<112)), etc
Can be reduced to
=IF( T<=80, T, IF( AND( R<13, T>80, T<112)), etc.
Once you look at the simplified statement, you can easily see that the AND does not need the T>80 check given that T<=80 obviously failed earlier.