Equipment Performance Library Manual
About this documentation
This documentation provides essential information for working with components of the DDAS software ecosystem. It is intended for software developers and machine manufacturers who integrate, validate, and operate DDAS function blocks within CODESYS‑based applications.
Note!
Before installing or configuring any software, ensure that you have read and understood the operating instructions of all relevant hardware devices!
Tip!
Further information can be found at: https://www.ddas.digital
This manual is part of the DDAS library collection, which includes documentation for license management, date and time handling, scheduling, equipment performance, and other functional modules:
| Documentation | Subject |
|---|---|
| DDAS License Manager Manual | Licensing with DDAS activation keys (Machine Insight Suite) |
| DDAS Machine Insight Suite SL – Installation and Licensing | Licensing with a CODESYS device license (Machine Insight Suite SL) |
| DDAS Date Time Library Manual | Description and usage of the Date Time function blocks |
| DDAS Scheduler Library Manual | Description and usage of the Scheduler function blocks |
| DDAS Equipment Performance Library Manual | Description and usage of the Equipment Performance function blocks |
| DDAS Application Template Manual | Structure and usage of the Application Template |
Document history
| Version | Description | ||
|---|---|---|---|
| 1.0 | 08.05.2026 | DDAS | Initial version |
| 1.1 | 07.10.2026 | DDAS | New function block EP_Result and structure scEP_Result. Stop counting, parts without an active schedule and parameter errors described. Output xLicensed clarified. |
General
Library
This library provides a comprehensive solution for real-time monitoring and historical tracking of equipment performance. It enables the calculation and analysis of key performance indicators (KPIs) such as production counts, overall equipment effectiveness (OEE), performance rates, and loss metrics across different operational contexts, including batches, shifts, or product runs.
In addition to real-time evaluation, the library supports the structured capture and storage of performance data over time. This allows for detailed trend analysis, traceability, and long-term performance assessment.
The solution includes capabilities for identifying and analysing production losses and operational states, helping to improve transparency and support continuous optimization of manufacturing processes.
The library includes the following user function blocks:
EquipmentPerformance
EP_History
EP_Result
EquipmentPerformance
This Function block calculating and tracking key equipment performance indicators (KPIs), including production counts,
OEE, performance rates, and loss analysis, for an active batch, shift, or product run.
EP_History
This Function block stores equipment performance data into historical arrays, capturing snapshots of performance, production, loss, and top-state metrics from the EquipmentPerformance function block.
EP_Result
This function block evaluates the history arrays of EP_History and returns one total result over several shifts, batches or product runs. The running schedule can be included.
Detailed descriptions of the function blocks and their relevant dependencies are provided in the following chapters.
Licensing
All DDAS libraries require a valid license. The license check is performed by the DDAS License Manager library (DDAS_LicenseManager_Lib), which is added to the project automatically as a dependency of this library. The function blocks of this library need no licensing code.
How the license is activated depends on your product:
DDAS Machine Insight Suite (DDAS activation keys): DDAS License Manager Manual, https://ddas.cloudet.digital/html/DDAS-LicenseManager-LibraryManual-en.html
DDAS Machine Insight Suite SL (CODESYS device license): DDAS Machine Insight Suite SL – Installation and Licensing, https://ddas.cloudet.digital/html/DDAS-MachineInsightSuiteSL-Manual-en.html
Without a valid license, the library runs in a time-limited demo mode, as described in the licensing documentation of your product. After the demo has expired, all function blocks of this library stop and report error 10 (no_ValidLicense). The function DDAS_LM.GetLicenseInfo returns the license status and the cause.
Note: The function Get_sError is available in every library and returns the error text and the enumeration value for an error code of this library.
FB EquipmentPerformance
General Information
This chapter describes the function block EquipmentPerformance.
Function Block Name: EquipmentPerformance
Library: DDAS_EquipmentPerformance_Lib
Dependent CODESYS libraries: None
CODESYS Version Compatibility: CODESYS V3.5 and higher
License / Usage Restrictions: Requires valid full or demo library license
Purpose & Scope
This Function block calculating and tracking key equipment performance indicators (KPIs), including production counts, OEE, performance rates, and loss analysis, for an active batch, shift, or product run.
It processes production data, schedules, and state information to generate detailed KPIs, production insights, and loss analytics, supporting performance optimization, OEE tracking, and reporting at batch, shift, or product level.
Typical Use Cases
This function block is used in industrial automation systems to monitor and analyse machine performance in real time.
Functional Overview
When enabled, the Equipment Performance function block provides real-time calculation and tracking of key equipment performance indicators (KPIs) for an active production context, such as a batch, shift, or product run.
It continuously processes operational inputs including production counts, product cycle time, machine performance targets, equipment states, and time information to generate a comprehensive view of machine efficiency and productivity.
The function block evaluates production output by distinguishing
between good (OK) and defective (NOK) units and compares actual
performance against planned production rates. Based on this data, it
calculates key metrics such as performance rates and overall equipment
effectiveness (OEE), enabling transparent assessment of production
efficiency.
In addition to production metrics, the function block monitors equipment
states to identify and categorize production losses. It analyzes
downtime, scheduled breaks, and operational conditions to provide
detailed loss information and supports prioritization through top-state
analysis, highlighting the most significant contributors to reduced
performance.

