Example using javascript in KPIs¶
An example to calculate the speed of the CNC milling machine using json script.
Procedure¶
To calculate the speed of the CNC milling machine, follow these steps:
- Click “Add a KPI”.
- Name: Speed-KPI
- Description: Speed of the spindle
- Calculation cycle: 10 minutes
- Inputs: in1 = T_L_A_Equipping / Machine_KPIs / Quality
- Inputs: in2 = T_L_A_Equipping / Machine_KPIs / Quality
- Outputs: out = T_L_A_Milling_CNC / KPI_Quality / Quality
- Formula:
const last = flow.get('lastSpeed'); if (last !== null && last !== undefined) { out = in1 - last; } if (in1 !== null && in1 !== undefined) { flow.set('lastSpeed', in1); }
- Click Save.
Result¶
The output will be displayed in KPIs page. You can create dashboard to display the KPIs in the dashboard page by using the available widgets. For more information on adding KPIs to the dashboard, see Dashboards Actions.
Any questions left?
Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.
Last update: April 21, 2022