The way that they suggest to use units in formula expressions is this:
FormulaData["KineticEnergy", {QuantityVariable["K", "Energy"] ->
Quantity[10, "Joules"],
QuantityVariable["m", "Mass"] -> Quantity[10, "Grams"]}]
to define a function you would do something like this:
testfun[energy_, mass_] :=
FormulaData[
"KineticEnergy", {QuantityVariable["K", "Energy"] -> energy,
QuantityVariable["m", "Mass"] -> mass}]
To use it, you can either use numbers (but you lose your unit checking) or Quantity expressions:
testfun[Quantity[10., "Joules"], Quantity[10., "Grams"]]
to get the output form of this (copied as InputForm):
QuantityVariable["v","Speed"] ==
Quantity[-44.7214, ("Meters")/("Seconds")] ||
QuantityVariable["v","Speed"] ==
Quantity[44.7214, ("Meters")/("Seconds")]
of course you can use any units:
testfun[Quantity[100./7457, "Hp Seconds"],
Quantity[10., "Grams"]]
gives the same result.
If you put numbers in but have the wrong units you will get the wrong answer.
For example:
testfun[10., 10.]
gives +-1.4 as the answer (which is wrong)
Therefore I'd usually recommend that you specify that the inputs must have units so Mathematica will enforce the proper units on your answer and you get an error if you make a mistake
testfun2[energy_Quantity, mass_Quantity] :=
FormulaData[
"KineticEnergy", {QuantityVariable["K", "Energy"] -> energy,
QuantityVariable["m", "Mass"] -> mass}]
HOWEVER,
with your nasty expression, I notice that when you use units it takes a long time to evaluate and it is instantaneous when you use numbers. This is maybe due to the fact that it has Log[length units] (which I really do not understand why??]. If you are careful to use consistent units it will evaluate much faster if you use the testfun version and not the testfun2. You will need to experiment with this to try to get the units version to evaluate faster.