The solution manages lifecycle events of production schedules, including activation and completion, ensuring that KPI tracking is aligned with the current operational context. It also handles transitions between production runs by resetting and reinitializing relevant data at the end of each schedule.
All calculated KPIs and analytical results are made available through structured data outputs, enabling further processing, visualization, or storage in higher-level systems. Built-in status and diagnostic signals provide transparency regarding execution state, licensing, and potential errors, ensuring reliable integration into industrial automation environments.
Stop counting and short stops
Every stop is counted once, with one occurrence and its whole duration. Whether it counts as a short stop or as a long stop depends on its duration:
| Production state | Threshold (scPar) | Shorter than the threshold | Longer than the threshold |
|---|---|---|---|
| Starved, Blocked, NoMaterial | tShortStopTimePerfLoss | Short stop (tStarvedShort, tBlockedShort, tNoMaterialShort): performance loss | Long stop (tStarved, tBlocked, tNoMaterial): availability loss |
| OperatorStop | tShortStopTimeAvailLoss | Short stop (tOperatorStopShort): performance loss | Long stop (tOperatorStop): availability loss |
| EquipmentFailure, NotReady | none | – | Always availability loss |
While a stop is running and has not yet reached the threshold, it is shown as a short stop. When it reaches the threshold, its occurrence and the time elapsed so far are moved from the short stop to the long stop. At this moment tPerformanceLoss decreases by this amount and tAvailabilityLoss increases by the same amount; the sum tUnplannedDowntime does not change.
Example with a threshold of 5 s: a stop of 2 s results in tStarvedShort = 2 s and uiStarvedShort = 1. A stop of 7 s results in tStarved = 7 s and uiStarved = 1; nothing remains in the short stop.
If a schedule ends while a stop is still below the threshold, the time elapsed so far stays a short stop of this schedule. During an active scheduled break (xActiveScheduledBreak) no stops are counted.
Parts without an active schedule
Parts that are counted while no schedule is active (xActivated = FALSE) are not lost. The function block reports the hint 35 (productCount_NoSchedule) as long as no schedule is active and continues to run. The parts are taken over into the next schedule: they are included in lrQuantity, lrQuantityOK and lrQuantityNOK, but not in the performance, the throughput and the speed loss of that schedule.
Behaviour with invalid input parameters
| Error | Cause | Behaviour |
|---|---|---|
| 21 invalid_LocalDateTime | dtLocalDateTime is not valid | Nothing is calculated until the value is valid. |
| 30 invalid_InputParameter | rProductsPerMin or rOEEpercent outside the permissible range | The schedule starts and ends as usual; losses and production times are calculated. KPIs, throughput and the losses in product count are paused until the value is valid. |
| 32 productionState_None | eProdState = None | The schedule starts and ends as usual and all values are calculated. The time is counted in tNone. |
| 34 negativ_ProductCount | lrProductCountOK or lrProductCountNOK is negative | Nothing is calculated until the value is valid. |
The errors 30 and 32 are reported at the end of the PLC cycle, so that xScheduleEnd and the start of the next schedule are not affected by them.
Note: Multiple instances can be used in parallel. For example, one instance can monitor batch or shift OEE KPIs, while another instance can be used to track product-specific OEE KPIs.
Interface Description
Function block Inputs and Outputs
| Scope | Name | Type | Comment |
|---|---|---|---|
| Input | xEnabled | BOOL | Enables execution of the function block when TRUE. |
| xActivated | BOOL | TRUE = Active shift schedule, batch or product run | |
| xActiveScheduledBreak | BOOL | Active scheduled break from production schedule/calendar | |
| diScheduleID | DINT | Shift or batch run ID; can be 0 for a product run | |
| sScheduleDescription | STRING | Shift or Batch run Description ; can be empty string by product run | |
| diProductID | DINT | Running product ID | |
| sProductDescription | STRING | Product type or ID Description | |
| rProductsPerMin | REAL | Planned Machine Performance in products per min. (valid value between >= 0.001 and <= 10000) | |
| lrProductCountOK | LREAL | Product OK count | |
| lrProductCountNOK | LREAL | Product NOK count | |
| rOEEpercent | REAL | Actual or average OEE in percent e.g 80.5% (expected value between > 0.1 and <= 100 , Limit 999%), 0% will be set to 100% | |
| dtLocalDateTime | DT | Local Date and Time | |
| eProdState | eProductionState | Production states and Downtime losses | |
| scPar | scPar | Equipment Performance input parameter | |
| Inout | scEP | scPerformanceDetails | Equipment performance KPI’s about the active scheduled batch, shift, or product run. |
| scPD | scProductionDetails | Detailed information about the active scheduled batch, shift, or product run. | |
| scPL | scProductionLossDetails | Detailed information about the losses of the active scheduled batch, shift, or product run. | |
| scTS | scTopState | Top-state analysis of the duration and occurrences of losses in the active scheduled batch, shift, or product run. | |
| Output | xActiveSchedule | BOOL | Valid active schedule and KPI calculation |
| xScheduleEnd | BOOL | TRUE for one PLC cycle on end of schedule; all output date get be cleared and reseted on the next PLC cycle | |
| xLicensed | BOOL | TRUE when a valid full or demo library license is active. FALSE while the function block is disabled (xEnabled = FALSE). | |
| xError | BOOL | TRUE if an error or warning is detected. Detailed error information is provided in iErrorID | |
| iErrorID | INT | Error and status identifier for diagnostics |
Execution & Timing Behaviour
The function block is intended to be executed cyclically in a task context.
Timing precision depends on the configured task cycle time and target platform
Error Handling & Diagnostics
If an internal error, a library issue, or a licensing problem occurs, xError is set to TRUE and iErrorID provides the corresponding error code. Detailed descriptions of the error codes are defined in the enumeration eError.
Assumptions & Limitations
Accuracy depends on the system clock. Hardware‑dependent behavior may vary across different CODESYS platforms.
All durations are calculated from the local date and time (dtLocalDateTime) with a resolution of one second. A change of the clock during an active schedule therefore changes the durations of this schedule: when the clock is set forward (for example at the start of daylight saving time), running durations jump forward by the same amount. When the clock is set back (for example at the end of daylight saving time), the function block may report error 21 for a time and does not calculate. Only the schedule that is active during the change is affected.
The function block KPI calculation is restricted to a 49-day window. If the required build time extends beyond this period, the function block cannot provide a valid result.
Before ordering this library, please verify the correct functionality of the library function block in your target system.
Example Implementation
Declaration and Call of the Function Block EquipmentPerformance:
GVL_MIF:
VAR_GLOBAL
| xActiveSchedule | : BOOL; | // TRUE when a shift or batch schedule is currently active. |
|---|---|---|
| xActiveBreak | : BOOL; | // TRUE when a break schedule is currently active. |
| diJobID | : DINT; | // Batch ID |
| sActiveScheduleDesc | : STRING; | // Active schedule description of Shift schedule or JobID |
| diProductID | : DINT; | // Running product ID |
| sProductDescription | : STRING; | // Product type or ID Description |
| rProductsPerMin | : REAL; | // Planned Machine Performance in products per min. (valid value between >= 0.001 and <= 10000) |
| lrActualBuildOK | : LREAL; | Actual build products, if no parts are made it is zero (0) |
| lrActualBuildNOK | : LREAL; | Actual build scrap products, if no parts are made it is zero (0) |
| rOEEpercent | : REAL; | // Actual or average OEE in percent e.g 80.5% (expected value between > 0.1 and <= 100 %, Limit 999%), 0% will be set to 100% |
| dtLocalDateTime | : DT; | // Local Date and Time |
END_VAR
GVL_Par_EP:
VAR_GLOBAL
| scPar | : DDAS_EP.scPar; | // Parameter Input structure FB EquipmentPerformance |
|---|---|---|
| eProdState | : DDAS_EP.eProductionState; | // Production states |
END_VAR
GVL_EP_History:
VAR_GLOBAL RETAIN
| scEP | : DDAS_EP.scPerformanceDetails; | // Equipment performance KPI's about the active scheduled batch, shift, or product run |
|---|---|---|
| scPD | : DDAS_EP.scProductionDetails; | // Detailed information about the active scheduled batch, shift, or product run |
| scPL | : DDAS_EP.scProductionLossDetails; | // Detailed information about the losses of the active scheduled batch, shift, or product run |
| scTS | : DDAS_EP.scTopState; | // Top-state analysis of the duration and occurrences of losses in the active scheduled batch, shift, or product run |
END_VAR
VAR
fb_EP : DDAS_EP.EquipmentPerformance;
END_VAR
FB call in structure text:
fb_ EP(
xEnabled := TRUE,
xActivated := GVL_MIF.xActiveSchedule,
xActiveScheduledBreak := GVL_MIF.xActiveBreak,
diScheduleID := GVL_MIF.diJobID,
sScheduleDescription := GVL_MIF.sActiveScheduleDesc,
diProductID := GVL_MIF.diProductID,
sProductDescription := GVL_MIF.sProductDescription,
rProductsPerMin := GVL_MIF.rProductsPerMin,
lrProductCountOK := GVL_MIF.lrActualBuildOK,
lrProductCountNOK := GVL_MIF.lrActualBuildNOK,
rOEEpercent := GVL_MIF.rOEEpercent,
dtLocalDateTime := GVL_MIF.dtLocalDateTime,
eProdState := GVL_Par_EP.eProdState,
scPar := GVL_Par_EP.scPar,
scEP := GVL_EP_History.scEP,
scPD := GVL_EP_History.scPD,
scPL := GVL_EP_History.scPL,
scTS := GVL_EP_History.scTS
);
FB call in continuous function chart diagram:

