Sepasoft MES Module Suite
BatchMasterLogic
In the Sepasoft MES Module Suite, the BatchMasterLogic object serves as the foundational architectural container for all recipe-related logic. It is designed to encapsulate the procedural requirements of a batch process, functioning either as a reusable template or as a functional reference within a higher-level workflow. From a systems architecture perspective, this object ensures that logic remains consistent and manageable across the entire batch execution lifecycle by providing a structured environment for Procedures, Unit Procedures, and Operations.
Properties
The following table outlines the core properties that define a BatchMasterLogic object:
| Property | Description | ||||||||||||||||||||
|
UUID |
A Universally Unique Identifier providing a distinct link to the object within the MES database. | ||||||||||||||||||||
|
Name |
The user-defined string used to identify the logic object. | ||||||||||||||||||||
|
Description |
A user-provided explanation of the logic object's purpose or function. | ||||||||||||||||||||
|
Enabled |
A boolean flag indicating whether the logic is active and available for use in the system. | ||||||||||||||||||||
|
Creator |
Login details at time of creation | ||||||||||||||||||||
|
Logic Type |
Defines the structural level: Procedure, Unit Procedure, or Operation. See Batch Procedure Recipe Elements and Valid Workflow Structures in Batch Procedure.
The system differentiates between these logic types to maintain procedural integrity. While a Procedure or Operation focuses on logical flow, a Unit Procedure specifically requires an Equipment reference. This reference links the logic to a Batch Unit Class; failing to provide a valid equipment link prevents the logic from interacting with the physical production model. Beyond these static attributes, the object utilizes dynamic methods to construct the actual workflow and logic steps. |
||||||||||||||||||||
|
Equipment |
This is only required if the Logic Type is set to Unit Procedure. It is a reference to a Batch Unit Class and represents the equipment that is required for the Unit Procedure |
||||||||||||||||||||
|
Steps |
This is a complex property that holds logic steps that are the elements of the SPC diagram
|
||||||||||||||||||||
|
Transitions |
This is a complex property that holds logic transitions that are the conditions of the workflow.
|
||||||||||||||||||||
|
Links |
This is a complex property that holds the links that define the connections between the Steps and Transitions
|
||||||||||||||||||||
|
Parameters |
This is a complex property that holds phase-parameter definitions. This is the same complex property class as used by the BatchPhase class
|
||||||||||||||||||||
|
Enum Definition Name |
(If this property is defined, then the value can only be a valid ENUM option.) |
||||||||||||||||||||
|
Current Value |
(The Value and Current Value properties will equal each other unless an Enum Definition Name is defined. In that case, the Current Value property will equal the ENUM name and the Value will equal the ENUM ordinal value. For example, if Test = 1, then the Current Value property will equal “Test” and the Value property will equal 1. |
||||||||||||||||||||
|
Value |
(See Current Value above) |
||||||||||||||||||||
|
Default Value |
Value by default |
||||||||||||||||||||
|
Minimum Value |
Minimum value allowed |
||||||||||||||||||||
|
Maximum Value |
Maximum value allowed |
||||||||||||||||||||
|
Enable Expression |
(This is a logical expression that evaluates to determine if a parameter should be enabled. The expression can only refer to other parameters of the same BatchPhase. For example, a parameter named mode can be set to ‘Concentration’ or ‘Amount’, and enabled states for other parameters can change based on the expression of Mode = ‘Concentration’ or Mode = ‘Amount’ ) |
||||||||||||||||||||
|
Calculation |
Ignition tag expression can be used but then the calculation will not be synchronized between MES servers in an enterprise architecture. |
||||||||||||||||||||
|
TimeStamp |
System timestamp |
||||||||||||||||||||
BatchMasterLogic Methods and Property Values
|
In MES 3.81.12 SP5, MES 4.83.1 SP5, and later, addStep can be called with only a phase name or a phase link. Omitted arguments are filled in.
A phase name, phase link, or phase object is required. These calls add a normal phase step at the next order, with a generated name:
These calls set the name, the order, or both:
A Unit Procedure or Operation step also needs the logic created with createLogic:
The same calls accept a phase link or logic link in place of the phase name or logic object. addStep(name, stepOrder, phaseLink, logicRefLink) is unchanged. If addStep is called before a Start step exists, a Start step is still inserted and linked to the new step. The Start step is created from the Start phase, so the expected Start parameters are present. BatchQueueEntry
BatchMasterRecipe and BatchControlRecipe
|
|
Name
|
Description |
|---|---|
| addLink(int sourceStepOrder, int destStepOrder) |
Adds an outgoing link from the source step to be an incoming link on the destination step. |
| addStep(String name, int stepOrder, MESObjectLink phaseLink, MESObjectLink logicRefLink) |
Adds a new step to the Logic with the given name and order with the type of the phase link passed in. This should be a Unit Procedure or Operation phase type. The logicRefLink should be created from createLogic. Do not use templates directly, always go through the BatchMasterLogic.createLogic method. Returns the new BatchMasterLogicStepsProperty. |
| addStep(String name, int stepOrder, MESObjectLink phaseLink) |
Adds a new step to the Logic with the given name and order with the type of the phase link passed in. Returns the new BatchMasterLogicStepsProperty. |
| createLogic(String name) |
Creates Unit Procedure or Operation logic using the specified name, returns the created BatchMasterLogic representing the Unit Procedure or Operation. |
| createLogic(MESObjectLink templateLink, String name) |
Creates Unit Procedure or Operation logic using the specified name from a template link. This returns all the BatchMasterLogic copied from the template, with the passed in template BatchMasterLogic being at index 0. |
| isTemplateValid() |
Boolean Returns void |
| getLogicType() | Returns Batch logic types |
| setUnitClassRef(MESObjectLink mesObjectLink) | Returns void |
| getUnitClassRef() | Returns MESObjectLink |
| getSteps() | List < BatchMasterLogicStepsProperty > |
| getStepsWithSublogic() | List<BatchMasterLogicStepsProperty> |
| getSublogicLinks() | List<MESObjectLink> |
| addParameter(String name) | AbstractBatchParametersProperty |
| removeParameter(String name) | Returns void |
| renameParameter(String existingName, String newName) | Returns void |
| removeAllParameters() | Returns void |
| getAllParameters() | List<BatchMasterParametersProperty> |
| getParameters(BatchItemPath filterPath) | List<BatchMasterParametersProperty> |
| getVisibleParameters(BatchItemPath filterPath) | List<BatchMasterParametersProperty> |
| getParameter(BatchItemPath paramPath) | BatchMasterParametersProperty |
| findParameterByFriendlyName(String paramFriendlyName) | BatchMasterParametersProperty |
| getParameterValueAsString(BatchItemPath paramPath) | Returns string |
Returns the BatchMasterLogic Object:
Workflow Construction: Steps, Links, and Transitions
Steps and links form the "connective tissue" of a batch process, defining the sequential and conditional flow of operations. Precise ordering and phase referencing are essential to ensure the MES execution engine follows the intended path without conflict.
The addStep method is the primary tool for building this structure. It exists in two main variations:
|
In MES 3.81.12 SP3, MES 4.83.1 SP3, and later,
|
- Standard Step: addStep(String name, int stepOrder, MESObjectLink phaseLink) — Adds a functional step at a specific point in the sequence.
- Reference Step: addStep(String name, int stepOrder, MESObjectLink phaseLink, MESObjectLink logicRefLink) — Adds a step requiring a link to Unit Procedure or Operation logic. The logicRefLink must be derived from an object created via the createLogic method.
To guide the definition of step functions, the programmer must specify an Element Type. Valid types include:
Start / Terminator: Defines the entry and exit points of the logic.
Phase: Represents an individual execution phase.
SubLogic: Allows for nested logic structures.
AndBegin / AndEnd and OrBegin / OrEnd: Defines parallel or alternative execution paths.
Once steps are defined, the addLink(int sourceStepOrder, int destStepOrder) method creates an outgoing link from the source step to serve as an incoming link on the destination. By linking these stepOrder integers, the programmer dictates the exact path the batch engine will follow.
Script Example
Create a Batch Recipe based on a Template
This example uses an existing Unit Procedure template to build out a recipe via script.
Reference documentation for this example:
Python |
# Load recipe class and template recipe_class = system.mes.batch.recipe.loadRecipeClass('Template Test', None) template = system.mes.batch.recipe.loadTemplate('GUI Template', None) # Create a new Recipe recipe = system.mes.batch.recipe.createRecipe('Script Using Template Example', recipe_class.asLink()) # Add procedures to recipe... procedure = recipe.createLogic('Procedure') # Create 2 Unit Procedures from the first item in the template list unit_procedure_1 = procedure.createLogic(template[0].asLink(), 'Unit Procedure') unit_procedure_2 = procedure.createLogic(template[0].asLink(), 'Unit Procedure') # Add steps to the procedure procedure.addStep("P1", 1, system.mes.batch.phase.getBuiltInPhaseLink('Start')) # Note additional argument that sets the unit procedure logic from what was created above p2 = procedure.addStep("P2", 2, system.mes.batch.phase.getBuiltInPhaseLink('Unit Procedure'), unit_procedure_1[0].asLink()) p3 = procedure.addStep("P3", 3, system.mes.batch.phase.getBuiltInPhaseLink('Transition')) # Note additional argument that sets the unit procedure logic from what was created above p4 = procedure.addStep("P4", 4, system.mes.batch.phase.getBuiltInPhaseLink('Unit Procedure'), unit_procedure_2[0].asLink()) p5 = procedure.addStep("P5", 5, system.mes.batch.phase.getBuiltInPhaseLink('Transition')) procedure.addStep("P6", 6, system.mes.batch.phase.getBuiltInPhaseLink('Terminator')) p3.setParameterValue('Transition_Expression', 'P2.Complete = True') p5.setParameterValue('Transition_Expression', 'P4.Complete = True') # Configure links procedure.addLink(1, 2) procedure.addLink(2, 3) procedure.addLink(3, 4) procedure.addLink(4, 5) procedure.addLink(5, 6) # Save the recipe and all the logic saveList = system.mes.object.list.createList() saveList.add(recipe) saveList.add(procedure) # Note unit_procedure_1 and unit_procedure_2 are lists and can have additional logic for Operations, add all items to the save list saveList.addAll(unit_procedure_1) saveList.addAll(unit_procedure_2) system.mes.batch.recipe.saveRecipe(saveList) |
Sepasoft MES Module Suite