Resolution

Business Automation allows to manually or programmatically set/update usage of resources based on DUMMYGATE using the Public API method SetResourceUsage_API.

Business Automation uses the following formula to calculate usage of non-additive resources in a subscription which is displayed on the Resources tab in a subscription properties in Business Automation Control Panel:

  • Resource amount set - the amount of resource set by the SetResourceUsageAPI_ API method
  • Resource amount set time - the moment of time when resource amount was set for a subscription
  • Subscription last overusage reset time - the moment of time when resource overusage was last time billed for a subscription (last billing date of a subscription)

So, Business Automation displays the average usage of non-additive resource since a subscription last overusage billing time.

Additional information

Algorithm of showing usage of resources in Business Automation Control Panel in a subscription properties and in Billing Orders is different for additive and non-additive resources:

  • For additive resources it is quite straightforward – Business Automation always shows the last amount set by the SetResourceUsage_API API method as 'Usage' in Control Panel and shows the same value as quantity in Billing Order.

  • For non-additive resources Business Automation takes into account resource usage history and period of time each amount was used within the Billing Period

Simple example

Let us consider the following usage of a resource during a 30-days month:

  1. 1st - 10th days of month: 60 units
  2. 11th - 20th days of month: 90 units
  3. 21th - 30th days of month: 0 units

The total usage in Billing Order (BO) for the whole month in the example above will be calculated as follows:

Detailed example (how algorithm works)

Whenever the SetResourceUsage_API Business Automation API method is executed for a subscription the used amounts of resource, dates and other parameters are stored in Business Automation database.

E.g. we have Billing Order with order detail for resource overusage like this:

We can fetch parameters for calculating the above quantity = 3.07 GB from Business Automation database, they may look like this:

Quantity in the Billing Order is calculated as total sum of Usage[i] (usage for each period of time listed above) where each amount of resource was used during its part of Billing Period:

  • (Time[i+1] - Time[i]) is the period of time in seconds while Amount[i] has been used
  • (BillingPeriodStart - BillingPeriodEnd) is the length of Billing Period in seconds

The fraction

Also we consider that initial Amount[0] = Amount(BillingPeriodStart) and the last Amount[N] = Amount(BillingPeriodEnd). Thus:

Example with graph

Please see the below picture illustrating the algorithm:

Internal content