Function block sample input and output parameter:

Screenshot example in Online / Monitor mode
Demo Visualisation


FB EP_History
General Information
This chapter describes the function block EP_History.
Function Block Name: EP_History
Library: DDAS_EquipmentPerformance_Lib
Dependent Codesys libraries: None
CODESYS Version Compatibility: CODESYS V3.5 and higher
License / Usage Restrictions: Requires valid full or demo library license
Purpose & Scope
This function block stores equipment performance data into historical arrays, capturing snapshots of performance, production, loss, and top-state metrics from the EquipmentPerformance function block.
This function block is used to maintain a rolling history of equipment performance data for analysis, visualization, and reporting.
It enables controlled storage and clearing of historical KPI datasets, preserving time-based snapshots in reverse chronological order.
Typical Use Cases
Typical applications include trend analysis, dashboard visualization, batch/shift comparison, and short-term buffering of performance data for higher-level systems such as SCADA, MES, or cloud analytics.
Functional Overview
When enabled, the Equipment Performance History function block provides structured storage and management of time-based equipment performance data. It captures snapshots of key performance datasets, including performance metrics, production details, loss information, and top-state analysis, and organizes them into historical records for further use.
The function block enables selective recording of different data categories, allowing flexible control over which information is stored. Data is captured on demand and inserted into history buffers in reverse chronological order, ensuring that the most recent dataset is always immediately accessible while maintaining a defined history depth.
In addition to data storage, the function block supports controlled clearing of historical records, enabling reset operations when required, such as at the start of new production phases or for memory management purposes.

