Auto-splitting jobs/MOs based on custom logic
This guide will step through the process of coding a Auto-split customization. If you are just getting started, you can learn about getting started with customizations
Creating the Class
To use custom logic for scheduling activities we will need to create a new class that inherits from SplitCustomization. This customization class is located at: PT.Scheduler.Simulation.Customizations.SplitCustomization
Here is what a basic class should look like:
public class AutoSplit: PT.Scheduler.Simulation.Customizations.SplitCustomization
//Declare any objects for the customization here
//Customizations must have a name
public override string Name => "Custom Splitting";
//Customizations must have a description
public override string Description => "Performs custom logic for splitting jobs or MOs";
/// This function is called by the scheduler while it is attempting to schedule an activity on a resource
/// It can either split a job into multiple jobs, or it can split a job's manufacturing order into
/// multiple manufacturing orders.
protected override SplitResult Split(ScenarioDetail.SimulationType a_simType, long a_clock, long a_simClock, Resource a_primaryResource, InternalActivity a_act, SchedulableInfo r_si, CycleCompletionProfile a_ccp, ScenarioDetail a_sd)
//Calculate a decimal value to determine how much quantity to split off from the current job
decimal splitOffQty = CalculateSplitOffQty(a_sd, a_act, a_primaryResource);
if(splitOffQty > 0)
return new SplitResult(SplitResultEnum.SplitJob, splitOffRatio);
return new SplitResult(SplitResultEnum.SplitMO, splitOffRatio);
else if(splitOffQty == 0)
//Don't split, schedule with current qty
return new SplitResult(SplitResultEnum.NoSplit);
//Don't split and don't schedule
return new SplitResult(SplitResultEnum.NoSplitAndDontSchedule);
Here we have a single function to override to begin customizing at the Split Customization point:
Split can be used to override the split functionality during the scheduler's attempt to schedule for an activity.
Let's take a look at the parameters for Split:
- ScenarioDetail.SimulationType a_simulationType: The type of simulation that is being run.
- long a_clock: The ticks of the scenario clock date.
- long a_simClock: The ticks of the DateTime the scheduler is attempting to schedule an activity.
- Resource a_primaryResource: The resource the scheduler is attempting to schedule on.
- InternalActivity a_activity: The activity that is attempting to schedule.
- SchedulableInfo r_si: Defines the possible scheduling result of an activity on this result. The primary resource requirement is used to calculate.
- CycleCompletionProfile a_ccp:Basic information about a cycle such when it ends, the cycle number within a block, and the quantity produced within the cycle.
- ScenarioDetail a_sd: Via the various manager objects in this top level object, all other data objects can be accessed.
Take a look at an example customization project. This example splits MOs based on available resources using a fixed runtime.