Hello,
I am completely new to the subject. I would like to have this formula calculated:
([Pressure#Druck]+1.013)*(2.71828182845904^(-10.73797+(2617.25/([Temp#temp]+273.15))))*10
Unfortunately, I don't know how to change it so that ESPeasy can work with it. I have already tried a few things, but unfortunately without success.
I hope someone has a solution?
Convert formula
Moderators: grovkillen, Stuntteam, TD-er
Re: Convert formula
It is probably a bit too much for the formula field.
N.B. the formula field can use %value% as template for the value of that taskvalue.
But since you need to also use other taskvalues and need quite a lot of calculation, I guess it is best done via rules.
Something like this:
The computed value can be referred to via [var#1]
You can also store it in a dummy task using the TaskValueSet command.
N.B. the formula field can use %value% as template for the value of that taskvalue.
But since you need to also use other taskvalues and need quite a lot of calculation, I guess it is best done via rules.
Something like this:
Code: Select all
on Pressure#Druck do
let,1,[Temp#temp]+273.15 // To Kelvin
let,1,(2617.25/[var#1])-10.73797 // Exponent
let,1,2.71828182845904^[var#1] // e^Exponent
let,1,([Pressure#Druck]+1.013)*[var#1]
let,1,[var#1]*10
logentry,"Computed value: [var#1]"
endon
You can also store it in a dummy task using the TaskValueSet command.
Re: Convert formula
TD-er wrote: ↑08 Apr 2024, 15:14 It is probably a bit too much for the formula field.
N.B. the formula field can use %value% as template for the value of that taskvalue.
But since you need to also use other taskvalues and need quite a lot of calculation, I guess it is best done via rules.
Something like this:The computed value can be referred to via [var#1]Code: Select all
on Pressure#Druck do let,1,[Temp#temp]+273.15 // To Kelvin let,1,(2617.25/[var#1])-10.73797 // Exponent let,1,2.71828182845904^[var#1] // e^Exponent let,1,([Pressure#Druck]+1.013)*[var#1] let,1,[var#1]*10 logentry,"Computed value: [var#1]" endon
You can also store it in a dummy task using the TaskValueSet command.
Thank you very much for the quick reply. I have now tried to solve it this way:
Code: Select all
On Pressure#Druck Do
TaskValueSet 3,1,[Pressure#Druck]
Endon
on Temp#temp do
TaskValueSet 3,2,[Temp#temp]
Endon
on Pressure#Druck do
let,1,[Temp#temp]+273.15 // To Kelvin
let,1,(2617.25/[var#1])-10.73797 // Exponent
let,1,2.71828182845904^[var#1] // e^Exponent
let,1,([Pressure#Druck]+1.013)*[var#1]
let,1,[var#1]*10
TaskValueSet 3,3,[var#1]
Endon
This is what my setup looks like:
Last edited by basti on 08 Apr 2024, 15:34, edited 1 time in total.
Re: Convert formula
You have a duplicate On Pressure#Druck handler, and only the first one is executed (speed optimization in the Rules engine).
Combined you could have this:
Code: Select all
On Temp#temp do
TaskValueSet 3,2,%eventvalue1%
Endon
On Pressure#Druck do
TaskValueSet 3,1,%eventvalue1%
let,1,[Temp#temp]+273.15 // To Kelvin
let,1,(2617.25/[var#1])-10.73797 // Exponent
let,1,2.71828182845904^[var#1] // e^Exponent
let,1,(%eventvalue1%+1.013)*[var#1]
let,1,[var#1]*10
TaskValueSet 3,3,[var#1]
Endon
/Ton (PayPal.me)
Re: Convert formula
Ath wrote: ↑08 Apr 2024, 15:34You have a duplicate On Pressure#Druck handler, and only the first one is executed (speed optimization in the Rules engine).
Combined you could have this:
Also used %eventvalue1% instead of the separate variablesCode: Select all
On Temp#temp do TaskValueSet 3,2,%eventvalue1% Endon On Pressure#Druck do TaskValueSet 3,1,%eventvalue1% let,1,[Temp#temp]+273.15 // To Kelvin let,1,(2617.25/[var#1])-10.73797 // Exponent let,1,2.71828182845904^[var#1] // e^Exponent let,1,(%eventvalue1%+1.013)*[var#1] let,1,[var#1]*10 TaskValueSet 3,3,[var#1] Endon
This is how it works. Thank you very much. I'm still a complete beginner and have yet to really get to grips with the subject. But I haven't found many good tutorials yet...
Thanks again for the quick help.
Who is online
Users browsing this forum: No registered users and 2 guests