The stored historical data can be used for trend analysis, visualization, and reporting in higher-level systems. This supports use cases such as performance monitoring over time, comparison of batches or shifts, and short-term buffering of KPIs before transfer to SCADA, MES, or cloud-based analytics platforms.
Status signals indicate the successful execution of storage and clearing operations, while integrated diagnostic outputs provide transparency regarding licensing status and potential errors. This ensures reliable and traceable operation within industrial automation environments.
Note: Multiple instances can be used in parallel. For example, one instance can store history data of batch or shift OEE KPIs, while another instance can be used to store history data of product-specific OEE KPIs.
Interface Description
Function block Inputs and Outputs
| Scope | Name | Type | Comment |
|---|---|---|---|
| Input | xEnabled | BOOL | Enables execution of the function block when TRUE. |
| xStoreHistoryEP | BOOL | Store history Performance Details data | |
| xStoreHistoryPD | BOOL | Store history Production Details data | |
| xStoreHistoryPL | BOOL | Store history Production Loss Details data | |
| xStoreHistoryTS | BOOL | Store history Top State data | |
| xStoreHistoryData | BOOL | On rising True store History data | |
| xClearHistoryData | BOOL | On rising True clear History data | |
| Inout | scEP | scPerformanceDetails | Input Performance Details data |
| scPD | scProductionDetails | Input Production Details data | |
| scPL | scProductionLossDetails | Input Production Loss Details data | |
| scTS | scTopState | Input Top State data | |
| ascEP | ARRAY [0..GVL_Constant_EP.uiHistorySize] OF scPerformanceDetails | History Performance Details data (Values are stored in reverse chronological order, with index 0 representing the newest entry and the highest index (GVL_Constant_EP.uiHistorySize) the oldest) | |
| ascPD | ARRAY [0..GVL_Constant_EP.uiHistorySize] OF scProductionDetails | History Production Details data (Values are stored in reverse chronological order, with index 0 representing the newest entry and the highest index (GVL_Constant_EP.uiHistorySize) the oldest) | |
| ascPL | ARRAY [0..GVL_Constant_EP.uiHistorySize] OF scProductionLossDetails | History Production Loss Details data (Values are stored in reverse chronological order, with index 0 representing the newest entry and the highest index (GVL_Constant_EP.uiHistorySize) the oldest) | |
| ascTS | ARRAY [0..GVL_Constant_EP.uiHistorySize] OF scTopState | History Top State data (Values are stored in reverse chronological order, with index 0 representing the newest entry and the highest index (GVL_Constant_EP.uiHistorySize) the oldest) | |
| Output | xStoreHistoryDone | BOOL | IF TRUE history data are stored; TRUE for one PLC cycle |
| xClearHistoryDone | BOOL | IF TRUE history data are cleared; TRUE for one PLC cycle | |
| xLicensed | BOOL | TRUE when a valid full or demo library license is active. FALSE while the function block is disabled (xEnabled = FALSE). | |
| xError | BOOL | TRUE if an error or warning is detected. Detailed error information is provided in iErrorID | |
| iErrorID | INT | Error and status identifier for diagnostics |
Execution & Timing Behaviour
The function block is intended to be executed cyclically in a task context.
Timing precision depends on the configured task cycle time and target platform
Error Handling & Diagnostics
If an internal error, a library issue, or a licensing problem occurs, xError is set to TRUE and iErrorID provides the corresponding error code. Detailed descriptions of the error codes are defined in the enumeration eError.
Assumptions & Limitations
Accuracy depends on the system clock. Hardware‑dependent behavior may vary across different CODESYS platforms.
Before ordering this library, please verify the correct functionality of the library function block in your target system.
Example Implementation
Declaration and Call of the Function Block EP_History:
GVL_Par_EP:
VAR_GLOBAL
| xScheduleEnd | : BOOL; | // TRUE for one PLC cycle on end of schedule; all output date get be cleared and reseted on the next PLC cycle |
|---|---|---|
| xClearHistoryData | : BOOL; | // On rising True clear History data |
END_VAR
GVL_EP_History:
VAR_GLOBAL RETAIN
| scEP | : DDAS_EP.scPerformanceDetails; | // Equipment performance KPI's about the active scheduled batch, shift, or product run |
|---|---|---|
| scPD | : DDAS_EP.scProductionDetails; | // Detailed information about the active scheduled batch, shift, or product run |
| scPL | : DDAS_EP.scProductionLossDetails; | // Detailed information about the losses of the active scheduled batch, shift, or product run |
| scTS | : DDAS_EP.scTopState; | // Top-state analysis of the duration and occurrences of losses in the active scheduled batch, shift, or product run |
| ascEP | : ARRAY[0..DDAS_EP.GVL_Constant_EP.uiHistorySize] OF DDAS_EP.scPerformanceDetails; | // History Equipment performance KPI's about the active scheduled batch, shift, or product run |
| ascPD | : ARRAY[0..DDAS_EP.GVL_Constant_EP.uiHistorySize] OF DDAS_EP.scProductionDetails; | // History detailed information about the active scheduled batch, shift, or product run |
| ascPL | : ARRAY[0..DDAS_EP.GVL_Constant_EP.uiHistorySize] OF DDAS_EP.scProductionLossDetails; | // History detailed information about the losses of the active scheduled batch, shift, or product run |
| ascTS | : ARRAY[0..DDAS_EP.GVL_Constant_EP.uiHistorySize] OF DDAS_EP.scTopState; | // History Top-state analysis of the duration and occurrences of losses in the active scheduled batch, shift, or product run |
END_VAR
Note: Declare the data of the running schedule and the history arrays as RETAIN, so that they survive a restart of the controller and a power failure. To keep them also after a cold reset or a new download of the application, declare them as persistent variables. The Application Template Manual describes both options.
VAR
fb_EP_History : DDAS_EP.EP_History;
END_VAR
FB call in structure text:
fb_EP_History(
xEnabled := TRUE,
xStoreHistoryEP := TRUE,
xStoreHistoryPD := TRUE,
xStoreHistoryPL := TRUE,
xStoreHistoryTS := TRUE,
xStoreHistoryData := GVL_Par_EP.xScheduleEnd,
xClearHistoryData := GVL_Par_EP.xClearHistoryData,
scEP := GVL_EP_History.scEP,
scPD := GVL_EP_History.scPD,
scPL := GVL_EP_History.scPL,
scTS := GVL_EP_History.scTS,
ascEP := GVL_EP_History.ascEP,
ascPD := GVL_EP_History.ascPD,
ascPL := GVL_EP_History.ascPL,
ascTS := GVL_EP_History.ascTS
);
FB call in continuous function chart diagram:

Function block sample input and output parameter:


Screenshot example in Online / Monitor mode
FB EP_Result
General Information
This chapter describes the function block EP_Result.
Function Block Name: EP_Result
Library: DDAS_EquipmentPerformance_Lib
Dependent CODESYS libraries: Standard
CODESYS Version Compatibility: CODESYS V3.5 and higher
License / Usage Restrictions: Requires valid full or demo library license
Purpose & Scope
This function block evaluates the history arrays of the function block EP_History and returns one total result over several schedules (shifts, batches or product runs). The running schedule can be included.
Typical Use Cases
Analysis on request, for example the result of a day (three shifts), of a week or of the last batches, for a dashboard or for a report to a higher-level system.
Functional Overview
When enabled, the function block calculates the result once on a rising edge of xExecute and holds it until the next calculation. It does not calculate cyclically.
The function block reads the newest entries of the history arrays, starting at index 0. The input uiHistoryEntries limits the number of entries; with 0 all stored entries are evaluated. With xIncludeActual = TRUE the running schedule is added. A running schedule that is empty or that is already stored as the newest history entry is not counted a second time.
A rising edge of xExecute within tMinInterval after the last calculation is ignored. This limits the load when the input is triggered from a visualization or a higher-level system.

