On certain SyteLine forms, several positions ofScheduler rules are listed as User-Defined. For example, positions 24-39 of the Sequence Rule are reserved for user-defined rules. A user-defined rule is a custom piece of logic that you write in one or more custom C++ functions. User-defined rules allow you to model your unique scheduling situations that the standard rules may not address.
For example, the fragment below from the initialization function ucini1 installs a load-ranking function for Sequence Rule 39:
double myrule39(LOAD*); void ucini1() { sedfrk(39, myrule39); /* Install other user-defined rules here. */ } double myrule39(LOAD*) { /* Insert your custom logic for myrule39 here. */ }
For a complete description of each user-callable Scheduler function, see the Simulation Tailoring Support Function Reference (available for download from our support site, on the documentation page for the APS Virtual Planning/Simulation product).
To execute correctly, custom functions must accept the proper arguments and return the proper value for the type of rule. The names of these functions must not conflict with the names of standard user-callable functions. You must make your custom functions accessible to the Scheduler by calling installation functions in the initialization function ucini1. See the following topics for these details for the following rules:
User code compiled for the Scheduler applies to all alternatives in the database. The install procedure creates a subdirectory named USERCODE that contains the user code support files. You should create a subdirectory beneath this one with the same name as your SQL database to hold your user code source files. The Scheduler also looks for the user code DLL file (USER.DLL) in this directory.
The Scheduler uses Unicode to support international string issues. To write code that can be conditionally compiled for Unicode, MBCS, or neither, follow these programming guidelines:
For Example:
After you have written your custom rules, you must link them into the standard system. See Compiling and Linking Custom Scheduler Rules for more information.
Compiling and Linking Custom Scheduler Rules
Writing Custom Job Release Rules
Writing Custom Resource Allocation Rules
Writing Custom Selection Rules
Writing a Custom Operation Calculation
Writing Custom Batch Separation Rules