Bypassing the metric engine conversion mechanism

#1

I’ve raw data coming in in CCF, I use metric to reflect changes in the conversion factor to BTU, i.e.

{
  "id": "metric_mmbtu",
  "name": "metric_mmbtu",
  "expression":  "metric_ccf * btu_conversion_factor",
  "unit": {"id": "million_BTU"}
}

I use this metric metric_mmbtu in AnalyzeEnergy and I want to be able to convert it back to ccf but without passing through the metric engine. In fact the metric engine uses factors from UnitOfConversion while instead I want it ot use my conversion metric btu_conversion_factor.

Is this possible? can I override the conversion mechanism?

0 Likes

#2

This should work:

{
  "id": "metric_mmbtu",
  "name": "metric_mmbtu",
  "expression":  "treatAsUnit('million_BTU', metric_ccf * btu_conversion_factor)"
}
1 Like

#3

MetricEngine depends on UnitsEngine for unit conversions. UnitsEngine gets data from Unit not UnitOfConversion. UnitConversion is denormalized units for some reporting/tools.
Unit.getConversionFactor/ Unit.convertToUnit has some support. But to convert a Timeseries data to another unit, try timeseries.convertToUnit()

1 Like