The result is provided in the structure scEP_Result and is calculated as follows:
| Values | Rule |
|---|---|
| Times, product counts, targets, losses, occurrences | Sum over all included schedules |
| dtStartTime, dtEndTime | Earliest start and latest end of the included schedules |
| rAvailability | Sum of the run times / sum of the planned production times × 100 % |
| rQuality | Sum of the OK parts / sum of all parts × 100 % |
| rPerformance, lrActualNetTPH, lrTargetNetTPH | Average of the schedules, weighted with the run time |
| lrActualPlanTPH, lrTargetPlanTPH | Average of the schedules, weighted with the planned production time |
| rOEE | Availability × Performance × Quality of the result |
| rTEEP | OEE × sum of the planned production times / sum of the all times |
| scTS (top states) | Sorted again from the summed durations and occurrences |
| uiEntries | Number of included schedules (history entries plus the running schedule) |
| dtEvaluation | Value of dtLocalDateTime at the time of the calculation |
The KPIs are calculated from the sums. They are not the average of the KPIs of the single schedules.
The following values are not evaluated and stay empty: diScheduleID, sScheduleDescription, diProductID, sProductDescription and rProductTime in scPD, and eEP_PT in scPL.
Note: Multiple instances can be used in parallel on the same history arrays, for example one instance for the day and one for the week.
Interface Description
Function block Inputs and Outputs
| Scope | Name | Type | Comment |
|---|---|---|---|
| Input | xEnabled | BOOL | Enables execution of the function block when TRUE. |
| xExecute | BOOL | On a rising edge the result is calculated. | |
| xIncludeActual | BOOL | When TRUE the running schedule is included in the result. | |
| uiHistoryEntries | UINT | Number of newest history entries to evaluate; 0 = all stored entries. | |
| tMinInterval | TIME | Minimum time between two calculations; a rising edge of xExecute within this time is ignored. Initial value: T#1S. | |
| dtLocalDateTime | DT | Local date and time, stored in the result as time of the evaluation. | |
| Inout | scEP | scPerformanceDetails | Performance Details data of the running schedule (read only) |
| scPD | scProductionDetails | Production Details data of the running schedule (read only) | |
| scPL | scProductionLossDetails | Production Loss Details data of the running schedule (read only) | |
| ascEP | ARRAY [0..GVL_Constant_EP.uiHistorySize] OF scPerformanceDetails | History Performance Details data (read only) | |
| ascPD | ARRAY [0..GVL_Constant_EP.uiHistorySize] OF scProductionDetails | History Production Details data (read only) | |
| ascPL | ARRAY [0..GVL_Constant_EP.uiHistorySize] OF scProductionLossDetails | History Production Loss Details data (read only) | |
| Output | scTotal | scEP_Result | Total result over the evaluated schedules |
| xDone | BOOL | TRUE for one PLC cycle when the result has been calculated | |
| xLicensed | BOOL | TRUE when a valid full or demo library license is active. FALSE while the function block is disabled (xEnabled = FALSE). | |
| xError | BOOL | TRUE if an error or warning is detected. Detailed error information is provided in iErrorID | |
| iErrorID | INT | Error and status identifier for diagnostics |
The function block does not write to the Inout variables.
Execution & Timing Behaviour
The function block is intended to be executed cyclically in a task context. The result is calculated within one PLC cycle, on the rising edge of xExecute.
When the function block is disabled (xEnabled = FALSE), scTotal is cleared.
Error Handling & Diagnostics
If a licensing problem occurs or the result is not complete, xError is set to TRUE and iErrorID provides the corresponding error code (enumeration eError). The result stays visible also with an error. An error of a calculation is held until the next calculation.
| Error | Meaning for EP_Result |
|---|---|
| 10 no_ValidLicense | No valid license; no result is calculated. |
| 30 invalid_InputParameter | At least one history entry has no matching Production Details or Production Loss Details and was skipped. |
| 42 time_overflow | At least one sum has reached the limit of its data type (TIME: 49 days, occurrences: 65535) and was limited to this value. |
Assumptions & Limitations
The history must contain Performance Details, Production Details and Production Loss Details (xStoreHistoryEP, xStoreHistoryPD and xStoreHistoryPL of EP_History = TRUE). Top State data of the history are not required.
The sum of a time is limited to 49 days, the sum of an occurrence to 65535. The KPIs are not affected by this limit.
Before ordering this library, please verify the correct functionality of the library function block in your target system.
Example Implementation
Declaration and Call of the Function Block EP_Result:
GVL_Par_EP:
VAR_GLOBAL
| xExecute | : BOOL; | // On rising True calculate the result |
|---|---|---|
| xIncludeActual | : BOOL := TRUE; | // When TRUE the running schedule is included in the result |
| uiHistoryEntries | : UINT; | // Number of newest history entries to evaluate; 0 = all stored entries |
| tMinInterval | : TIME := T#1S; | // Minimum time between two calculations; a rising edge of xExecute within this time is ignored |
| scTotal | : DDAS_EP.scEP_Result; | // Total result over the evaluated schedules |
END_VAR
VAR
fb_EP_Result : DDAS_EP.EP_Result;
END_VAR
FB call in structure text:
fb_EP_Result(
xEnabled := TRUE,
xExecute := GVL_Par_EP.xExecute,
xIncludeActual := GVL_Par_EP.xIncludeActual,
uiHistoryEntries := GVL_Par_EP.uiHistoryEntries,
tMinInterval := GVL_Par_EP.tMinInterval,
dtLocalDateTime := GVL_MIF.dtLocalDateTime,
scEP := GVL_EP_History.scEP,
scPD := GVL_EP_History.scPD,
scPL := GVL_EP_History.scPL,
ascEP := GVL_EP_History.ascEP,
ascPD := GVL_EP_History.ascPD,
ascPL := GVL_EP_History.ascPL,
scTotal => GVL_Par_EP.scTotal
);
FB call in continuous function chart diagram:

