Sepasoft MES Module Suite
Custom Value Calculator
You can register and unregister custom value sources and calculators on the fly. This enables critical use cases, such as loading production-line-specific calculations or integrating data from a new piece of equipment, without necessitating a gateway restart. This dynamic capability is central to creating a flexible and responsive manufacturing execution system. At the heart of these custom calculations is a fundamental component known as the Custom Value Calculator.
A Custom Value Calculator is an object used within the OEE Downtime module to define custom items and their associated calculations, making them available to the analysis engine. Its primary purpose is to encapsulate the business logic required to compute metrics that are specific to an organization's internal processes or reporting standards.
For instance, a manufacturer may need to track a proprietary metric like an "Operational Productivity Metric" (OPM) for internal reporting. The formula and mathematical logic required to calculate this OPM would be defined within a Custom Value Calculator. This allows the MES to be tailored precisely to business needs. The first step in leveraging this capability is to create the calculator object itself.
Instantiating a Custom Value Calculator Object
system.mes.analysis.createCustomValueCalculator. Once this function has been called and the calculator object is instantiated, the next step is to define the specific calculation logic it will perform.Implementing Custom Calculation Logic
calculateRow and calculateFinalRow.Beside the common MESAbstractObject methods, the following methods exist for the Custom Value Calculator object.
calculateRow
- Syntax:
calculateRow(valueItem, date, row, results)
- Parameters:
ValueItem valueItemDate dateList rowBaseAnalysisDataset results
- Returns:
boolean
- Scope:
All
calculateFinalRow
- Syntax:
calculateFinalRow(valueItem, date, row, results) Parameters:
ValueItem valueItemDate dateList rowBaseAnalysisDataset results- Returns:
boolean
- Scope:
All
Managing the Lifecycle of Custom Components
update functions provide a consolidated interface for registering new components and unregistering obsolete ones in a single, atomic operation. This approach is the recommended best practice, superseding the older, individual system.mes.analysis.register... and system.mes.analysis.unregister... functions. update functions ensures configuration integrity, simplifies script development, and aligns with the critical best practice of performing bulk atomic operations, system.mes.analysis.updateCustomValueCalculators Functionsystem.mes.analysis.updateCustomValueCalculators(Collection registerValueCalculators, Collection unregisterValueCalculatorNames) Parameter | Description |
registerValueCalculators | A collection of custom value-calculator objects to register with the MES Analysis Engine. |
unregisterValueCalculatorNames | A collection of custom value-calculator names to unregister from the MES Analysis Engine. |
system.mes.analysis.updateCustomValueSources Functionsystem.mes.analysis.updateCustomValueSources(Collection registerValueSources, Collection unregisterValueSourceNames) Parameter | Description |
registerValueSources | A collection of custom value-source objects to register with the MES Analysis Engine. |
unregisterValueSourceNames | A collection of custom value-source names to unregister from the MES Analysis Engine. |
Critical Implementation Best Practices
Gateway Scope Exclusivity
Efficient Bulk Operations
update function acquires and releases a configuration lock on the MES Analysis Engine, an operation that carries performance overhead. The functions are designed to minimize this overhead by processing all registrations and unregistrations in a single, atomic operation. Therefore, the most efficient implementation is to batch all desired changes into a single call rather than making multiple sequential calls.Recommended: Call once with all changes
# Recommended: Call once with all changes system.mes.analysis.updateCustomValueSources(all_new_sources, all_old_source_names) Avoid: Calling inside a loop for each individual item
# Avoid: Calling inside a loop for each individual item for source in all_new_sources: system.mes.analysis.updateCustomValueSources([source], []) # Inefficient Sepasoft MES Module Suite