Xrev API Tools: Increase Productivity!



Tuesday, August 13, 2013

Using Temperature Parameters in Formulas

Yesterday I was working on some MEP families and thought I'd do some tricks to generate some formulas to match a manufacturers capacity tables for Total Cooling Capacity & Sensible Cooling Capacity.

Being metric, the Dry Bulb & Wet Bulb Inside temperature parameters I had setup were in degrees Celsius.  The Capacity parameters are in kW's so in order to use the temperature parameters in the formula I would need to remove the units.

Easy, I thought.  I'll just divide by 1°C and that will give me a unitless value.

Unfortunately Revit decided to throw a curve ball at me.  Internally all its calculations are done in Kelvin.  For example, if I use my DB in a formula and its value is set to 20, Revit actually uses 293.15.  So then I thought I'd divide by 1 K... No luck!

After trying for 3 hours I eventually gave up and went to bed.

With a fresh head I did some playing around in Excel to try and figure out how Revit was getting the results it was and eventually I came to this:
Unitless Temperature Parameter

So essentially what Revit is doing here is:

(293.15-272.15) / (546.3/546.3) or 20/1 = 20

Now hopefully someone else doesn't have to go insane trying to figure this out!


Jaesin said...

A buddy of mine (who works for autodesk) sent me this link since I had recently went through a very, very similar process trying to get it to work, and my solution was subtracting zero.

(30 F - 0 F) / (1 F - 0 F) returned a parameter-less 30.

Stranger yet to get things back with units,
30 * (1 F - 0 F) + 0 F
Returned 30F.

Kind of an odd way to go about things I think.

Anonymous said...

Nice work Chris! That's quite ridiculous! That _ANZRS rubbish really is a waste of time and space. I'm all for the uptake of these kind of initiatives but they can't expect people to adhere to that.

Chris said...

Sorry, turns out all comments were going to my old work address and I wasn't aware of them!!

Thanks Jaesin, I'll have to try that, to see if it still works when working with celsius...

I agree that _ANZRS on shared parameters makes them longer than they need be, but it does help differentiate and ensure the names are unique and that someone has definitely used the ANZRS shared parameter. The common misconception is that you are supposed to put the suffix on all your parameters is wrong!