Time Normalization and Grid-Based Billing for Complex Equipment Reservations

 Time Normalization and Grid-Based Billing for Complex Equipment Reservations


Large shared laboratories often rely on automated billing systems to charge for equipment usage, reservations, materials, and training time. As facilities grow, billing logic tends to accumulate exception rules — cancellations, overlaps, partial usage, priority users, and special pricing categories — eventually making the system slow, unpredictable, and difficult to audit.

This article describes a redesign of a nano-lab equipment billing engine that replaced rule-heavy evaluation with a time-grid–based allocation algorithm. By modeling reservations as normalized time packets and resolving actual usage before applying billing rules, the new system eliminated incorrect charges, simplified rule interaction, and reduced billing runtime from over 30 minutes to under 2 minutes.


Problem Statement — LNF Nano Lab Equipment Billing System

The Lurie NanoFabrication Facility (LNF) operates a large microfabrication laboratory with over 130 specialized tools and hundreds of active users. Each tool supports multiple reservation and usage models, with billing dependent on parameters such as minimum reservation time, duration-based charges, material usage fees, and equipment-specific booking costs.

The monthly billing process became increasingly complex as the lab scaled. Charges varied across multiple user categories — internal departments, external universities, corporate users, funded research groups, and international users — each with different pricing rules. Additional billing factors included advance vs instant booking rates, training sessions, no-show penalties, partial usage, and administrative overrides.

To prevent reservation abuse and resource hoarding, layered cancellation and minimum-usage rules were introduced. These rules depended on cancellation timing, user type, slot reuse by other users, overlapping reservations, and equipment downtime. As more scenarios emerged, exception handling and conditional adjustments expanded significantly.

The billing engine was required to cross-evaluate reservations across time windows and users, applying hundreds of interdependent rules. Over time, the rule set grew beyond 600 conditions, many overlapping or overriding earlier logic. New rules were often added reactively to handle edge cases, reducing predictability and making individual charge explanations difficult.

As a result, the monthly billing cron process became resource-intensive and unstable, occasionally failing and requiring manual cleanup and reruns. Billing delivery was delayed, maintenance effort increased, and operational risk grew as rule complexity outpaced the original system design.



Solution — Grid-Based Reservation Billing Algorithm

To address billing inaccuracies, rule conflicts, and performance issues, I redesigned the billing engine using a time-grid–based allocation algorithm. The new model eliminated incorrect charges, resolved overlapping reservation conflicts deterministically, and significantly improved performance — reducing monthly billing runtime from over 30 minutes to under 2 minutes.

Core Approach

Instead of evaluating reservations through layered conditional rules alone, the new system converts all reservations into a normalized time grid and computes billing from actual time occupancy resolution.




1. Time Grid Normalization

Each tool is mapped to a time grid where each cell represents the minimum billable unit for that equipment (for example, 2–5 minutes depending on tool policy). This is not the minimum reservation duration, but the smallest billable packet.

  • X-axis: Time divided into minimum billable packets

  • Y-axis: Reservation rows within the billing period

  • Each reservation is expanded into contiguous grid cells based on its reserved duration

  • Cancelled reservations are also plotted in the grid and marked with a cancellation state (not removed)

Example:
A 30-minute reservation with a 5-minute billing unit occupies 6 grid cells.

2. Reservation Layering

Reservations are placed into the grid by time order:

  • Earlier reservations occupy lower rows

  • Later or overlapping reservations are placed on higher rows

  • No billing decisions are made at this stage — this step is purely structural mapping

  • Partial usage, cancellations, and modified reservations are all preserved visually in the grid model

This preserves full historical intent before billing logic is applied.

3. Grid Flattening (Conflict Resolution Phase)

After all reservations are mapped, the grid is flattened vertically:

  • For each time cell, the topmost valid reservation is selected as the effective usage owner

  • This immediately resolves overlaps and double-bookings deterministically

  • Cancelled slots remain visible where no later reservation replaced them

  • Rebooked cancelled slots automatically transfer usage to the new reservation

The result is a single resolved usage timeline per tool showing:

  • Actual billed usage periods

  • Cancelled but unfilled slots

  • Partially reused time segments

  • True idle periods

4. Rule Application Layer

Once the flattened usage timeline is produced, billing rules are applied cleanly and locally:

  • User category pricing

  • Cancellation penalties

  • Minimum usage enforcement

  • No-show rules

  • Training session rates

  • Late booking and instant booking surcharges

  • Maintenance and shutdown adjustments

  • Administrative overrides

Because time conflicts are already resolved by the grid, rule evaluation no longer needs complex cross-reservation dependency checks.


Results

  • Eliminated incorrect overlapping and double charges

  • Correctly handled cancellations with slot reuse scenarios

  • Accurately billed partial usage and instant rebookings

  • Reduced rule interaction complexity

  • Improved billing predictability and auditability

  • Stabilized monthly cron execution

  • Reduced runtime from 30+ minutes to under 2 minutes

This grid-based resolution model converted a rule-heavy billing system into a deterministic time-allocation engine, making billing both faster and easier to explain and verify.