Function block sample input and output parameter:

Screenshot example in Online / Monitor mode
Global
Structures
scPar
This structure provides input user‑configuration.
| Name | Type | Initial | Comment |
|---|---|---|---|
| tStartUpWaitTime | TIME | TIME#5m0s0ms | Waiting time before performance and througput calculation is started |
| lrStartUpWaitCount | LREAL | 10 | Waiting part count number before performance and througput calculation is started |
| tShortStopTimePerfLoss | TIME | TIME#10s0ms | A stop in the state Starved, Blocked or NoMaterial that is shorter than this time is a short stop (performance loss); a longer stop is a long stop (availability loss) with its whole duration |
| tShortStopTimeAvailLoss | TIME | TIME#30s0ms | A stop in the state OperatorStop that is shorter than this time is a short stop (performance loss); a longer stop is a long stop (availability loss) with its whole duration |
| tKPIUpdateFilter | TIME | TIME#5s0ms | Update filter for OEE KPI’s calculation |
scPerformanceDetails
This structure provides Equipment performance KPI’s about the active scheduled batch, shift, or product run.
| Name | Type | Comment |
|---|---|---|
| dtStartTime | DT | Start Time of event |
| dtEndTime | DT | End Time of event; Note: During a active schedule it will be updated with dtLocalDateTime and freeze on the end of the schedule |
| rOEE | REAL | Overall Equipment Effectiveness := Availability % * Performance %* Quality % - shift based |
| rAvailability | REAL | Run Time / Planned Production Time * 100% |
| rPerformance | REAL | ((Ideal Cycle Time × Total Count) / Run Time) * 100% , Based in the time the machine is in production |
| rQuality | REAL | (Good Count / Total Count) * 100% |
| lrQuantity | LREAL | Total build products (lrQuantityOK + lrQuantityNOK) |
| rTEEP | REAL | Total Effective Equipment Performance := OEE% × Utilization; Utilization –> (Planned Production Time / All Time) |
| lrQuantityOK | LREAL | Product build OK count |
| lrQuantityNOK | LREAL | Product build NOK count |
| lrActualPlanTarget | LREAL | Actual No. of parts which should be build based on eleapsed planned prodution time |
| lrActualNetTarget | LREAL | Actual No. of parts which should be build based on eleapsed runtime time |
| lrActualPlanOEETarget | LREAL | Actual No. of parts which should be build based on eleapsed planned prodution time based on OEE target |
| lrActualNetOEETarget | LREAL | Actual No. of parts which should be build based on eleapsed runtime based on OEE target |
| lrActualPlanTPH | LREAL | Actual Throughput per hour ((lrQuantityOK + lrQuantityNOK) / Planned Production * 3600sec) |
| lrTargetPlanTPH | LREAL | Target Throughput per hour (rActualPlanTarget / Planned Production * 3600sec) |
| lrActualNetTPH | LREAL | Actual Throughput per hour ((lrQuantityOK + lrQuantityNOK) / Run time * 3600sec) |
| lrTargetNetTPH | LREAL | Target Throughput per hour (rActualPlanTarget / Run time * 3600sec) |
| tScheduleLoss | TIME | Total time of Planned downtime e.g. ‘Breaks’, ‘No Demand’.. |
| tAvailabilityLoss | TIME | Total time for all machine downtimes e.g. ‘EquipmentFailure’ , ‘NotReady’, ‘OperatorStop’… |
| tPerformanceLoss | TIME | Total time of all short stops (StarvedShort, BlockedShort, NoMaterialShort, OperatorStopShort). Short stops only; the performance loss of the OEE time model is tPerformanceLoss + tSpeedLoss |
| tQualityLoss | TIME | Total time of quality losses based numer of scrap parts * product cycle time |
| tSpeedLoss | TIME | Total time of speed loss: Run Time - short stops (tPerformanceLoss) - Net Run Time |
| lrScheduleLoss | LREAL | Schedule losses in product count e.g. ‘Breaks’, ‘No Demand’.. |
| lrAvailabilityLoss | LREAL | Availability losses in product count e.g. ‘EquipmentFailure’ , ‘NotReady’, ‘OperatorStop’… |
| lrPerformanceLoss | LREAL | Performance losses in product count of all short stops (StarvedShort, BlockedShort, NoMaterialShort, OperatorStopShort); speed losses are in lrSpeedLoss |
| lrQualityLoss | LREAL | Quality losses in product count = lrQuantityNOK |
| lrSpeedLoss | LREAL | Speed losses in product count (tSpeedLoss / product cycle time) |
scProductionDetails
This structure provides detailed information about the active scheduled batch, shift, or product run.
| Name | Type | Comment |
|---|---|---|
| dtStartTime | DT | Start Time of event |
| dtEndTime | DT | End Time of event; Note: During a active schedule it will be updated with dtLocalDateTime and freeze on the end of the schedule |
| tDuration | TIME | Time elapsed since the start |
| diScheduleID | DINT | Shift or batch run ID; can be 0 for a product run |
| sScheduleDescription | STRING | Shift or Batch run Description ; can be empty string by product run |
| diProductID | DINT | Running product ID |
| sProductDescription | STRING | Product type or ID Description |
| rProductTime | REAL | Part cycle time base don input parameter (60.0 / rProductsPerMin) |
| tActualAllTime | TIME | Actual All Time (Actual time - Schedule start) |
| tPlannedProdTime | TIME | Planned Production Time (Actual All time - Schedule Loss) |
| tRunTime | TIME | Run Time (Planned Production Time - Availability Loss) |
| tNetRunTime | TIME | Net Run Time (Ideal Cycle Time x Total Count = Run Time - short stops - speed loss) |
| tFullyProdTime | TIME | Fully Productive Time (Net Run Time - Quality Loss) |
| tProducing | TIME | Time production is running |
| uiProducing | UINT | Occurrence rate how oftens the production was started |
scProductionLossDetails
This structure provides detailed information about the losses of the active scheduled batch, shift, or product run.
| Name | Type | Comment |
|---|---|---|
| dtStartTime | DT | Start Time of event |
| dtEndTime | DT | End Time of event; Note: During a active schedule it will be updated with dtLocalDateTime and freeze on the end of the schedule |
| eEP_PT | eEP_ProductionState | Output production states as enumeration |
| tUnplannedDowntime | TIME | Total time of unplanned Availability and Performance events |
| uiUnplannedOccurrence | UINT | Total Occurrence rate of unplanned Availability and Performance events |
| tBreak | TIME | Time production is in break and production has stopped |
| tNoDemand | TIME | Time where there is no production demand or order |
| tNone | TIME | Time where no production state is identified |
| tStarvedShort | TIME | Short stops: Time where upstream is starved e.g. No incoming parts |
| tBlockedShort | TIME | Short stops: Time where downstream is blocked e.g. No output part transfer |
| tNoMaterialShort | TIME | Short stops: Time where is No material available for production(e.g. film roll empty) |
| tOperatorStopShort | TIME | Short stops: Time when the Operator-initiated pause for minor issues (e.g., clearing a jam) |
| tEquipmentFailure | TIME | Time when Emergency or critical fault is active and production has been aborted |
| tNotReady | TIME | Time when the machine has been stopped and wating for restart |
| tOperatorStop | TIME | Time when the Operator-initiated pause for minor issues (e.g., clearing a jam) |
| tStarved | TIME | Time where upstream is starved e.g. No incoming parts |
| tBlocked | TIME | Time where downstream is blocked e.g. No output part transfer |
| tNoMaterial | TIME | Time where is No material available for production(e.g. film roll empty) |
| uiBreak | UINT | Occurrence rate production is in break and production has stopped |
| uiNoDemand | UINT | Occurrence rate where there is no production demand or order |
| uiNone | UINT | Occurrence rate where no production state is identified |
| uiStarvedShort | UINT | Short stops: Occurrence rate where upstream is starved e.g. No incoming parts |
| uiBlockedShort | UINT | Short stops: Occurrence rate where downstream is blocked e.g. No output part transfer |
| uiNoMaterialShort | UINT | Short stops: Occurrence rate where No material is available for production(e.g. film roll empty) |
| uiOperatorStopShort | UINT | Short stops: Occurrence rate when the Operator-initiated pause for minor issues (e.g., clearing a jam) |
| uiEquipmentFailure | UINT | Occurrence rate when Emergency or critical fault is active and production has been aborted |
| uiNotReady | UINT | Occurrence rate when the machine has been stopped and wating for restart |
| uiOperatorStop | UINT | Occurrence rate when the Operator-initiated pause for minor issues (e.g., clearing a jam) |
| uiStarved | UINT | Occurrence rate where upstream is starved e.g. No incoming parts |
| uiBlocked | UINT | Occurrence rate where downstream is blocked e.g. No output part transfer |
| uiNoMaterial | UINT | Occurrence rate where No material is available for production(e.g. film roll empty) |
scTopState
This structure provides top-state analysis of the duration and occurrences of losses in the active scheduled batch, shift, or product run.
| Name | Type | Comment |
|---|---|---|
| dtStartTime | DT | Start Time of event |
| dtEndTime | DT | End Time of event; Note: During a active schedule it will be updated with dtLocalDateTime and freeze on the end of the schedule |
| scTopStateDur | ARRAY [0..9] OF scTopStateDuration | |
| scTopStateOcc | ARRAY [0..9] OF scTopStateOccurances |
scTopStateDuration
This structure provides the duration of losses in the active scheduled batch, shift, or product run.
| Name | Type | Comment |
|---|---|---|
| eTopStateDurations | eTopState | Top state durations index 0 is longest time |
| tSortOfTime | TIME | Time of State duration |
| rDowntimePercent | REAL | Downtime percent of the total downtime |
scTopStateOccurances
This structure provides occurrences of losses in the active scheduled batch, shift, or product run.
| Name | Type | Comment |
|---|---|---|
| eTopStateOccurrence | eTopState | Top state Occurrence index 0 is most occurrences |
| uiSortOfOccurrence | UINT | Number of Occurrence |
| rDowntimePercent | REAL | Downtime percent of the total downtime |
scEP_Result
This structure provides the result of an evaluation over several schedules (shifts, batches or product runs).
| Name | Type | Comment |
|---|---|---|
| uiEntries | UINT | Number of schedules included in the result (history entries plus the running schedule) |
| dtEvaluation | DT | Local date and time of the evaluation |
| scEP | scPerformanceDetails | Performance Details over all included schedules |
| scPD | scProductionDetails | Production Details over all included schedules; IDs, descriptions and rProductTime are not evaluated |
| scPL | scProductionLossDetails | Production Loss Details over all included schedules; eEP_PT is not evaluated |
| scTS | scTopState | Top State data, sorted from the summed production losses |
Enumerations
eProductionState
Defined input production states as enumeration.
| Name | Initial | Comment |
|---|---|---|
| None | 0 | unknowing production state. |
| Producing | 1 | Production is running (Note: e.g. Execute or Running) |
| NoDemand | 10 | Machine is ready to start waiting for Start (Note: Planned downtime e.g. Idle state, No Order). |
| Starved | 20 | Automatic pause triggered by upstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| Blocked | 21 | Automatic pause triggered by downstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| NoMaterial | 22 | No material (e.g. film roll empty); (Note: Performance loss e.g. Suspended state). |
| EquipmentFailure | 30 | Emergency or critical fault state; stops immediately (Note: Availability loss e.g. Abort state). |
| NotReady | 31 | Safe stopped condition; requires start command (Note: Availability loss e.g. Stopped state). |
| OperatorStop | 32 | Operator-initiated pause for minor issues (e.g., clearing a jam); (Note: Availability loss e.g. Held state). |
eTopState
Defined provided production loss states as enumeration.
| Name | Initial | Comment |
|---|---|---|
| None | 0 | unknowing production state. |
| Starved | 20 | Automatic pause triggered by upstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| Blocked | 21 | Automatic pause triggered by downstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| NoMaterial | 22 | No material (e.g. film roll empty); (Note: Performance loss e.g. Suspended state). |
| EquipmentFailure | 30 | Emergency or critical fault state; stops immediately (Note: Availability loss e.g. Abort state). |
| NotReady | 31 | Safe stopped condition; requires start command (Note: Availability loss e.g. Stopped state). |
| OperatorStop | 32 | Operator-initiated pause for minor issues (e.g., clearing a jam); (Note: Availability loss e.g. Held state). |
| StarvedShort | 40 | Short automatic pause triggered by upstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| BlockedShort | 41 | Short automatic pause triggered by downstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| NoMaterialShort | 42 | Short No material (e.g. film roll empty); (Note: Performance loss e.g. Suspended state). |
| OperatorStopShort | 43 | Short Operator-initiated pause for minor issues (e.g., clearing a jam); (Note: Availability loss e.g. Held state). |
eEP_ProductionState
Defined output production states as enumeration.
| Name | Initial | Comment |
|---|---|---|
| None | 0 | unknowing production state. |
| Producing | 1 | Production is running (Note: e.g. Execute or Running). |
| Break | 3 | Active Break / Pause - Performance calculation is on Hold |
| NoDemand | 10 | Machine is ready to start waiting for Start (Note: Planned downtime e.g. Idle state, No Order). |
| Starved | 20 | Automatic pause triggered by upstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| Blocked | 21 | Automatic pause triggered by downstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| NoMaterial | 22 | No material (e.g. film roll empty); (Note: Performance loss e.g. Suspended state). |
| EquipmentFailure | 30 | Emergency or critical fault state; stops immediately (Note: Availability loss e.g. Abort state). |
| NotReady | 31 | Safe stopped condition; requires start command (Note: Availability loss e.g. Stopped state). |
| OperatorStop | 32 | Operator-initiated pause for minor issues (e.g., clearing a jam); (Note: Availability loss e.g. Held state). |
| StarvedShort | 40 | Short automatic pause triggered by upstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| BlockedShort | 41 | Short automatic pause triggered by downstream conditions (blocked/starved); (Note: Performance loss e.g. Suspended state). |
| NoMaterialShort | 42 | Short No material (e.g. film roll empty); (Note: Performance loss e.g. Suspended state). |
| OperatorStopShort | 43 | Short Operator-initiated pause for minor issues (e.g., clearing a jam); (Note: Availability loss e.g. Held state). |
eError
Library Possible Error Codes and Descriptions as enumeration.
| Name | Initial | Comment |
|---|---|---|
| no_error | 0 | No error detected. |
| no_ValidLicense | 10 | No valid license was found. Check the license status with DDAS_LM.GetLicenseInfo. |
| invalid_LocalDateTime | 21 | Invalid dtLocalDateTime = DT#1970-01-01-00:00:00. |
| invalid_eDayofWeek | 23 | Invalid weekday eDayofWeek = 0 or eDayofWeek > 7. |
| invalid_DateTimeBoundries | 25 | Invalid date and time boundaries = DT#1970-01-01-00:00:00 or dtLocalDateTime = DT#2106-02-07-06:28:15). |
| invalid_InputParameter | 30 | At least one input parameter is zero or lies outside the permissible range. EP_Result: a history entry without matching Production or Loss Details was skipped. |
| no_Active_Schedule | 31 | No active schedule was found. |
| productionState_None | 32 | Input production state is None and invalid; it must be set to a value other than None. |
| drift_ProductCount | 33 | The input part count may drift slightly; this could be normal and will be ignored. |
| negativ_ProductCount | 34 | The input part count is invalid because it is negative; only positive values are allowed. |
| productCount_NoSchedule | 35 | Hint: product count detected while no schedule is active. The parts are taken over into the next schedule. |
| week_overlow | 40 | Batch end behind one week. |
| ltime_overflow | 41 | The calculated LTime value is greater than 1000 days and exceeds the allowed range. |
| time_overflow | 42 | The calculated Time value is greater than 49 days and exceeds the allowed range. EP_Result: a sum was limited. |
| invalid_time_diff | 45 | Invalid time difference calculation: subtrahend > minuend. |
| unknowing_error | 99 | Unknown error. |
Global Variable
GVL_Constant_EP
Library constants.
| Scope | Name | Type | Initial | Comment |
|---|---|---|---|---|
| Constant | uiHistorySize | UINT | 20 | Max. size of historical array storage |
GVL_LibGuide
This Global Variable List provides the library GUID. It is used for activation keys (DDAS_LM.GVL_License) and for the license status (DDAS_LM.GetLicenseInfo); see the licensing documentation of your product.
| Scope | Name | Type | Initial | Comment |
|---|---|---|---|---|
| Constant | cLibraryGuid | STRING | ‘{LIB-DDAS-FF2F57D0}’ | Unique Library license GUID for use in the user program to activate the library license. |
Example Implementation
The following screenshot illustrates a complete implementation of the library function blocks.

The current local date, time, and day of the week can be obtained using the DDAS function block DDAS_DT.GetDateTimeInfo from the DDAS_DateTime_lib library.
Your Feedback Matters
These instructions have been prepared to the best of our knowledge and belief to provide you with the highest possible level of support when working with our product.
Despite our best efforts, we may not always fully achieve this objective. If you identify any issues or have suggestions for improvement, we would greatly appreciate your feedback.
Please send your comments or criticism in a short e‑mail to:
Thank you for your support.
Your DDAS Application Software Team