Embedding Intelligence and Sustainability into Custom Applications on SAP BTP
This is the 5th blog post of the blog series about Building Intelligent and Sustainability Scenarios on SAP BTP with AI and Planning by Gianluigi BAGNOLI, Yatsea Li, Alice Magnani, Cesare Calabria, Stuart Clarke, Dayanand Karalkar and Jacob Tan, which showcases our SAP Partners how to create industry cloud solutions for end-to-end industry-specific business processes that embeds intelligence and sustainability.
Previously, in the first blog post of this series, my colleague Gianluigi BAGNOLI has explained you the storyline about a traditional Milan-based Light Guide Plates (LGP) manufacturer BAGNOLI & CO was transformed into a sustainable smart factory with the help of SAP AI Core, SAP AI Launchpad and SAP Analytics Cloud for Planning. Using Artificial Intelligence deep learning for computer vision based automatic defect detection, and condition (sound) monitoring based predictive maintenance in production lines, the company has improved the efficiency of production and energy, and reduced waste.
In the last blog posts written by Cesare Calabria and Alice Magnani, we have learnt about the end-to-end MLops with SAP AI Core, and how to build your own model with TensorFlow about product image segmentation for auto. defect detection and equipment sound anomaly classification for predictive maintenance with SAP AI Core and SAP AI Launchpad.
Now, in this blog post, let us put the pieces together into a custom app named Sustainable Smart Factory App, which can:
- Monitor the plant daily operation in real-time about plant status, production yield, defective rate, equipment conditions, as well as a new sustainability KPIs (Key Performance Indicators) about energy consumption and calculated CO2 emission.
- Ingest and score the real-time IoT (Internet of Things) streaming data against the AI Models
- Image Segmentation model on LGP product images streaming from camera for automated defect detection
- Sound Anomaly Classification model on equipment audio data from microphones.
- Trigger a proactive maintenance order in SAP S/4HANA Cloud once the occurrences of a certain type of anomalies detected exceed the threshold within a period, which extends the Maintenance Management of SAP S/4HANA Cloud with Predictive Maintenance.
Introduction to the Sustainable Smart Factory App
Now, let us have a look at the Sustainable Smart Factory App from a functional perspective, which consists of the following four modules as listed below.
- My Home (Target Persona: Plant Manager)
- Tile to navigate to Plant 360 Analytics story in SAP Analytics Cloud.
- Tile to navigate to Maintenance Order & Sustainability Planning story in SAP Analytics Cloud.
- Auto. Defect Detection (Target Persona: Quality Inspector or Quality Manager)
- Quality Record via Computer Vision: A product quality record with its image and quality classification predicted by AI Model.
- Manage Defective Product Price: Define the pricing rule for the defective product based on the size of the defective area.
- Plant Master Data (Target Persona: Plant Manager)
- Manage Equipment: Equipment master data maintained in the Sustainable Smart Factory App, which is synchronized as Technical Object in SAP S/4HANA Cloud, including general data such as equipment id, name, description, class etc., organization data such as company code, plant id, function location etc.
- Configure Plant Status: Configuration of plant status, such as Breakdown, Fault, Maintenance, and Normal etc.
- Configure of Anomaly Types: An Anomaly type is mapped into an Anomaly Class in the AI model, such as Slow Sound or Damage Noise.
- Predictive Maintenance (Target Persona: Plant Manager or Maintenance Technician/Manager)
- Plant Condition Visualization: Real-time Monitoring of plant operation namely plant condition explained below, as well as Visualization of Plant Floor Plan about equipment conditions.
- Manage Plant Condition: A plant condition is a historical snapshot of the plant condition including production yield, defective product number, energy consumption and its equipment conditions within a time period, such as a morning shift of today starting from 0:00 am to 7:59 am.
- Manage Equipment Condition: Equipment Condition record within time period of a shift, including a list of detected anomalies associated to the equipment. Trigger the creation Maintenance order in SAP S/4HANA Cloud based on rule configuration.
- Manage Equipment Anomalies: When an anomaly is detected on an equipment, an Anomaly record will be created including equipment, detected At, sound data, and sound anomaly classification by inferencing the AI model etc.
Now, you may be interested on how we built the Sustainable Smart Factory App. Let us have a look at its technical details.
Technical Details of Sustainable Smart Factory App
High-level Solution Architecture
The high-level solution architecture of the Sustainable Smart Factory App as below.
Now let us zoom into the architecture of Bagnoli&Co’s Sustainable Smart Factory App, which is built on top of SAP Cloud Application Programming model (CAP) with
- SAP Fiori Element as its main UI technology
- NodeJS as its application and service layer
- SAP HANA Cloud as its database for persistence.
The app glues all the pieces of Bagnoli&Co’s Sustainable Smart Factory into an end-to-end solution to achieve its sustainable goals.
As you have already seen in screenshot of the app above, it provides an user interface as a SAP Fiori app for the end users such as Quality Inspector, Quality Manager, Plant Manager, Maintenance Manager, Maintenance Technician etc.
It inferences the AI Models with real-time IoT data ingestion for Defect Detection and Sound Anomaly Detection through REST API deployed in SAP AI Core, which automates the quality inspection, and eliminates the human errors.
Furthermore, it extends the Maintenance Management of SAP S/4HANA Cloud side by side with sound-based Predictive Management by rule-based trigger of proactive maintenance order in SAP S/4HANA Cloud via SAP Cloud SDK when the occurrences of anomaly detected on an equipment exceed the configured threshold, which can minimize the disruption of production line, and maximize the lifespan and efficiency of the equipment, and reduce the maintenance cost.
And, all the API integrations above are through the destination and xsuaa service in SAP BTP for security reasons.
With data persistence in SAP HANA Cloud, some calculation views are custom developed for plant-condition and equipment-insight queries, which provide live connection to SAP Analytics Cloud for a Plant 360 Analytics story in real-time.
#1: Auto. Defect Detection
Data Model (sqi-data-model.cds)
- CVQualityRecords: Quality Record by Computer Vision
- DefectiveProductPrices: Pricing rules of defective products based on the defective area percentage range.
- Connect to SAP BTP destination service, and authenticate to inference API of AI Models in SAP AI Core – getDestination(dest)
- Inference product image segmentation AI Model for Auto. Defect Detection – inferenceImageCV()
#2: Predictive Maintenance
Data Model (pdm-data-model.cds)
- Equipments: Equipment Master Data synchronized as technical objects in SAP S/4HANA Cloud
- AnomalyType: An anomaly type is mapped as a sound anomaly class in AI model.
- PlantConditions: A historical record about the plant daily operation by shift within a time period, such as plant status, production yield, number of defective products and energy consumption, and its associated EquipmentConditions records within the same time period.
- EquipmentConditions: A historical record about the condition of the equipment within a time period, such as the associated equipment, equipment status, the detected anomalies by the AI model. Creation of proactive maintenance order will be triggered in SAP S/4HANA Cloud if the occurrences of the detected anomalies in the time period exceed the threshold defined in the anomaly type. The associated maintenance order number and cost will also be recorded in the equipment condition record if any.
- Anomalies: An anomaly is detected by the AI Model on about its associated equipment, including when it is detected, what is source type such as sound, image temperature, vibration etc, which can be used for any type of anomaly detected by different sensors. The raw value and raw measure unit depend on the source type as, for example, if the source type is sound, then raw value is the path to sound clip in cloud storage; if the source type is temperature, the raw value could the decimal string about the temperature captured by the sensor, and the raw measure unit could be Celsius to Fahrenheit.
- Inference sound anomaly classification AI model for Predictive Maintenance: inferenceSoundAnomaly()
- Trigger of proactive maintenance order creation in SAP S/4HANA Cloud based on rule: createMO()
#3: Plant 360 Analytics
To enable real-time plant 360 analytics, the following calculation views have been created.
- date-dimension.hdbcalculationview: date dimension
- equipments.hdbcalculationview: equipment dimension
- plant-equipment-status.hdbcalculationview: equipment status dimension
- equipment-conditions-fact.hdbcalculationview: equipment condition fact table
- equipment-anomalies.hdbcalculationview: equipment condition insight query
- plant-conditions.hdbcalculationview: plant condition insight query
Please follow this manual to deploy the Sustainable Smart Factory App (sample app).
If you would like to learn more about this topic, please check out materials below
- The source code of Sustainable Smart Factory App available here.
- YouTube playlist by SAP HANA Academy about SAP Artificial Intelligence; Application as below
- How to deploy the Sustainable Smart Factory App on SAP BTP
- Demo#1 of Sustainable Smart Factory App about Auto. Defect Detection
- Demo#2 of Sustainable Smart Factory App about Sound-based Predictive Maintenance
- How to create a CAP app using SAP AI Core service from scratch with the template of SAP HANA Academy CAP in SAP Business Application Studio.
- SAP Cloud Application Programming Model document
- SAP Developer Tutorial about Create an SAP Cloud Application Programming Model Project for SAP HANA Cloud by Thomas Jung
Throughout this sample, we have seen how an SAP partner can embed the AI models and sustainability dimension data (energy consumption and CO2 emission etc.) into end-to-end cloud solution on SAP BTP for Bagnoli&Co., which automates defect defection and employs sound-based predictive maintenance. As a result, Bagnoli &Co has improved the efficiency of production and the safety of workplace and reduced the waste.
What’s next in this blog series
In the next blog of this series, we will see how to perform an end-to-end planning for maintenance cost and sustainability for Bagnoli&Co with SAP Analytics Cloud for Planning. As a wrap up, here are all the episodes of our blog series:
- An overview of sustainability on top of SAP BTP
- Introduction of end-to-end ML ops with SAP AI Core
- BYOM with TensorFlow in SAP AI Core for Defect Detection
- SAP AI Core for sound-based predictive maintenance
- Embedding Intelligence and Sustainability into Custom Applications on SAP BTP (this post)
- Maintenance Cost & Sustainability Planning with SAP Analytics Cloud Planning (to be published)