Metric Formulas

In many cases, calculating realistic targets for metrics requires more than a static value or a simple hourly rate. Expected performance may depend on location-specific metadata, a position on an improvement curve, or the values of other metrics recorded for the same task.
For these scenarios, Hivekit provides powerful metric formulas that can be entered directly into the expected Value or expected Rate field. These formulas are evaluated automatically and updated whenever their inputs change.
Environment variables
Formulas can reference contextual data from the environment in which a task is scheduled.
When defining a location, you can specify location metadata, such as the size of a material pile or the dimensions of a heading. These values can be accessed in formulas using location.valueName, where valueName corresponds to the label of the location metadata field.
If a metadata label contains spaces, dots, or other non-alphanumeric characters, you can use bracket notation instead, for example location["value name"].
Values from other metrics defined on the same activity can be accessed using metric.metricName, allowing formulas to combine multiple measurements into a single expected value.
If you are using improvement curves, the current curve value can be referenced using curve.curveName.
Operators and expressions
Metric formulas support the full Expr expression language, including arithmetic operators, comparisons, conditional expressions, and lookups.
For example, to compute expected blasted tonnage based on heading dimensions, drilled depth, and material type, you might use a formula such as:
location.width * location.height * metric.drillDepth * (location.materialType == "ore" ? 2.7 : 2.6)
This allows expected values to adapt automatically to changing conditions, while remaining fully transparent and reproducible.
Language reference
See metric formula syntax and functions for the full reference.