Hi there. I need help for creating a new process in input process list. I need to convert the saturation pressure of R410 refrigerant into saturation temperature. I created the process in Misc group but have a problem to implement the calculation. The polynome that represent the realation of pressure and temperature is:
Saturated_Temperature in Celsius = -0,000000307447482float(RP**6) + 0,000043580766960float(RP5) - 0,002446689046739*float(RP4) + 0,069912343918256float(RP**3) - 1,115593843136520float(RP**2) + 12,054120339664600*float(RP) - 47,984764806890900
I imported the calculation into process_processlist.php like:
public function barg($arg, $time, $value) { if ($value>0) return $value =((-0.000000307447482*float($value**6)) + (0.000043580766960*float($value**5))+(- 0.002446689046739*float($value**4)) + (0.069912343918256*float($value**3))+(- 1.115593843136520*float($value**2)) + (12.054120339664600*float($value)) - 47.984764806890900); return $value; }
but the process fails to calculate the value.
What can be the problem?
I know very little about the inner workings of emonCMS, but out of curiosity I looked at the file. Did you add your new process to the array $list defined at the top of the file?
Yes. I did. The process appeared in the list menu, a can trigger it in process list, but it fails to calculate. I think my problem is in the polynome. Do python need to trigger math module or numpy to calculate the polynome or the way I wrote the code is ok?
You could easily prove that your function is being called and returns a value by substituting a known constant. This will prove your problem is the maths.
How does it not work? What do you see? Do you have an error message?
OK, make it even more simple:
public function barg($arg, $time, $value) {
$value = 12.3;
return $value;
}
This should always set $value to 12.3 and the function should return this value always. (If 12.3 is too big or too small, change it.) Does this “work” at all? Does it give an error when you try to run it? Does the variable that receives the value returned by the function change after this runs?
If the variable is always set to 12.3, the function is working but the code inside it is not.
Thank you for your help. I succeded at the end. The problem was that Raspberry Pi needs to be rebooted the changes in the file to take effect. I`m new in this and learning…