I am trying to make a custom function in the QGIS expression editor that takes three arguments. Below is the tested standalone function, which I would like to integrate:
import math def qfull_circle(DN, kb, I): #Input: DN in mm, kb in mm, I in ppm #Output: Q in l/s viscosity = 1.31 * math.pow(10,-6) roughness = kb / 1000 Acircle = (DN * DN * math.pi / 4) * math.pow(10,-6) Xroot = math.pow((2 * 9.81 * DN * math.pow(10,-3) * I * math.pow(10,-3)),0.5) fraction1 = (2.51 * viscosity) / (DN * math.pow(10,-3) * Xroot) fraction2 = roughness / (3.71 * DN * math.pow(10,-3)) return Acircle * (-2 * math.log(fraction1 + fraction2, 10) * Xroot) * math.pow(10,3)
Unfortunately, I cannot make it work. Any assistance on how to define it within the function editor is highly welcome.