Writing Custom Batch Override Rules

NOTE: See Writing a Custom Scheduler Rule for a summary of the steps required to create custom rules. For more details about the functions described in this topic, see the Simulation Tailoring Support Function Reference (available for download from the Support web site, on the documentation page for the Infor APS Virtual Planning/Simulation product).

The Scheduler uses batch override rules to determine if forming batches should be released even though they have not reached the minimum release quantity.

Override Rule Logic

Before you create custom batch override rules and write the corresponding batch override functions, you should understand the logic used by the override function. This rule is invoked under two conditions:

When the batch override function is called, it determines whether the forming batch should be released.

Naming the Function

Your custom override function can have any name that is not a standard user-callable function name.

Arguments

Summary

#include "factor.h"
int borl(formbat, batch)
FORMBAT *formbat;    /* pointer to the forming batch */
BATCHDEF *batch;     /* pointer to the batch definition */

The override function accepts two arguments, a pointer to forming batch (Type: FORMBAT *) and a pointer to the batch (Type: BATCHDEF *).

Return Value

The function returns TRUE (non-zero) if the forming batch should be released or FALSE (zero) if the forming batch should not be released (Type:int).

Example

Here is an example of a batch override function based on the time greater than or equal to the override threshold:

int borl (FORMBAT *formbat, BATCHDEF *batch)
/*-----------------------------------------------------------------
     Batch override rule which determines that the forming batch should
     be released if it has been waiting longer or equal to the override
     threshold.
     ARGS:
       formbat - pointer to the arriving forming batch
       batch - pointer to the batch that this load will follow
     RETURNS: true, if it has been waiting too long
              false, otherwise
-----------------------------------------------------------------*/
{
     double x;
     x = cstnow - formbat->fbsttim;
     /* If the time the batch has been forming is at least the
        threshold, then release the batch */
     if (x >= batch->btovth)
     {
         return(1)
     }
     else
     {
         return(0)
     }
{

Installing the Custom Function

To make your custom override function available to the Scheduler, you must "install" it from ucini1 by calling the function sedfok. This function has two arguments in the following order:

  1. The number of the batch override rule for which your function contains custom logic
  2. The address of your batch override function

For example, to install the above example rule "borl" in rule position 39:

sedfok (39, borl);

Related Topics

Scheduler Batching

Batch Definitions